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 Tue, Dec 21, 2021 05:44+1100 for FHIR v5.0.0-snapshot1
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    parseBaseProperties(json, res);
207    if (json.has("id"))
208      res.setIdElement(parseString(json.get("id").getAsString()));
209    if (json.has("_id"))
210      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
211    if (json.has("extension")) {
212      JsonArray array = getJArray(json, "extension");
213      for (int i = 0; i < array.size(); i++) {
214        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
215      }
216    };
217  }
218
219  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
220    Address res = new Address();
221    parseAddressProperties(json, res);
222    return res;
223  }
224
225  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
226    parseDataTypeProperties(json, res);
227    if (json.has("use"))
228      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
229    if (json.has("_use"))
230      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
231    if (json.has("type"))
232      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
233    if (json.has("_type"))
234      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
235    if (json.has("text"))
236      res.setTextElement(parseString(json.get("text").getAsString()));
237    if (json.has("_text"))
238      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
239    if (json.has("line")) {
240      JsonArray array = getJArray(json, "line");
241      for (int i = 0; i < array.size(); i++) {
242        if (array.get(i).isJsonNull()) {
243          res.getLine().add(new StringType());
244        } else {;
245          res.getLine().add(parseString(array.get(i).getAsString()));
246        }
247      }
248    };
249    if (json.has("_line")) {
250      JsonArray array = getJArray(json, "_line");
251      for (int i = 0; i < array.size(); i++) {
252        if (i == res.getLine().size())
253          res.getLine().add(parseString(null));
254        if (array.get(i) instanceof JsonObject) 
255          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
256      }
257    };
258    if (json.has("city"))
259      res.setCityElement(parseString(json.get("city").getAsString()));
260    if (json.has("_city"))
261      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
262    if (json.has("district"))
263      res.setDistrictElement(parseString(json.get("district").getAsString()));
264    if (json.has("_district"))
265      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
266    if (json.has("state"))
267      res.setStateElement(parseString(json.get("state").getAsString()));
268    if (json.has("_state"))
269      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
270    if (json.has("postalCode"))
271      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
272    if (json.has("_postalCode"))
273      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
274    if (json.has("country"))
275      res.setCountryElement(parseString(json.get("country").getAsString()));
276    if (json.has("_country"))
277      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
278    if (json.has("period"))
279      res.setPeriod(parsePeriod(getJObject(json, "period")));
280  }
281
282  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
283    Age res = new Age();
284    parseAgeProperties(json, res);
285    return res;
286  }
287
288  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
289    parseQuantityProperties(json, res);
290  }
291
292  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
293    Annotation res = new Annotation();
294    parseAnnotationProperties(json, res);
295    return res;
296  }
297
298  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
299    parseDataTypeProperties(json, res);
300    DataType author = parseType("author", json);
301    if (author != null)
302      res.setAuthor(author);
303    if (json.has("time"))
304      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
305    if (json.has("_time"))
306      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
307    if (json.has("text"))
308      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
309    if (json.has("_text"))
310      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
311  }
312
313  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
314    Attachment res = new Attachment();
315    parseAttachmentProperties(json, res);
316    return res;
317  }
318
319  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
320    parseDataTypeProperties(json, res);
321    if (json.has("contentType"))
322      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
323    if (json.has("_contentType"))
324      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
325    if (json.has("language"))
326      res.setLanguageElement(parseCode(json.get("language").getAsString()));
327    if (json.has("_language"))
328      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
329    if (json.has("data"))
330      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
331    if (json.has("_data"))
332      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
333    if (json.has("url"))
334      res.setUrlElement(parseUrl(json.get("url").getAsString()));
335    if (json.has("_url"))
336      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
337    if (json.has("size"))
338      res.setSizeElement(parseInteger64(json.get("size").getAsLong()));
339    if (json.has("_size"))
340      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
341    if (json.has("hash"))
342      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
343    if (json.has("_hash"))
344      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
345    if (json.has("title"))
346      res.setTitleElement(parseString(json.get("title").getAsString()));
347    if (json.has("_title"))
348      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
349    if (json.has("creation"))
350      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
351    if (json.has("_creation"))
352      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
353    if (json.has("height"))
354      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
355    if (json.has("_height"))
356      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
357    if (json.has("width"))
358      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
359    if (json.has("_width"))
360      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
361    if (json.has("frames"))
362      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
363    if (json.has("_frames"))
364      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
365    if (json.has("duration"))
366      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
367    if (json.has("_duration"))
368      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
369    if (json.has("pages"))
370      res.setPagesElement(parsePositiveInt(json.get("pages").getAsString()));
371    if (json.has("_pages"))
372      parseElementProperties(getJObject(json, "_pages"), res.getPagesElement());
373  }
374
375  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
376    CodeableConcept res = new CodeableConcept();
377    parseCodeableConceptProperties(json, res);
378    return res;
379  }
380
381  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
382    parseDataTypeProperties(json, res);
383    if (json.has("coding")) {
384      JsonArray array = getJArray(json, "coding");
385      for (int i = 0; i < array.size(); i++) {
386        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
387      }
388    };
389    if (json.has("text"))
390      res.setTextElement(parseString(json.get("text").getAsString()));
391    if (json.has("_text"))
392      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
393  }
394
395  protected CodeableReference parseCodeableReference(JsonObject json) throws IOException, FHIRFormatError {
396    CodeableReference res = new CodeableReference();
397    parseCodeableReferenceProperties(json, res);
398    return res;
399  }
400
401  protected void parseCodeableReferenceProperties(JsonObject json, CodeableReference res) throws IOException, FHIRFormatError {
402    parseDataTypeProperties(json, res);
403    if (json.has("concept"))
404      res.setConcept(parseCodeableConcept(getJObject(json, "concept")));
405    if (json.has("reference"))
406      res.setReference(parseReference(getJObject(json, "reference")));
407  }
408
409  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
410    Coding res = new Coding();
411    parseCodingProperties(json, res);
412    return res;
413  }
414
415  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
416    parseDataTypeProperties(json, res);
417    if (json.has("system"))
418      res.setSystemElement(parseUri(json.get("system").getAsString()));
419    if (json.has("_system"))
420      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
421    if (json.has("version"))
422      res.setVersionElement(parseString(json.get("version").getAsString()));
423    if (json.has("_version"))
424      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
425    if (json.has("code"))
426      res.setCodeElement(parseCode(json.get("code").getAsString()));
427    if (json.has("_code"))
428      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
429    if (json.has("display"))
430      res.setDisplayElement(parseString(json.get("display").getAsString()));
431    if (json.has("_display"))
432      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
433    if (json.has("userSelected"))
434      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
435    if (json.has("_userSelected"))
436      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
437  }
438
439  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
440    ContactDetail res = new ContactDetail();
441    parseContactDetailProperties(json, res);
442    return res;
443  }
444
445  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
446    parseDataTypeProperties(json, res);
447    if (json.has("name"))
448      res.setNameElement(parseString(json.get("name").getAsString()));
449    if (json.has("_name"))
450      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
451    if (json.has("telecom")) {
452      JsonArray array = getJArray(json, "telecom");
453      for (int i = 0; i < array.size(); i++) {
454        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
455      }
456    };
457  }
458
459  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
460    ContactPoint res = new ContactPoint();
461    parseContactPointProperties(json, res);
462    return res;
463  }
464
465  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
466    parseDataTypeProperties(json, res);
467    if (json.has("system"))
468      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
469    if (json.has("_system"))
470      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
471    if (json.has("value"))
472      res.setValueElement(parseString(json.get("value").getAsString()));
473    if (json.has("_value"))
474      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
475    if (json.has("use"))
476      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
477    if (json.has("_use"))
478      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
479    if (json.has("rank"))
480      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
481    if (json.has("_rank"))
482      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
483    if (json.has("period"))
484      res.setPeriod(parsePeriod(getJObject(json, "period")));
485  }
486
487  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
488    Contributor res = new Contributor();
489    parseContributorProperties(json, res);
490    return res;
491  }
492
493  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
494    parseDataTypeProperties(json, res);
495    if (json.has("type"))
496      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
497    if (json.has("_type"))
498      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
499    if (json.has("name"))
500      res.setNameElement(parseString(json.get("name").getAsString()));
501    if (json.has("_name"))
502      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
503    if (json.has("contact")) {
504      JsonArray array = getJArray(json, "contact");
505      for (int i = 0; i < array.size(); i++) {
506        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
507      }
508    };
509  }
510
511  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
512    Count res = new Count();
513    parseCountProperties(json, res);
514    return res;
515  }
516
517  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
518    parseQuantityProperties(json, res);
519  }
520
521  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
522    DataRequirement res = new DataRequirement();
523    parseDataRequirementProperties(json, res);
524    return res;
525  }
526
527  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
528    parseDataTypeProperties(json, res);
529    if (json.has("type"))
530      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
531    if (json.has("_type"))
532      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
533    if (json.has("profile")) {
534      JsonArray array = getJArray(json, "profile");
535      for (int i = 0; i < array.size(); i++) {
536        if (array.get(i).isJsonNull()) {
537          res.getProfile().add(new CanonicalType());
538        } else {;
539          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
540        }
541      }
542    };
543    if (json.has("_profile")) {
544      JsonArray array = getJArray(json, "_profile");
545      for (int i = 0; i < array.size(); i++) {
546        if (i == res.getProfile().size())
547          res.getProfile().add(parseCanonical(null));
548        if (array.get(i) instanceof JsonObject) 
549          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
550      }
551    };
552    DataType subject = parseType("subject", json);
553    if (subject != null)
554      res.setSubject(subject);
555    if (json.has("mustSupport")) {
556      JsonArray array = getJArray(json, "mustSupport");
557      for (int i = 0; i < array.size(); i++) {
558        if (array.get(i).isJsonNull()) {
559          res.getMustSupport().add(new StringType());
560        } else {;
561          res.getMustSupport().add(parseString(array.get(i).getAsString()));
562        }
563      }
564    };
565    if (json.has("_mustSupport")) {
566      JsonArray array = getJArray(json, "_mustSupport");
567      for (int i = 0; i < array.size(); i++) {
568        if (i == res.getMustSupport().size())
569          res.getMustSupport().add(parseString(null));
570        if (array.get(i) instanceof JsonObject) 
571          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
572      }
573    };
574    if (json.has("codeFilter")) {
575      JsonArray array = getJArray(json, "codeFilter");
576      for (int i = 0; i < array.size(); i++) {
577        res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject()));
578      }
579    };
580    if (json.has("dateFilter")) {
581      JsonArray array = getJArray(json, "dateFilter");
582      for (int i = 0; i < array.size(); i++) {
583        res.getDateFilter().add(parseDataRequirementDateFilterComponent(array.get(i).getAsJsonObject()));
584      }
585    };
586    if (json.has("limit"))
587      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
588    if (json.has("_limit"))
589      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
590    if (json.has("sort")) {
591      JsonArray array = getJArray(json, "sort");
592      for (int i = 0; i < array.size(); i++) {
593        res.getSort().add(parseDataRequirementSortComponent(array.get(i).getAsJsonObject()));
594      }
595    };
596  }
597
598  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
599    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
600    parseDataRequirementCodeFilterComponentProperties(json, res);
601    return res;
602  }
603
604  protected void parseDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
605    parseElementProperties(json, res);
606    if (json.has("path"))
607      res.setPathElement(parseString(json.get("path").getAsString()));
608    if (json.has("_path"))
609      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
610    if (json.has("searchParam"))
611      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
612    if (json.has("_searchParam"))
613      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
614    if (json.has("valueSet"))
615      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
616    if (json.has("_valueSet"))
617      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
618    if (json.has("code")) {
619      JsonArray array = getJArray(json, "code");
620      for (int i = 0; i < array.size(); i++) {
621        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
622      }
623    };
624  }
625
626  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
627    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
628    parseDataRequirementDateFilterComponentProperties(json, res);
629    return res;
630  }
631
632  protected void parseDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
633    parseElementProperties(json, res);
634    if (json.has("path"))
635      res.setPathElement(parseString(json.get("path").getAsString()));
636    if (json.has("_path"))
637      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
638    if (json.has("searchParam"))
639      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
640    if (json.has("_searchParam"))
641      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
642    DataType value = parseType("value", json);
643    if (value != null)
644      res.setValue(value);
645  }
646
647  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(JsonObject json) throws IOException, FHIRFormatError {
648    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
649    parseDataRequirementSortComponentProperties(json, res);
650    return res;
651  }
652
653  protected void parseDataRequirementSortComponentProperties(JsonObject json, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
654    parseElementProperties(json, res);
655    if (json.has("path"))
656      res.setPathElement(parseString(json.get("path").getAsString()));
657    if (json.has("_path"))
658      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
659    if (json.has("direction"))
660      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
661    if (json.has("_direction"))
662      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
663  }
664
665  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
666    Distance res = new Distance();
667    parseDistanceProperties(json, res);
668    return res;
669  }
670
671  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
672    parseQuantityProperties(json, res);
673  }
674
675  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
676    Dosage res = new Dosage();
677    parseDosageProperties(json, res);
678    return res;
679  }
680
681  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
682    parseBackboneTypeProperties(json, res);
683    if (json.has("sequence"))
684      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
685    if (json.has("_sequence"))
686      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
687    if (json.has("text"))
688      res.setTextElement(parseString(json.get("text").getAsString()));
689    if (json.has("_text"))
690      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
691    if (json.has("additionalInstruction")) {
692      JsonArray array = getJArray(json, "additionalInstruction");
693      for (int i = 0; i < array.size(); i++) {
694        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
695      }
696    };
697    if (json.has("patientInstruction"))
698      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
699    if (json.has("_patientInstruction"))
700      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
701    if (json.has("timing"))
702      res.setTiming(parseTiming(getJObject(json, "timing")));
703    DataType asNeeded = parseType("asNeeded", json);
704    if (asNeeded != null)
705      res.setAsNeeded(asNeeded);
706    if (json.has("site"))
707      res.setSite(parseCodeableConcept(getJObject(json, "site")));
708    if (json.has("route"))
709      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
710    if (json.has("method"))
711      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
712    if (json.has("doseAndRate")) {
713      JsonArray array = getJArray(json, "doseAndRate");
714      for (int i = 0; i < array.size(); i++) {
715        res.getDoseAndRate().add(parseDosageDoseAndRateComponent(array.get(i).getAsJsonObject()));
716      }
717    };
718    if (json.has("maxDosePerPeriod"))
719      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
720    if (json.has("maxDosePerAdministration"))
721      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
722    if (json.has("maxDosePerLifetime"))
723      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
724  }
725
726  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(JsonObject json) throws IOException, FHIRFormatError {
727    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
728    parseDosageDoseAndRateComponentProperties(json, res);
729    return res;
730  }
731
732  protected void parseDosageDoseAndRateComponentProperties(JsonObject json, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
733    parseElementProperties(json, res);
734    if (json.has("type"))
735      res.setType(parseCodeableConcept(getJObject(json, "type")));
736    DataType dose = parseType("dose", json);
737    if (dose != null)
738      res.setDose(dose);
739    DataType rate = parseType("rate", json);
740    if (rate != null)
741      res.setRate(rate);
742  }
743
744  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
745    Duration res = new Duration();
746    parseDurationProperties(json, res);
747    return res;
748  }
749
750  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
751    parseQuantityProperties(json, res);
752  }
753
754  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
755    ElementDefinition res = new ElementDefinition();
756    parseElementDefinitionProperties(json, res);
757    return res;
758  }
759
760  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
761    parseBackboneTypeProperties(json, res);
762    if (json.has("path"))
763      res.setPathElement(parseString(json.get("path").getAsString()));
764    if (json.has("_path"))
765      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
766    if (json.has("representation")) {
767      JsonArray array = getJArray(json, "representation");
768      for (int i = 0; i < array.size(); i++) {
769        if (array.get(i).isJsonNull()) {
770          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>(new ElementDefinition.PropertyRepresentationEnumFactory(), ElementDefinition.PropertyRepresentation.NULL));
771        } else {;
772          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
773        }
774      }
775    };
776    if (json.has("_representation")) {
777      JsonArray array = getJArray(json, "_representation");
778      for (int i = 0; i < array.size(); i++) {
779        if (i == res.getRepresentation().size())
780          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
781        if (array.get(i) instanceof JsonObject) 
782          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
783      }
784    };
785    if (json.has("sliceName"))
786      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
787    if (json.has("_sliceName"))
788      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
789    if (json.has("sliceIsConstraining"))
790      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
791    if (json.has("_sliceIsConstraining"))
792      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
793    if (json.has("label"))
794      res.setLabelElement(parseString(json.get("label").getAsString()));
795    if (json.has("_label"))
796      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
797    if (json.has("code")) {
798      JsonArray array = getJArray(json, "code");
799      for (int i = 0; i < array.size(); i++) {
800        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
801      }
802    };
803    if (json.has("slicing"))
804      res.setSlicing(parseElementDefinitionSlicingComponent(getJObject(json, "slicing")));
805    if (json.has("short"))
806      res.setShortElement(parseString(json.get("short").getAsString()));
807    if (json.has("_short"))
808      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
809    if (json.has("definition"))
810      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
811    if (json.has("_definition"))
812      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
813    if (json.has("comment"))
814      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
815    if (json.has("_comment"))
816      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
817    if (json.has("requirements"))
818      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
819    if (json.has("_requirements"))
820      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
821    if (json.has("alias")) {
822      JsonArray array = getJArray(json, "alias");
823      for (int i = 0; i < array.size(); i++) {
824        if (array.get(i).isJsonNull()) {
825          res.getAlias().add(new StringType());
826        } else {;
827          res.getAlias().add(parseString(array.get(i).getAsString()));
828        }
829      }
830    };
831    if (json.has("_alias")) {
832      JsonArray array = getJArray(json, "_alias");
833      for (int i = 0; i < array.size(); i++) {
834        if (i == res.getAlias().size())
835          res.getAlias().add(parseString(null));
836        if (array.get(i) instanceof JsonObject) 
837          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
838      }
839    };
840    if (json.has("min"))
841      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
842    if (json.has("_min"))
843      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
844    if (json.has("max"))
845      res.setMaxElement(parseString(json.get("max").getAsString()));
846    if (json.has("_max"))
847      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
848    if (json.has("base"))
849      res.setBase(parseElementDefinitionBaseComponent(getJObject(json, "base")));
850    if (json.has("contentReference"))
851      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
852    if (json.has("_contentReference"))
853      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
854    if (json.has("type")) {
855      JsonArray array = getJArray(json, "type");
856      for (int i = 0; i < array.size(); i++) {
857        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject()));
858      }
859    };
860    DataType defaultValue = parseType("defaultValue", json);
861    if (defaultValue != null)
862      res.setDefaultValue(defaultValue);
863    if (json.has("meaningWhenMissing"))
864      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
865    if (json.has("_meaningWhenMissing"))
866      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
867    if (json.has("orderMeaning"))
868      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
869    if (json.has("_orderMeaning"))
870      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
871    DataType fixed = parseType("fixed", json);
872    if (fixed != null)
873      res.setFixed(fixed);
874    DataType pattern = parseType("pattern", json);
875    if (pattern != null)
876      res.setPattern(pattern);
877    if (json.has("example")) {
878      JsonArray array = getJArray(json, "example");
879      for (int i = 0; i < array.size(); i++) {
880        res.getExample().add(parseElementDefinitionExampleComponent(array.get(i).getAsJsonObject()));
881      }
882    };
883    DataType minValue = parseType("minValue", json);
884    if (minValue != null)
885      res.setMinValue(minValue);
886    DataType maxValue = parseType("maxValue", json);
887    if (maxValue != null)
888      res.setMaxValue(maxValue);
889    if (json.has("maxLength"))
890      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
891    if (json.has("_maxLength"))
892      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
893    if (json.has("condition")) {
894      JsonArray array = getJArray(json, "condition");
895      for (int i = 0; i < array.size(); i++) {
896        if (array.get(i).isJsonNull()) {
897          res.getCondition().add(new IdType());
898        } else {;
899          res.getCondition().add(parseId(array.get(i).getAsString()));
900        }
901      }
902    };
903    if (json.has("_condition")) {
904      JsonArray array = getJArray(json, "_condition");
905      for (int i = 0; i < array.size(); i++) {
906        if (i == res.getCondition().size())
907          res.getCondition().add(parseId(null));
908        if (array.get(i) instanceof JsonObject) 
909          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
910      }
911    };
912    if (json.has("constraint")) {
913      JsonArray array = getJArray(json, "constraint");
914      for (int i = 0; i < array.size(); i++) {
915        res.getConstraint().add(parseElementDefinitionConstraintComponent(array.get(i).getAsJsonObject()));
916      }
917    };
918    if (json.has("mustSupport"))
919      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
920    if (json.has("_mustSupport"))
921      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
922    if (json.has("isModifier"))
923      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
924    if (json.has("_isModifier"))
925      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
926    if (json.has("isModifierReason"))
927      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
928    if (json.has("_isModifierReason"))
929      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
930    if (json.has("isSummary"))
931      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
932    if (json.has("_isSummary"))
933      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
934    if (json.has("binding"))
935      res.setBinding(parseElementDefinitionBindingComponent(getJObject(json, "binding")));
936    if (json.has("mapping")) {
937      JsonArray array = getJArray(json, "mapping");
938      for (int i = 0; i < array.size(); i++) {
939        res.getMapping().add(parseElementDefinitionMappingComponent(array.get(i).getAsJsonObject()));
940      }
941    };
942  }
943
944  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(JsonObject json) throws IOException, FHIRFormatError {
945    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
946    parseElementDefinitionSlicingComponentProperties(json, res);
947    return res;
948  }
949
950  protected void parseElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
951    parseElementProperties(json, res);
952    if (json.has("discriminator")) {
953      JsonArray array = getJArray(json, "discriminator");
954      for (int i = 0; i < array.size(); i++) {
955        res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject()));
956      }
957    };
958    if (json.has("description"))
959      res.setDescriptionElement(parseString(json.get("description").getAsString()));
960    if (json.has("_description"))
961      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
962    if (json.has("ordered"))
963      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
964    if (json.has("_ordered"))
965      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
966    if (json.has("rules"))
967      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
968    if (json.has("_rules"))
969      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
970  }
971
972  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(JsonObject json) throws IOException, FHIRFormatError {
973    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
974    parseElementDefinitionSlicingDiscriminatorComponentProperties(json, res);
975    return res;
976  }
977
978  protected void parseElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
979    parseElementProperties(json, res);
980    if (json.has("type"))
981      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
982    if (json.has("_type"))
983      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
984    if (json.has("path"))
985      res.setPathElement(parseString(json.get("path").getAsString()));
986    if (json.has("_path"))
987      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
988  }
989
990  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(JsonObject json) throws IOException, FHIRFormatError {
991    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
992    parseElementDefinitionBaseComponentProperties(json, res);
993    return res;
994  }
995
996  protected void parseElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
997    parseElementProperties(json, res);
998    if (json.has("path"))
999      res.setPathElement(parseString(json.get("path").getAsString()));
1000    if (json.has("_path"))
1001      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1002    if (json.has("min"))
1003      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1004    if (json.has("_min"))
1005      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1006    if (json.has("max"))
1007      res.setMaxElement(parseString(json.get("max").getAsString()));
1008    if (json.has("_max"))
1009      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1010  }
1011
1012  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json) throws IOException, FHIRFormatError {
1013    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1014    parseElementDefinitionTypeRefComponentProperties(json, res);
1015    return res;
1016  }
1017
1018  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1019    parseElementProperties(json, res);
1020    if (json.has("code"))
1021      res.setCodeElement(parseUri(json.get("code").getAsString()));
1022    if (json.has("_code"))
1023      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1024    if (json.has("profile")) {
1025      JsonArray array = getJArray(json, "profile");
1026      for (int i = 0; i < array.size(); i++) {
1027        if (array.get(i).isJsonNull()) {
1028          res.getProfile().add(new CanonicalType());
1029        } else {;
1030          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1031        }
1032      }
1033    };
1034    if (json.has("_profile")) {
1035      JsonArray array = getJArray(json, "_profile");
1036      for (int i = 0; i < array.size(); i++) {
1037        if (i == res.getProfile().size())
1038          res.getProfile().add(parseCanonical(null));
1039        if (array.get(i) instanceof JsonObject) 
1040          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1041      }
1042    };
1043    if (json.has("targetProfile")) {
1044      JsonArray array = getJArray(json, "targetProfile");
1045      for (int i = 0; i < array.size(); i++) {
1046        if (array.get(i).isJsonNull()) {
1047          res.getTargetProfile().add(new CanonicalType());
1048        } else {;
1049          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1050        }
1051      }
1052    };
1053    if (json.has("_targetProfile")) {
1054      JsonArray array = getJArray(json, "_targetProfile");
1055      for (int i = 0; i < array.size(); i++) {
1056        if (i == res.getTargetProfile().size())
1057          res.getTargetProfile().add(parseCanonical(null));
1058        if (array.get(i) instanceof JsonObject) 
1059          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1060      }
1061    };
1062    if (json.has("aggregation")) {
1063      JsonArray array = getJArray(json, "aggregation");
1064      for (int i = 0; i < array.size(); i++) {
1065        if (array.get(i).isJsonNull()) {
1066          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>(new ElementDefinition.AggregationModeEnumFactory(), ElementDefinition.AggregationMode.NULL));
1067        } else {;
1068          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1069        }
1070      }
1071    };
1072    if (json.has("_aggregation")) {
1073      JsonArray array = getJArray(json, "_aggregation");
1074      for (int i = 0; i < array.size(); i++) {
1075        if (i == res.getAggregation().size())
1076          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1077        if (array.get(i) instanceof JsonObject) 
1078          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1079      }
1080    };
1081    if (json.has("versioning"))
1082      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1083    if (json.has("_versioning"))
1084      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1085  }
1086
1087  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(JsonObject json) throws IOException, FHIRFormatError {
1088    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1089    parseElementDefinitionExampleComponentProperties(json, res);
1090    return res;
1091  }
1092
1093  protected void parseElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1094    parseElementProperties(json, res);
1095    if (json.has("label"))
1096      res.setLabelElement(parseString(json.get("label").getAsString()));
1097    if (json.has("_label"))
1098      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1099    DataType value = parseType("value", json);
1100    if (value != null)
1101      res.setValue(value);
1102  }
1103
1104  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(JsonObject json) throws IOException, FHIRFormatError {
1105    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1106    parseElementDefinitionConstraintComponentProperties(json, res);
1107    return res;
1108  }
1109
1110  protected void parseElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1111    parseElementProperties(json, res);
1112    if (json.has("key"))
1113      res.setKeyElement(parseId(json.get("key").getAsString()));
1114    if (json.has("_key"))
1115      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1116    if (json.has("requirements"))
1117      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1118    if (json.has("_requirements"))
1119      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1120    if (json.has("severity"))
1121      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1122    if (json.has("_severity"))
1123      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1124    if (json.has("human"))
1125      res.setHumanElement(parseString(json.get("human").getAsString()));
1126    if (json.has("_human"))
1127      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1128    if (json.has("expression"))
1129      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1130    if (json.has("_expression"))
1131      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1132    if (json.has("xpath"))
1133      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1134    if (json.has("_xpath"))
1135      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1136    if (json.has("source"))
1137      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1138    if (json.has("_source"))
1139      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1140  }
1141
1142  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
1143    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1144    parseElementDefinitionBindingComponentProperties(json, res);
1145    return res;
1146  }
1147
1148  protected void parseElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1149    parseElementProperties(json, res);
1150    if (json.has("strength"))
1151      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1152    if (json.has("_strength"))
1153      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1154    if (json.has("description"))
1155      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1156    if (json.has("_description"))
1157      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1158    if (json.has("valueSet"))
1159      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1160    if (json.has("_valueSet"))
1161      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1162  }
1163
1164  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
1165    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1166    parseElementDefinitionMappingComponentProperties(json, res);
1167    return res;
1168  }
1169
1170  protected void parseElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1171    parseElementProperties(json, res);
1172    if (json.has("identity"))
1173      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1174    if (json.has("_identity"))
1175      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1176    if (json.has("language"))
1177      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1178    if (json.has("_language"))
1179      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1180    if (json.has("map"))
1181      res.setMapElement(parseString(json.get("map").getAsString()));
1182    if (json.has("_map"))
1183      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1184    if (json.has("comment"))
1185      res.setCommentElement(parseString(json.get("comment").getAsString()));
1186    if (json.has("_comment"))
1187      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1188  }
1189
1190  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1191    Expression res = new Expression();
1192    parseExpressionProperties(json, res);
1193    return res;
1194  }
1195
1196  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1197    parseDataTypeProperties(json, res);
1198    if (json.has("description"))
1199      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1200    if (json.has("_description"))
1201      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1202    if (json.has("name"))
1203      res.setNameElement(parseId(json.get("name").getAsString()));
1204    if (json.has("_name"))
1205      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1206    if (json.has("language"))
1207      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1208    if (json.has("_language"))
1209      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1210    if (json.has("expression"))
1211      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1212    if (json.has("_expression"))
1213      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1214    if (json.has("reference"))
1215      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1216    if (json.has("_reference"))
1217      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1218  }
1219
1220  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
1221    Extension res = new Extension();
1222    parseExtensionProperties(json, res);
1223    return res;
1224  }
1225
1226  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
1227    parseDataTypeProperties(json, res);
1228    if (json.has("url"))
1229      res.setUrlElement(parseUri(json.get("url").getAsString()));
1230    if (json.has("_url"))
1231      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1232    DataType value = parseType("value", json);
1233    if (value != null)
1234      res.setValue(value);
1235  }
1236
1237  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1238    HumanName res = new HumanName();
1239    parseHumanNameProperties(json, res);
1240    return res;
1241  }
1242
1243  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
1244    parseDataTypeProperties(json, res);
1245    if (json.has("use"))
1246      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1247    if (json.has("_use"))
1248      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1249    if (json.has("text"))
1250      res.setTextElement(parseString(json.get("text").getAsString()));
1251    if (json.has("_text"))
1252      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1253    if (json.has("family"))
1254      res.setFamilyElement(parseString(json.get("family").getAsString()));
1255    if (json.has("_family"))
1256      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1257    if (json.has("given")) {
1258      JsonArray array = getJArray(json, "given");
1259      for (int i = 0; i < array.size(); i++) {
1260        if (array.get(i).isJsonNull()) {
1261          res.getGiven().add(new StringType());
1262        } else {;
1263          res.getGiven().add(parseString(array.get(i).getAsString()));
1264        }
1265      }
1266    };
1267    if (json.has("_given")) {
1268      JsonArray array = getJArray(json, "_given");
1269      for (int i = 0; i < array.size(); i++) {
1270        if (i == res.getGiven().size())
1271          res.getGiven().add(parseString(null));
1272        if (array.get(i) instanceof JsonObject) 
1273          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1274      }
1275    };
1276    if (json.has("prefix")) {
1277      JsonArray array = getJArray(json, "prefix");
1278      for (int i = 0; i < array.size(); i++) {
1279        if (array.get(i).isJsonNull()) {
1280          res.getPrefix().add(new StringType());
1281        } else {;
1282          res.getPrefix().add(parseString(array.get(i).getAsString()));
1283        }
1284      }
1285    };
1286    if (json.has("_prefix")) {
1287      JsonArray array = getJArray(json, "_prefix");
1288      for (int i = 0; i < array.size(); i++) {
1289        if (i == res.getPrefix().size())
1290          res.getPrefix().add(parseString(null));
1291        if (array.get(i) instanceof JsonObject) 
1292          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1293      }
1294    };
1295    if (json.has("suffix")) {
1296      JsonArray array = getJArray(json, "suffix");
1297      for (int i = 0; i < array.size(); i++) {
1298        if (array.get(i).isJsonNull()) {
1299          res.getSuffix().add(new StringType());
1300        } else {;
1301          res.getSuffix().add(parseString(array.get(i).getAsString()));
1302        }
1303      }
1304    };
1305    if (json.has("_suffix")) {
1306      JsonArray array = getJArray(json, "_suffix");
1307      for (int i = 0; i < array.size(); i++) {
1308        if (i == res.getSuffix().size())
1309          res.getSuffix().add(parseString(null));
1310        if (array.get(i) instanceof JsonObject) 
1311          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1312      }
1313    };
1314    if (json.has("period"))
1315      res.setPeriod(parsePeriod(getJObject(json, "period")));
1316  }
1317
1318  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
1319    Identifier res = new Identifier();
1320    parseIdentifierProperties(json, res);
1321    return res;
1322  }
1323
1324  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
1325    parseDataTypeProperties(json, res);
1326    if (json.has("use"))
1327      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1328    if (json.has("_use"))
1329      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1330    if (json.has("type"))
1331      res.setType(parseCodeableConcept(getJObject(json, "type")));
1332    if (json.has("system"))
1333      res.setSystemElement(parseUri(json.get("system").getAsString()));
1334    if (json.has("_system"))
1335      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1336    if (json.has("value"))
1337      res.setValueElement(parseString(json.get("value").getAsString()));
1338    if (json.has("_value"))
1339      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1340    if (json.has("period"))
1341      res.setPeriod(parsePeriod(getJObject(json, "period")));
1342    if (json.has("assigner"))
1343      res.setAssigner(parseReference(getJObject(json, "assigner")));
1344  }
1345
1346  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1347    MarketingStatus res = new MarketingStatus();
1348    parseMarketingStatusProperties(json, res);
1349    return res;
1350  }
1351
1352  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1353    parseBackboneTypeProperties(json, res);
1354    if (json.has("country"))
1355      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
1356    if (json.has("jurisdiction"))
1357      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
1358    if (json.has("status"))
1359      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
1360    if (json.has("dateRange"))
1361      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
1362    if (json.has("restoreDate"))
1363      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1364    if (json.has("_restoreDate"))
1365      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
1366  }
1367
1368  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1369    Meta res = new Meta();
1370    parseMetaProperties(json, res);
1371    return res;
1372  }
1373
1374  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
1375    parseDataTypeProperties(json, res);
1376    if (json.has("versionId"))
1377      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1378    if (json.has("_versionId"))
1379      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
1380    if (json.has("lastUpdated"))
1381      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1382    if (json.has("_lastUpdated"))
1383      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
1384    if (json.has("source"))
1385      res.setSourceElement(parseUri(json.get("source").getAsString()));
1386    if (json.has("_source"))
1387      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1388    if (json.has("profile")) {
1389      JsonArray array = getJArray(json, "profile");
1390      for (int i = 0; i < array.size(); i++) {
1391        if (array.get(i).isJsonNull()) {
1392          res.getProfile().add(new CanonicalType());
1393        } else {;
1394          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1395        }
1396      }
1397    };
1398    if (json.has("_profile")) {
1399      JsonArray array = getJArray(json, "_profile");
1400      for (int i = 0; i < array.size(); i++) {
1401        if (i == res.getProfile().size())
1402          res.getProfile().add(parseCanonical(null));
1403        if (array.get(i) instanceof JsonObject) 
1404          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1405      }
1406    };
1407    if (json.has("security")) {
1408      JsonArray array = getJArray(json, "security");
1409      for (int i = 0; i < array.size(); i++) {
1410        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1411      }
1412    };
1413    if (json.has("tag")) {
1414      JsonArray array = getJArray(json, "tag");
1415      for (int i = 0; i < array.size(); i++) {
1416        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1417      }
1418    };
1419  }
1420
1421  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
1422    Money res = new Money();
1423    parseMoneyProperties(json, res);
1424    return res;
1425  }
1426
1427  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
1428    parseDataTypeProperties(json, res);
1429    if (json.has("value"))
1430      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1431    if (json.has("_value"))
1432      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1433    if (json.has("currency"))
1434      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
1435    if (json.has("_currency"))
1436      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
1437  }
1438
1439  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
1440    Narrative res = new Narrative();
1441    parseNarrativeProperties(json, res);
1442    return res;
1443  }
1444
1445  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
1446    parseDataTypeProperties(json, res);
1447    if (json.has("status"))
1448      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1449    if (json.has("_status"))
1450      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1451    if (json.has("div"))
1452      res.setDiv(parseXhtml(json.get("div").getAsString()));
1453  }
1454
1455  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1456    ParameterDefinition res = new ParameterDefinition();
1457    parseParameterDefinitionProperties(json, res);
1458    return res;
1459  }
1460
1461  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1462    parseDataTypeProperties(json, res);
1463    if (json.has("name"))
1464      res.setNameElement(parseCode(json.get("name").getAsString()));
1465    if (json.has("_name"))
1466      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1467    if (json.has("use"))
1468      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1469    if (json.has("_use"))
1470      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1471    if (json.has("min"))
1472      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1473    if (json.has("_min"))
1474      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1475    if (json.has("max"))
1476      res.setMaxElement(parseString(json.get("max").getAsString()));
1477    if (json.has("_max"))
1478      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1479    if (json.has("documentation"))
1480      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1481    if (json.has("_documentation"))
1482      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1483    if (json.has("type"))
1484      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
1485    if (json.has("_type"))
1486      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1487    if (json.has("profile"))
1488      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1489    if (json.has("_profile"))
1490      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1491  }
1492
1493  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1494    Period res = new Period();
1495    parsePeriodProperties(json, res);
1496    return res;
1497  }
1498
1499  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1500    parseDataTypeProperties(json, res);
1501    if (json.has("start"))
1502      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1503    if (json.has("_start"))
1504      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1505    if (json.has("end"))
1506      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1507    if (json.has("_end"))
1508      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1509  }
1510
1511  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
1512    Population res = new Population();
1513    parsePopulationProperties(json, res);
1514    return res;
1515  }
1516
1517  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
1518    parseBackboneTypeProperties(json, res);
1519    DataType age = parseType("age", json);
1520    if (age != null)
1521      res.setAge(age);
1522    if (json.has("gender"))
1523      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
1524    if (json.has("race"))
1525      res.setRace(parseCodeableConcept(getJObject(json, "race")));
1526    if (json.has("physiologicalCondition"))
1527      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
1528  }
1529
1530  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1531    ProdCharacteristic res = new ProdCharacteristic();
1532    parseProdCharacteristicProperties(json, res);
1533    return res;
1534  }
1535
1536  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1537    parseBackboneTypeProperties(json, res);
1538    if (json.has("height"))
1539      res.setHeight(parseQuantity(getJObject(json, "height")));
1540    if (json.has("width"))
1541      res.setWidth(parseQuantity(getJObject(json, "width")));
1542    if (json.has("depth"))
1543      res.setDepth(parseQuantity(getJObject(json, "depth")));
1544    if (json.has("weight"))
1545      res.setWeight(parseQuantity(getJObject(json, "weight")));
1546    if (json.has("nominalVolume"))
1547      res.setNominalVolume(parseQuantity(getJObject(json, "nominalVolume")));
1548    if (json.has("externalDiameter"))
1549      res.setExternalDiameter(parseQuantity(getJObject(json, "externalDiameter")));
1550    if (json.has("shape"))
1551      res.setShapeElement(parseString(json.get("shape").getAsString()));
1552    if (json.has("_shape"))
1553      parseElementProperties(getJObject(json, "_shape"), res.getShapeElement());
1554    if (json.has("color")) {
1555      JsonArray array = getJArray(json, "color");
1556      for (int i = 0; i < array.size(); i++) {
1557        if (array.get(i).isJsonNull()) {
1558          res.getColor().add(new StringType());
1559        } else {;
1560          res.getColor().add(parseString(array.get(i).getAsString()));
1561        }
1562      }
1563    };
1564    if (json.has("_color")) {
1565      JsonArray array = getJArray(json, "_color");
1566      for (int i = 0; i < array.size(); i++) {
1567        if (i == res.getColor().size())
1568          res.getColor().add(parseString(null));
1569        if (array.get(i) instanceof JsonObject) 
1570          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1571      }
1572    };
1573    if (json.has("imprint")) {
1574      JsonArray array = getJArray(json, "imprint");
1575      for (int i = 0; i < array.size(); i++) {
1576        if (array.get(i).isJsonNull()) {
1577          res.getImprint().add(new StringType());
1578        } else {;
1579          res.getImprint().add(parseString(array.get(i).getAsString()));
1580        }
1581      }
1582    };
1583    if (json.has("_imprint")) {
1584      JsonArray array = getJArray(json, "_imprint");
1585      for (int i = 0; i < array.size(); i++) {
1586        if (i == res.getImprint().size())
1587          res.getImprint().add(parseString(null));
1588        if (array.get(i) instanceof JsonObject) 
1589          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1590      }
1591    };
1592    if (json.has("image")) {
1593      JsonArray array = getJArray(json, "image");
1594      for (int i = 0; i < array.size(); i++) {
1595        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1596      }
1597    };
1598    if (json.has("scoring"))
1599      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
1600  }
1601
1602  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1603    ProductShelfLife res = new ProductShelfLife();
1604    parseProductShelfLifeProperties(json, res);
1605    return res;
1606  }
1607
1608  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1609    parseBackboneTypeProperties(json, res);
1610    if (json.has("type"))
1611      res.setType(parseCodeableConcept(getJObject(json, "type")));
1612    DataType period = parseType("period", json);
1613    if (period != null)
1614      res.setPeriod(period);
1615    if (json.has("specialPrecautionsForStorage")) {
1616      JsonArray array = getJArray(json, "specialPrecautionsForStorage");
1617      for (int i = 0; i < array.size(); i++) {
1618        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1619      }
1620    };
1621  }
1622
1623  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1624    Quantity res = new Quantity();
1625    parseQuantityProperties(json, res);
1626    return res;
1627  }
1628
1629  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1630    parseDataTypeProperties(json, res);
1631    if (json.has("value"))
1632      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1633    if (json.has("_value"))
1634      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1635    if (json.has("comparator"))
1636      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1637    if (json.has("_comparator"))
1638      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1639    if (json.has("unit"))
1640      res.setUnitElement(parseString(json.get("unit").getAsString()));
1641    if (json.has("_unit"))
1642      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1643    if (json.has("system"))
1644      res.setSystemElement(parseUri(json.get("system").getAsString()));
1645    if (json.has("_system"))
1646      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1647    if (json.has("code"))
1648      res.setCodeElement(parseCode(json.get("code").getAsString()));
1649    if (json.has("_code"))
1650      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1651  }
1652
1653  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1654    Range res = new Range();
1655    parseRangeProperties(json, res);
1656    return res;
1657  }
1658
1659  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1660    parseDataTypeProperties(json, res);
1661    if (json.has("low"))
1662      res.setLow(parseQuantity(getJObject(json, "low")));
1663    if (json.has("high"))
1664      res.setHigh(parseQuantity(getJObject(json, "high")));
1665  }
1666
1667  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1668    Ratio res = new Ratio();
1669    parseRatioProperties(json, res);
1670    return res;
1671  }
1672
1673  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1674    parseDataTypeProperties(json, res);
1675    if (json.has("numerator"))
1676      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
1677    if (json.has("denominator"))
1678      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1679  }
1680
1681  protected RatioRange parseRatioRange(JsonObject json) throws IOException, FHIRFormatError {
1682    RatioRange res = new RatioRange();
1683    parseRatioRangeProperties(json, res);
1684    return res;
1685  }
1686
1687  protected void parseRatioRangeProperties(JsonObject json, RatioRange res) throws IOException, FHIRFormatError {
1688    parseDataTypeProperties(json, res);
1689    if (json.has("lowNumerator"))
1690      res.setLowNumerator(parseQuantity(getJObject(json, "lowNumerator")));
1691    if (json.has("highNumerator"))
1692      res.setHighNumerator(parseQuantity(getJObject(json, "highNumerator")));
1693    if (json.has("denominator"))
1694      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1695  }
1696
1697  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1698    Reference res = new Reference();
1699    parseReferenceProperties(json, res);
1700    return res;
1701  }
1702
1703  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1704    parseDataTypeProperties(json, res);
1705    if (json.has("reference"))
1706      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1707    if (json.has("_reference"))
1708      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1709    if (json.has("type"))
1710      res.setTypeElement(parseUri(json.get("type").getAsString()));
1711    if (json.has("_type"))
1712      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1713    if (json.has("identifier"))
1714      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1715    if (json.has("display"))
1716      res.setDisplayElement(parseString(json.get("display").getAsString()));
1717    if (json.has("_display"))
1718      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1719  }
1720
1721  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1722    RelatedArtifact res = new RelatedArtifact();
1723    parseRelatedArtifactProperties(json, res);
1724    return res;
1725  }
1726
1727  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1728    parseDataTypeProperties(json, res);
1729    if (json.has("type"))
1730      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1731    if (json.has("_type"))
1732      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1733    if (json.has("classifier")) {
1734      JsonArray array = getJArray(json, "classifier");
1735      for (int i = 0; i < array.size(); i++) {
1736        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1737      }
1738    };
1739    if (json.has("label"))
1740      res.setLabelElement(parseString(json.get("label").getAsString()));
1741    if (json.has("_label"))
1742      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1743    if (json.has("display"))
1744      res.setDisplayElement(parseString(json.get("display").getAsString()));
1745    if (json.has("_display"))
1746      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1747    if (json.has("citation"))
1748      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1749    if (json.has("_citation"))
1750      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1751    if (json.has("document"))
1752      res.setDocument(parseAttachment(getJObject(json, "document")));
1753    if (json.has("resource"))
1754      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1755    if (json.has("_resource"))
1756      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1757    if (json.has("resourceReference"))
1758      res.setResourceReference(parseReference(getJObject(json, "resourceReference")));
1759  }
1760
1761  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1762    SampledData res = new SampledData();
1763    parseSampledDataProperties(json, res);
1764    return res;
1765  }
1766
1767  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1768    parseDataTypeProperties(json, res);
1769    if (json.has("origin"))
1770      res.setOrigin(parseQuantity(getJObject(json, "origin")));
1771    if (json.has("period"))
1772      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1773    if (json.has("_period"))
1774      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1775    if (json.has("factor"))
1776      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1777    if (json.has("_factor"))
1778      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1779    if (json.has("lowerLimit"))
1780      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1781    if (json.has("_lowerLimit"))
1782      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
1783    if (json.has("upperLimit"))
1784      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1785    if (json.has("_upperLimit"))
1786      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
1787    if (json.has("dimensions"))
1788      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1789    if (json.has("_dimensions"))
1790      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
1791    if (json.has("data"))
1792      res.setDataElement(parseString(json.get("data").getAsString()));
1793    if (json.has("_data"))
1794      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1795  }
1796
1797  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1798    Signature res = new Signature();
1799    parseSignatureProperties(json, res);
1800    return res;
1801  }
1802
1803  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1804    parseDataTypeProperties(json, res);
1805    if (json.has("type")) {
1806      JsonArray array = getJArray(json, "type");
1807      for (int i = 0; i < array.size(); i++) {
1808        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1809      }
1810    };
1811    if (json.has("when"))
1812      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1813    if (json.has("_when"))
1814      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1815    if (json.has("who"))
1816      res.setWho(parseReference(getJObject(json, "who")));
1817    if (json.has("onBehalfOf"))
1818      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1819    if (json.has("targetFormat"))
1820      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1821    if (json.has("_targetFormat"))
1822      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1823    if (json.has("sigFormat"))
1824      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1825    if (json.has("_sigFormat"))
1826      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1827    if (json.has("data"))
1828      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1829    if (json.has("_data"))
1830      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1831  }
1832
1833  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1834    Timing res = new Timing();
1835    parseTimingProperties(json, res);
1836    return res;
1837  }
1838
1839  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1840    parseBackboneTypeProperties(json, res);
1841    if (json.has("event")) {
1842      JsonArray array = getJArray(json, "event");
1843      for (int i = 0; i < array.size(); i++) {
1844        if (array.get(i).isJsonNull()) {
1845          res.getEvent().add(new DateTimeType());
1846        } else {;
1847          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1848        }
1849      }
1850    };
1851    if (json.has("_event")) {
1852      JsonArray array = getJArray(json, "_event");
1853      for (int i = 0; i < array.size(); i++) {
1854        if (i == res.getEvent().size())
1855          res.getEvent().add(parseDateTime(null));
1856        if (array.get(i) instanceof JsonObject) 
1857          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1858      }
1859    };
1860    if (json.has("repeat"))
1861      res.setRepeat(parseTimingRepeatComponent(getJObject(json, "repeat")));
1862    if (json.has("code"))
1863      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1864  }
1865
1866  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
1867    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1868    parseTimingRepeatComponentProperties(json, res);
1869    return res;
1870  }
1871
1872  protected void parseTimingRepeatComponentProperties(JsonObject json, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1873    parseElementProperties(json, res);
1874    DataType bounds = parseType("bounds", json);
1875    if (bounds != null)
1876      res.setBounds(bounds);
1877    if (json.has("count"))
1878      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1879    if (json.has("_count"))
1880      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1881    if (json.has("countMax"))
1882      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1883    if (json.has("_countMax"))
1884      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1885    if (json.has("duration"))
1886      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1887    if (json.has("_duration"))
1888      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1889    if (json.has("durationMax"))
1890      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1891    if (json.has("_durationMax"))
1892      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1893    if (json.has("durationUnit"))
1894      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1895    if (json.has("_durationUnit"))
1896      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1897    if (json.has("frequency"))
1898      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1899    if (json.has("_frequency"))
1900      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1901    if (json.has("frequencyMax"))
1902      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1903    if (json.has("_frequencyMax"))
1904      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1905    if (json.has("period"))
1906      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1907    if (json.has("_period"))
1908      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1909    if (json.has("periodMax"))
1910      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1911    if (json.has("_periodMax"))
1912      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1913    if (json.has("periodUnit"))
1914      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1915    if (json.has("_periodUnit"))
1916      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1917    if (json.has("dayOfWeek")) {
1918      JsonArray array = getJArray(json, "dayOfWeek");
1919      for (int i = 0; i < array.size(); i++) {
1920        if (array.get(i).isJsonNull()) {
1921          res.getDayOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
1922        } else {;
1923          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
1924        }
1925      }
1926    };
1927    if (json.has("_dayOfWeek")) {
1928      JsonArray array = getJArray(json, "_dayOfWeek");
1929      for (int i = 0; i < array.size(); i++) {
1930        if (i == res.getDayOfWeek().size())
1931          res.getDayOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
1932        if (array.get(i) instanceof JsonObject) 
1933          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1934      }
1935    };
1936    if (json.has("timeOfDay")) {
1937      JsonArray array = getJArray(json, "timeOfDay");
1938      for (int i = 0; i < array.size(); i++) {
1939        if (array.get(i).isJsonNull()) {
1940          res.getTimeOfDay().add(new TimeType());
1941        } else {;
1942          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1943        }
1944      }
1945    };
1946    if (json.has("_timeOfDay")) {
1947      JsonArray array = getJArray(json, "_timeOfDay");
1948      for (int i = 0; i < array.size(); i++) {
1949        if (i == res.getTimeOfDay().size())
1950          res.getTimeOfDay().add(parseTime(null));
1951        if (array.get(i) instanceof JsonObject) 
1952          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1953      }
1954    };
1955    if (json.has("when")) {
1956      JsonArray array = getJArray(json, "when");
1957      for (int i = 0; i < array.size(); i++) {
1958        if (array.get(i).isJsonNull()) {
1959          res.getWhen().add(new Enumeration<Timing.EventTiming>(new Timing.EventTimingEnumFactory(), Timing.EventTiming.NULL));
1960        } else {;
1961          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1962        }
1963      }
1964    };
1965    if (json.has("_when")) {
1966      JsonArray array = getJArray(json, "_when");
1967      for (int i = 0; i < array.size(); i++) {
1968        if (i == res.getWhen().size())
1969          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1970        if (array.get(i) instanceof JsonObject) 
1971          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1972      }
1973    };
1974    if (json.has("offset"))
1975      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1976    if (json.has("_offset"))
1977      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1978  }
1979
1980  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
1981    TriggerDefinition res = new TriggerDefinition();
1982    parseTriggerDefinitionProperties(json, res);
1983    return res;
1984  }
1985
1986  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
1987    parseDataTypeProperties(json, res);
1988    if (json.has("type"))
1989      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
1990    if (json.has("_type"))
1991      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1992    if (json.has("name"))
1993      res.setNameElement(parseString(json.get("name").getAsString()));
1994    if (json.has("_name"))
1995      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1996    DataType timing = parseType("timing", json);
1997    if (timing != null)
1998      res.setTiming(timing);
1999    if (json.has("data")) {
2000      JsonArray array = getJArray(json, "data");
2001      for (int i = 0; i < array.size(); i++) {
2002        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
2003      }
2004    };
2005    if (json.has("condition"))
2006      res.setCondition(parseExpression(getJObject(json, "condition")));
2007  }
2008
2009  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
2010    UsageContext res = new UsageContext();
2011    parseUsageContextProperties(json, res);
2012    return res;
2013  }
2014
2015  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
2016    parseDataTypeProperties(json, res);
2017    if (json.has("code"))
2018      res.setCode(parseCoding(getJObject(json, "code")));
2019    DataType value = parseType("value", json);
2020    if (value != null)
2021      res.setValue(value);
2022  }
2023
2024  protected void parseCanonicalResourceProperties(JsonObject json, CanonicalResource res) throws IOException, FHIRFormatError {
2025    parseDomainResourceProperties(json, res);
2026  }
2027
2028  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2029    parseResourceProperties(json, res);
2030    if (json.has("text"))
2031      res.setText(parseNarrative(getJObject(json, "text")));
2032    if (json.has("contained")) {
2033      JsonArray array = getJArray(json, "contained");
2034      for (int i = 0; i < array.size(); i++) {
2035        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2036      }
2037    };
2038    if (json.has("extension")) {
2039      JsonArray array = getJArray(json, "extension");
2040      for (int i = 0; i < array.size(); i++) {
2041        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2042      }
2043    };
2044    if (json.has("modifierExtension")) {
2045      JsonArray array = getJArray(json, "modifierExtension");
2046      for (int i = 0; i < array.size(); i++) {
2047        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2048      }
2049    };
2050  }
2051
2052  protected void parseMetadataResourceProperties(JsonObject json, MetadataResource res) throws IOException, FHIRFormatError {
2053    parseCanonicalResourceProperties(json, res);
2054  }
2055
2056  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2057    parseBaseProperties(json, res);
2058    if (json.has("id"))
2059      res.setIdElement(parseId(json.get("id").getAsString()));
2060    if (json.has("_id"))
2061      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2062    if (json.has("meta"))
2063      res.setMeta(parseMeta(getJObject(json, "meta")));
2064    if (json.has("implicitRules"))
2065      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2066    if (json.has("_implicitRules"))
2067      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2068    if (json.has("language"))
2069      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2070    if (json.has("_language"))
2071      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2072  }
2073
2074  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2075    Account res = new Account();
2076    parseAccountProperties(json, res);
2077    return res;
2078  }
2079
2080  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2081    parseDomainResourceProperties(json, res);
2082    if (json.has("identifier")) {
2083      JsonArray array = getJArray(json, "identifier");
2084      for (int i = 0; i < array.size(); i++) {
2085        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2086      }
2087    };
2088    if (json.has("status"))
2089      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2090    if (json.has("_status"))
2091      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2092    if (json.has("billingStatus"))
2093      res.setBillingStatus(parseCodeableConcept(getJObject(json, "billingStatus")));
2094    if (json.has("type"))
2095      res.setType(parseCodeableConcept(getJObject(json, "type")));
2096    if (json.has("name"))
2097      res.setNameElement(parseString(json.get("name").getAsString()));
2098    if (json.has("_name"))
2099      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2100    if (json.has("subject")) {
2101      JsonArray array = getJArray(json, "subject");
2102      for (int i = 0; i < array.size(); i++) {
2103        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2104      }
2105    };
2106    if (json.has("servicePeriod"))
2107      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2108    if (json.has("coverage")) {
2109      JsonArray array = getJArray(json, "coverage");
2110      for (int i = 0; i < array.size(); i++) {
2111        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject()));
2112      }
2113    };
2114    if (json.has("owner"))
2115      res.setOwner(parseReference(getJObject(json, "owner")));
2116    if (json.has("description"))
2117      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2118    if (json.has("_description"))
2119      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2120    if (json.has("guarantor")) {
2121      JsonArray array = getJArray(json, "guarantor");
2122      for (int i = 0; i < array.size(); i++) {
2123        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject()));
2124      }
2125    };
2126    if (json.has("partOf"))
2127      res.setPartOf(parseReference(getJObject(json, "partOf")));
2128  }
2129
2130  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
2131    Account.CoverageComponent res = new Account.CoverageComponent();
2132    parseAccountCoverageComponentProperties(json, res);
2133    return res;
2134  }
2135
2136  protected void parseAccountCoverageComponentProperties(JsonObject json, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2137    parseBackboneElementProperties(json, res);
2138    if (json.has("coverage"))
2139      res.setCoverage(parseReference(getJObject(json, "coverage")));
2140    if (json.has("priority"))
2141      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2142    if (json.has("_priority"))
2143      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2144  }
2145
2146  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json) throws IOException, FHIRFormatError {
2147    Account.GuarantorComponent res = new Account.GuarantorComponent();
2148    parseAccountGuarantorComponentProperties(json, res);
2149    return res;
2150  }
2151
2152  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2153    parseBackboneElementProperties(json, res);
2154    if (json.has("party"))
2155      res.setParty(parseReference(getJObject(json, "party")));
2156    if (json.has("onHold"))
2157      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2158    if (json.has("_onHold"))
2159      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2160    if (json.has("period"))
2161      res.setPeriod(parsePeriod(getJObject(json, "period")));
2162  }
2163
2164  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2165    ActivityDefinition res = new ActivityDefinition();
2166    parseActivityDefinitionProperties(json, res);
2167    return res;
2168  }
2169
2170  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2171    parseMetadataResourceProperties(json, res);
2172    if (json.has("url"))
2173      res.setUrlElement(parseUri(json.get("url").getAsString()));
2174    if (json.has("_url"))
2175      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2176    if (json.has("identifier")) {
2177      JsonArray array = getJArray(json, "identifier");
2178      for (int i = 0; i < array.size(); i++) {
2179        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2180      }
2181    };
2182    if (json.has("version"))
2183      res.setVersionElement(parseString(json.get("version").getAsString()));
2184    if (json.has("_version"))
2185      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2186    if (json.has("name"))
2187      res.setNameElement(parseString(json.get("name").getAsString()));
2188    if (json.has("_name"))
2189      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2190    if (json.has("title"))
2191      res.setTitleElement(parseString(json.get("title").getAsString()));
2192    if (json.has("_title"))
2193      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2194    if (json.has("subtitle"))
2195      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2196    if (json.has("_subtitle"))
2197      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2198    if (json.has("status"))
2199      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2200    if (json.has("_status"))
2201      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2202    if (json.has("experimental"))
2203      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2204    if (json.has("_experimental"))
2205      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2206    DataType subject = parseType("subject", json);
2207    if (subject != null)
2208      res.setSubject(subject);
2209    if (json.has("date"))
2210      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2211    if (json.has("_date"))
2212      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2213    if (json.has("publisher"))
2214      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2215    if (json.has("_publisher"))
2216      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2217    if (json.has("contact")) {
2218      JsonArray array = getJArray(json, "contact");
2219      for (int i = 0; i < array.size(); i++) {
2220        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2221      }
2222    };
2223    if (json.has("description"))
2224      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2225    if (json.has("_description"))
2226      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2227    if (json.has("useContext")) {
2228      JsonArray array = getJArray(json, "useContext");
2229      for (int i = 0; i < array.size(); i++) {
2230        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2231      }
2232    };
2233    if (json.has("jurisdiction")) {
2234      JsonArray array = getJArray(json, "jurisdiction");
2235      for (int i = 0; i < array.size(); i++) {
2236        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2237      }
2238    };
2239    if (json.has("purpose"))
2240      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2241    if (json.has("_purpose"))
2242      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2243    if (json.has("usage"))
2244      res.setUsageElement(parseString(json.get("usage").getAsString()));
2245    if (json.has("_usage"))
2246      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2247    if (json.has("copyright"))
2248      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2249    if (json.has("_copyright"))
2250      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2251    if (json.has("approvalDate"))
2252      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2253    if (json.has("_approvalDate"))
2254      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2255    if (json.has("lastReviewDate"))
2256      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2257    if (json.has("_lastReviewDate"))
2258      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2259    if (json.has("effectivePeriod"))
2260      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2261    if (json.has("topic")) {
2262      JsonArray array = getJArray(json, "topic");
2263      for (int i = 0; i < array.size(); i++) {
2264        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2265      }
2266    };
2267    if (json.has("author")) {
2268      JsonArray array = getJArray(json, "author");
2269      for (int i = 0; i < array.size(); i++) {
2270        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2271      }
2272    };
2273    if (json.has("editor")) {
2274      JsonArray array = getJArray(json, "editor");
2275      for (int i = 0; i < array.size(); i++) {
2276        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2277      }
2278    };
2279    if (json.has("reviewer")) {
2280      JsonArray array = getJArray(json, "reviewer");
2281      for (int i = 0; i < array.size(); i++) {
2282        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2283      }
2284    };
2285    if (json.has("endorser")) {
2286      JsonArray array = getJArray(json, "endorser");
2287      for (int i = 0; i < array.size(); i++) {
2288        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2289      }
2290    };
2291    if (json.has("relatedArtifact")) {
2292      JsonArray array = getJArray(json, "relatedArtifact");
2293      for (int i = 0; i < array.size(); i++) {
2294        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2295      }
2296    };
2297    if (json.has("library")) {
2298      JsonArray array = getJArray(json, "library");
2299      for (int i = 0; i < array.size(); i++) {
2300        if (array.get(i).isJsonNull()) {
2301          res.getLibrary().add(new CanonicalType());
2302        } else {;
2303          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2304        }
2305      }
2306    };
2307    if (json.has("_library")) {
2308      JsonArray array = getJArray(json, "_library");
2309      for (int i = 0; i < array.size(); i++) {
2310        if (i == res.getLibrary().size())
2311          res.getLibrary().add(parseCanonical(null));
2312        if (array.get(i) instanceof JsonObject) 
2313          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2314      }
2315    };
2316    if (json.has("kind"))
2317      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.RequestResourceType.NULL, new ActivityDefinition.RequestResourceTypeEnumFactory()));
2318    if (json.has("_kind"))
2319      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2320    if (json.has("profile"))
2321      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2322    if (json.has("_profile"))
2323      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2324    if (json.has("code"))
2325      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2326    if (json.has("intent"))
2327      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2328    if (json.has("_intent"))
2329      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2330    if (json.has("priority"))
2331      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2332    if (json.has("_priority"))
2333      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2334    if (json.has("doNotPerform"))
2335      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2336    if (json.has("_doNotPerform"))
2337      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2338    DataType timing = parseType("timing", json);
2339    if (timing != null)
2340      res.setTiming(timing);
2341    if (json.has("location"))
2342      res.setLocation(parseCodeableReference(getJObject(json, "location")));
2343    if (json.has("participant")) {
2344      JsonArray array = getJArray(json, "participant");
2345      for (int i = 0; i < array.size(); i++) {
2346        res.getParticipant().add(parseActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject()));
2347      }
2348    };
2349    DataType product = parseType("product", json);
2350    if (product != null)
2351      res.setProduct(product);
2352    if (json.has("quantity"))
2353      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2354    if (json.has("dosage")) {
2355      JsonArray array = getJArray(json, "dosage");
2356      for (int i = 0; i < array.size(); i++) {
2357        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2358      }
2359    };
2360    if (json.has("bodySite")) {
2361      JsonArray array = getJArray(json, "bodySite");
2362      for (int i = 0; i < array.size(); i++) {
2363        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2364      }
2365    };
2366    if (json.has("specimenRequirement")) {
2367      JsonArray array = getJArray(json, "specimenRequirement");
2368      for (int i = 0; i < array.size(); i++) {
2369        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2370      }
2371    };
2372    if (json.has("observationRequirement")) {
2373      JsonArray array = getJArray(json, "observationRequirement");
2374      for (int i = 0; i < array.size(); i++) {
2375        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2376      }
2377    };
2378    if (json.has("observationResultRequirement")) {
2379      JsonArray array = getJArray(json, "observationResultRequirement");
2380      for (int i = 0; i < array.size(); i++) {
2381        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2382      }
2383    };
2384    if (json.has("transform"))
2385      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2386    if (json.has("_transform"))
2387      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2388    if (json.has("dynamicValue")) {
2389      JsonArray array = getJArray(json, "dynamicValue");
2390      for (int i = 0; i < array.size(); i++) {
2391        res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject()));
2392      }
2393    };
2394  }
2395
2396  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2397    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2398    parseActivityDefinitionParticipantComponentProperties(json, res);
2399    return res;
2400  }
2401
2402  protected void parseActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2403    parseBackboneElementProperties(json, res);
2404    if (json.has("type"))
2405      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2406    if (json.has("_type"))
2407      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2408    if (json.has("typeReference"))
2409      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
2410    if (json.has("role"))
2411      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2412    if (json.has("function"))
2413      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
2414  }
2415
2416  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
2417    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2418    parseActivityDefinitionDynamicValueComponentProperties(json, res);
2419    return res;
2420  }
2421
2422  protected void parseActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2423    parseBackboneElementProperties(json, res);
2424    if (json.has("path"))
2425      res.setPathElement(parseString(json.get("path").getAsString()));
2426    if (json.has("_path"))
2427      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2428    if (json.has("expression"))
2429      res.setExpression(parseExpression(getJObject(json, "expression")));
2430  }
2431
2432  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2433    AdministrableProductDefinition res = new AdministrableProductDefinition();
2434    parseAdministrableProductDefinitionProperties(json, res);
2435    return res;
2436  }
2437
2438  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2439    parseDomainResourceProperties(json, res);
2440    if (json.has("identifier")) {
2441      JsonArray array = getJArray(json, "identifier");
2442      for (int i = 0; i < array.size(); i++) {
2443        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2444      }
2445    };
2446    if (json.has("status"))
2447      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2448    if (json.has("_status"))
2449      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2450    if (json.has("formOf")) {
2451      JsonArray array = getJArray(json, "formOf");
2452      for (int i = 0; i < array.size(); i++) {
2453        res.getFormOf().add(parseReference(array.get(i).getAsJsonObject()));
2454      }
2455    };
2456    if (json.has("administrableDoseForm"))
2457      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
2458    if (json.has("unitOfPresentation"))
2459      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
2460    if (json.has("producedFrom")) {
2461      JsonArray array = getJArray(json, "producedFrom");
2462      for (int i = 0; i < array.size(); i++) {
2463        res.getProducedFrom().add(parseReference(array.get(i).getAsJsonObject()));
2464      }
2465    };
2466    if (json.has("ingredient")) {
2467      JsonArray array = getJArray(json, "ingredient");
2468      for (int i = 0; i < array.size(); i++) {
2469        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2470      }
2471    };
2472    if (json.has("device"))
2473      res.setDevice(parseReference(getJObject(json, "device")));
2474    if (json.has("property")) {
2475      JsonArray array = getJArray(json, "property");
2476      for (int i = 0; i < array.size(); i++) {
2477        res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
2478      }
2479    };
2480    if (json.has("routeOfAdministration")) {
2481      JsonArray array = getJArray(json, "routeOfAdministration");
2482      for (int i = 0; i < array.size(); i++) {
2483        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject()));
2484      }
2485    };
2486  }
2487
2488  protected AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent parseAdministrableProductDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
2489    AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent();
2490    parseAdministrableProductDefinitionPropertyComponentProperties(json, res);
2491    return res;
2492  }
2493
2494  protected void parseAdministrableProductDefinitionPropertyComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
2495    parseBackboneElementProperties(json, res);
2496    if (json.has("type"))
2497      res.setType(parseCodeableConcept(getJObject(json, "type")));
2498    DataType value = parseType("value", json);
2499    if (value != null)
2500      res.setValue(value);
2501    if (json.has("status"))
2502      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
2503  }
2504
2505  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
2506    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2507    parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, res);
2508    return res;
2509  }
2510
2511  protected void parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
2512    parseBackboneElementProperties(json, res);
2513    if (json.has("code"))
2514      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2515    if (json.has("firstDose"))
2516      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
2517    if (json.has("maxSingleDose"))
2518      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
2519    if (json.has("maxDosePerDay"))
2520      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
2521    if (json.has("maxDosePerTreatmentPeriod"))
2522      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
2523    if (json.has("maxTreatmentPeriod"))
2524      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
2525    if (json.has("targetSpecies")) {
2526      JsonArray array = getJArray(json, "targetSpecies");
2527      for (int i = 0; i < array.size(); i++) {
2528        res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject()));
2529      }
2530    };
2531  }
2532
2533  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json) throws IOException, FHIRFormatError {
2534    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2535    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, res);
2536    return res;
2537  }
2538
2539  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
2540    parseBackboneElementProperties(json, res);
2541    if (json.has("code"))
2542      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2543    if (json.has("withdrawalPeriod")) {
2544      JsonArray array = getJArray(json, "withdrawalPeriod");
2545      for (int i = 0; i < array.size(); i++) {
2546        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject()));
2547      }
2548    };
2549  }
2550
2551  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json) throws IOException, FHIRFormatError {
2552    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2553    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, res);
2554    return res;
2555  }
2556
2557  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
2558    parseBackboneElementProperties(json, res);
2559    if (json.has("tissue"))
2560      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
2561    if (json.has("value"))
2562      res.setValue(parseQuantity(getJObject(json, "value")));
2563    if (json.has("supportingInformation"))
2564      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
2565    if (json.has("_supportingInformation"))
2566      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
2567  }
2568
2569  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2570    AdverseEvent res = new AdverseEvent();
2571    parseAdverseEventProperties(json, res);
2572    return res;
2573  }
2574
2575  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2576    parseDomainResourceProperties(json, res);
2577    if (json.has("identifier")) {
2578      JsonArray array = getJArray(json, "identifier");
2579      for (int i = 0; i < array.size(); i++) {
2580        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2581      }
2582    };
2583    if (json.has("status"))
2584      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
2585    if (json.has("_status"))
2586      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2587    if (json.has("actuality"))
2588      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2589    if (json.has("_actuality"))
2590      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2591    if (json.has("category")) {
2592      JsonArray array = getJArray(json, "category");
2593      for (int i = 0; i < array.size(); i++) {
2594        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2595      }
2596    };
2597    if (json.has("code"))
2598      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2599    if (json.has("subject"))
2600      res.setSubject(parseReference(getJObject(json, "subject")));
2601    if (json.has("encounter"))
2602      res.setEncounter(parseReference(getJObject(json, "encounter")));
2603    DataType occurrence = parseType("occurrence", json);
2604    if (occurrence != null)
2605      res.setOccurrence(occurrence);
2606    if (json.has("detected"))
2607      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2608    if (json.has("_detected"))
2609      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
2610    if (json.has("recordedDate"))
2611      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2612    if (json.has("_recordedDate"))
2613      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2614    if (json.has("resultingCondition")) {
2615      JsonArray array = getJArray(json, "resultingCondition");
2616      for (int i = 0; i < array.size(); i++) {
2617        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2618      }
2619    };
2620    if (json.has("location"))
2621      res.setLocation(parseReference(getJObject(json, "location")));
2622    if (json.has("seriousness"))
2623      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2624    if (json.has("outcome")) {
2625      JsonArray array = getJArray(json, "outcome");
2626      for (int i = 0; i < array.size(); i++) {
2627        res.getOutcome().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2628      }
2629    };
2630    if (json.has("recorder"))
2631      res.setRecorder(parseReference(getJObject(json, "recorder")));
2632    if (json.has("participant")) {
2633      JsonArray array = getJArray(json, "participant");
2634      for (int i = 0; i < array.size(); i++) {
2635        res.getParticipant().add(parseAdverseEventParticipantComponent(array.get(i).getAsJsonObject()));
2636      }
2637    };
2638    if (json.has("suspectEntity")) {
2639      JsonArray array = getJArray(json, "suspectEntity");
2640      for (int i = 0; i < array.size(); i++) {
2641        res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject()));
2642      }
2643    };
2644    if (json.has("contributingFactor")) {
2645      JsonArray array = getJArray(json, "contributingFactor");
2646      for (int i = 0; i < array.size(); i++) {
2647        res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(array.get(i).getAsJsonObject()));
2648      }
2649    };
2650    if (json.has("preventiveAction")) {
2651      JsonArray array = getJArray(json, "preventiveAction");
2652      for (int i = 0; i < array.size(); i++) {
2653        res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(array.get(i).getAsJsonObject()));
2654      }
2655    };
2656    if (json.has("mitigatingAction")) {
2657      JsonArray array = getJArray(json, "mitigatingAction");
2658      for (int i = 0; i < array.size(); i++) {
2659        res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(array.get(i).getAsJsonObject()));
2660      }
2661    };
2662    if (json.has("supportingInfo")) {
2663      JsonArray array = getJArray(json, "supportingInfo");
2664      for (int i = 0; i < array.size(); i++) {
2665        res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(array.get(i).getAsJsonObject()));
2666      }
2667    };
2668    if (json.has("study")) {
2669      JsonArray array = getJArray(json, "study");
2670      for (int i = 0; i < array.size(); i++) {
2671        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2672      }
2673    };
2674  }
2675
2676  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2677    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
2678    parseAdverseEventParticipantComponentProperties(json, res);
2679    return res;
2680  }
2681
2682  protected void parseAdverseEventParticipantComponentProperties(JsonObject json, AdverseEvent.AdverseEventParticipantComponent res) throws IOException, FHIRFormatError {
2683    parseBackboneElementProperties(json, res);
2684    if (json.has("function"))
2685      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
2686    if (json.has("actor"))
2687      res.setActor(parseReference(getJObject(json, "actor")));
2688  }
2689
2690  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
2691    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2692    parseAdverseEventSuspectEntityComponentProperties(json, res);
2693    return res;
2694  }
2695
2696  protected void parseAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2697    parseBackboneElementProperties(json, res);
2698    DataType instance = parseType("instance", json);
2699    if (instance != null)
2700      res.setInstance(instance);
2701    if (json.has("causality"))
2702      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(getJObject(json, "causality")));
2703  }
2704
2705  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(JsonObject json) throws IOException, FHIRFormatError {
2706    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2707    parseAdverseEventSuspectEntityCausalityComponentProperties(json, res);
2708    return res;
2709  }
2710
2711  protected void parseAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2712    parseBackboneElementProperties(json, res);
2713    if (json.has("assessmentMethod"))
2714      res.setAssessmentMethod(parseCodeableConcept(getJObject(json, "assessmentMethod")));
2715    if (json.has("entityRelatedness"))
2716      res.setEntityRelatedness(parseCodeableConcept(getJObject(json, "entityRelatedness")));
2717    if (json.has("author"))
2718      res.setAuthor(parseReference(getJObject(json, "author")));
2719  }
2720
2721  protected AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(JsonObject json) throws IOException, FHIRFormatError {
2722    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
2723    parseAdverseEventContributingFactorComponentProperties(json, res);
2724    return res;
2725  }
2726
2727  protected void parseAdverseEventContributingFactorComponentProperties(JsonObject json, AdverseEvent.AdverseEventContributingFactorComponent res) throws IOException, FHIRFormatError {
2728    parseBackboneElementProperties(json, res);
2729    DataType item = parseType("item", json);
2730    if (item != null)
2731      res.setItem(item);
2732  }
2733
2734  protected AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(JsonObject json) throws IOException, FHIRFormatError {
2735    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
2736    parseAdverseEventPreventiveActionComponentProperties(json, res);
2737    return res;
2738  }
2739
2740  protected void parseAdverseEventPreventiveActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventPreventiveActionComponent res) throws IOException, FHIRFormatError {
2741    parseBackboneElementProperties(json, res);
2742    DataType item = parseType("item", json);
2743    if (item != null)
2744      res.setItem(item);
2745  }
2746
2747  protected AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(JsonObject json) throws IOException, FHIRFormatError {
2748    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
2749    parseAdverseEventMitigatingActionComponentProperties(json, res);
2750    return res;
2751  }
2752
2753  protected void parseAdverseEventMitigatingActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventMitigatingActionComponent res) throws IOException, FHIRFormatError {
2754    parseBackboneElementProperties(json, res);
2755    DataType item = parseType("item", json);
2756    if (item != null)
2757      res.setItem(item);
2758  }
2759
2760  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
2761    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
2762    parseAdverseEventSupportingInfoComponentProperties(json, res);
2763    return res;
2764  }
2765
2766  protected void parseAdverseEventSupportingInfoComponentProperties(JsonObject json, AdverseEvent.AdverseEventSupportingInfoComponent res) throws IOException, FHIRFormatError {
2767    parseBackboneElementProperties(json, res);
2768    DataType item = parseType("item", json);
2769    if (item != null)
2770      res.setItem(item);
2771  }
2772
2773  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2774    AllergyIntolerance res = new AllergyIntolerance();
2775    parseAllergyIntoleranceProperties(json, res);
2776    return res;
2777  }
2778
2779  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2780    parseDomainResourceProperties(json, res);
2781    if (json.has("identifier")) {
2782      JsonArray array = getJArray(json, "identifier");
2783      for (int i = 0; i < array.size(); i++) {
2784        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2785      }
2786    };
2787    if (json.has("clinicalStatus"))
2788      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
2789    if (json.has("verificationStatus"))
2790      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
2791    if (json.has("type"))
2792      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2793    if (json.has("_type"))
2794      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2795    if (json.has("category")) {
2796      JsonArray array = getJArray(json, "category");
2797      for (int i = 0; i < array.size(); i++) {
2798        if (array.get(i).isJsonNull()) {
2799          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>(new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), AllergyIntolerance.AllergyIntoleranceCategory.NULL));
2800        } else {;
2801          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2802        }
2803      }
2804    };
2805    if (json.has("_category")) {
2806      JsonArray array = getJArray(json, "_category");
2807      for (int i = 0; i < array.size(); i++) {
2808        if (i == res.getCategory().size())
2809          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2810        if (array.get(i) instanceof JsonObject) 
2811          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2812      }
2813    };
2814    if (json.has("criticality"))
2815      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2816    if (json.has("_criticality"))
2817      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2818    if (json.has("code"))
2819      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2820    if (json.has("patient"))
2821      res.setPatient(parseReference(getJObject(json, "patient")));
2822    if (json.has("encounter"))
2823      res.setEncounter(parseReference(getJObject(json, "encounter")));
2824    DataType onset = parseType("onset", json);
2825    if (onset != null)
2826      res.setOnset(onset);
2827    if (json.has("recordedDate"))
2828      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2829    if (json.has("_recordedDate"))
2830      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2831    if (json.has("recorder"))
2832      res.setRecorder(parseReference(getJObject(json, "recorder")));
2833    if (json.has("asserter"))
2834      res.setAsserter(parseReference(getJObject(json, "asserter")));
2835    if (json.has("lastOccurrence"))
2836      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2837    if (json.has("_lastOccurrence"))
2838      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2839    if (json.has("note")) {
2840      JsonArray array = getJArray(json, "note");
2841      for (int i = 0; i < array.size(); i++) {
2842        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2843      }
2844    };
2845    if (json.has("reaction")) {
2846      JsonArray array = getJArray(json, "reaction");
2847      for (int i = 0; i < array.size(); i++) {
2848        res.getReaction().add(parseAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject()));
2849      }
2850    };
2851  }
2852
2853  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
2854    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2855    parseAllergyIntoleranceReactionComponentProperties(json, res);
2856    return res;
2857  }
2858
2859  protected void parseAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2860    parseBackboneElementProperties(json, res);
2861    if (json.has("substance"))
2862      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2863    if (json.has("manifestation")) {
2864      JsonArray array = getJArray(json, "manifestation");
2865      for (int i = 0; i < array.size(); i++) {
2866        res.getManifestation().add(parseCodeableReference(array.get(i).getAsJsonObject()));
2867      }
2868    };
2869    if (json.has("description"))
2870      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2871    if (json.has("_description"))
2872      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2873    if (json.has("onset"))
2874      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2875    if (json.has("_onset"))
2876      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2877    if (json.has("severity"))
2878      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2879    if (json.has("_severity"))
2880      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2881    if (json.has("exposureRoute"))
2882      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2883    if (json.has("note")) {
2884      JsonArray array = getJArray(json, "note");
2885      for (int i = 0; i < array.size(); i++) {
2886        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2887      }
2888    };
2889  }
2890
2891  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2892    Appointment res = new Appointment();
2893    parseAppointmentProperties(json, res);
2894    return res;
2895  }
2896
2897  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2898    parseDomainResourceProperties(json, res);
2899    if (json.has("identifier")) {
2900      JsonArray array = getJArray(json, "identifier");
2901      for (int i = 0; i < array.size(); i++) {
2902        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2903      }
2904    };
2905    if (json.has("status"))
2906      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2907    if (json.has("_status"))
2908      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2909    if (json.has("cancellationReason"))
2910      res.setCancellationReason(parseCodeableConcept(getJObject(json, "cancellationReason")));
2911    if (json.has("serviceCategory")) {
2912      JsonArray array = getJArray(json, "serviceCategory");
2913      for (int i = 0; i < array.size(); i++) {
2914        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2915      }
2916    };
2917    if (json.has("serviceType")) {
2918      JsonArray array = getJArray(json, "serviceType");
2919      for (int i = 0; i < array.size(); i++) {
2920        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2921      }
2922    };
2923    if (json.has("specialty")) {
2924      JsonArray array = getJArray(json, "specialty");
2925      for (int i = 0; i < array.size(); i++) {
2926        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2927      }
2928    };
2929    if (json.has("appointmentType"))
2930      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2931    if (json.has("reason")) {
2932      JsonArray array = getJArray(json, "reason");
2933      for (int i = 0; i < array.size(); i++) {
2934        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
2935      }
2936    };
2937    if (json.has("priority"))
2938      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
2939    if (json.has("description"))
2940      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2941    if (json.has("_description"))
2942      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2943    if (json.has("replaces")) {
2944      JsonArray array = getJArray(json, "replaces");
2945      for (int i = 0; i < array.size(); i++) {
2946        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
2947      }
2948    };
2949    if (json.has("supportingInformation")) {
2950      JsonArray array = getJArray(json, "supportingInformation");
2951      for (int i = 0; i < array.size(); i++) {
2952        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2953      }
2954    };
2955    if (json.has("start"))
2956      res.setStartElement(parseInstant(json.get("start").getAsString()));
2957    if (json.has("_start"))
2958      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2959    if (json.has("end"))
2960      res.setEndElement(parseInstant(json.get("end").getAsString()));
2961    if (json.has("_end"))
2962      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2963    if (json.has("minutesDuration"))
2964      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2965    if (json.has("_minutesDuration"))
2966      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2967    if (json.has("slot")) {
2968      JsonArray array = getJArray(json, "slot");
2969      for (int i = 0; i < array.size(); i++) {
2970        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2971      }
2972    };
2973    if (json.has("account")) {
2974      JsonArray array = getJArray(json, "account");
2975      for (int i = 0; i < array.size(); i++) {
2976        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
2977      }
2978    };
2979    if (json.has("created"))
2980      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2981    if (json.has("_created"))
2982      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2983    if (json.has("note")) {
2984      JsonArray array = getJArray(json, "note");
2985      for (int i = 0; i < array.size(); i++) {
2986        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2987      }
2988    };
2989    if (json.has("patientInstruction")) {
2990      JsonArray array = getJArray(json, "patientInstruction");
2991      for (int i = 0; i < array.size(); i++) {
2992        res.getPatientInstruction().add(parseCodeableReference(array.get(i).getAsJsonObject()));
2993      }
2994    };
2995    if (json.has("basedOn")) {
2996      JsonArray array = getJArray(json, "basedOn");
2997      for (int i = 0; i < array.size(); i++) {
2998        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2999      }
3000    };
3001    if (json.has("subject"))
3002      res.setSubject(parseReference(getJObject(json, "subject")));
3003    if (json.has("participant")) {
3004      JsonArray array = getJArray(json, "participant");
3005      for (int i = 0; i < array.size(); i++) {
3006        res.getParticipant().add(parseAppointmentParticipantComponent(array.get(i).getAsJsonObject()));
3007      }
3008    };
3009    if (json.has("requestedPeriod")) {
3010      JsonArray array = getJArray(json, "requestedPeriod");
3011      for (int i = 0; i < array.size(); i++) {
3012        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3013      }
3014    };
3015  }
3016
3017  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3018    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3019    parseAppointmentParticipantComponentProperties(json, res);
3020    return res;
3021  }
3022
3023  protected void parseAppointmentParticipantComponentProperties(JsonObject json, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3024    parseBackboneElementProperties(json, res);
3025    if (json.has("type")) {
3026      JsonArray array = getJArray(json, "type");
3027      for (int i = 0; i < array.size(); i++) {
3028        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3029      }
3030    };
3031    if (json.has("period"))
3032      res.setPeriod(parsePeriod(getJObject(json, "period")));
3033    if (json.has("actor"))
3034      res.setActor(parseReference(getJObject(json, "actor")));
3035    if (json.has("required"))
3036      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
3037    if (json.has("_required"))
3038      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
3039    if (json.has("status"))
3040      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3041    if (json.has("_status"))
3042      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3043  }
3044
3045  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3046    AppointmentResponse res = new AppointmentResponse();
3047    parseAppointmentResponseProperties(json, res);
3048    return res;
3049  }
3050
3051  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
3052    parseDomainResourceProperties(json, res);
3053    if (json.has("identifier")) {
3054      JsonArray array = getJArray(json, "identifier");
3055      for (int i = 0; i < array.size(); i++) {
3056        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3057      }
3058    };
3059    if (json.has("appointment"))
3060      res.setAppointment(parseReference(getJObject(json, "appointment")));
3061    if (json.has("start"))
3062      res.setStartElement(parseInstant(json.get("start").getAsString()));
3063    if (json.has("_start"))
3064      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3065    if (json.has("end"))
3066      res.setEndElement(parseInstant(json.get("end").getAsString()));
3067    if (json.has("_end"))
3068      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3069    if (json.has("participantType")) {
3070      JsonArray array = getJArray(json, "participantType");
3071      for (int i = 0; i < array.size(); i++) {
3072        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3073      }
3074    };
3075    if (json.has("actor"))
3076      res.setActor(parseReference(getJObject(json, "actor")));
3077    if (json.has("participantStatus"))
3078      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3079    if (json.has("_participantStatus"))
3080      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
3081    if (json.has("comment"))
3082      res.setCommentElement(parseString(json.get("comment").getAsString()));
3083    if (json.has("_comment"))
3084      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
3085  }
3086
3087  protected ArtifactAssessment parseArtifactAssessment(JsonObject json) throws IOException, FHIRFormatError {
3088    ArtifactAssessment res = new ArtifactAssessment();
3089    parseArtifactAssessmentProperties(json, res);
3090    return res;
3091  }
3092
3093  protected void parseArtifactAssessmentProperties(JsonObject json, ArtifactAssessment res) throws IOException, FHIRFormatError {
3094    parseMetadataResourceProperties(json, res);
3095    if (json.has("identifier")) {
3096      JsonArray array = getJArray(json, "identifier");
3097      for (int i = 0; i < array.size(); i++) {
3098        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3099      }
3100    };
3101    DataType citeAs = parseType("citeAs", json);
3102    if (citeAs != null)
3103      res.setCiteAs(citeAs);
3104    if (json.has("date"))
3105      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3106    if (json.has("_date"))
3107      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3108    if (json.has("copyright"))
3109      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3110    if (json.has("_copyright"))
3111      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3112    if (json.has("approvalDate"))
3113      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
3114    if (json.has("_approvalDate"))
3115      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
3116    if (json.has("lastReviewDate"))
3117      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
3118    if (json.has("_lastReviewDate"))
3119      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
3120    DataType artifact = parseType("artifact", json);
3121    if (artifact != null)
3122      res.setArtifact(artifact);
3123    if (json.has("content")) {
3124      JsonArray array = getJArray(json, "content");
3125      for (int i = 0; i < array.size(); i++) {
3126        res.getContent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3127      }
3128    };
3129    if (json.has("workflowStatus"))
3130      res.setWorkflowStatusElement(parseEnumeration(json.get("workflowStatus").getAsString(), ArtifactAssessment.ArtifactAssessmentWorkflowStatus.NULL, new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory()));
3131    if (json.has("_workflowStatus"))
3132      parseElementProperties(getJObject(json, "_workflowStatus"), res.getWorkflowStatusElement());
3133    if (json.has("disposition"))
3134      res.setDispositionElement(parseEnumeration(json.get("disposition").getAsString(), ArtifactAssessment.ArtifactAssessmentDisposition.NULL, new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory()));
3135    if (json.has("_disposition"))
3136      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
3137  }
3138
3139  protected ArtifactAssessment.ArtifactAssessmentContentComponent parseArtifactAssessmentContentComponent(JsonObject json) throws IOException, FHIRFormatError {
3140    ArtifactAssessment.ArtifactAssessmentContentComponent res = new ArtifactAssessment.ArtifactAssessmentContentComponent();
3141    parseArtifactAssessmentContentComponentProperties(json, res);
3142    return res;
3143  }
3144
3145  protected void parseArtifactAssessmentContentComponentProperties(JsonObject json, ArtifactAssessment.ArtifactAssessmentContentComponent res) throws IOException, FHIRFormatError {
3146    parseBackboneElementProperties(json, res);
3147    if (json.has("informationType"))
3148      res.setInformationTypeElement(parseEnumeration(json.get("informationType").getAsString(), ArtifactAssessment.ArtifactAssessmentInformationType.NULL, new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory()));
3149    if (json.has("_informationType"))
3150      parseElementProperties(getJObject(json, "_informationType"), res.getInformationTypeElement());
3151    if (json.has("summary"))
3152      res.setSummaryElement(parseMarkdown(json.get("summary").getAsString()));
3153    if (json.has("_summary"))
3154      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
3155    if (json.has("type"))
3156      res.setType(parseCodeableConcept(getJObject(json, "type")));
3157    if (json.has("classifier")) {
3158      JsonArray array = getJArray(json, "classifier");
3159      for (int i = 0; i < array.size(); i++) {
3160        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3161      }
3162    };
3163    if (json.has("author"))
3164      res.setAuthor(parseReference(getJObject(json, "author")));
3165    if (json.has("path")) {
3166      JsonArray array = getJArray(json, "path");
3167      for (int i = 0; i < array.size(); i++) {
3168        if (array.get(i).isJsonNull()) {
3169          res.getPath().add(new UriType());
3170        } else {;
3171          res.getPath().add(parseUri(array.get(i).getAsString()));
3172        }
3173      }
3174    };
3175    if (json.has("_path")) {
3176      JsonArray array = getJArray(json, "_path");
3177      for (int i = 0; i < array.size(); i++) {
3178        if (i == res.getPath().size())
3179          res.getPath().add(parseUri(null));
3180        if (array.get(i) instanceof JsonObject) 
3181          parseElementProperties(array.get(i).getAsJsonObject(), res.getPath().get(i));
3182      }
3183    };
3184    if (json.has("relatedArtifact")) {
3185      JsonArray array = getJArray(json, "relatedArtifact");
3186      for (int i = 0; i < array.size(); i++) {
3187        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
3188      }
3189    };
3190    if (json.has("freeToShare"))
3191      res.setFreeToShareElement(parseBoolean(json.get("freeToShare").getAsBoolean()));
3192    if (json.has("_freeToShare"))
3193      parseElementProperties(getJObject(json, "_freeToShare"), res.getFreeToShareElement());
3194    if (json.has("component")) {
3195      JsonArray array = getJArray(json, "component");
3196      for (int i = 0; i < array.size(); i++) {
3197        res.getComponent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3198      }
3199    };
3200  }
3201
3202  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3203    AuditEvent res = new AuditEvent();
3204    parseAuditEventProperties(json, res);
3205    return res;
3206  }
3207
3208  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3209    parseDomainResourceProperties(json, res);
3210    if (json.has("category")) {
3211      JsonArray array = getJArray(json, "category");
3212      for (int i = 0; i < array.size(); i++) {
3213        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3214      }
3215    };
3216    if (json.has("code"))
3217      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3218    if (json.has("action"))
3219      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
3220    if (json.has("_action"))
3221      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
3222    if (json.has("severity"))
3223      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
3224    if (json.has("_severity"))
3225      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
3226    DataType occurred = parseType("occurred", json);
3227    if (occurred != null)
3228      res.setOccurred(occurred);
3229    if (json.has("recorded"))
3230      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
3231    if (json.has("_recorded"))
3232      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
3233    if (json.has("outcome"))
3234      res.setOutcome(parseAuditEventOutcomeComponent(getJObject(json, "outcome")));
3235    if (json.has("authorization")) {
3236      JsonArray array = getJArray(json, "authorization");
3237      for (int i = 0; i < array.size(); i++) {
3238        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3239      }
3240    };
3241    if (json.has("basedOn")) {
3242      JsonArray array = getJArray(json, "basedOn");
3243      for (int i = 0; i < array.size(); i++) {
3244        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3245      }
3246    };
3247    if (json.has("encounter"))
3248      res.setEncounter(parseReference(getJObject(json, "encounter")));
3249    if (json.has("agent")) {
3250      JsonArray array = getJArray(json, "agent");
3251      for (int i = 0; i < array.size(); i++) {
3252        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
3253      }
3254    };
3255    if (json.has("source"))
3256      res.setSource(parseAuditEventSourceComponent(getJObject(json, "source")));
3257    if (json.has("entity")) {
3258      JsonArray array = getJArray(json, "entity");
3259      for (int i = 0; i < array.size(); i++) {
3260        res.getEntity().add(parseAuditEventEntityComponent(array.get(i).getAsJsonObject()));
3261      }
3262    };
3263  }
3264
3265  protected AuditEvent.AuditEventOutcomeComponent parseAuditEventOutcomeComponent(JsonObject json) throws IOException, FHIRFormatError {
3266    AuditEvent.AuditEventOutcomeComponent res = new AuditEvent.AuditEventOutcomeComponent();
3267    parseAuditEventOutcomeComponentProperties(json, res);
3268    return res;
3269  }
3270
3271  protected void parseAuditEventOutcomeComponentProperties(JsonObject json, AuditEvent.AuditEventOutcomeComponent res) throws IOException, FHIRFormatError {
3272    parseBackboneElementProperties(json, res);
3273    if (json.has("code"))
3274      res.setCode(parseCoding(getJObject(json, "code")));
3275    if (json.has("detail")) {
3276      JsonArray array = getJArray(json, "detail");
3277      for (int i = 0; i < array.size(); i++) {
3278        res.getDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3279      }
3280    };
3281  }
3282
3283  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
3284    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3285    parseAuditEventAgentComponentProperties(json, res);
3286    return res;
3287  }
3288
3289  protected void parseAuditEventAgentComponentProperties(JsonObject json, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3290    parseBackboneElementProperties(json, res);
3291    if (json.has("type"))
3292      res.setType(parseCodeableConcept(getJObject(json, "type")));
3293    if (json.has("role")) {
3294      JsonArray array = getJArray(json, "role");
3295      for (int i = 0; i < array.size(); i++) {
3296        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3297      }
3298    };
3299    if (json.has("who"))
3300      res.setWho(parseReference(getJObject(json, "who")));
3301    if (json.has("requestor"))
3302      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3303    if (json.has("_requestor"))
3304      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
3305    if (json.has("location"))
3306      res.setLocation(parseReference(getJObject(json, "location")));
3307    if (json.has("policy")) {
3308      JsonArray array = getJArray(json, "policy");
3309      for (int i = 0; i < array.size(); i++) {
3310        if (array.get(i).isJsonNull()) {
3311          res.getPolicy().add(new UriType());
3312        } else {;
3313          res.getPolicy().add(parseUri(array.get(i).getAsString()));
3314        }
3315      }
3316    };
3317    if (json.has("_policy")) {
3318      JsonArray array = getJArray(json, "_policy");
3319      for (int i = 0; i < array.size(); i++) {
3320        if (i == res.getPolicy().size())
3321          res.getPolicy().add(parseUri(null));
3322        if (array.get(i) instanceof JsonObject) 
3323          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3324      }
3325    };
3326    DataType network = parseType("network", json);
3327    if (network != null)
3328      res.setNetwork(network);
3329    if (json.has("authorization")) {
3330      JsonArray array = getJArray(json, "authorization");
3331      for (int i = 0; i < array.size(); i++) {
3332        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3333      }
3334    };
3335  }
3336
3337  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
3338    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3339    parseAuditEventSourceComponentProperties(json, res);
3340    return res;
3341  }
3342
3343  protected void parseAuditEventSourceComponentProperties(JsonObject json, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3344    parseBackboneElementProperties(json, res);
3345    if (json.has("site"))
3346      res.setSite(parseReference(getJObject(json, "site")));
3347    if (json.has("observer"))
3348      res.setObserver(parseReference(getJObject(json, "observer")));
3349    if (json.has("type")) {
3350      JsonArray array = getJArray(json, "type");
3351      for (int i = 0; i < array.size(); i++) {
3352        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3353      }
3354    };
3355  }
3356
3357  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3358    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3359    parseAuditEventEntityComponentProperties(json, res);
3360    return res;
3361  }
3362
3363  protected void parseAuditEventEntityComponentProperties(JsonObject json, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3364    parseBackboneElementProperties(json, res);
3365    if (json.has("what"))
3366      res.setWhat(parseReference(getJObject(json, "what")));
3367    if (json.has("role"))
3368      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3369    if (json.has("securityLabel")) {
3370      JsonArray array = getJArray(json, "securityLabel");
3371      for (int i = 0; i < array.size(); i++) {
3372        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3373      }
3374    };
3375    if (json.has("query"))
3376      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3377    if (json.has("_query"))
3378      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
3379    if (json.has("detail")) {
3380      JsonArray array = getJArray(json, "detail");
3381      for (int i = 0; i < array.size(); i++) {
3382        res.getDetail().add(parseAuditEventEntityDetailComponent(array.get(i).getAsJsonObject()));
3383      }
3384    };
3385    if (json.has("agent")) {
3386      JsonArray array = getJArray(json, "agent");
3387      for (int i = 0; i < array.size(); i++) {
3388        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
3389      }
3390    };
3391  }
3392
3393  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
3394    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3395    parseAuditEventEntityDetailComponentProperties(json, res);
3396    return res;
3397  }
3398
3399  protected void parseAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3400    parseBackboneElementProperties(json, res);
3401    if (json.has("type"))
3402      res.setType(parseCodeableConcept(getJObject(json, "type")));
3403    DataType value = parseType("value", json);
3404    if (value != null)
3405      res.setValue(value);
3406  }
3407
3408  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3409    Basic res = new Basic();
3410    parseBasicProperties(json, res);
3411    return res;
3412  }
3413
3414  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3415    parseDomainResourceProperties(json, res);
3416    if (json.has("identifier")) {
3417      JsonArray array = getJArray(json, "identifier");
3418      for (int i = 0; i < array.size(); i++) {
3419        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3420      }
3421    };
3422    if (json.has("code"))
3423      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3424    if (json.has("subject"))
3425      res.setSubject(parseReference(getJObject(json, "subject")));
3426    if (json.has("created"))
3427      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3428    if (json.has("_created"))
3429      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3430    if (json.has("author"))
3431      res.setAuthor(parseReference(getJObject(json, "author")));
3432  }
3433
3434  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3435    Binary res = new Binary();
3436    parseBinaryProperties(json, res);
3437    return res;
3438  }
3439
3440  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3441    parseResourceProperties(json, res);
3442    if (json.has("contentType"))
3443      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3444    if (json.has("_contentType"))
3445      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
3446    if (json.has("securityContext"))
3447      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
3448    if (json.has("data"))
3449      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3450    if (json.has("_data"))
3451      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
3452  }
3453
3454  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3455    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3456    parseBiologicallyDerivedProductProperties(json, res);
3457    return res;
3458  }
3459
3460  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3461    parseDomainResourceProperties(json, res);
3462    if (json.has("productCategory"))
3463      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3464    if (json.has("_productCategory"))
3465      parseElementProperties(getJObject(json, "_productCategory"), res.getProductCategoryElement());
3466    if (json.has("productCode"))
3467      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
3468    if (json.has("parent")) {
3469      JsonArray array = getJArray(json, "parent");
3470      for (int i = 0; i < array.size(); i++) {
3471        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3472      }
3473    };
3474    if (json.has("request")) {
3475      JsonArray array = getJArray(json, "request");
3476      for (int i = 0; i < array.size(); i++) {
3477        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3478      }
3479    };
3480    if (json.has("identifier")) {
3481      JsonArray array = getJArray(json, "identifier");
3482      for (int i = 0; i < array.size(); i++) {
3483        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3484      }
3485    };
3486    if (json.has("biologicalSource"))
3487      res.setBiologicalSource(parseIdentifier(getJObject(json, "biologicalSource")));
3488    if (json.has("processingFacility")) {
3489      JsonArray array = getJArray(json, "processingFacility");
3490      for (int i = 0; i < array.size(); i++) {
3491        res.getProcessingFacility().add(parseReference(array.get(i).getAsJsonObject()));
3492      }
3493    };
3494    if (json.has("division"))
3495      res.setDivisionElement(parseString(json.get("division").getAsString()));
3496    if (json.has("_division"))
3497      parseElementProperties(getJObject(json, "_division"), res.getDivisionElement());
3498    if (json.has("status"))
3499      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3500    if (json.has("_status"))
3501      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3502    if (json.has("expirationDate"))
3503      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
3504    if (json.has("_expirationDate"))
3505      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
3506    if (json.has("collection"))
3507      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection")));
3508    if (json.has("storageTempRequirements"))
3509      res.setStorageTempRequirements(parseRange(getJObject(json, "storageTempRequirements")));
3510    if (json.has("property")) {
3511      JsonArray array = getJArray(json, "property");
3512      for (int i = 0; i < array.size(); i++) {
3513        res.getProperty().add(parseBiologicallyDerivedProductPropertyComponent(array.get(i).getAsJsonObject()));
3514      }
3515    };
3516  }
3517
3518  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
3519    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3520    parseBiologicallyDerivedProductCollectionComponentProperties(json, res);
3521    return res;
3522  }
3523
3524  protected void parseBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3525    parseBackboneElementProperties(json, res);
3526    if (json.has("collector"))
3527      res.setCollector(parseReference(getJObject(json, "collector")));
3528    if (json.has("source"))
3529      res.setSource(parseReference(getJObject(json, "source")));
3530    DataType collected = parseType("collected", json);
3531    if (collected != null)
3532      res.setCollected(collected);
3533  }
3534
3535  protected BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent parseBiologicallyDerivedProductPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
3536    BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent();
3537    parseBiologicallyDerivedProductPropertyComponentProperties(json, res);
3538    return res;
3539  }
3540
3541  protected void parseBiologicallyDerivedProductPropertyComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res) throws IOException, FHIRFormatError {
3542    parseBackboneElementProperties(json, res);
3543    if (json.has("type"))
3544      res.setType(parseCodeableConcept(getJObject(json, "type")));
3545    DataType value = parseType("value", json);
3546    if (value != null)
3547      res.setValue(value);
3548  }
3549
3550  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3551    BodyStructure res = new BodyStructure();
3552    parseBodyStructureProperties(json, res);
3553    return res;
3554  }
3555
3556  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3557    parseDomainResourceProperties(json, res);
3558    if (json.has("identifier")) {
3559      JsonArray array = getJArray(json, "identifier");
3560      for (int i = 0; i < array.size(); i++) {
3561        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3562      }
3563    };
3564    if (json.has("active"))
3565      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3566    if (json.has("_active"))
3567      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
3568    if (json.has("morphology"))
3569      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
3570    if (json.has("location"))
3571      res.setLocation(parseCodeableConcept(getJObject(json, "location")));
3572    if (json.has("includedStructure")) {
3573      JsonArray array = getJArray(json, "includedStructure");
3574      for (int i = 0; i < array.size(); i++) {
3575        res.getIncludedStructure().add(parseBodyStructureIncludedStructureComponent(array.get(i).getAsJsonObject()));
3576      }
3577    };
3578    if (json.has("excludedStructure")) {
3579      JsonArray array = getJArray(json, "excludedStructure");
3580      for (int i = 0; i < array.size(); i++) {
3581        res.getExcludedStructure().add(parseBodyStructureExcludedStructureComponent(array.get(i).getAsJsonObject()));
3582      }
3583    };
3584    if (json.has("description"))
3585      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3586    if (json.has("_description"))
3587      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3588    if (json.has("image")) {
3589      JsonArray array = getJArray(json, "image");
3590      for (int i = 0; i < array.size(); i++) {
3591        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3592      }
3593    };
3594    if (json.has("patient"))
3595      res.setPatient(parseReference(getJObject(json, "patient")));
3596  }
3597
3598  protected BodyStructure.BodyStructureIncludedStructureComponent parseBodyStructureIncludedStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
3599    BodyStructure.BodyStructureIncludedStructureComponent res = new BodyStructure.BodyStructureIncludedStructureComponent();
3600    parseBodyStructureIncludedStructureComponentProperties(json, res);
3601    return res;
3602  }
3603
3604  protected void parseBodyStructureIncludedStructureComponentProperties(JsonObject json, BodyStructure.BodyStructureIncludedStructureComponent res) throws IOException, FHIRFormatError {
3605    parseBackboneElementProperties(json, res);
3606    if (json.has("structure"))
3607      res.setStructure(parseCodeableConcept(getJObject(json, "structure")));
3608    if (json.has("laterality"))
3609      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
3610    if (json.has("qualifier")) {
3611      JsonArray array = getJArray(json, "qualifier");
3612      for (int i = 0; i < array.size(); i++) {
3613        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3614      }
3615    };
3616  }
3617
3618  protected BodyStructure.BodyStructureExcludedStructureComponent parseBodyStructureExcludedStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
3619    BodyStructure.BodyStructureExcludedStructureComponent res = new BodyStructure.BodyStructureExcludedStructureComponent();
3620    parseBodyStructureExcludedStructureComponentProperties(json, res);
3621    return res;
3622  }
3623
3624  protected void parseBodyStructureExcludedStructureComponentProperties(JsonObject json, BodyStructure.BodyStructureExcludedStructureComponent res) throws IOException, FHIRFormatError {
3625    parseBackboneElementProperties(json, res);
3626    if (json.has("structure"))
3627      res.setStructure(parseCodeableConcept(getJObject(json, "structure")));
3628    if (json.has("laterality"))
3629      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
3630    if (json.has("qualifier")) {
3631      JsonArray array = getJArray(json, "qualifier");
3632      for (int i = 0; i < array.size(); i++) {
3633        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3634      }
3635    };
3636  }
3637
3638  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3639    Bundle res = new Bundle();
3640    parseBundleProperties(json, res);
3641    return res;
3642  }
3643
3644  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3645    parseResourceProperties(json, res);
3646    if (json.has("identifier"))
3647      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3648    if (json.has("type"))
3649      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3650    if (json.has("_type"))
3651      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3652    if (json.has("timestamp"))
3653      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3654    if (json.has("_timestamp"))
3655      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
3656    if (json.has("total"))
3657      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3658    if (json.has("_total"))
3659      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
3660    if (json.has("link")) {
3661      JsonArray array = getJArray(json, "link");
3662      for (int i = 0; i < array.size(); i++) {
3663        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3664      }
3665    };
3666    if (json.has("entry")) {
3667      JsonArray array = getJArray(json, "entry");
3668      for (int i = 0; i < array.size(); i++) {
3669        res.getEntry().add(parseBundleEntryComponent(array.get(i).getAsJsonObject()));
3670      }
3671    };
3672    if (json.has("signature"))
3673      res.setSignature(parseSignature(getJObject(json, "signature")));
3674  }
3675
3676  protected Bundle.BundleLinkComponent parseBundleLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
3677    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3678    parseBundleLinkComponentProperties(json, res);
3679    return res;
3680  }
3681
3682  protected void parseBundleLinkComponentProperties(JsonObject json, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3683    parseBackboneElementProperties(json, res);
3684    if (json.has("relation"))
3685      res.setRelationElement(parseString(json.get("relation").getAsString()));
3686    if (json.has("_relation"))
3687      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
3688    if (json.has("url"))
3689      res.setUrlElement(parseUri(json.get("url").getAsString()));
3690    if (json.has("_url"))
3691      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3692  }
3693
3694  protected Bundle.BundleEntryComponent parseBundleEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
3695    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3696    parseBundleEntryComponentProperties(json, res);
3697    return res;
3698  }
3699
3700  protected void parseBundleEntryComponentProperties(JsonObject json, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3701    parseBackboneElementProperties(json, res);
3702    if (json.has("link")) {
3703      JsonArray array = getJArray(json, "link");
3704      for (int i = 0; i < array.size(); i++) {
3705        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3706      }
3707    };
3708    if (json.has("fullUrl"))
3709      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3710    if (json.has("_fullUrl"))
3711      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
3712    if (json.has("resource"))
3713      res.setResource(parseResource(getJObject(json, "resource")));
3714    if (json.has("search"))
3715      res.setSearch(parseBundleEntrySearchComponent(getJObject(json, "search")));
3716    if (json.has("request"))
3717      res.setRequest(parseBundleEntryRequestComponent(getJObject(json, "request")));
3718    if (json.has("response"))
3719      res.setResponse(parseBundleEntryResponseComponent(getJObject(json, "response")));
3720  }
3721
3722  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(JsonObject json) throws IOException, FHIRFormatError {
3723    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3724    parseBundleEntrySearchComponentProperties(json, res);
3725    return res;
3726  }
3727
3728  protected void parseBundleEntrySearchComponentProperties(JsonObject json, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3729    parseBackboneElementProperties(json, res);
3730    if (json.has("mode"))
3731      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3732    if (json.has("_mode"))
3733      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3734    if (json.has("score"))
3735      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3736    if (json.has("_score"))
3737      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
3738  }
3739
3740  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
3741    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3742    parseBundleEntryRequestComponentProperties(json, res);
3743    return res;
3744  }
3745
3746  protected void parseBundleEntryRequestComponentProperties(JsonObject json, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3747    parseBackboneElementProperties(json, res);
3748    if (json.has("method"))
3749      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3750    if (json.has("_method"))
3751      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
3752    if (json.has("url"))
3753      res.setUrlElement(parseUri(json.get("url").getAsString()));
3754    if (json.has("_url"))
3755      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3756    if (json.has("ifNoneMatch"))
3757      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3758    if (json.has("_ifNoneMatch"))
3759      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
3760    if (json.has("ifModifiedSince"))
3761      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3762    if (json.has("_ifModifiedSince"))
3763      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
3764    if (json.has("ifMatch"))
3765      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3766    if (json.has("_ifMatch"))
3767      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
3768    if (json.has("ifNoneExist"))
3769      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3770    if (json.has("_ifNoneExist"))
3771      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
3772  }
3773
3774  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
3775    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3776    parseBundleEntryResponseComponentProperties(json, res);
3777    return res;
3778  }
3779
3780  protected void parseBundleEntryResponseComponentProperties(JsonObject json, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3781    parseBackboneElementProperties(json, res);
3782    if (json.has("status"))
3783      res.setStatusElement(parseString(json.get("status").getAsString()));
3784    if (json.has("_status"))
3785      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3786    if (json.has("location"))
3787      res.setLocationElement(parseUri(json.get("location").getAsString()));
3788    if (json.has("_location"))
3789      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
3790    if (json.has("etag"))
3791      res.setEtagElement(parseString(json.get("etag").getAsString()));
3792    if (json.has("_etag"))
3793      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
3794    if (json.has("lastModified"))
3795      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3796    if (json.has("_lastModified"))
3797      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
3798    if (json.has("outcome"))
3799      res.setOutcome(parseResource(getJObject(json, "outcome")));
3800  }
3801
3802  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3803    CapabilityStatement res = new CapabilityStatement();
3804    parseCapabilityStatementProperties(json, res);
3805    return res;
3806  }
3807
3808  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3809    parseCanonicalResourceProperties(json, res);
3810    if (json.has("url"))
3811      res.setUrlElement(parseUri(json.get("url").getAsString()));
3812    if (json.has("_url"))
3813      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3814    if (json.has("version"))
3815      res.setVersionElement(parseString(json.get("version").getAsString()));
3816    if (json.has("_version"))
3817      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3818    if (json.has("name"))
3819      res.setNameElement(parseString(json.get("name").getAsString()));
3820    if (json.has("_name"))
3821      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3822    if (json.has("title"))
3823      res.setTitleElement(parseString(json.get("title").getAsString()));
3824    if (json.has("_title"))
3825      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3826    if (json.has("status"))
3827      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3828    if (json.has("_status"))
3829      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3830    if (json.has("experimental"))
3831      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3832    if (json.has("_experimental"))
3833      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
3834    if (json.has("date"))
3835      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3836    if (json.has("_date"))
3837      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3838    if (json.has("publisher"))
3839      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3840    if (json.has("_publisher"))
3841      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
3842    if (json.has("contact")) {
3843      JsonArray array = getJArray(json, "contact");
3844      for (int i = 0; i < array.size(); i++) {
3845        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3846      }
3847    };
3848    if (json.has("description"))
3849      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3850    if (json.has("_description"))
3851      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3852    if (json.has("useContext")) {
3853      JsonArray array = getJArray(json, "useContext");
3854      for (int i = 0; i < array.size(); i++) {
3855        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3856      }
3857    };
3858    if (json.has("jurisdiction")) {
3859      JsonArray array = getJArray(json, "jurisdiction");
3860      for (int i = 0; i < array.size(); i++) {
3861        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3862      }
3863    };
3864    if (json.has("purpose"))
3865      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3866    if (json.has("_purpose"))
3867      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
3868    if (json.has("copyright"))
3869      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3870    if (json.has("_copyright"))
3871      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3872    if (json.has("kind"))
3873      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
3874    if (json.has("_kind"))
3875      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
3876    if (json.has("instantiates")) {
3877      JsonArray array = getJArray(json, "instantiates");
3878      for (int i = 0; i < array.size(); i++) {
3879        if (array.get(i).isJsonNull()) {
3880          res.getInstantiates().add(new CanonicalType());
3881        } else {;
3882          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3883        }
3884      }
3885    };
3886    if (json.has("_instantiates")) {
3887      JsonArray array = getJArray(json, "_instantiates");
3888      for (int i = 0; i < array.size(); i++) {
3889        if (i == res.getInstantiates().size())
3890          res.getInstantiates().add(parseCanonical(null));
3891        if (array.get(i) instanceof JsonObject) 
3892          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3893      }
3894    };
3895    if (json.has("imports")) {
3896      JsonArray array = getJArray(json, "imports");
3897      for (int i = 0; i < array.size(); i++) {
3898        if (array.get(i).isJsonNull()) {
3899          res.getImports().add(new CanonicalType());
3900        } else {;
3901          res.getImports().add(parseCanonical(array.get(i).getAsString()));
3902        }
3903      }
3904    };
3905    if (json.has("_imports")) {
3906      JsonArray array = getJArray(json, "_imports");
3907      for (int i = 0; i < array.size(); i++) {
3908        if (i == res.getImports().size())
3909          res.getImports().add(parseCanonical(null));
3910        if (array.get(i) instanceof JsonObject) 
3911          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3912      }
3913    };
3914    if (json.has("software"))
3915      res.setSoftware(parseCapabilityStatementSoftwareComponent(getJObject(json, "software")));
3916    if (json.has("implementation"))
3917      res.setImplementation(parseCapabilityStatementImplementationComponent(getJObject(json, "implementation")));
3918    if (json.has("fhirVersion"))
3919      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3920    if (json.has("_fhirVersion"))
3921      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3922    if (json.has("format")) {
3923      JsonArray array = getJArray(json, "format");
3924      for (int i = 0; i < array.size(); i++) {
3925        if (array.get(i).isJsonNull()) {
3926          res.getFormat().add(new CodeType());
3927        } else {;
3928          res.getFormat().add(parseCode(array.get(i).getAsString()));
3929        }
3930      }
3931    };
3932    if (json.has("_format")) {
3933      JsonArray array = getJArray(json, "_format");
3934      for (int i = 0; i < array.size(); i++) {
3935        if (i == res.getFormat().size())
3936          res.getFormat().add(parseCode(null));
3937        if (array.get(i) instanceof JsonObject) 
3938          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3939      }
3940    };
3941    if (json.has("patchFormat")) {
3942      JsonArray array = getJArray(json, "patchFormat");
3943      for (int i = 0; i < array.size(); i++) {
3944        if (array.get(i).isJsonNull()) {
3945          res.getPatchFormat().add(new CodeType());
3946        } else {;
3947          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3948        }
3949      }
3950    };
3951    if (json.has("_patchFormat")) {
3952      JsonArray array = getJArray(json, "_patchFormat");
3953      for (int i = 0; i < array.size(); i++) {
3954        if (i == res.getPatchFormat().size())
3955          res.getPatchFormat().add(parseCode(null));
3956        if (array.get(i) instanceof JsonObject) 
3957          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3958      }
3959    };
3960    if (json.has("implementationGuide")) {
3961      JsonArray array = getJArray(json, "implementationGuide");
3962      for (int i = 0; i < array.size(); i++) {
3963        if (array.get(i).isJsonNull()) {
3964          res.getImplementationGuide().add(new CanonicalType());
3965        } else {;
3966          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3967        }
3968      }
3969    };
3970    if (json.has("_implementationGuide")) {
3971      JsonArray array = getJArray(json, "_implementationGuide");
3972      for (int i = 0; i < array.size(); i++) {
3973        if (i == res.getImplementationGuide().size())
3974          res.getImplementationGuide().add(parseCanonical(null));
3975        if (array.get(i) instanceof JsonObject) 
3976          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3977      }
3978    };
3979    if (json.has("rest")) {
3980      JsonArray array = getJArray(json, "rest");
3981      for (int i = 0; i < array.size(); i++) {
3982        res.getRest().add(parseCapabilityStatementRestComponent(array.get(i).getAsJsonObject()));
3983      }
3984    };
3985    if (json.has("messaging")) {
3986      JsonArray array = getJArray(json, "messaging");
3987      for (int i = 0; i < array.size(); i++) {
3988        res.getMessaging().add(parseCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject()));
3989      }
3990    };
3991    if (json.has("document")) {
3992      JsonArray array = getJArray(json, "document");
3993      for (int i = 0; i < array.size(); i++) {
3994        res.getDocument().add(parseCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject()));
3995      }
3996    };
3997  }
3998
3999  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4000    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4001    parseCapabilityStatementSoftwareComponentProperties(json, res);
4002    return res;
4003  }
4004
4005  protected void parseCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
4006    parseBackboneElementProperties(json, res);
4007    if (json.has("name"))
4008      res.setNameElement(parseString(json.get("name").getAsString()));
4009    if (json.has("_name"))
4010      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4011    if (json.has("version"))
4012      res.setVersionElement(parseString(json.get("version").getAsString()));
4013    if (json.has("_version"))
4014      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4015    if (json.has("releaseDate"))
4016      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4017    if (json.has("_releaseDate"))
4018      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
4019  }
4020
4021  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4022    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4023    parseCapabilityStatementImplementationComponentProperties(json, res);
4024    return res;
4025  }
4026
4027  protected void parseCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
4028    parseBackboneElementProperties(json, res);
4029    if (json.has("description"))
4030      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4031    if (json.has("_description"))
4032      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4033    if (json.has("url"))
4034      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4035    if (json.has("_url"))
4036      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4037    if (json.has("custodian"))
4038      res.setCustodian(parseReference(getJObject(json, "custodian")));
4039  }
4040
4041  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(JsonObject json) throws IOException, FHIRFormatError {
4042    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4043    parseCapabilityStatementRestComponentProperties(json, res);
4044    return res;
4045  }
4046
4047  protected void parseCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
4048    parseBackboneElementProperties(json, res);
4049    if (json.has("mode"))
4050      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.RestfulCapabilityMode.NULL, new Enumerations.RestfulCapabilityModeEnumFactory()));
4051    if (json.has("_mode"))
4052      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4053    if (json.has("documentation"))
4054      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4055    if (json.has("_documentation"))
4056      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4057    if (json.has("security"))
4058      res.setSecurity(parseCapabilityStatementRestSecurityComponent(getJObject(json, "security")));
4059    if (json.has("resource")) {
4060      JsonArray array = getJArray(json, "resource");
4061      for (int i = 0; i < array.size(); i++) {
4062        res.getResource().add(parseCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject()));
4063      }
4064    };
4065    if (json.has("interaction")) {
4066      JsonArray array = getJArray(json, "interaction");
4067      for (int i = 0; i < array.size(); i++) {
4068        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject()));
4069      }
4070    };
4071    if (json.has("searchParam")) {
4072      JsonArray array = getJArray(json, "searchParam");
4073      for (int i = 0; i < array.size(); i++) {
4074        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4075      }
4076    };
4077    if (json.has("operation")) {
4078      JsonArray array = getJArray(json, "operation");
4079      for (int i = 0; i < array.size(); i++) {
4080        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4081      }
4082    };
4083    if (json.has("compartment")) {
4084      JsonArray array = getJArray(json, "compartment");
4085      for (int i = 0; i < array.size(); i++) {
4086        if (array.get(i).isJsonNull()) {
4087          res.getCompartment().add(new CanonicalType());
4088        } else {;
4089          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4090        }
4091      }
4092    };
4093    if (json.has("_compartment")) {
4094      JsonArray array = getJArray(json, "_compartment");
4095      for (int i = 0; i < array.size(); i++) {
4096        if (i == res.getCompartment().size())
4097          res.getCompartment().add(parseCanonical(null));
4098        if (array.get(i) instanceof JsonObject) 
4099          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4100      }
4101    };
4102  }
4103
4104  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(JsonObject json) throws IOException, FHIRFormatError {
4105    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4106    parseCapabilityStatementRestSecurityComponentProperties(json, res);
4107    return res;
4108  }
4109
4110  protected void parseCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
4111    parseBackboneElementProperties(json, res);
4112    if (json.has("cors"))
4113      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4114    if (json.has("_cors"))
4115      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
4116    if (json.has("service")) {
4117      JsonArray array = getJArray(json, "service");
4118      for (int i = 0; i < array.size(); i++) {
4119        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4120      }
4121    };
4122    if (json.has("description"))
4123      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4124    if (json.has("_description"))
4125      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4126  }
4127
4128  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4129    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4130    parseCapabilityStatementRestResourceComponentProperties(json, res);
4131    return res;
4132  }
4133
4134  protected void parseCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
4135    parseBackboneElementProperties(json, res);
4136    if (json.has("type"))
4137      res.setTypeElement(parseCode(json.get("type").getAsString()));
4138    if (json.has("_type"))
4139      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4140    if (json.has("profile"))
4141      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4142    if (json.has("_profile"))
4143      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4144    if (json.has("supportedProfile")) {
4145      JsonArray array = getJArray(json, "supportedProfile");
4146      for (int i = 0; i < array.size(); i++) {
4147        if (array.get(i).isJsonNull()) {
4148          res.getSupportedProfile().add(new CanonicalType());
4149        } else {;
4150          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4151        }
4152      }
4153    };
4154    if (json.has("_supportedProfile")) {
4155      JsonArray array = getJArray(json, "_supportedProfile");
4156      for (int i = 0; i < array.size(); i++) {
4157        if (i == res.getSupportedProfile().size())
4158          res.getSupportedProfile().add(parseCanonical(null));
4159        if (array.get(i) instanceof JsonObject) 
4160          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4161      }
4162    };
4163    if (json.has("documentation"))
4164      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4165    if (json.has("_documentation"))
4166      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4167    if (json.has("interaction")) {
4168      JsonArray array = getJArray(json, "interaction");
4169      for (int i = 0; i < array.size(); i++) {
4170        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject()));
4171      }
4172    };
4173    if (json.has("versioning"))
4174      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4175    if (json.has("_versioning"))
4176      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
4177    if (json.has("readHistory"))
4178      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4179    if (json.has("_readHistory"))
4180      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
4181    if (json.has("updateCreate"))
4182      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4183    if (json.has("_updateCreate"))
4184      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
4185    if (json.has("conditionalCreate"))
4186      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4187    if (json.has("_conditionalCreate"))
4188      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
4189    if (json.has("conditionalRead"))
4190      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4191    if (json.has("_conditionalRead"))
4192      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
4193    if (json.has("conditionalUpdate"))
4194      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4195    if (json.has("_conditionalUpdate"))
4196      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
4197    if (json.has("conditionalDelete"))
4198      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4199    if (json.has("_conditionalDelete"))
4200      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
4201    if (json.has("referencePolicy")) {
4202      JsonArray array = getJArray(json, "referencePolicy");
4203      for (int i = 0; i < array.size(); i++) {
4204        if (array.get(i).isJsonNull()) {
4205          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), CapabilityStatement.ReferenceHandlingPolicy.NULL));
4206        } else {;
4207          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4208        }
4209      }
4210    };
4211    if (json.has("_referencePolicy")) {
4212      JsonArray array = getJArray(json, "_referencePolicy");
4213      for (int i = 0; i < array.size(); i++) {
4214        if (i == res.getReferencePolicy().size())
4215          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4216        if (array.get(i) instanceof JsonObject) 
4217          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
4218      }
4219    };
4220    if (json.has("searchInclude")) {
4221      JsonArray array = getJArray(json, "searchInclude");
4222      for (int i = 0; i < array.size(); i++) {
4223        if (array.get(i).isJsonNull()) {
4224          res.getSearchInclude().add(new StringType());
4225        } else {;
4226          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4227        }
4228      }
4229    };
4230    if (json.has("_searchInclude")) {
4231      JsonArray array = getJArray(json, "_searchInclude");
4232      for (int i = 0; i < array.size(); i++) {
4233        if (i == res.getSearchInclude().size())
4234          res.getSearchInclude().add(parseString(null));
4235        if (array.get(i) instanceof JsonObject) 
4236          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4237      }
4238    };
4239    if (json.has("searchRevInclude")) {
4240      JsonArray array = getJArray(json, "searchRevInclude");
4241      for (int i = 0; i < array.size(); i++) {
4242        if (array.get(i).isJsonNull()) {
4243          res.getSearchRevInclude().add(new StringType());
4244        } else {;
4245          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4246        }
4247      }
4248    };
4249    if (json.has("_searchRevInclude")) {
4250      JsonArray array = getJArray(json, "_searchRevInclude");
4251      for (int i = 0; i < array.size(); i++) {
4252        if (i == res.getSearchRevInclude().size())
4253          res.getSearchRevInclude().add(parseString(null));
4254        if (array.get(i) instanceof JsonObject) 
4255          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4256      }
4257    };
4258    if (json.has("searchParam")) {
4259      JsonArray array = getJArray(json, "searchParam");
4260      for (int i = 0; i < array.size(); i++) {
4261        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4262      }
4263    };
4264    if (json.has("operation")) {
4265      JsonArray array = getJArray(json, "operation");
4266      for (int i = 0; i < array.size(); i++) {
4267        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4268      }
4269    };
4270  }
4271
4272  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4273    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4274    parseCapabilityStatementResourceInteractionComponentProperties(json, res);
4275    return res;
4276  }
4277
4278  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4279    parseBackboneElementProperties(json, res);
4280    if (json.has("code"))
4281      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4282    if (json.has("_code"))
4283      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4284    if (json.has("documentation"))
4285      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4286    if (json.has("_documentation"))
4287      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4288  }
4289
4290  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4291    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4292    parseCapabilityStatementRestResourceSearchParamComponentProperties(json, res);
4293    return res;
4294  }
4295
4296  protected void parseCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4297    parseBackboneElementProperties(json, res);
4298    if (json.has("name"))
4299      res.setNameElement(parseString(json.get("name").getAsString()));
4300    if (json.has("_name"))
4301      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4302    if (json.has("definition"))
4303      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4304    if (json.has("_definition"))
4305      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4306    if (json.has("type"))
4307      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4308    if (json.has("_type"))
4309      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4310    if (json.has("documentation"))
4311      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4312    if (json.has("_documentation"))
4313      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4314  }
4315
4316  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4317    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4318    parseCapabilityStatementRestResourceOperationComponentProperties(json, res);
4319    return res;
4320  }
4321
4322  protected void parseCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
4323    parseBackboneElementProperties(json, res);
4324    if (json.has("name"))
4325      res.setNameElement(parseString(json.get("name").getAsString()));
4326    if (json.has("_name"))
4327      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4328    if (json.has("definition"))
4329      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4330    if (json.has("_definition"))
4331      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4332    if (json.has("documentation"))
4333      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4334    if (json.has("_documentation"))
4335      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4336  }
4337
4338  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4339    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4340    parseCapabilityStatementSystemInteractionComponentProperties(json, res);
4341    return res;
4342  }
4343
4344  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4345    parseBackboneElementProperties(json, res);
4346    if (json.has("code"))
4347      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4348    if (json.has("_code"))
4349      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4350    if (json.has("documentation"))
4351      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4352    if (json.has("_documentation"))
4353      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4354  }
4355
4356  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(JsonObject json) throws IOException, FHIRFormatError {
4357    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4358    parseCapabilityStatementMessagingComponentProperties(json, res);
4359    return res;
4360  }
4361
4362  protected void parseCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
4363    parseBackboneElementProperties(json, res);
4364    if (json.has("endpoint")) {
4365      JsonArray array = getJArray(json, "endpoint");
4366      for (int i = 0; i < array.size(); i++) {
4367        res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject()));
4368      }
4369    };
4370    if (json.has("reliableCache"))
4371      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4372    if (json.has("_reliableCache"))
4373      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
4374    if (json.has("documentation"))
4375      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4376    if (json.has("_documentation"))
4377      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4378    if (json.has("supportedMessage")) {
4379      JsonArray array = getJArray(json, "supportedMessage");
4380      for (int i = 0; i < array.size(); i++) {
4381        res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject()));
4382      }
4383    };
4384  }
4385
4386  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(JsonObject json) throws IOException, FHIRFormatError {
4387    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4388    parseCapabilityStatementMessagingEndpointComponentProperties(json, res);
4389    return res;
4390  }
4391
4392  protected void parseCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
4393    parseBackboneElementProperties(json, res);
4394    if (json.has("protocol"))
4395      res.setProtocol(parseCoding(getJObject(json, "protocol")));
4396    if (json.has("address"))
4397      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4398    if (json.has("_address"))
4399      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
4400  }
4401
4402  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(JsonObject json) throws IOException, FHIRFormatError {
4403    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4404    parseCapabilityStatementMessagingSupportedMessageComponentProperties(json, res);
4405    return res;
4406  }
4407
4408  protected void parseCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
4409    parseBackboneElementProperties(json, res);
4410    if (json.has("mode"))
4411      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4412    if (json.has("_mode"))
4413      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4414    if (json.has("definition"))
4415      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4416    if (json.has("_definition"))
4417      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4418  }
4419
4420  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(JsonObject json) throws IOException, FHIRFormatError {
4421    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4422    parseCapabilityStatementDocumentComponentProperties(json, res);
4423    return res;
4424  }
4425
4426  protected void parseCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
4427    parseBackboneElementProperties(json, res);
4428    if (json.has("mode"))
4429      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4430    if (json.has("_mode"))
4431      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4432    if (json.has("documentation"))
4433      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4434    if (json.has("_documentation"))
4435      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4436    if (json.has("profile"))
4437      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4438    if (json.has("_profile"))
4439      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4440  }
4441
4442  protected CapabilityStatement2 parseCapabilityStatement2(JsonObject json) throws IOException, FHIRFormatError {
4443    CapabilityStatement2 res = new CapabilityStatement2();
4444    parseCapabilityStatement2Properties(json, res);
4445    return res;
4446  }
4447
4448  protected void parseCapabilityStatement2Properties(JsonObject json, CapabilityStatement2 res) throws IOException, FHIRFormatError {
4449    parseCanonicalResourceProperties(json, res);
4450    if (json.has("url"))
4451      res.setUrlElement(parseUri(json.get("url").getAsString()));
4452    if (json.has("_url"))
4453      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4454    if (json.has("version"))
4455      res.setVersionElement(parseString(json.get("version").getAsString()));
4456    if (json.has("_version"))
4457      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4458    if (json.has("name"))
4459      res.setNameElement(parseString(json.get("name").getAsString()));
4460    if (json.has("_name"))
4461      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4462    if (json.has("title"))
4463      res.setTitleElement(parseString(json.get("title").getAsString()));
4464    if (json.has("_title"))
4465      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4466    if (json.has("status"))
4467      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4468    if (json.has("_status"))
4469      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4470    if (json.has("experimental"))
4471      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4472    if (json.has("_experimental"))
4473      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4474    if (json.has("date"))
4475      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4476    if (json.has("_date"))
4477      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4478    if (json.has("publisher"))
4479      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4480    if (json.has("_publisher"))
4481      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4482    if (json.has("contact")) {
4483      JsonArray array = getJArray(json, "contact");
4484      for (int i = 0; i < array.size(); i++) {
4485        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4486      }
4487    };
4488    if (json.has("description"))
4489      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4490    if (json.has("_description"))
4491      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4492    if (json.has("useContext")) {
4493      JsonArray array = getJArray(json, "useContext");
4494      for (int i = 0; i < array.size(); i++) {
4495        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4496      }
4497    };
4498    if (json.has("jurisdiction")) {
4499      JsonArray array = getJArray(json, "jurisdiction");
4500      for (int i = 0; i < array.size(); i++) {
4501        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4502      }
4503    };
4504    if (json.has("purpose"))
4505      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
4506    if (json.has("_purpose"))
4507      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
4508    if (json.has("copyright"))
4509      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4510    if (json.has("_copyright"))
4511      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4512    if (json.has("kind"))
4513      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
4514    if (json.has("_kind"))
4515      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4516    if (json.has("instantiates")) {
4517      JsonArray array = getJArray(json, "instantiates");
4518      for (int i = 0; i < array.size(); i++) {
4519        if (array.get(i).isJsonNull()) {
4520          res.getInstantiates().add(new CanonicalType());
4521        } else {;
4522          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
4523        }
4524      }
4525    };
4526    if (json.has("_instantiates")) {
4527      JsonArray array = getJArray(json, "_instantiates");
4528      for (int i = 0; i < array.size(); i++) {
4529        if (i == res.getInstantiates().size())
4530          res.getInstantiates().add(parseCanonical(null));
4531        if (array.get(i) instanceof JsonObject) 
4532          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
4533      }
4534    };
4535    if (json.has("imports")) {
4536      JsonArray array = getJArray(json, "imports");
4537      for (int i = 0; i < array.size(); i++) {
4538        if (array.get(i).isJsonNull()) {
4539          res.getImports().add(new CanonicalType());
4540        } else {;
4541          res.getImports().add(parseCanonical(array.get(i).getAsString()));
4542        }
4543      }
4544    };
4545    if (json.has("_imports")) {
4546      JsonArray array = getJArray(json, "_imports");
4547      for (int i = 0; i < array.size(); i++) {
4548        if (i == res.getImports().size())
4549          res.getImports().add(parseCanonical(null));
4550        if (array.get(i) instanceof JsonObject) 
4551          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
4552      }
4553    };
4554    if (json.has("software"))
4555      res.setSoftware(parseCapabilityStatement2SoftwareComponent(getJObject(json, "software")));
4556    if (json.has("implementation"))
4557      res.setImplementation(parseCapabilityStatement2ImplementationComponent(getJObject(json, "implementation")));
4558    if (json.has("fhirVersion"))
4559      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4560    if (json.has("_fhirVersion"))
4561      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
4562    if (json.has("format")) {
4563      JsonArray array = getJArray(json, "format");
4564      for (int i = 0; i < array.size(); i++) {
4565        if (array.get(i).isJsonNull()) {
4566          res.getFormat().add(new CodeType());
4567        } else {;
4568          res.getFormat().add(parseCode(array.get(i).getAsString()));
4569        }
4570      }
4571    };
4572    if (json.has("_format")) {
4573      JsonArray array = getJArray(json, "_format");
4574      for (int i = 0; i < array.size(); i++) {
4575        if (i == res.getFormat().size())
4576          res.getFormat().add(parseCode(null));
4577        if (array.get(i) instanceof JsonObject) 
4578          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4579      }
4580    };
4581    if (json.has("patchFormat")) {
4582      JsonArray array = getJArray(json, "patchFormat");
4583      for (int i = 0; i < array.size(); i++) {
4584        if (array.get(i).isJsonNull()) {
4585          res.getPatchFormat().add(new CodeType());
4586        } else {;
4587          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4588        }
4589      }
4590    };
4591    if (json.has("_patchFormat")) {
4592      JsonArray array = getJArray(json, "_patchFormat");
4593      for (int i = 0; i < array.size(); i++) {
4594        if (i == res.getPatchFormat().size())
4595          res.getPatchFormat().add(parseCode(null));
4596        if (array.get(i) instanceof JsonObject) 
4597          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4598      }
4599    };
4600    if (json.has("implementationGuide")) {
4601      JsonArray array = getJArray(json, "implementationGuide");
4602      for (int i = 0; i < array.size(); i++) {
4603        if (array.get(i).isJsonNull()) {
4604          res.getImplementationGuide().add(new CanonicalType());
4605        } else {;
4606          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4607        }
4608      }
4609    };
4610    if (json.has("_implementationGuide")) {
4611      JsonArray array = getJArray(json, "_implementationGuide");
4612      for (int i = 0; i < array.size(); i++) {
4613        if (i == res.getImplementationGuide().size())
4614          res.getImplementationGuide().add(parseCanonical(null));
4615        if (array.get(i) instanceof JsonObject) 
4616          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4617      }
4618    };
4619    if (json.has("rest")) {
4620      JsonArray array = getJArray(json, "rest");
4621      for (int i = 0; i < array.size(); i++) {
4622        res.getRest().add(parseCapabilityStatement2RestComponent(array.get(i).getAsJsonObject()));
4623      }
4624    };
4625  }
4626
4627  protected CapabilityStatement2.CapabilityStatement2SoftwareComponent parseCapabilityStatement2SoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4628    CapabilityStatement2.CapabilityStatement2SoftwareComponent res = new CapabilityStatement2.CapabilityStatement2SoftwareComponent();
4629    parseCapabilityStatement2SoftwareComponentProperties(json, res);
4630    return res;
4631  }
4632
4633  protected void parseCapabilityStatement2SoftwareComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2SoftwareComponent res) throws IOException, FHIRFormatError {
4634    parseBackboneElementProperties(json, res);
4635    if (json.has("name"))
4636      res.setNameElement(parseString(json.get("name").getAsString()));
4637    if (json.has("_name"))
4638      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4639    if (json.has("version"))
4640      res.setVersionElement(parseString(json.get("version").getAsString()));
4641    if (json.has("_version"))
4642      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4643    if (json.has("releaseDate"))
4644      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4645    if (json.has("_releaseDate"))
4646      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
4647  }
4648
4649  protected CapabilityStatement2.CapabilityStatement2ImplementationComponent parseCapabilityStatement2ImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4650    CapabilityStatement2.CapabilityStatement2ImplementationComponent res = new CapabilityStatement2.CapabilityStatement2ImplementationComponent();
4651    parseCapabilityStatement2ImplementationComponentProperties(json, res);
4652    return res;
4653  }
4654
4655  protected void parseCapabilityStatement2ImplementationComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2ImplementationComponent res) throws IOException, FHIRFormatError {
4656    parseBackboneElementProperties(json, res);
4657    if (json.has("description"))
4658      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4659    if (json.has("_description"))
4660      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4661    if (json.has("url"))
4662      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4663    if (json.has("_url"))
4664      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4665    if (json.has("custodian"))
4666      res.setCustodian(parseReference(getJObject(json, "custodian")));
4667  }
4668
4669  protected CapabilityStatement2.CapabilityStatement2RestComponent parseCapabilityStatement2RestComponent(JsonObject json) throws IOException, FHIRFormatError {
4670    CapabilityStatement2.CapabilityStatement2RestComponent res = new CapabilityStatement2.CapabilityStatement2RestComponent();
4671    parseCapabilityStatement2RestComponentProperties(json, res);
4672    return res;
4673  }
4674
4675  protected void parseCapabilityStatement2RestComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestComponent res) throws IOException, FHIRFormatError {
4676    parseBackboneElementProperties(json, res);
4677    if (json.has("mode"))
4678      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.RestfulCapabilityMode.NULL, new Enumerations.RestfulCapabilityModeEnumFactory()));
4679    if (json.has("_mode"))
4680      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4681    if (json.has("documentation"))
4682      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4683    if (json.has("_documentation"))
4684      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4685    if (json.has("feature")) {
4686      JsonArray array = getJArray(json, "feature");
4687      for (int i = 0; i < array.size(); i++) {
4688        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4689      }
4690    };
4691    if (json.has("resource")) {
4692      JsonArray array = getJArray(json, "resource");
4693      for (int i = 0; i < array.size(); i++) {
4694        res.getResource().add(parseCapabilityStatement2RestResourceComponent(array.get(i).getAsJsonObject()));
4695      }
4696    };
4697    if (json.has("interaction")) {
4698      JsonArray array = getJArray(json, "interaction");
4699      for (int i = 0; i < array.size(); i++) {
4700        res.getInteraction().add(parseCapabilityStatement2SystemInteractionComponent(array.get(i).getAsJsonObject()));
4701      }
4702    };
4703    if (json.has("searchParam")) {
4704      JsonArray array = getJArray(json, "searchParam");
4705      for (int i = 0; i < array.size(); i++) {
4706        res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4707      }
4708    };
4709    if (json.has("operation")) {
4710      JsonArray array = getJArray(json, "operation");
4711      for (int i = 0; i < array.size(); i++) {
4712        res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject()));
4713      }
4714    };
4715    if (json.has("compartment")) {
4716      JsonArray array = getJArray(json, "compartment");
4717      for (int i = 0; i < array.size(); i++) {
4718        if (array.get(i).isJsonNull()) {
4719          res.getCompartment().add(new CanonicalType());
4720        } else {;
4721          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4722        }
4723      }
4724    };
4725    if (json.has("_compartment")) {
4726      JsonArray array = getJArray(json, "_compartment");
4727      for (int i = 0; i < array.size(); i++) {
4728        if (i == res.getCompartment().size())
4729          res.getCompartment().add(parseCanonical(null));
4730        if (array.get(i) instanceof JsonObject) 
4731          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4732      }
4733    };
4734  }
4735
4736  protected CapabilityStatement2.CapabilityStatement2RestFeatureComponent parseCapabilityStatement2RestFeatureComponent(JsonObject json) throws IOException, FHIRFormatError {
4737    CapabilityStatement2.CapabilityStatement2RestFeatureComponent res = new CapabilityStatement2.CapabilityStatement2RestFeatureComponent();
4738    parseCapabilityStatement2RestFeatureComponentProperties(json, res);
4739    return res;
4740  }
4741
4742  protected void parseCapabilityStatement2RestFeatureComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestFeatureComponent res) throws IOException, FHIRFormatError {
4743    parseBackboneElementProperties(json, res);
4744    if (json.has("code"))
4745      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.CapabilityFeature.NULL, new CapabilityStatement2.CapabilityFeatureEnumFactory()));
4746    if (json.has("_code"))
4747      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4748    if (json.has("value"))
4749      res.setValueElement(parseEnumeration(json.get("value").getAsString(), CapabilityStatement2.CapabilityFeatureValue.NULL, new CapabilityStatement2.CapabilityFeatureValueEnumFactory()));
4750    if (json.has("_value"))
4751      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
4752  }
4753
4754  protected CapabilityStatement2.CapabilityStatement2RestResourceComponent parseCapabilityStatement2RestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4755    CapabilityStatement2.CapabilityStatement2RestResourceComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceComponent();
4756    parseCapabilityStatement2RestResourceComponentProperties(json, res);
4757    return res;
4758  }
4759
4760  protected void parseCapabilityStatement2RestResourceComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceComponent res) throws IOException, FHIRFormatError {
4761    parseBackboneElementProperties(json, res);
4762    if (json.has("type"))
4763      res.setTypeElement(parseCode(json.get("type").getAsString()));
4764    if (json.has("_type"))
4765      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4766    if (json.has("profile"))
4767      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4768    if (json.has("_profile"))
4769      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4770    if (json.has("supportedProfile")) {
4771      JsonArray array = getJArray(json, "supportedProfile");
4772      for (int i = 0; i < array.size(); i++) {
4773        if (array.get(i).isJsonNull()) {
4774          res.getSupportedProfile().add(new CanonicalType());
4775        } else {;
4776          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4777        }
4778      }
4779    };
4780    if (json.has("_supportedProfile")) {
4781      JsonArray array = getJArray(json, "_supportedProfile");
4782      for (int i = 0; i < array.size(); i++) {
4783        if (i == res.getSupportedProfile().size())
4784          res.getSupportedProfile().add(parseCanonical(null));
4785        if (array.get(i) instanceof JsonObject) 
4786          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4787      }
4788    };
4789    if (json.has("documentation"))
4790      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4791    if (json.has("_documentation"))
4792      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4793    if (json.has("feature")) {
4794      JsonArray array = getJArray(json, "feature");
4795      for (int i = 0; i < array.size(); i++) {
4796        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4797      }
4798    };
4799    if (json.has("interaction")) {
4800      JsonArray array = getJArray(json, "interaction");
4801      for (int i = 0; i < array.size(); i++) {
4802        res.getInteraction().add(parseCapabilityStatement2ResourceInteractionComponent(array.get(i).getAsJsonObject()));
4803      }
4804    };
4805    if (json.has("searchParam")) {
4806      JsonArray array = getJArray(json, "searchParam");
4807      for (int i = 0; i < array.size(); i++) {
4808        res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4809      }
4810    };
4811    if (json.has("operation")) {
4812      JsonArray array = getJArray(json, "operation");
4813      for (int i = 0; i < array.size(); i++) {
4814        res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject()));
4815      }
4816    };
4817  }
4818
4819  protected CapabilityStatement2.ResourceInteractionComponent parseCapabilityStatement2ResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4820    CapabilityStatement2.ResourceInteractionComponent res = new CapabilityStatement2.ResourceInteractionComponent();
4821    parseCapabilityStatement2ResourceInteractionComponentProperties(json, res);
4822    return res;
4823  }
4824
4825  protected void parseCapabilityStatement2ResourceInteractionComponentProperties(JsonObject json, CapabilityStatement2.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4826    parseBackboneElementProperties(json, res);
4827    if (json.has("code"))
4828      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.TypeRestfulInteraction.NULL, new CapabilityStatement2.TypeRestfulInteractionEnumFactory()));
4829    if (json.has("_code"))
4830      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4831    if (json.has("documentation"))
4832      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4833    if (json.has("_documentation"))
4834      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4835    if (json.has("feature")) {
4836      JsonArray array = getJArray(json, "feature");
4837      for (int i = 0; i < array.size(); i++) {
4838        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4839      }
4840    };
4841  }
4842
4843  protected CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent parseCapabilityStatement2RestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4844    CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent();
4845    parseCapabilityStatement2RestResourceSearchParamComponentProperties(json, res);
4846    return res;
4847  }
4848
4849  protected void parseCapabilityStatement2RestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4850    parseBackboneElementProperties(json, res);
4851    if (json.has("name"))
4852      res.setNameElement(parseString(json.get("name").getAsString()));
4853    if (json.has("_name"))
4854      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4855    if (json.has("definition"))
4856      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4857    if (json.has("_definition"))
4858      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4859    if (json.has("type"))
4860      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4861    if (json.has("_type"))
4862      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4863    if (json.has("documentation"))
4864      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4865    if (json.has("_documentation"))
4866      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4867    if (json.has("feature")) {
4868      JsonArray array = getJArray(json, "feature");
4869      for (int i = 0; i < array.size(); i++) {
4870        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4871      }
4872    };
4873  }
4874
4875  protected CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent parseCapabilityStatement2RestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4876    CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent();
4877    parseCapabilityStatement2RestResourceOperationComponentProperties(json, res);
4878    return res;
4879  }
4880
4881  protected void parseCapabilityStatement2RestResourceOperationComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res) throws IOException, FHIRFormatError {
4882    parseBackboneElementProperties(json, res);
4883    if (json.has("name"))
4884      res.setNameElement(parseString(json.get("name").getAsString()));
4885    if (json.has("_name"))
4886      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4887    if (json.has("definition"))
4888      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4889    if (json.has("_definition"))
4890      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4891    if (json.has("documentation"))
4892      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4893    if (json.has("_documentation"))
4894      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4895    if (json.has("feature")) {
4896      JsonArray array = getJArray(json, "feature");
4897      for (int i = 0; i < array.size(); i++) {
4898        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4899      }
4900    };
4901  }
4902
4903  protected CapabilityStatement2.SystemInteractionComponent parseCapabilityStatement2SystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4904    CapabilityStatement2.SystemInteractionComponent res = new CapabilityStatement2.SystemInteractionComponent();
4905    parseCapabilityStatement2SystemInteractionComponentProperties(json, res);
4906    return res;
4907  }
4908
4909  protected void parseCapabilityStatement2SystemInteractionComponentProperties(JsonObject json, CapabilityStatement2.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4910    parseBackboneElementProperties(json, res);
4911    if (json.has("code"))
4912      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.SystemRestfulInteraction.NULL, new CapabilityStatement2.SystemRestfulInteractionEnumFactory()));
4913    if (json.has("_code"))
4914      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4915    if (json.has("documentation"))
4916      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4917    if (json.has("_documentation"))
4918      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4919    if (json.has("feature")) {
4920      JsonArray array = getJArray(json, "feature");
4921      for (int i = 0; i < array.size(); i++) {
4922        res.getFeature().add(parseCapabilityStatement2RestFeatureComponent(array.get(i).getAsJsonObject()));
4923      }
4924    };
4925  }
4926
4927  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4928    CarePlan res = new CarePlan();
4929    parseCarePlanProperties(json, res);
4930    return res;
4931  }
4932
4933  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4934    parseDomainResourceProperties(json, res);
4935    if (json.has("identifier")) {
4936      JsonArray array = getJArray(json, "identifier");
4937      for (int i = 0; i < array.size(); i++) {
4938        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4939      }
4940    };
4941    if (json.has("instantiatesCanonical")) {
4942      JsonArray array = getJArray(json, "instantiatesCanonical");
4943      for (int i = 0; i < array.size(); i++) {
4944        if (array.get(i).isJsonNull()) {
4945          res.getInstantiatesCanonical().add(new CanonicalType());
4946        } else {;
4947          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4948        }
4949      }
4950    };
4951    if (json.has("_instantiatesCanonical")) {
4952      JsonArray array = getJArray(json, "_instantiatesCanonical");
4953      for (int i = 0; i < array.size(); i++) {
4954        if (i == res.getInstantiatesCanonical().size())
4955          res.getInstantiatesCanonical().add(parseCanonical(null));
4956        if (array.get(i) instanceof JsonObject) 
4957          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4958      }
4959    };
4960    if (json.has("instantiatesUri")) {
4961      JsonArray array = getJArray(json, "instantiatesUri");
4962      for (int i = 0; i < array.size(); i++) {
4963        if (array.get(i).isJsonNull()) {
4964          res.getInstantiatesUri().add(new UriType());
4965        } else {;
4966          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4967        }
4968      }
4969    };
4970    if (json.has("_instantiatesUri")) {
4971      JsonArray array = getJArray(json, "_instantiatesUri");
4972      for (int i = 0; i < array.size(); i++) {
4973        if (i == res.getInstantiatesUri().size())
4974          res.getInstantiatesUri().add(parseUri(null));
4975        if (array.get(i) instanceof JsonObject) 
4976          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4977      }
4978    };
4979    if (json.has("basedOn")) {
4980      JsonArray array = getJArray(json, "basedOn");
4981      for (int i = 0; i < array.size(); i++) {
4982        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4983      }
4984    };
4985    if (json.has("replaces")) {
4986      JsonArray array = getJArray(json, "replaces");
4987      for (int i = 0; i < array.size(); i++) {
4988        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4989      }
4990    };
4991    if (json.has("partOf")) {
4992      JsonArray array = getJArray(json, "partOf");
4993      for (int i = 0; i < array.size(); i++) {
4994        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4995      }
4996    };
4997    if (json.has("status"))
4998      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
4999    if (json.has("_status"))
5000      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5001    if (json.has("intent"))
5002      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
5003    if (json.has("_intent"))
5004      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
5005    if (json.has("category")) {
5006      JsonArray array = getJArray(json, "category");
5007      for (int i = 0; i < array.size(); i++) {
5008        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5009      }
5010    };
5011    if (json.has("title"))
5012      res.setTitleElement(parseString(json.get("title").getAsString()));
5013    if (json.has("_title"))
5014      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5015    if (json.has("description"))
5016      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5017    if (json.has("_description"))
5018      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5019    if (json.has("subject"))
5020      res.setSubject(parseReference(getJObject(json, "subject")));
5021    if (json.has("encounter"))
5022      res.setEncounter(parseReference(getJObject(json, "encounter")));
5023    if (json.has("period"))
5024      res.setPeriod(parsePeriod(getJObject(json, "period")));
5025    if (json.has("created"))
5026      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5027    if (json.has("_created"))
5028      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5029    if (json.has("author"))
5030      res.setAuthor(parseReference(getJObject(json, "author")));
5031    if (json.has("contributor")) {
5032      JsonArray array = getJArray(json, "contributor");
5033      for (int i = 0; i < array.size(); i++) {
5034        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
5035      }
5036    };
5037    if (json.has("careTeam")) {
5038      JsonArray array = getJArray(json, "careTeam");
5039      for (int i = 0; i < array.size(); i++) {
5040        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
5041      }
5042    };
5043    if (json.has("addresses")) {
5044      JsonArray array = getJArray(json, "addresses");
5045      for (int i = 0; i < array.size(); i++) {
5046        res.getAddresses().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5047      }
5048    };
5049    if (json.has("supportingInfo")) {
5050      JsonArray array = getJArray(json, "supportingInfo");
5051      for (int i = 0; i < array.size(); i++) {
5052        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
5053      }
5054    };
5055    if (json.has("goal")) {
5056      JsonArray array = getJArray(json, "goal");
5057      for (int i = 0; i < array.size(); i++) {
5058        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5059      }
5060    };
5061    if (json.has("activity")) {
5062      JsonArray array = getJArray(json, "activity");
5063      for (int i = 0; i < array.size(); i++) {
5064        res.getActivity().add(parseCarePlanActivityComponent(array.get(i).getAsJsonObject()));
5065      }
5066    };
5067    if (json.has("note")) {
5068      JsonArray array = getJArray(json, "note");
5069      for (int i = 0; i < array.size(); i++) {
5070        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5071      }
5072    };
5073  }
5074
5075  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
5076    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
5077    parseCarePlanActivityComponentProperties(json, res);
5078    return res;
5079  }
5080
5081  protected void parseCarePlanActivityComponentProperties(JsonObject json, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
5082    parseBackboneElementProperties(json, res);
5083    if (json.has("performedActivity")) {
5084      JsonArray array = getJArray(json, "performedActivity");
5085      for (int i = 0; i < array.size(); i++) {
5086        res.getPerformedActivity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5087      }
5088    };
5089    if (json.has("progress")) {
5090      JsonArray array = getJArray(json, "progress");
5091      for (int i = 0; i < array.size(); i++) {
5092        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
5093      }
5094    };
5095    if (json.has("plannedActivityReference"))
5096      res.setPlannedActivityReference(parseReference(getJObject(json, "plannedActivityReference")));
5097    if (json.has("plannedActivityDetail"))
5098      res.setPlannedActivityDetail(parseCarePlanActivityPlannedActivityDetailComponent(getJObject(json, "plannedActivityDetail")));
5099  }
5100
5101  protected CarePlan.CarePlanActivityPlannedActivityDetailComponent parseCarePlanActivityPlannedActivityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
5102    CarePlan.CarePlanActivityPlannedActivityDetailComponent res = new CarePlan.CarePlanActivityPlannedActivityDetailComponent();
5103    parseCarePlanActivityPlannedActivityDetailComponentProperties(json, res);
5104    return res;
5105  }
5106
5107  protected void parseCarePlanActivityPlannedActivityDetailComponentProperties(JsonObject json, CarePlan.CarePlanActivityPlannedActivityDetailComponent res) throws IOException, FHIRFormatError {
5108    parseBackboneElementProperties(json, res);
5109    if (json.has("kind"))
5110      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
5111    if (json.has("_kind"))
5112      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
5113    if (json.has("instantiatesCanonical")) {
5114      JsonArray array = getJArray(json, "instantiatesCanonical");
5115      for (int i = 0; i < array.size(); i++) {
5116        if (array.get(i).isJsonNull()) {
5117          res.getInstantiatesCanonical().add(new CanonicalType());
5118        } else {;
5119          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
5120        }
5121      }
5122    };
5123    if (json.has("_instantiatesCanonical")) {
5124      JsonArray array = getJArray(json, "_instantiatesCanonical");
5125      for (int i = 0; i < array.size(); i++) {
5126        if (i == res.getInstantiatesCanonical().size())
5127          res.getInstantiatesCanonical().add(parseCanonical(null));
5128        if (array.get(i) instanceof JsonObject) 
5129          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
5130      }
5131    };
5132    if (json.has("instantiatesUri")) {
5133      JsonArray array = getJArray(json, "instantiatesUri");
5134      for (int i = 0; i < array.size(); i++) {
5135        if (array.get(i).isJsonNull()) {
5136          res.getInstantiatesUri().add(new UriType());
5137        } else {;
5138          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
5139        }
5140      }
5141    };
5142    if (json.has("_instantiatesUri")) {
5143      JsonArray array = getJArray(json, "_instantiatesUri");
5144      for (int i = 0; i < array.size(); i++) {
5145        if (i == res.getInstantiatesUri().size())
5146          res.getInstantiatesUri().add(parseUri(null));
5147        if (array.get(i) instanceof JsonObject) 
5148          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5149      }
5150    };
5151    if (json.has("code"))
5152      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5153    if (json.has("reason")) {
5154      JsonArray array = getJArray(json, "reason");
5155      for (int i = 0; i < array.size(); i++) {
5156        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5157      }
5158    };
5159    if (json.has("goal")) {
5160      JsonArray array = getJArray(json, "goal");
5161      for (int i = 0; i < array.size(); i++) {
5162        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5163      }
5164    };
5165    if (json.has("status"))
5166      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
5167    if (json.has("_status"))
5168      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5169    if (json.has("statusReason"))
5170      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
5171    if (json.has("doNotPerform"))
5172      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
5173    if (json.has("_doNotPerform"))
5174      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
5175    DataType scheduled = parseType("scheduled", json);
5176    if (scheduled != null)
5177      res.setScheduled(scheduled);
5178    if (json.has("location"))
5179      res.setLocation(parseCodeableReference(getJObject(json, "location")));
5180    DataType reported = parseType("reported", json);
5181    if (reported != null)
5182      res.setReported(reported);
5183    if (json.has("performer")) {
5184      JsonArray array = getJArray(json, "performer");
5185      for (int i = 0; i < array.size(); i++) {
5186        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
5187      }
5188    };
5189    DataType product = parseType("product", json);
5190    if (product != null)
5191      res.setProduct(product);
5192    if (json.has("dailyAmount"))
5193      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
5194    if (json.has("quantity"))
5195      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5196    if (json.has("description"))
5197      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5198    if (json.has("_description"))
5199      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5200  }
5201
5202  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
5203    CareTeam res = new CareTeam();
5204    parseCareTeamProperties(json, res);
5205    return res;
5206  }
5207
5208  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
5209    parseDomainResourceProperties(json, res);
5210    if (json.has("identifier")) {
5211      JsonArray array = getJArray(json, "identifier");
5212      for (int i = 0; i < array.size(); i++) {
5213        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5214      }
5215    };
5216    if (json.has("status"))
5217      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
5218    if (json.has("_status"))
5219      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5220    if (json.has("category")) {
5221      JsonArray array = getJArray(json, "category");
5222      for (int i = 0; i < array.size(); i++) {
5223        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5224      }
5225    };
5226    if (json.has("name"))
5227      res.setNameElement(parseString(json.get("name").getAsString()));
5228    if (json.has("_name"))
5229      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5230    if (json.has("subject"))
5231      res.setSubject(parseReference(getJObject(json, "subject")));
5232    if (json.has("period"))
5233      res.setPeriod(parsePeriod(getJObject(json, "period")));
5234    if (json.has("participant")) {
5235      JsonArray array = getJArray(json, "participant");
5236      for (int i = 0; i < array.size(); i++) {
5237        res.getParticipant().add(parseCareTeamParticipantComponent(array.get(i).getAsJsonObject()));
5238      }
5239    };
5240    if (json.has("reason")) {
5241      JsonArray array = getJArray(json, "reason");
5242      for (int i = 0; i < array.size(); i++) {
5243        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5244      }
5245    };
5246    if (json.has("managingOrganization")) {
5247      JsonArray array = getJArray(json, "managingOrganization");
5248      for (int i = 0; i < array.size(); i++) {
5249        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
5250      }
5251    };
5252    if (json.has("telecom")) {
5253      JsonArray array = getJArray(json, "telecom");
5254      for (int i = 0; i < array.size(); i++) {
5255        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5256      }
5257    };
5258    if (json.has("note")) {
5259      JsonArray array = getJArray(json, "note");
5260      for (int i = 0; i < array.size(); i++) {
5261        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5262      }
5263    };
5264  }
5265
5266  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
5267    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
5268    parseCareTeamParticipantComponentProperties(json, res);
5269    return res;
5270  }
5271
5272  protected void parseCareTeamParticipantComponentProperties(JsonObject json, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
5273    parseBackboneElementProperties(json, res);
5274    if (json.has("role"))
5275      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5276    if (json.has("member"))
5277      res.setMember(parseReference(getJObject(json, "member")));
5278    if (json.has("onBehalfOf"))
5279      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
5280    DataType coverage = parseType("coverage", json);
5281    if (coverage != null)
5282      res.setCoverage(coverage);
5283  }
5284
5285  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5286    ChargeItem res = new ChargeItem();
5287    parseChargeItemProperties(json, res);
5288    return res;
5289  }
5290
5291  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5292    parseDomainResourceProperties(json, res);
5293    if (json.has("identifier")) {
5294      JsonArray array = getJArray(json, "identifier");
5295      for (int i = 0; i < array.size(); i++) {
5296        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5297      }
5298    };
5299    if (json.has("definitionUri")) {
5300      JsonArray array = getJArray(json, "definitionUri");
5301      for (int i = 0; i < array.size(); i++) {
5302        if (array.get(i).isJsonNull()) {
5303          res.getDefinitionUri().add(new UriType());
5304        } else {;
5305          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5306        }
5307      }
5308    };
5309    if (json.has("_definitionUri")) {
5310      JsonArray array = getJArray(json, "_definitionUri");
5311      for (int i = 0; i < array.size(); i++) {
5312        if (i == res.getDefinitionUri().size())
5313          res.getDefinitionUri().add(parseUri(null));
5314        if (array.get(i) instanceof JsonObject) 
5315          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5316      }
5317    };
5318    if (json.has("definitionCanonical")) {
5319      JsonArray array = getJArray(json, "definitionCanonical");
5320      for (int i = 0; i < array.size(); i++) {
5321        if (array.get(i).isJsonNull()) {
5322          res.getDefinitionCanonical().add(new CanonicalType());
5323        } else {;
5324          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5325        }
5326      }
5327    };
5328    if (json.has("_definitionCanonical")) {
5329      JsonArray array = getJArray(json, "_definitionCanonical");
5330      for (int i = 0; i < array.size(); i++) {
5331        if (i == res.getDefinitionCanonical().size())
5332          res.getDefinitionCanonical().add(parseCanonical(null));
5333        if (array.get(i) instanceof JsonObject) 
5334          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5335      }
5336    };
5337    if (json.has("status"))
5338      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5339    if (json.has("_status"))
5340      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5341    if (json.has("partOf")) {
5342      JsonArray array = getJArray(json, "partOf");
5343      for (int i = 0; i < array.size(); i++) {
5344        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5345      }
5346    };
5347    if (json.has("code"))
5348      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5349    if (json.has("subject"))
5350      res.setSubject(parseReference(getJObject(json, "subject")));
5351    if (json.has("context"))
5352      res.setContext(parseReference(getJObject(json, "context")));
5353    DataType occurrence = parseType("occurrence", json);
5354    if (occurrence != null)
5355      res.setOccurrence(occurrence);
5356    if (json.has("performer")) {
5357      JsonArray array = getJArray(json, "performer");
5358      for (int i = 0; i < array.size(); i++) {
5359        res.getPerformer().add(parseChargeItemPerformerComponent(array.get(i).getAsJsonObject()));
5360      }
5361    };
5362    if (json.has("performingOrganization"))
5363      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
5364    if (json.has("requestingOrganization"))
5365      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
5366    if (json.has("costCenter"))
5367      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
5368    if (json.has("quantity"))
5369      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5370    if (json.has("bodysite")) {
5371      JsonArray array = getJArray(json, "bodysite");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5374      }
5375    };
5376    if (json.has("factorOverride"))
5377      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
5378    if (json.has("_factorOverride"))
5379      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
5380    if (json.has("priceOverride"))
5381      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
5382    if (json.has("overrideReason"))
5383      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
5384    if (json.has("_overrideReason"))
5385      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
5386    if (json.has("enterer"))
5387      res.setEnterer(parseReference(getJObject(json, "enterer")));
5388    if (json.has("enteredDate"))
5389      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5390    if (json.has("_enteredDate"))
5391      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
5392    if (json.has("reason")) {
5393      JsonArray array = getJArray(json, "reason");
5394      for (int i = 0; i < array.size(); i++) {
5395        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5396      }
5397    };
5398    if (json.has("service")) {
5399      JsonArray array = getJArray(json, "service");
5400      for (int i = 0; i < array.size(); i++) {
5401        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
5402      }
5403    };
5404    if (json.has("product")) {
5405      JsonArray array = getJArray(json, "product");
5406      for (int i = 0; i < array.size(); i++) {
5407        res.getProduct().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5408      }
5409    };
5410    if (json.has("account")) {
5411      JsonArray array = getJArray(json, "account");
5412      for (int i = 0; i < array.size(); i++) {
5413        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5414      }
5415    };
5416    if (json.has("note")) {
5417      JsonArray array = getJArray(json, "note");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5420      }
5421    };
5422    if (json.has("supportingInformation")) {
5423      JsonArray array = getJArray(json, "supportingInformation");
5424      for (int i = 0; i < array.size(); i++) {
5425        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5426      }
5427    };
5428  }
5429
5430  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
5431    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5432    parseChargeItemPerformerComponentProperties(json, res);
5433    return res;
5434  }
5435
5436  protected void parseChargeItemPerformerComponentProperties(JsonObject json, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5437    parseBackboneElementProperties(json, res);
5438    if (json.has("function"))
5439      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
5440    if (json.has("actor"))
5441      res.setActor(parseReference(getJObject(json, "actor")));
5442  }
5443
5444  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5445    ChargeItemDefinition res = new ChargeItemDefinition();
5446    parseChargeItemDefinitionProperties(json, res);
5447    return res;
5448  }
5449
5450  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
5451    parseMetadataResourceProperties(json, res);
5452    if (json.has("url"))
5453      res.setUrlElement(parseUri(json.get("url").getAsString()));
5454    if (json.has("_url"))
5455      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5456    if (json.has("identifier")) {
5457      JsonArray array = getJArray(json, "identifier");
5458      for (int i = 0; i < array.size(); i++) {
5459        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5460      }
5461    };
5462    if (json.has("version"))
5463      res.setVersionElement(parseString(json.get("version").getAsString()));
5464    if (json.has("_version"))
5465      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5466    if (json.has("title"))
5467      res.setTitleElement(parseString(json.get("title").getAsString()));
5468    if (json.has("_title"))
5469      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5470    if (json.has("derivedFromUri")) {
5471      JsonArray array = getJArray(json, "derivedFromUri");
5472      for (int i = 0; i < array.size(); i++) {
5473        if (array.get(i).isJsonNull()) {
5474          res.getDerivedFromUri().add(new UriType());
5475        } else {;
5476          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5477        }
5478      }
5479    };
5480    if (json.has("_derivedFromUri")) {
5481      JsonArray array = getJArray(json, "_derivedFromUri");
5482      for (int i = 0; i < array.size(); i++) {
5483        if (i == res.getDerivedFromUri().size())
5484          res.getDerivedFromUri().add(parseUri(null));
5485        if (array.get(i) instanceof JsonObject) 
5486          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5487      }
5488    };
5489    if (json.has("partOf")) {
5490      JsonArray array = getJArray(json, "partOf");
5491      for (int i = 0; i < array.size(); i++) {
5492        if (array.get(i).isJsonNull()) {
5493          res.getPartOf().add(new CanonicalType());
5494        } else {;
5495          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5496        }
5497      }
5498    };
5499    if (json.has("_partOf")) {
5500      JsonArray array = getJArray(json, "_partOf");
5501      for (int i = 0; i < array.size(); i++) {
5502        if (i == res.getPartOf().size())
5503          res.getPartOf().add(parseCanonical(null));
5504        if (array.get(i) instanceof JsonObject) 
5505          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5506      }
5507    };
5508    if (json.has("replaces")) {
5509      JsonArray array = getJArray(json, "replaces");
5510      for (int i = 0; i < array.size(); i++) {
5511        if (array.get(i).isJsonNull()) {
5512          res.getReplaces().add(new CanonicalType());
5513        } else {;
5514          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5515        }
5516      }
5517    };
5518    if (json.has("_replaces")) {
5519      JsonArray array = getJArray(json, "_replaces");
5520      for (int i = 0; i < array.size(); i++) {
5521        if (i == res.getReplaces().size())
5522          res.getReplaces().add(parseCanonical(null));
5523        if (array.get(i) instanceof JsonObject) 
5524          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5525      }
5526    };
5527    if (json.has("status"))
5528      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5529    if (json.has("_status"))
5530      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5531    if (json.has("experimental"))
5532      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5533    if (json.has("_experimental"))
5534      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5535    if (json.has("date"))
5536      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5537    if (json.has("_date"))
5538      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5539    if (json.has("publisher"))
5540      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5541    if (json.has("_publisher"))
5542      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5543    if (json.has("contact")) {
5544      JsonArray array = getJArray(json, "contact");
5545      for (int i = 0; i < array.size(); i++) {
5546        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5547      }
5548    };
5549    if (json.has("description"))
5550      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5551    if (json.has("_description"))
5552      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5553    if (json.has("useContext")) {
5554      JsonArray array = getJArray(json, "useContext");
5555      for (int i = 0; i < array.size(); i++) {
5556        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5557      }
5558    };
5559    if (json.has("jurisdiction")) {
5560      JsonArray array = getJArray(json, "jurisdiction");
5561      for (int i = 0; i < array.size(); i++) {
5562        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5563      }
5564    };
5565    if (json.has("copyright"))
5566      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5567    if (json.has("_copyright"))
5568      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5569    if (json.has("approvalDate"))
5570      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5571    if (json.has("_approvalDate"))
5572      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5573    if (json.has("lastReviewDate"))
5574      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5575    if (json.has("_lastReviewDate"))
5576      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5577    if (json.has("effectivePeriod"))
5578      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5579    if (json.has("code"))
5580      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5581    if (json.has("instance")) {
5582      JsonArray array = getJArray(json, "instance");
5583      for (int i = 0; i < array.size(); i++) {
5584        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5585      }
5586    };
5587    if (json.has("applicability")) {
5588      JsonArray array = getJArray(json, "applicability");
5589      for (int i = 0; i < array.size(); i++) {
5590        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5591      }
5592    };
5593    if (json.has("propertyGroup")) {
5594      JsonArray array = getJArray(json, "propertyGroup");
5595      for (int i = 0; i < array.size(); i++) {
5596        res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject()));
5597      }
5598    };
5599  }
5600
5601  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
5602    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5603    parseChargeItemDefinitionApplicabilityComponentProperties(json, res);
5604    return res;
5605  }
5606
5607  protected void parseChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
5608    parseBackboneElementProperties(json, res);
5609    if (json.has("description"))
5610      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5611    if (json.has("_description"))
5612      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5613    if (json.has("language"))
5614      res.setLanguageElement(parseString(json.get("language").getAsString()));
5615    if (json.has("_language"))
5616      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
5617    if (json.has("expression"))
5618      res.setExpressionElement(parseString(json.get("expression").getAsString()));
5619    if (json.has("_expression"))
5620      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
5621  }
5622
5623  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
5624    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5625    parseChargeItemDefinitionPropertyGroupComponentProperties(json, res);
5626    return res;
5627  }
5628
5629  protected void parseChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
5630    parseBackboneElementProperties(json, res);
5631    if (json.has("applicability")) {
5632      JsonArray array = getJArray(json, "applicability");
5633      for (int i = 0; i < array.size(); i++) {
5634        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5635      }
5636    };
5637    if (json.has("priceComponent")) {
5638      JsonArray array = getJArray(json, "priceComponent");
5639      for (int i = 0; i < array.size(); i++) {
5640        res.getPriceComponent().add(parseChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject()));
5641      }
5642    };
5643  }
5644
5645  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
5646    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
5647    parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, res);
5648    return res;
5649  }
5650
5651  protected void parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
5652    parseBackboneElementProperties(json, res);
5653    if (json.has("type"))
5654      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.InvoicePriceComponentType.NULL, new Enumerations.InvoicePriceComponentTypeEnumFactory()));
5655    if (json.has("_type"))
5656      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5657    if (json.has("code"))
5658      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5659    if (json.has("factor"))
5660      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5661    if (json.has("_factor"))
5662      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5663    if (json.has("amount"))
5664      res.setAmount(parseMoney(getJObject(json, "amount")));
5665  }
5666
5667  protected Citation parseCitation(JsonObject json) throws IOException, FHIRFormatError {
5668    Citation res = new Citation();
5669    parseCitationProperties(json, res);
5670    return res;
5671  }
5672
5673  protected void parseCitationProperties(JsonObject json, Citation res) throws IOException, FHIRFormatError {
5674    parseMetadataResourceProperties(json, res);
5675    if (json.has("url"))
5676      res.setUrlElement(parseUri(json.get("url").getAsString()));
5677    if (json.has("_url"))
5678      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5679    if (json.has("identifier")) {
5680      JsonArray array = getJArray(json, "identifier");
5681      for (int i = 0; i < array.size(); i++) {
5682        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5683      }
5684    };
5685    if (json.has("version"))
5686      res.setVersionElement(parseString(json.get("version").getAsString()));
5687    if (json.has("_version"))
5688      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5689    if (json.has("name"))
5690      res.setNameElement(parseString(json.get("name").getAsString()));
5691    if (json.has("_name"))
5692      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5693    if (json.has("title"))
5694      res.setTitleElement(parseString(json.get("title").getAsString()));
5695    if (json.has("_title"))
5696      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
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("effectivePeriod"))
5752      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5753    if (json.has("author")) {
5754      JsonArray array = getJArray(json, "author");
5755      for (int i = 0; i < array.size(); i++) {
5756        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5757      }
5758    };
5759    if (json.has("editor")) {
5760      JsonArray array = getJArray(json, "editor");
5761      for (int i = 0; i < array.size(); i++) {
5762        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5763      }
5764    };
5765    if (json.has("reviewer")) {
5766      JsonArray array = getJArray(json, "reviewer");
5767      for (int i = 0; i < array.size(); i++) {
5768        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
5769      }
5770    };
5771    if (json.has("endorser")) {
5772      JsonArray array = getJArray(json, "endorser");
5773      for (int i = 0; i < array.size(); i++) {
5774        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
5775      }
5776    };
5777    if (json.has("summary")) {
5778      JsonArray array = getJArray(json, "summary");
5779      for (int i = 0; i < array.size(); i++) {
5780        res.getSummary().add(parseCitationSummaryComponent(array.get(i).getAsJsonObject()));
5781      }
5782    };
5783    if (json.has("classification")) {
5784      JsonArray array = getJArray(json, "classification");
5785      for (int i = 0; i < array.size(); i++) {
5786        res.getClassification().add(parseCitationClassificationComponent(array.get(i).getAsJsonObject()));
5787      }
5788    };
5789    if (json.has("note")) {
5790      JsonArray array = getJArray(json, "note");
5791      for (int i = 0; i < array.size(); i++) {
5792        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5793      }
5794    };
5795    if (json.has("currentState")) {
5796      JsonArray array = getJArray(json, "currentState");
5797      for (int i = 0; i < array.size(); i++) {
5798        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5799      }
5800    };
5801    if (json.has("statusDate")) {
5802      JsonArray array = getJArray(json, "statusDate");
5803      for (int i = 0; i < array.size(); i++) {
5804        res.getStatusDate().add(parseCitationStatusDateComponent(array.get(i).getAsJsonObject()));
5805      }
5806    };
5807    if (json.has("relatedArtifact")) {
5808      JsonArray array = getJArray(json, "relatedArtifact");
5809      for (int i = 0; i < array.size(); i++) {
5810        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
5811      }
5812    };
5813    if (json.has("citedArtifact"))
5814      res.setCitedArtifact(parseCitationCitedArtifactComponent(getJObject(json, "citedArtifact")));
5815  }
5816
5817  protected Citation.CitationSummaryComponent parseCitationSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
5818    Citation.CitationSummaryComponent res = new Citation.CitationSummaryComponent();
5819    parseCitationSummaryComponentProperties(json, res);
5820    return res;
5821  }
5822
5823  protected void parseCitationSummaryComponentProperties(JsonObject json, Citation.CitationSummaryComponent res) throws IOException, FHIRFormatError {
5824    parseBackboneElementProperties(json, res);
5825    if (json.has("style"))
5826      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
5827    if (json.has("text"))
5828      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
5829    if (json.has("_text"))
5830      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5831  }
5832
5833  protected Citation.CitationClassificationComponent parseCitationClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
5834    Citation.CitationClassificationComponent res = new Citation.CitationClassificationComponent();
5835    parseCitationClassificationComponentProperties(json, res);
5836    return res;
5837  }
5838
5839  protected void parseCitationClassificationComponentProperties(JsonObject json, Citation.CitationClassificationComponent res) throws IOException, FHIRFormatError {
5840    parseBackboneElementProperties(json, res);
5841    if (json.has("type"))
5842      res.setType(parseCodeableConcept(getJObject(json, "type")));
5843    if (json.has("classifier")) {
5844      JsonArray array = getJArray(json, "classifier");
5845      for (int i = 0; i < array.size(); i++) {
5846        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5847      }
5848    };
5849  }
5850
5851  protected Citation.CitationStatusDateComponent parseCitationStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
5852    Citation.CitationStatusDateComponent res = new Citation.CitationStatusDateComponent();
5853    parseCitationStatusDateComponentProperties(json, res);
5854    return res;
5855  }
5856
5857  protected void parseCitationStatusDateComponentProperties(JsonObject json, Citation.CitationStatusDateComponent res) throws IOException, FHIRFormatError {
5858    parseBackboneElementProperties(json, res);
5859    if (json.has("activity"))
5860      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
5861    if (json.has("actual"))
5862      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5863    if (json.has("_actual"))
5864      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
5865    if (json.has("period"))
5866      res.setPeriod(parsePeriod(getJObject(json, "period")));
5867  }
5868
5869  protected Citation.CitationCitedArtifactComponent parseCitationCitedArtifactComponent(JsonObject json) throws IOException, FHIRFormatError {
5870    Citation.CitationCitedArtifactComponent res = new Citation.CitationCitedArtifactComponent();
5871    parseCitationCitedArtifactComponentProperties(json, res);
5872    return res;
5873  }
5874
5875  protected void parseCitationCitedArtifactComponentProperties(JsonObject json, Citation.CitationCitedArtifactComponent res) throws IOException, FHIRFormatError {
5876    parseBackboneElementProperties(json, res);
5877    if (json.has("identifier")) {
5878      JsonArray array = getJArray(json, "identifier");
5879      for (int i = 0; i < array.size(); i++) {
5880        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5881      }
5882    };
5883    if (json.has("relatedIdentifier")) {
5884      JsonArray array = getJArray(json, "relatedIdentifier");
5885      for (int i = 0; i < array.size(); i++) {
5886        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5887      }
5888    };
5889    if (json.has("dateAccessed"))
5890      res.setDateAccessedElement(parseDateTime(json.get("dateAccessed").getAsString()));
5891    if (json.has("_dateAccessed"))
5892      parseElementProperties(getJObject(json, "_dateAccessed"), res.getDateAccessedElement());
5893    if (json.has("version"))
5894      res.setVersion(parseCitationCitedArtifactVersionComponent(getJObject(json, "version")));
5895    if (json.has("currentState")) {
5896      JsonArray array = getJArray(json, "currentState");
5897      for (int i = 0; i < array.size(); i++) {
5898        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5899      }
5900    };
5901    if (json.has("statusDate")) {
5902      JsonArray array = getJArray(json, "statusDate");
5903      for (int i = 0; i < array.size(); i++) {
5904        res.getStatusDate().add(parseCitationCitedArtifactStatusDateComponent(array.get(i).getAsJsonObject()));
5905      }
5906    };
5907    if (json.has("title")) {
5908      JsonArray array = getJArray(json, "title");
5909      for (int i = 0; i < array.size(); i++) {
5910        res.getTitle().add(parseCitationCitedArtifactTitleComponent(array.get(i).getAsJsonObject()));
5911      }
5912    };
5913    if (json.has("abstract")) {
5914      JsonArray array = getJArray(json, "abstract");
5915      for (int i = 0; i < array.size(); i++) {
5916        res.getAbstract().add(parseCitationCitedArtifactAbstractComponent(array.get(i).getAsJsonObject()));
5917      }
5918    };
5919    if (json.has("part"))
5920      res.setPart(parseCitationCitedArtifactPartComponent(getJObject(json, "part")));
5921    if (json.has("relatesTo")) {
5922      JsonArray array = getJArray(json, "relatesTo");
5923      for (int i = 0; i < array.size(); i++) {
5924        res.getRelatesTo().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
5925      }
5926    };
5927    if (json.has("publicationForm")) {
5928      JsonArray array = getJArray(json, "publicationForm");
5929      for (int i = 0; i < array.size(); i++) {
5930        res.getPublicationForm().add(parseCitationCitedArtifactPublicationFormComponent(array.get(i).getAsJsonObject()));
5931      }
5932    };
5933    if (json.has("webLocation")) {
5934      JsonArray array = getJArray(json, "webLocation");
5935      for (int i = 0; i < array.size(); i++) {
5936        res.getWebLocation().add(parseCitationCitedArtifactWebLocationComponent(array.get(i).getAsJsonObject()));
5937      }
5938    };
5939    if (json.has("classification")) {
5940      JsonArray array = getJArray(json, "classification");
5941      for (int i = 0; i < array.size(); i++) {
5942        res.getClassification().add(parseCitationCitedArtifactClassificationComponent(array.get(i).getAsJsonObject()));
5943      }
5944    };
5945    if (json.has("contributorship"))
5946      res.setContributorship(parseCitationCitedArtifactContributorshipComponent(getJObject(json, "contributorship")));
5947    if (json.has("note")) {
5948      JsonArray array = getJArray(json, "note");
5949      for (int i = 0; i < array.size(); i++) {
5950        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5951      }
5952    };
5953  }
5954
5955  protected Citation.CitationCitedArtifactVersionComponent parseCitationCitedArtifactVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
5956    Citation.CitationCitedArtifactVersionComponent res = new Citation.CitationCitedArtifactVersionComponent();
5957    parseCitationCitedArtifactVersionComponentProperties(json, res);
5958    return res;
5959  }
5960
5961  protected void parseCitationCitedArtifactVersionComponentProperties(JsonObject json, Citation.CitationCitedArtifactVersionComponent res) throws IOException, FHIRFormatError {
5962    parseBackboneElementProperties(json, res);
5963    if (json.has("value"))
5964      res.setValueElement(parseString(json.get("value").getAsString()));
5965    if (json.has("_value"))
5966      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5967    if (json.has("baseCitation"))
5968      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
5969  }
5970
5971  protected Citation.CitationCitedArtifactStatusDateComponent parseCitationCitedArtifactStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
5972    Citation.CitationCitedArtifactStatusDateComponent res = new Citation.CitationCitedArtifactStatusDateComponent();
5973    parseCitationCitedArtifactStatusDateComponentProperties(json, res);
5974    return res;
5975  }
5976
5977  protected void parseCitationCitedArtifactStatusDateComponentProperties(JsonObject json, Citation.CitationCitedArtifactStatusDateComponent res) throws IOException, FHIRFormatError {
5978    parseBackboneElementProperties(json, res);
5979    if (json.has("activity"))
5980      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
5981    if (json.has("actual"))
5982      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5983    if (json.has("_actual"))
5984      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
5985    if (json.has("period"))
5986      res.setPeriod(parsePeriod(getJObject(json, "period")));
5987  }
5988
5989  protected Citation.CitationCitedArtifactTitleComponent parseCitationCitedArtifactTitleComponent(JsonObject json) throws IOException, FHIRFormatError {
5990    Citation.CitationCitedArtifactTitleComponent res = new Citation.CitationCitedArtifactTitleComponent();
5991    parseCitationCitedArtifactTitleComponentProperties(json, res);
5992    return res;
5993  }
5994
5995  protected void parseCitationCitedArtifactTitleComponentProperties(JsonObject json, Citation.CitationCitedArtifactTitleComponent res) throws IOException, FHIRFormatError {
5996    parseBackboneElementProperties(json, res);
5997    if (json.has("type")) {
5998      JsonArray array = getJArray(json, "type");
5999      for (int i = 0; i < array.size(); i++) {
6000        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6001      }
6002    };
6003    if (json.has("language"))
6004      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6005    if (json.has("text"))
6006      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6007    if (json.has("_text"))
6008      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6009  }
6010
6011  protected Citation.CitationCitedArtifactAbstractComponent parseCitationCitedArtifactAbstractComponent(JsonObject json) throws IOException, FHIRFormatError {
6012    Citation.CitationCitedArtifactAbstractComponent res = new Citation.CitationCitedArtifactAbstractComponent();
6013    parseCitationCitedArtifactAbstractComponentProperties(json, res);
6014    return res;
6015  }
6016
6017  protected void parseCitationCitedArtifactAbstractComponentProperties(JsonObject json, Citation.CitationCitedArtifactAbstractComponent res) throws IOException, FHIRFormatError {
6018    parseBackboneElementProperties(json, res);
6019    if (json.has("type"))
6020      res.setType(parseCodeableConcept(getJObject(json, "type")));
6021    if (json.has("language"))
6022      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6023    if (json.has("text"))
6024      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6025    if (json.has("_text"))
6026      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6027    if (json.has("copyright"))
6028      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6029    if (json.has("_copyright"))
6030      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6031  }
6032
6033  protected Citation.CitationCitedArtifactPartComponent parseCitationCitedArtifactPartComponent(JsonObject json) throws IOException, FHIRFormatError {
6034    Citation.CitationCitedArtifactPartComponent res = new Citation.CitationCitedArtifactPartComponent();
6035    parseCitationCitedArtifactPartComponentProperties(json, res);
6036    return res;
6037  }
6038
6039  protected void parseCitationCitedArtifactPartComponentProperties(JsonObject json, Citation.CitationCitedArtifactPartComponent res) throws IOException, FHIRFormatError {
6040    parseBackboneElementProperties(json, res);
6041    if (json.has("type"))
6042      res.setType(parseCodeableConcept(getJObject(json, "type")));
6043    if (json.has("value"))
6044      res.setValueElement(parseString(json.get("value").getAsString()));
6045    if (json.has("_value"))
6046      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6047    if (json.has("baseCitation"))
6048      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
6049  }
6050
6051  protected Citation.CitationCitedArtifactPublicationFormComponent parseCitationCitedArtifactPublicationFormComponent(JsonObject json) throws IOException, FHIRFormatError {
6052    Citation.CitationCitedArtifactPublicationFormComponent res = new Citation.CitationCitedArtifactPublicationFormComponent();
6053    parseCitationCitedArtifactPublicationFormComponentProperties(json, res);
6054    return res;
6055  }
6056
6057  protected void parseCitationCitedArtifactPublicationFormComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormComponent res) throws IOException, FHIRFormatError {
6058    parseBackboneElementProperties(json, res);
6059    if (json.has("publishedIn"))
6060      res.setPublishedIn(parseCitationCitedArtifactPublicationFormPublishedInComponent(getJObject(json, "publishedIn")));
6061    if (json.has("periodicRelease"))
6062      res.setPeriodicRelease(parseCitationCitedArtifactPublicationFormPeriodicReleaseComponent(getJObject(json, "periodicRelease")));
6063    if (json.has("articleDate"))
6064      res.setArticleDateElement(parseDateTime(json.get("articleDate").getAsString()));
6065    if (json.has("_articleDate"))
6066      parseElementProperties(getJObject(json, "_articleDate"), res.getArticleDateElement());
6067    if (json.has("lastRevisionDate"))
6068      res.setLastRevisionDateElement(parseDateTime(json.get("lastRevisionDate").getAsString()));
6069    if (json.has("_lastRevisionDate"))
6070      parseElementProperties(getJObject(json, "_lastRevisionDate"), res.getLastRevisionDateElement());
6071    if (json.has("language")) {
6072      JsonArray array = getJArray(json, "language");
6073      for (int i = 0; i < array.size(); i++) {
6074        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6075      }
6076    };
6077    if (json.has("accessionNumber"))
6078      res.setAccessionNumberElement(parseString(json.get("accessionNumber").getAsString()));
6079    if (json.has("_accessionNumber"))
6080      parseElementProperties(getJObject(json, "_accessionNumber"), res.getAccessionNumberElement());
6081    if (json.has("pageString"))
6082      res.setPageStringElement(parseString(json.get("pageString").getAsString()));
6083    if (json.has("_pageString"))
6084      parseElementProperties(getJObject(json, "_pageString"), res.getPageStringElement());
6085    if (json.has("firstPage"))
6086      res.setFirstPageElement(parseString(json.get("firstPage").getAsString()));
6087    if (json.has("_firstPage"))
6088      parseElementProperties(getJObject(json, "_firstPage"), res.getFirstPageElement());
6089    if (json.has("lastPage"))
6090      res.setLastPageElement(parseString(json.get("lastPage").getAsString()));
6091    if (json.has("_lastPage"))
6092      parseElementProperties(getJObject(json, "_lastPage"), res.getLastPageElement());
6093    if (json.has("pageCount"))
6094      res.setPageCountElement(parseString(json.get("pageCount").getAsString()));
6095    if (json.has("_pageCount"))
6096      parseElementProperties(getJObject(json, "_pageCount"), res.getPageCountElement());
6097    if (json.has("copyright"))
6098      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6099    if (json.has("_copyright"))
6100      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6101  }
6102
6103  protected Citation.CitationCitedArtifactPublicationFormPublishedInComponent parseCitationCitedArtifactPublicationFormPublishedInComponent(JsonObject json) throws IOException, FHIRFormatError {
6104    Citation.CitationCitedArtifactPublicationFormPublishedInComponent res = new Citation.CitationCitedArtifactPublicationFormPublishedInComponent();
6105    parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(json, res);
6106    return res;
6107  }
6108
6109  protected void parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPublishedInComponent res) throws IOException, FHIRFormatError {
6110    parseBackboneElementProperties(json, res);
6111    if (json.has("type"))
6112      res.setType(parseCodeableConcept(getJObject(json, "type")));
6113    if (json.has("identifier")) {
6114      JsonArray array = getJArray(json, "identifier");
6115      for (int i = 0; i < array.size(); i++) {
6116        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6117      }
6118    };
6119    if (json.has("title"))
6120      res.setTitleElement(parseString(json.get("title").getAsString()));
6121    if (json.has("_title"))
6122      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6123    if (json.has("publisher"))
6124      res.setPublisher(parseReference(getJObject(json, "publisher")));
6125    if (json.has("publisherLocation"))
6126      res.setPublisherLocationElement(parseString(json.get("publisherLocation").getAsString()));
6127    if (json.has("_publisherLocation"))
6128      parseElementProperties(getJObject(json, "_publisherLocation"), res.getPublisherLocationElement());
6129  }
6130
6131  protected Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent parseCitationCitedArtifactPublicationFormPeriodicReleaseComponent(JsonObject json) throws IOException, FHIRFormatError {
6132    Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent res = new Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent();
6133    parseCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(json, res);
6134    return res;
6135  }
6136
6137  protected void parseCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent res) throws IOException, FHIRFormatError {
6138    parseBackboneElementProperties(json, res);
6139    if (json.has("citedMedium"))
6140      res.setCitedMedium(parseCodeableConcept(getJObject(json, "citedMedium")));
6141    if (json.has("volume"))
6142      res.setVolumeElement(parseString(json.get("volume").getAsString()));
6143    if (json.has("_volume"))
6144      parseElementProperties(getJObject(json, "_volume"), res.getVolumeElement());
6145    if (json.has("issue"))
6146      res.setIssueElement(parseString(json.get("issue").getAsString()));
6147    if (json.has("_issue"))
6148      parseElementProperties(getJObject(json, "_issue"), res.getIssueElement());
6149    if (json.has("dateOfPublication"))
6150      res.setDateOfPublication(parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent(getJObject(json, "dateOfPublication")));
6151  }
6152
6153  protected Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent(JsonObject json) throws IOException, FHIRFormatError {
6154    Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent res = new Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent();
6155    parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(json, res);
6156    return res;
6157  }
6158
6159  protected void parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent res) throws IOException, FHIRFormatError {
6160    parseBackboneElementProperties(json, res);
6161    if (json.has("date"))
6162      res.setDateElement(parseDate(json.get("date").getAsString()));
6163    if (json.has("_date"))
6164      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6165    if (json.has("year"))
6166      res.setYearElement(parseString(json.get("year").getAsString()));
6167    if (json.has("_year"))
6168      parseElementProperties(getJObject(json, "_year"), res.getYearElement());
6169    if (json.has("month"))
6170      res.setMonthElement(parseString(json.get("month").getAsString()));
6171    if (json.has("_month"))
6172      parseElementProperties(getJObject(json, "_month"), res.getMonthElement());
6173    if (json.has("day"))
6174      res.setDayElement(parseString(json.get("day").getAsString()));
6175    if (json.has("_day"))
6176      parseElementProperties(getJObject(json, "_day"), res.getDayElement());
6177    if (json.has("season"))
6178      res.setSeasonElement(parseString(json.get("season").getAsString()));
6179    if (json.has("_season"))
6180      parseElementProperties(getJObject(json, "_season"), res.getSeasonElement());
6181    if (json.has("text"))
6182      res.setTextElement(parseString(json.get("text").getAsString()));
6183    if (json.has("_text"))
6184      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6185  }
6186
6187  protected Citation.CitationCitedArtifactWebLocationComponent parseCitationCitedArtifactWebLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
6188    Citation.CitationCitedArtifactWebLocationComponent res = new Citation.CitationCitedArtifactWebLocationComponent();
6189    parseCitationCitedArtifactWebLocationComponentProperties(json, res);
6190    return res;
6191  }
6192
6193  protected void parseCitationCitedArtifactWebLocationComponentProperties(JsonObject json, Citation.CitationCitedArtifactWebLocationComponent res) throws IOException, FHIRFormatError {
6194    parseBackboneElementProperties(json, res);
6195    if (json.has("classifier")) {
6196      JsonArray array = getJArray(json, "classifier");
6197      for (int i = 0; i < array.size(); i++) {
6198        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6199      }
6200    };
6201    if (json.has("url"))
6202      res.setUrlElement(parseUri(json.get("url").getAsString()));
6203    if (json.has("_url"))
6204      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6205  }
6206
6207  protected Citation.CitationCitedArtifactClassificationComponent parseCitationCitedArtifactClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
6208    Citation.CitationCitedArtifactClassificationComponent res = new Citation.CitationCitedArtifactClassificationComponent();
6209    parseCitationCitedArtifactClassificationComponentProperties(json, res);
6210    return res;
6211  }
6212
6213  protected void parseCitationCitedArtifactClassificationComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationComponent res) throws IOException, FHIRFormatError {
6214    parseBackboneElementProperties(json, res);
6215    if (json.has("type"))
6216      res.setType(parseCodeableConcept(getJObject(json, "type")));
6217    if (json.has("classifier")) {
6218      JsonArray array = getJArray(json, "classifier");
6219      for (int i = 0; i < array.size(); i++) {
6220        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6221      }
6222    };
6223    if (json.has("whoClassified"))
6224      res.setWhoClassified(parseCitationCitedArtifactClassificationWhoClassifiedComponent(getJObject(json, "whoClassified")));
6225  }
6226
6227  protected Citation.CitationCitedArtifactClassificationWhoClassifiedComponent parseCitationCitedArtifactClassificationWhoClassifiedComponent(JsonObject json) throws IOException, FHIRFormatError {
6228    Citation.CitationCitedArtifactClassificationWhoClassifiedComponent res = new Citation.CitationCitedArtifactClassificationWhoClassifiedComponent();
6229    parseCitationCitedArtifactClassificationWhoClassifiedComponentProperties(json, res);
6230    return res;
6231  }
6232
6233  protected void parseCitationCitedArtifactClassificationWhoClassifiedComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationWhoClassifiedComponent res) throws IOException, FHIRFormatError {
6234    parseBackboneElementProperties(json, res);
6235    if (json.has("person"))
6236      res.setPerson(parseReference(getJObject(json, "person")));
6237    if (json.has("organization"))
6238      res.setOrganization(parseReference(getJObject(json, "organization")));
6239    if (json.has("publisher"))
6240      res.setPublisher(parseReference(getJObject(json, "publisher")));
6241    if (json.has("classifierCopyright"))
6242      res.setClassifierCopyrightElement(parseString(json.get("classifierCopyright").getAsString()));
6243    if (json.has("_classifierCopyright"))
6244      parseElementProperties(getJObject(json, "_classifierCopyright"), res.getClassifierCopyrightElement());
6245    if (json.has("freeToShare"))
6246      res.setFreeToShareElement(parseBoolean(json.get("freeToShare").getAsBoolean()));
6247    if (json.has("_freeToShare"))
6248      parseElementProperties(getJObject(json, "_freeToShare"), res.getFreeToShareElement());
6249  }
6250
6251  protected Citation.CitationCitedArtifactContributorshipComponent parseCitationCitedArtifactContributorshipComponent(JsonObject json) throws IOException, FHIRFormatError {
6252    Citation.CitationCitedArtifactContributorshipComponent res = new Citation.CitationCitedArtifactContributorshipComponent();
6253    parseCitationCitedArtifactContributorshipComponentProperties(json, res);
6254    return res;
6255  }
6256
6257  protected void parseCitationCitedArtifactContributorshipComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipComponent res) throws IOException, FHIRFormatError {
6258    parseBackboneElementProperties(json, res);
6259    if (json.has("complete"))
6260      res.setCompleteElement(parseBoolean(json.get("complete").getAsBoolean()));
6261    if (json.has("_complete"))
6262      parseElementProperties(getJObject(json, "_complete"), res.getCompleteElement());
6263    if (json.has("entry")) {
6264      JsonArray array = getJArray(json, "entry");
6265      for (int i = 0; i < array.size(); i++) {
6266        res.getEntry().add(parseCitationCitedArtifactContributorshipEntryComponent(array.get(i).getAsJsonObject()));
6267      }
6268    };
6269    if (json.has("summary")) {
6270      JsonArray array = getJArray(json, "summary");
6271      for (int i = 0; i < array.size(); i++) {
6272        res.getSummary().add(parseCitationCitedArtifactContributorshipSummaryComponent(array.get(i).getAsJsonObject()));
6273      }
6274    };
6275  }
6276
6277  protected Citation.CitationCitedArtifactContributorshipEntryComponent parseCitationCitedArtifactContributorshipEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
6278    Citation.CitationCitedArtifactContributorshipEntryComponent res = new Citation.CitationCitedArtifactContributorshipEntryComponent();
6279    parseCitationCitedArtifactContributorshipEntryComponentProperties(json, res);
6280    return res;
6281  }
6282
6283  protected void parseCitationCitedArtifactContributorshipEntryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryComponent res) throws IOException, FHIRFormatError {
6284    parseBackboneElementProperties(json, res);
6285    if (json.has("name"))
6286      res.setName(parseHumanName(getJObject(json, "name")));
6287    if (json.has("initials"))
6288      res.setInitialsElement(parseString(json.get("initials").getAsString()));
6289    if (json.has("_initials"))
6290      parseElementProperties(getJObject(json, "_initials"), res.getInitialsElement());
6291    if (json.has("collectiveName"))
6292      res.setCollectiveNameElement(parseString(json.get("collectiveName").getAsString()));
6293    if (json.has("_collectiveName"))
6294      parseElementProperties(getJObject(json, "_collectiveName"), res.getCollectiveNameElement());
6295    if (json.has("identifier")) {
6296      JsonArray array = getJArray(json, "identifier");
6297      for (int i = 0; i < array.size(); i++) {
6298        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6299      }
6300    };
6301    if (json.has("affiliationInfo")) {
6302      JsonArray array = getJArray(json, "affiliationInfo");
6303      for (int i = 0; i < array.size(); i++) {
6304        res.getAffiliationInfo().add(parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(array.get(i).getAsJsonObject()));
6305      }
6306    };
6307    if (json.has("address")) {
6308      JsonArray array = getJArray(json, "address");
6309      for (int i = 0; i < array.size(); i++) {
6310        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
6311      }
6312    };
6313    if (json.has("telecom")) {
6314      JsonArray array = getJArray(json, "telecom");
6315      for (int i = 0; i < array.size(); i++) {
6316        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6317      }
6318    };
6319    if (json.has("contributionType")) {
6320      JsonArray array = getJArray(json, "contributionType");
6321      for (int i = 0; i < array.size(); i++) {
6322        res.getContributionType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6323      }
6324    };
6325    if (json.has("role"))
6326      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6327    if (json.has("contributionInstance")) {
6328      JsonArray array = getJArray(json, "contributionInstance");
6329      for (int i = 0; i < array.size(); i++) {
6330        res.getContributionInstance().add(parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(array.get(i).getAsJsonObject()));
6331      }
6332    };
6333    if (json.has("correspondingContact"))
6334      res.setCorrespondingContactElement(parseBoolean(json.get("correspondingContact").getAsBoolean()));
6335    if (json.has("_correspondingContact"))
6336      parseElementProperties(getJObject(json, "_correspondingContact"), res.getCorrespondingContactElement());
6337    if (json.has("rankingOrder"))
6338      res.setRankingOrderElement(parsePositiveInt(json.get("rankingOrder").getAsString()));
6339    if (json.has("_rankingOrder"))
6340      parseElementProperties(getJObject(json, "_rankingOrder"), res.getRankingOrderElement());
6341  }
6342
6343  protected Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
6344    Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent res = new Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent();
6345    parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(json, res);
6346    return res;
6347  }
6348
6349  protected void parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent res) throws IOException, FHIRFormatError {
6350    parseBackboneElementProperties(json, res);
6351    if (json.has("affiliation"))
6352      res.setAffiliationElement(parseString(json.get("affiliation").getAsString()));
6353    if (json.has("_affiliation"))
6354      parseElementProperties(getJObject(json, "_affiliation"), res.getAffiliationElement());
6355    if (json.has("role"))
6356      res.setRoleElement(parseString(json.get("role").getAsString()));
6357    if (json.has("_role"))
6358      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
6359    if (json.has("identifier")) {
6360      JsonArray array = getJArray(json, "identifier");
6361      for (int i = 0; i < array.size(); i++) {
6362        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6363      }
6364    };
6365  }
6366
6367  protected Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
6368    Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res = new Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent();
6369    parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(json, res);
6370    return res;
6371  }
6372
6373  protected void parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res) throws IOException, FHIRFormatError {
6374    parseBackboneElementProperties(json, res);
6375    if (json.has("type"))
6376      res.setType(parseCodeableConcept(getJObject(json, "type")));
6377    if (json.has("time"))
6378      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6379    if (json.has("_time"))
6380      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
6381  }
6382
6383  protected Citation.CitationCitedArtifactContributorshipSummaryComponent parseCitationCitedArtifactContributorshipSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
6384    Citation.CitationCitedArtifactContributorshipSummaryComponent res = new Citation.CitationCitedArtifactContributorshipSummaryComponent();
6385    parseCitationCitedArtifactContributorshipSummaryComponentProperties(json, res);
6386    return res;
6387  }
6388
6389  protected void parseCitationCitedArtifactContributorshipSummaryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipSummaryComponent res) throws IOException, FHIRFormatError {
6390    parseBackboneElementProperties(json, res);
6391    if (json.has("type"))
6392      res.setType(parseCodeableConcept(getJObject(json, "type")));
6393    if (json.has("style"))
6394      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
6395    if (json.has("source"))
6396      res.setSource(parseCodeableConcept(getJObject(json, "source")));
6397    if (json.has("value"))
6398      res.setValueElement(parseMarkdown(json.get("value").getAsString()));
6399    if (json.has("_value"))
6400      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6401  }
6402
6403  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
6404    Claim res = new Claim();
6405    parseClaimProperties(json, res);
6406    return res;
6407  }
6408
6409  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
6410    parseDomainResourceProperties(json, res);
6411    if (json.has("identifier")) {
6412      JsonArray array = getJArray(json, "identifier");
6413      for (int i = 0; i < array.size(); i++) {
6414        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6415      }
6416    };
6417    if (json.has("status"))
6418      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6419    if (json.has("_status"))
6420      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6421    if (json.has("type"))
6422      res.setType(parseCodeableConcept(getJObject(json, "type")));
6423    if (json.has("subType"))
6424      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6425    if (json.has("use"))
6426      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6427    if (json.has("_use"))
6428      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6429    if (json.has("patient"))
6430      res.setPatient(parseReference(getJObject(json, "patient")));
6431    if (json.has("billablePeriod"))
6432      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
6433    if (json.has("created"))
6434      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6435    if (json.has("_created"))
6436      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6437    if (json.has("enterer"))
6438      res.setEnterer(parseReference(getJObject(json, "enterer")));
6439    if (json.has("insurer"))
6440      res.setInsurer(parseReference(getJObject(json, "insurer")));
6441    if (json.has("provider"))
6442      res.setProvider(parseReference(getJObject(json, "provider")));
6443    if (json.has("priority"))
6444      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
6445    if (json.has("fundsReserve"))
6446      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
6447    if (json.has("related")) {
6448      JsonArray array = getJArray(json, "related");
6449      for (int i = 0; i < array.size(); i++) {
6450        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject()));
6451      }
6452    };
6453    if (json.has("prescription"))
6454      res.setPrescription(parseReference(getJObject(json, "prescription")));
6455    if (json.has("originalPrescription"))
6456      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
6457    if (json.has("payee"))
6458      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee")));
6459    if (json.has("referral"))
6460      res.setReferral(parseReference(getJObject(json, "referral")));
6461    if (json.has("facility"))
6462      res.setFacility(parseReference(getJObject(json, "facility")));
6463    if (json.has("careTeam")) {
6464      JsonArray array = getJArray(json, "careTeam");
6465      for (int i = 0; i < array.size(); i++) {
6466        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject()));
6467      }
6468    };
6469    if (json.has("supportingInfo")) {
6470      JsonArray array = getJArray(json, "supportingInfo");
6471      for (int i = 0; i < array.size(); i++) {
6472        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject()));
6473      }
6474    };
6475    if (json.has("diagnosis")) {
6476      JsonArray array = getJArray(json, "diagnosis");
6477      for (int i = 0; i < array.size(); i++) {
6478        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject()));
6479      }
6480    };
6481    if (json.has("procedure")) {
6482      JsonArray array = getJArray(json, "procedure");
6483      for (int i = 0; i < array.size(); i++) {
6484        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject()));
6485      }
6486    };
6487    if (json.has("insurance")) {
6488      JsonArray array = getJArray(json, "insurance");
6489      for (int i = 0; i < array.size(); i++) {
6490        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject()));
6491      }
6492    };
6493    if (json.has("accident"))
6494      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident")));
6495    if (json.has("item")) {
6496      JsonArray array = getJArray(json, "item");
6497      for (int i = 0; i < array.size(); i++) {
6498        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject()));
6499      }
6500    };
6501    if (json.has("total"))
6502      res.setTotal(parseMoney(getJObject(json, "total")));
6503  }
6504
6505  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
6506    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
6507    parseClaimRelatedClaimComponentProperties(json, res);
6508    return res;
6509  }
6510
6511  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
6512    parseBackboneElementProperties(json, res);
6513    if (json.has("claim"))
6514      res.setClaim(parseReference(getJObject(json, "claim")));
6515    if (json.has("relationship"))
6516      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
6517    if (json.has("reference"))
6518      res.setReference(parseIdentifier(getJObject(json, "reference")));
6519  }
6520
6521  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
6522    Claim.PayeeComponent res = new Claim.PayeeComponent();
6523    parseClaimPayeeComponentProperties(json, res);
6524    return res;
6525  }
6526
6527  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
6528    parseBackboneElementProperties(json, res);
6529    if (json.has("type"))
6530      res.setType(parseCodeableConcept(getJObject(json, "type")));
6531    if (json.has("party"))
6532      res.setParty(parseReference(getJObject(json, "party")));
6533  }
6534
6535  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
6536    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
6537    parseClaimCareTeamComponentProperties(json, res);
6538    return res;
6539  }
6540
6541  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
6542    parseBackboneElementProperties(json, res);
6543    if (json.has("sequence"))
6544      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6545    if (json.has("_sequence"))
6546      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6547    if (json.has("provider"))
6548      res.setProvider(parseReference(getJObject(json, "provider")));
6549    if (json.has("responsible"))
6550      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
6551    if (json.has("_responsible"))
6552      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
6553    if (json.has("role"))
6554      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6555    if (json.has("qualification"))
6556      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
6557  }
6558
6559  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
6560    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
6561    parseClaimSupportingInformationComponentProperties(json, res);
6562    return res;
6563  }
6564
6565  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
6566    parseBackboneElementProperties(json, res);
6567    if (json.has("sequence"))
6568      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6569    if (json.has("_sequence"))
6570      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6571    if (json.has("category"))
6572      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6573    if (json.has("code"))
6574      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6575    DataType timing = parseType("timing", json);
6576    if (timing != null)
6577      res.setTiming(timing);
6578    DataType value = parseType("value", json);
6579    if (value != null)
6580      res.setValue(value);
6581    if (json.has("reason"))
6582      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
6583  }
6584
6585  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
6586    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
6587    parseClaimDiagnosisComponentProperties(json, res);
6588    return res;
6589  }
6590
6591  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
6592    parseBackboneElementProperties(json, res);
6593    if (json.has("sequence"))
6594      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6595    if (json.has("_sequence"))
6596      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6597    DataType diagnosis = parseType("diagnosis", json);
6598    if (diagnosis != null)
6599      res.setDiagnosis(diagnosis);
6600    if (json.has("type")) {
6601      JsonArray array = getJArray(json, "type");
6602      for (int i = 0; i < array.size(); i++) {
6603        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6604      }
6605    };
6606    if (json.has("onAdmission"))
6607      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
6608    if (json.has("packageCode"))
6609      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
6610  }
6611
6612  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
6613    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
6614    parseClaimProcedureComponentProperties(json, res);
6615    return res;
6616  }
6617
6618  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
6619    parseBackboneElementProperties(json, res);
6620    if (json.has("sequence"))
6621      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6622    if (json.has("_sequence"))
6623      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6624    if (json.has("type")) {
6625      JsonArray array = getJArray(json, "type");
6626      for (int i = 0; i < array.size(); i++) {
6627        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6628      }
6629    };
6630    if (json.has("date"))
6631      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6632    if (json.has("_date"))
6633      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6634    DataType procedure = parseType("procedure", json);
6635    if (procedure != null)
6636      res.setProcedure(procedure);
6637    if (json.has("udi")) {
6638      JsonArray array = getJArray(json, "udi");
6639      for (int i = 0; i < array.size(); i++) {
6640        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6641      }
6642    };
6643  }
6644
6645  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6646    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6647    parseClaimInsuranceComponentProperties(json, res);
6648    return res;
6649  }
6650
6651  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
6652    parseBackboneElementProperties(json, res);
6653    if (json.has("sequence"))
6654      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6655    if (json.has("_sequence"))
6656      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6657    if (json.has("focal"))
6658      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6659    if (json.has("_focal"))
6660      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6661    if (json.has("identifier"))
6662      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6663    if (json.has("coverage"))
6664      res.setCoverage(parseReference(getJObject(json, "coverage")));
6665    if (json.has("businessArrangement"))
6666      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6667    if (json.has("_businessArrangement"))
6668      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6669    if (json.has("preAuthRef")) {
6670      JsonArray array = getJArray(json, "preAuthRef");
6671      for (int i = 0; i < array.size(); i++) {
6672        if (array.get(i).isJsonNull()) {
6673          res.getPreAuthRef().add(new StringType());
6674        } else {;
6675          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
6676        }
6677      }
6678    };
6679    if (json.has("_preAuthRef")) {
6680      JsonArray array = getJArray(json, "_preAuthRef");
6681      for (int i = 0; i < array.size(); i++) {
6682        if (i == res.getPreAuthRef().size())
6683          res.getPreAuthRef().add(parseString(null));
6684        if (array.get(i) instanceof JsonObject) 
6685          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
6686      }
6687    };
6688    if (json.has("claimResponse"))
6689      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6690  }
6691
6692  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
6693    Claim.AccidentComponent res = new Claim.AccidentComponent();
6694    parseClaimAccidentComponentProperties(json, res);
6695    return res;
6696  }
6697
6698  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
6699    parseBackboneElementProperties(json, res);
6700    if (json.has("date"))
6701      res.setDateElement(parseDate(json.get("date").getAsString()));
6702    if (json.has("_date"))
6703      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6704    if (json.has("type"))
6705      res.setType(parseCodeableConcept(getJObject(json, "type")));
6706    DataType location = parseType("location", json);
6707    if (location != null)
6708      res.setLocation(location);
6709  }
6710
6711  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6712    Claim.ItemComponent res = new Claim.ItemComponent();
6713    parseClaimItemComponentProperties(json, res);
6714    return res;
6715  }
6716
6717  protected void parseClaimItemComponentProperties(JsonObject json, Claim.ItemComponent res) throws IOException, FHIRFormatError {
6718    parseBackboneElementProperties(json, res);
6719    if (json.has("sequence"))
6720      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6721    if (json.has("_sequence"))
6722      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6723    if (json.has("careTeamSequence")) {
6724      JsonArray array = getJArray(json, "careTeamSequence");
6725      for (int i = 0; i < array.size(); i++) {
6726        if (array.get(i).isJsonNull()) {
6727          res.getCareTeamSequence().add(new PositiveIntType());
6728        } else {;
6729          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
6730        }
6731      }
6732    };
6733    if (json.has("_careTeamSequence")) {
6734      JsonArray array = getJArray(json, "_careTeamSequence");
6735      for (int i = 0; i < array.size(); i++) {
6736        if (i == res.getCareTeamSequence().size())
6737          res.getCareTeamSequence().add(parsePositiveInt(null));
6738        if (array.get(i) instanceof JsonObject) 
6739          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
6740      }
6741    };
6742    if (json.has("diagnosisSequence")) {
6743      JsonArray array = getJArray(json, "diagnosisSequence");
6744      for (int i = 0; i < array.size(); i++) {
6745        if (array.get(i).isJsonNull()) {
6746          res.getDiagnosisSequence().add(new PositiveIntType());
6747        } else {;
6748          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
6749        }
6750      }
6751    };
6752    if (json.has("_diagnosisSequence")) {
6753      JsonArray array = getJArray(json, "_diagnosisSequence");
6754      for (int i = 0; i < array.size(); i++) {
6755        if (i == res.getDiagnosisSequence().size())
6756          res.getDiagnosisSequence().add(parsePositiveInt(null));
6757        if (array.get(i) instanceof JsonObject) 
6758          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
6759      }
6760    };
6761    if (json.has("procedureSequence")) {
6762      JsonArray array = getJArray(json, "procedureSequence");
6763      for (int i = 0; i < array.size(); i++) {
6764        if (array.get(i).isJsonNull()) {
6765          res.getProcedureSequence().add(new PositiveIntType());
6766        } else {;
6767          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
6768        }
6769      }
6770    };
6771    if (json.has("_procedureSequence")) {
6772      JsonArray array = getJArray(json, "_procedureSequence");
6773      for (int i = 0; i < array.size(); i++) {
6774        if (i == res.getProcedureSequence().size())
6775          res.getProcedureSequence().add(parsePositiveInt(null));
6776        if (array.get(i) instanceof JsonObject) 
6777          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
6778      }
6779    };
6780    if (json.has("informationSequence")) {
6781      JsonArray array = getJArray(json, "informationSequence");
6782      for (int i = 0; i < array.size(); i++) {
6783        if (array.get(i).isJsonNull()) {
6784          res.getInformationSequence().add(new PositiveIntType());
6785        } else {;
6786          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
6787        }
6788      }
6789    };
6790    if (json.has("_informationSequence")) {
6791      JsonArray array = getJArray(json, "_informationSequence");
6792      for (int i = 0; i < array.size(); i++) {
6793        if (i == res.getInformationSequence().size())
6794          res.getInformationSequence().add(parsePositiveInt(null));
6795        if (array.get(i) instanceof JsonObject) 
6796          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
6797      }
6798    };
6799    if (json.has("revenue"))
6800      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6801    if (json.has("category"))
6802      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6803    if (json.has("productOrService"))
6804      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6805    if (json.has("modifier")) {
6806      JsonArray array = getJArray(json, "modifier");
6807      for (int i = 0; i < array.size(); i++) {
6808        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6809      }
6810    };
6811    if (json.has("programCode")) {
6812      JsonArray array = getJArray(json, "programCode");
6813      for (int i = 0; i < array.size(); i++) {
6814        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6815      }
6816    };
6817    DataType serviced = parseType("serviced", json);
6818    if (serviced != null)
6819      res.setServiced(serviced);
6820    DataType location = parseType("location", json);
6821    if (location != null)
6822      res.setLocation(location);
6823    if (json.has("quantity"))
6824      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6825    if (json.has("unitPrice"))
6826      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6827    if (json.has("factor"))
6828      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6829    if (json.has("_factor"))
6830      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6831    if (json.has("net"))
6832      res.setNet(parseMoney(getJObject(json, "net")));
6833    if (json.has("udi")) {
6834      JsonArray array = getJArray(json, "udi");
6835      for (int i = 0; i < array.size(); i++) {
6836        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6837      }
6838    };
6839    if (json.has("bodySite"))
6840      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
6841    if (json.has("subSite")) {
6842      JsonArray array = getJArray(json, "subSite");
6843      for (int i = 0; i < array.size(); i++) {
6844        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6845      }
6846    };
6847    if (json.has("encounter")) {
6848      JsonArray array = getJArray(json, "encounter");
6849      for (int i = 0; i < array.size(); i++) {
6850        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6851      }
6852    };
6853    if (json.has("detail")) {
6854      JsonArray array = getJArray(json, "detail");
6855      for (int i = 0; i < array.size(); i++) {
6856        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject()));
6857      }
6858    };
6859  }
6860
6861  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6862    Claim.DetailComponent res = new Claim.DetailComponent();
6863    parseClaimDetailComponentProperties(json, res);
6864    return res;
6865  }
6866
6867  protected void parseClaimDetailComponentProperties(JsonObject json, Claim.DetailComponent res) throws IOException, FHIRFormatError {
6868    parseBackboneElementProperties(json, res);
6869    if (json.has("sequence"))
6870      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6871    if (json.has("_sequence"))
6872      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6873    if (json.has("revenue"))
6874      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6875    if (json.has("category"))
6876      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6877    if (json.has("productOrService"))
6878      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6879    if (json.has("modifier")) {
6880      JsonArray array = getJArray(json, "modifier");
6881      for (int i = 0; i < array.size(); i++) {
6882        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6883      }
6884    };
6885    if (json.has("programCode")) {
6886      JsonArray array = getJArray(json, "programCode");
6887      for (int i = 0; i < array.size(); i++) {
6888        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6889      }
6890    };
6891    if (json.has("quantity"))
6892      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6893    if (json.has("unitPrice"))
6894      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6895    if (json.has("factor"))
6896      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6897    if (json.has("_factor"))
6898      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6899    if (json.has("net"))
6900      res.setNet(parseMoney(getJObject(json, "net")));
6901    if (json.has("udi")) {
6902      JsonArray array = getJArray(json, "udi");
6903      for (int i = 0; i < array.size(); i++) {
6904        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6905      }
6906    };
6907    if (json.has("subDetail")) {
6908      JsonArray array = getJArray(json, "subDetail");
6909      for (int i = 0; i < array.size(); i++) {
6910        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject()));
6911      }
6912    };
6913  }
6914
6915  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6916    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6917    parseClaimSubDetailComponentProperties(json, res);
6918    return res;
6919  }
6920
6921  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
6922    parseBackboneElementProperties(json, res);
6923    if (json.has("sequence"))
6924      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6925    if (json.has("_sequence"))
6926      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6927    if (json.has("revenue"))
6928      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6929    if (json.has("category"))
6930      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6931    if (json.has("productOrService"))
6932      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6933    if (json.has("modifier")) {
6934      JsonArray array = getJArray(json, "modifier");
6935      for (int i = 0; i < array.size(); i++) {
6936        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6937      }
6938    };
6939    if (json.has("programCode")) {
6940      JsonArray array = getJArray(json, "programCode");
6941      for (int i = 0; i < array.size(); i++) {
6942        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6943      }
6944    };
6945    if (json.has("quantity"))
6946      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6947    if (json.has("unitPrice"))
6948      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6949    if (json.has("factor"))
6950      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6951    if (json.has("_factor"))
6952      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6953    if (json.has("net"))
6954      res.setNet(parseMoney(getJObject(json, "net")));
6955    if (json.has("udi")) {
6956      JsonArray array = getJArray(json, "udi");
6957      for (int i = 0; i < array.size(); i++) {
6958        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6959      }
6960    };
6961  }
6962
6963  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
6964    ClaimResponse res = new ClaimResponse();
6965    parseClaimResponseProperties(json, res);
6966    return res;
6967  }
6968
6969  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
6970    parseDomainResourceProperties(json, res);
6971    if (json.has("identifier")) {
6972      JsonArray array = getJArray(json, "identifier");
6973      for (int i = 0; i < array.size(); i++) {
6974        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6975      }
6976    };
6977    if (json.has("status"))
6978      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6979    if (json.has("_status"))
6980      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6981    if (json.has("type"))
6982      res.setType(parseCodeableConcept(getJObject(json, "type")));
6983    if (json.has("subType"))
6984      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6985    if (json.has("use"))
6986      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6987    if (json.has("_use"))
6988      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6989    if (json.has("patient"))
6990      res.setPatient(parseReference(getJObject(json, "patient")));
6991    if (json.has("created"))
6992      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6993    if (json.has("_created"))
6994      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6995    if (json.has("insurer"))
6996      res.setInsurer(parseReference(getJObject(json, "insurer")));
6997    if (json.has("requestor"))
6998      res.setRequestor(parseReference(getJObject(json, "requestor")));
6999    if (json.has("request"))
7000      res.setRequest(parseReference(getJObject(json, "request")));
7001    if (json.has("outcome"))
7002      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
7003    if (json.has("_outcome"))
7004      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
7005    if (json.has("disposition"))
7006      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
7007    if (json.has("_disposition"))
7008      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
7009    if (json.has("preAuthRef"))
7010      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
7011    if (json.has("_preAuthRef"))
7012      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
7013    if (json.has("preAuthPeriod"))
7014      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
7015    if (json.has("payeeType"))
7016      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
7017    if (json.has("item")) {
7018      JsonArray array = getJArray(json, "item");
7019      for (int i = 0; i < array.size(); i++) {
7020        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject()));
7021      }
7022    };
7023    if (json.has("addItem")) {
7024      JsonArray array = getJArray(json, "addItem");
7025      for (int i = 0; i < array.size(); i++) {
7026        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject()));
7027      }
7028    };
7029    if (json.has("adjudication")) {
7030      JsonArray array = getJArray(json, "adjudication");
7031      for (int i = 0; i < array.size(); i++) {
7032        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7033      }
7034    };
7035    if (json.has("total")) {
7036      JsonArray array = getJArray(json, "total");
7037      for (int i = 0; i < array.size(); i++) {
7038        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject()));
7039      }
7040    };
7041    if (json.has("payment"))
7042      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment")));
7043    if (json.has("fundsReserve"))
7044      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
7045    if (json.has("formCode"))
7046      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
7047    if (json.has("form"))
7048      res.setForm(parseAttachment(getJObject(json, "form")));
7049    if (json.has("processNote")) {
7050      JsonArray array = getJArray(json, "processNote");
7051      for (int i = 0; i < array.size(); i++) {
7052        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject()));
7053      }
7054    };
7055    if (json.has("communicationRequest")) {
7056      JsonArray array = getJArray(json, "communicationRequest");
7057      for (int i = 0; i < array.size(); i++) {
7058        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
7059      }
7060    };
7061    if (json.has("insurance")) {
7062      JsonArray array = getJArray(json, "insurance");
7063      for (int i = 0; i < array.size(); i++) {
7064        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject()));
7065      }
7066    };
7067    if (json.has("error")) {
7068      JsonArray array = getJArray(json, "error");
7069      for (int i = 0; i < array.size(); i++) {
7070        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject()));
7071      }
7072    };
7073  }
7074
7075  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7076    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
7077    parseClaimResponseItemComponentProperties(json, res);
7078    return res;
7079  }
7080
7081  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
7082    parseBackboneElementProperties(json, res);
7083    if (json.has("itemSequence"))
7084      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
7085    if (json.has("_itemSequence"))
7086      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
7087    if (json.has("noteNumber")) {
7088      JsonArray array = getJArray(json, "noteNumber");
7089      for (int i = 0; i < array.size(); i++) {
7090        if (array.get(i).isJsonNull()) {
7091          res.getNoteNumber().add(new PositiveIntType());
7092        } else {;
7093          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7094        }
7095      }
7096    };
7097    if (json.has("_noteNumber")) {
7098      JsonArray array = getJArray(json, "_noteNumber");
7099      for (int i = 0; i < array.size(); i++) {
7100        if (i == res.getNoteNumber().size())
7101          res.getNoteNumber().add(parsePositiveInt(null));
7102        if (array.get(i) instanceof JsonObject) 
7103          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7104      }
7105    };
7106    if (json.has("adjudication")) {
7107      JsonArray array = getJArray(json, "adjudication");
7108      for (int i = 0; i < array.size(); i++) {
7109        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7110      }
7111    };
7112    if (json.has("detail")) {
7113      JsonArray array = getJArray(json, "detail");
7114      for (int i = 0; i < array.size(); i++) {
7115        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject()));
7116      }
7117    };
7118  }
7119
7120  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7121    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
7122    parseClaimResponseAdjudicationComponentProperties(json, res);
7123    return res;
7124  }
7125
7126  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
7127    parseBackboneElementProperties(json, res);
7128    if (json.has("category"))
7129      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7130    if (json.has("reason"))
7131      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
7132    if (json.has("amount"))
7133      res.setAmount(parseMoney(getJObject(json, "amount")));
7134    if (json.has("value"))
7135      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7136    if (json.has("_value"))
7137      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7138  }
7139
7140  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7141    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
7142    parseClaimResponseItemDetailComponentProperties(json, res);
7143    return res;
7144  }
7145
7146  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
7147    parseBackboneElementProperties(json, res);
7148    if (json.has("detailSequence"))
7149      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
7150    if (json.has("_detailSequence"))
7151      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
7152    if (json.has("noteNumber")) {
7153      JsonArray array = getJArray(json, "noteNumber");
7154      for (int i = 0; i < array.size(); i++) {
7155        if (array.get(i).isJsonNull()) {
7156          res.getNoteNumber().add(new PositiveIntType());
7157        } else {;
7158          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7159        }
7160      }
7161    };
7162    if (json.has("_noteNumber")) {
7163      JsonArray array = getJArray(json, "_noteNumber");
7164      for (int i = 0; i < array.size(); i++) {
7165        if (i == res.getNoteNumber().size())
7166          res.getNoteNumber().add(parsePositiveInt(null));
7167        if (array.get(i) instanceof JsonObject) 
7168          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7169      }
7170    };
7171    if (json.has("adjudication")) {
7172      JsonArray array = getJArray(json, "adjudication");
7173      for (int i = 0; i < array.size(); i++) {
7174        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7175      }
7176    };
7177    if (json.has("subDetail")) {
7178      JsonArray array = getJArray(json, "subDetail");
7179      for (int i = 0; i < array.size(); i++) {
7180        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject()));
7181      }
7182    };
7183  }
7184
7185  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7186    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
7187    parseClaimResponseSubDetailComponentProperties(json, res);
7188    return res;
7189  }
7190
7191  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
7192    parseBackboneElementProperties(json, res);
7193    if (json.has("subDetailSequence"))
7194      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
7195    if (json.has("_subDetailSequence"))
7196      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
7197    if (json.has("noteNumber")) {
7198      JsonArray array = getJArray(json, "noteNumber");
7199      for (int i = 0; i < array.size(); i++) {
7200        if (array.get(i).isJsonNull()) {
7201          res.getNoteNumber().add(new PositiveIntType());
7202        } else {;
7203          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7204        }
7205      }
7206    };
7207    if (json.has("_noteNumber")) {
7208      JsonArray array = getJArray(json, "_noteNumber");
7209      for (int i = 0; i < array.size(); i++) {
7210        if (i == res.getNoteNumber().size())
7211          res.getNoteNumber().add(parsePositiveInt(null));
7212        if (array.get(i) instanceof JsonObject) 
7213          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7214      }
7215    };
7216    if (json.has("adjudication")) {
7217      JsonArray array = getJArray(json, "adjudication");
7218      for (int i = 0; i < array.size(); i++) {
7219        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7220      }
7221    };
7222  }
7223
7224  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7225    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
7226    parseClaimResponseAddedItemComponentProperties(json, res);
7227    return res;
7228  }
7229
7230  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
7231    parseBackboneElementProperties(json, res);
7232    if (json.has("itemSequence")) {
7233      JsonArray array = getJArray(json, "itemSequence");
7234      for (int i = 0; i < array.size(); i++) {
7235        if (array.get(i).isJsonNull()) {
7236          res.getItemSequence().add(new PositiveIntType());
7237        } else {;
7238          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
7239        }
7240      }
7241    };
7242    if (json.has("_itemSequence")) {
7243      JsonArray array = getJArray(json, "_itemSequence");
7244      for (int i = 0; i < array.size(); i++) {
7245        if (i == res.getItemSequence().size())
7246          res.getItemSequence().add(parsePositiveInt(null));
7247        if (array.get(i) instanceof JsonObject) 
7248          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
7249      }
7250    };
7251    if (json.has("detailSequence")) {
7252      JsonArray array = getJArray(json, "detailSequence");
7253      for (int i = 0; i < array.size(); i++) {
7254        if (array.get(i).isJsonNull()) {
7255          res.getDetailSequence().add(new PositiveIntType());
7256        } else {;
7257          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7258        }
7259      }
7260    };
7261    if (json.has("_detailSequence")) {
7262      JsonArray array = getJArray(json, "_detailSequence");
7263      for (int i = 0; i < array.size(); i++) {
7264        if (i == res.getDetailSequence().size())
7265          res.getDetailSequence().add(parsePositiveInt(null));
7266        if (array.get(i) instanceof JsonObject) 
7267          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
7268      }
7269    };
7270    if (json.has("subdetailSequence")) {
7271      JsonArray array = getJArray(json, "subdetailSequence");
7272      for (int i = 0; i < array.size(); i++) {
7273        if (array.get(i).isJsonNull()) {
7274          res.getSubdetailSequence().add(new PositiveIntType());
7275        } else {;
7276          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7277        }
7278      }
7279    };
7280    if (json.has("_subdetailSequence")) {
7281      JsonArray array = getJArray(json, "_subdetailSequence");
7282      for (int i = 0; i < array.size(); i++) {
7283        if (i == res.getSubdetailSequence().size())
7284          res.getSubdetailSequence().add(parsePositiveInt(null));
7285        if (array.get(i) instanceof JsonObject) 
7286          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
7287      }
7288    };
7289    if (json.has("provider")) {
7290      JsonArray array = getJArray(json, "provider");
7291      for (int i = 0; i < array.size(); i++) {
7292        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
7293      }
7294    };
7295    if (json.has("productOrService"))
7296      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7297    if (json.has("modifier")) {
7298      JsonArray array = getJArray(json, "modifier");
7299      for (int i = 0; i < array.size(); i++) {
7300        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7301      }
7302    };
7303    if (json.has("programCode")) {
7304      JsonArray array = getJArray(json, "programCode");
7305      for (int i = 0; i < array.size(); i++) {
7306        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7307      }
7308    };
7309    DataType serviced = parseType("serviced", json);
7310    if (serviced != null)
7311      res.setServiced(serviced);
7312    DataType location = parseType("location", json);
7313    if (location != null)
7314      res.setLocation(location);
7315    if (json.has("quantity"))
7316      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7317    if (json.has("unitPrice"))
7318      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7319    if (json.has("factor"))
7320      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7321    if (json.has("_factor"))
7322      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7323    if (json.has("net"))
7324      res.setNet(parseMoney(getJObject(json, "net")));
7325    if (json.has("bodySite"))
7326      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
7327    if (json.has("subSite")) {
7328      JsonArray array = getJArray(json, "subSite");
7329      for (int i = 0; i < array.size(); i++) {
7330        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7331      }
7332    };
7333    if (json.has("noteNumber")) {
7334      JsonArray array = getJArray(json, "noteNumber");
7335      for (int i = 0; i < array.size(); i++) {
7336        if (array.get(i).isJsonNull()) {
7337          res.getNoteNumber().add(new PositiveIntType());
7338        } else {;
7339          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7340        }
7341      }
7342    };
7343    if (json.has("_noteNumber")) {
7344      JsonArray array = getJArray(json, "_noteNumber");
7345      for (int i = 0; i < array.size(); i++) {
7346        if (i == res.getNoteNumber().size())
7347          res.getNoteNumber().add(parsePositiveInt(null));
7348        if (array.get(i) instanceof JsonObject) 
7349          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7350      }
7351    };
7352    if (json.has("adjudication")) {
7353      JsonArray array = getJArray(json, "adjudication");
7354      for (int i = 0; i < array.size(); i++) {
7355        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7356      }
7357    };
7358    if (json.has("detail")) {
7359      JsonArray array = getJArray(json, "detail");
7360      for (int i = 0; i < array.size(); i++) {
7361        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject()));
7362      }
7363    };
7364  }
7365
7366  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7367    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
7368    parseClaimResponseAddedItemDetailComponentProperties(json, res);
7369    return res;
7370  }
7371
7372  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
7373    parseBackboneElementProperties(json, res);
7374    if (json.has("productOrService"))
7375      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7376    if (json.has("modifier")) {
7377      JsonArray array = getJArray(json, "modifier");
7378      for (int i = 0; i < array.size(); i++) {
7379        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7380      }
7381    };
7382    if (json.has("quantity"))
7383      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7384    if (json.has("unitPrice"))
7385      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7386    if (json.has("factor"))
7387      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7388    if (json.has("_factor"))
7389      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7390    if (json.has("net"))
7391      res.setNet(parseMoney(getJObject(json, "net")));
7392    if (json.has("noteNumber")) {
7393      JsonArray array = getJArray(json, "noteNumber");
7394      for (int i = 0; i < array.size(); i++) {
7395        if (array.get(i).isJsonNull()) {
7396          res.getNoteNumber().add(new PositiveIntType());
7397        } else {;
7398          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7399        }
7400      }
7401    };
7402    if (json.has("_noteNumber")) {
7403      JsonArray array = getJArray(json, "_noteNumber");
7404      for (int i = 0; i < array.size(); i++) {
7405        if (i == res.getNoteNumber().size())
7406          res.getNoteNumber().add(parsePositiveInt(null));
7407        if (array.get(i) instanceof JsonObject) 
7408          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7409      }
7410    };
7411    if (json.has("adjudication")) {
7412      JsonArray array = getJArray(json, "adjudication");
7413      for (int i = 0; i < array.size(); i++) {
7414        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7415      }
7416    };
7417    if (json.has("subDetail")) {
7418      JsonArray array = getJArray(json, "subDetail");
7419      for (int i = 0; i < array.size(); i++) {
7420        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject()));
7421      }
7422    };
7423  }
7424
7425  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7426    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
7427    parseClaimResponseAddedItemSubDetailComponentProperties(json, res);
7428    return res;
7429  }
7430
7431  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
7432    parseBackboneElementProperties(json, res);
7433    if (json.has("productOrService"))
7434      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7435    if (json.has("modifier")) {
7436      JsonArray array = getJArray(json, "modifier");
7437      for (int i = 0; i < array.size(); i++) {
7438        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7439      }
7440    };
7441    if (json.has("quantity"))
7442      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7443    if (json.has("unitPrice"))
7444      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7445    if (json.has("factor"))
7446      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7447    if (json.has("_factor"))
7448      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7449    if (json.has("net"))
7450      res.setNet(parseMoney(getJObject(json, "net")));
7451    if (json.has("noteNumber")) {
7452      JsonArray array = getJArray(json, "noteNumber");
7453      for (int i = 0; i < array.size(); i++) {
7454        if (array.get(i).isJsonNull()) {
7455          res.getNoteNumber().add(new PositiveIntType());
7456        } else {;
7457          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7458        }
7459      }
7460    };
7461    if (json.has("_noteNumber")) {
7462      JsonArray array = getJArray(json, "_noteNumber");
7463      for (int i = 0; i < array.size(); i++) {
7464        if (i == res.getNoteNumber().size())
7465          res.getNoteNumber().add(parsePositiveInt(null));
7466        if (array.get(i) instanceof JsonObject) 
7467          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7468      }
7469    };
7470    if (json.has("adjudication")) {
7471      JsonArray array = getJArray(json, "adjudication");
7472      for (int i = 0; i < array.size(); i++) {
7473        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7474      }
7475    };
7476  }
7477
7478  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
7479    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
7480    parseClaimResponseTotalComponentProperties(json, res);
7481    return res;
7482  }
7483
7484  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
7485    parseBackboneElementProperties(json, res);
7486    if (json.has("category"))
7487      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7488    if (json.has("amount"))
7489      res.setAmount(parseMoney(getJObject(json, "amount")));
7490  }
7491
7492  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
7493    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
7494    parseClaimResponsePaymentComponentProperties(json, res);
7495    return res;
7496  }
7497
7498  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
7499    parseBackboneElementProperties(json, res);
7500    if (json.has("type"))
7501      res.setType(parseCodeableConcept(getJObject(json, "type")));
7502    if (json.has("adjustment"))
7503      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
7504    if (json.has("adjustmentReason"))
7505      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
7506    if (json.has("date"))
7507      res.setDateElement(parseDate(json.get("date").getAsString()));
7508    if (json.has("_date"))
7509      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7510    if (json.has("amount"))
7511      res.setAmount(parseMoney(getJObject(json, "amount")));
7512    if (json.has("identifier"))
7513      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7514  }
7515
7516  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
7517    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
7518    parseClaimResponseNoteComponentProperties(json, res);
7519    return res;
7520  }
7521
7522  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
7523    parseBackboneElementProperties(json, res);
7524    if (json.has("number"))
7525      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
7526    if (json.has("_number"))
7527      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
7528    if (json.has("type"))
7529      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
7530    if (json.has("_type"))
7531      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7532    if (json.has("text"))
7533      res.setTextElement(parseString(json.get("text").getAsString()));
7534    if (json.has("_text"))
7535      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7536    if (json.has("language"))
7537      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
7538  }
7539
7540  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
7541    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
7542    parseClaimResponseInsuranceComponentProperties(json, res);
7543    return res;
7544  }
7545
7546  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
7547    parseBackboneElementProperties(json, res);
7548    if (json.has("sequence"))
7549      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7550    if (json.has("_sequence"))
7551      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7552    if (json.has("focal"))
7553      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
7554    if (json.has("_focal"))
7555      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
7556    if (json.has("coverage"))
7557      res.setCoverage(parseReference(getJObject(json, "coverage")));
7558    if (json.has("businessArrangement"))
7559      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7560    if (json.has("_businessArrangement"))
7561      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
7562    if (json.has("claimResponse"))
7563      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
7564  }
7565
7566  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json) throws IOException, FHIRFormatError {
7567    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
7568    parseClaimResponseErrorComponentProperties(json, res);
7569    return res;
7570  }
7571
7572  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
7573    parseBackboneElementProperties(json, res);
7574    if (json.has("itemSequence"))
7575      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
7576    if (json.has("_itemSequence"))
7577      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
7578    if (json.has("detailSequence"))
7579      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
7580    if (json.has("_detailSequence"))
7581      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
7582    if (json.has("subDetailSequence"))
7583      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
7584    if (json.has("_subDetailSequence"))
7585      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
7586    if (json.has("code"))
7587      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7588  }
7589
7590  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
7591    ClinicalImpression res = new ClinicalImpression();
7592    parseClinicalImpressionProperties(json, res);
7593    return res;
7594  }
7595
7596  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
7597    parseDomainResourceProperties(json, res);
7598    if (json.has("identifier")) {
7599      JsonArray array = getJArray(json, "identifier");
7600      for (int i = 0; i < array.size(); i++) {
7601        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7602      }
7603    };
7604    if (json.has("status"))
7605      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
7606    if (json.has("_status"))
7607      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7608    if (json.has("statusReason"))
7609      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7610    if (json.has("description"))
7611      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7612    if (json.has("_description"))
7613      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7614    if (json.has("subject"))
7615      res.setSubject(parseReference(getJObject(json, "subject")));
7616    if (json.has("encounter"))
7617      res.setEncounter(parseReference(getJObject(json, "encounter")));
7618    DataType effective = parseType("effective", json);
7619    if (effective != null)
7620      res.setEffective(effective);
7621    if (json.has("date"))
7622      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7623    if (json.has("_date"))
7624      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7625    if (json.has("performer"))
7626      res.setPerformer(parseReference(getJObject(json, "performer")));
7627    if (json.has("previous"))
7628      res.setPrevious(parseReference(getJObject(json, "previous")));
7629    if (json.has("problem")) {
7630      JsonArray array = getJArray(json, "problem");
7631      for (int i = 0; i < array.size(); i++) {
7632        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
7633      }
7634    };
7635    if (json.has("protocol")) {
7636      JsonArray array = getJArray(json, "protocol");
7637      for (int i = 0; i < array.size(); i++) {
7638        if (array.get(i).isJsonNull()) {
7639          res.getProtocol().add(new UriType());
7640        } else {;
7641          res.getProtocol().add(parseUri(array.get(i).getAsString()));
7642        }
7643      }
7644    };
7645    if (json.has("_protocol")) {
7646      JsonArray array = getJArray(json, "_protocol");
7647      for (int i = 0; i < array.size(); i++) {
7648        if (i == res.getProtocol().size())
7649          res.getProtocol().add(parseUri(null));
7650        if (array.get(i) instanceof JsonObject) 
7651          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
7652      }
7653    };
7654    if (json.has("summary"))
7655      res.setSummaryElement(parseString(json.get("summary").getAsString()));
7656    if (json.has("_summary"))
7657      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
7658    if (json.has("finding")) {
7659      JsonArray array = getJArray(json, "finding");
7660      for (int i = 0; i < array.size(); i++) {
7661        res.getFinding().add(parseClinicalImpressionFindingComponent(array.get(i).getAsJsonObject()));
7662      }
7663    };
7664    if (json.has("prognosisCodeableConcept")) {
7665      JsonArray array = getJArray(json, "prognosisCodeableConcept");
7666      for (int i = 0; i < array.size(); i++) {
7667        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7668      }
7669    };
7670    if (json.has("prognosisReference")) {
7671      JsonArray array = getJArray(json, "prognosisReference");
7672      for (int i = 0; i < array.size(); i++) {
7673        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
7674      }
7675    };
7676    if (json.has("supportingInfo")) {
7677      JsonArray array = getJArray(json, "supportingInfo");
7678      for (int i = 0; i < array.size(); i++) {
7679        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7680      }
7681    };
7682    if (json.has("note")) {
7683      JsonArray array = getJArray(json, "note");
7684      for (int i = 0; i < array.size(); i++) {
7685        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7686      }
7687    };
7688  }
7689
7690  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(JsonObject json) throws IOException, FHIRFormatError {
7691    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
7692    parseClinicalImpressionFindingComponentProperties(json, res);
7693    return res;
7694  }
7695
7696  protected void parseClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
7697    parseBackboneElementProperties(json, res);
7698    if (json.has("item"))
7699      res.setItem(parseCodeableReference(getJObject(json, "item")));
7700    if (json.has("basis"))
7701      res.setBasisElement(parseString(json.get("basis").getAsString()));
7702    if (json.has("_basis"))
7703      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
7704  }
7705
7706  protected ClinicalUseDefinition parseClinicalUseDefinition(JsonObject json) throws IOException, FHIRFormatError {
7707    ClinicalUseDefinition res = new ClinicalUseDefinition();
7708    parseClinicalUseDefinitionProperties(json, res);
7709    return res;
7710  }
7711
7712  protected void parseClinicalUseDefinitionProperties(JsonObject json, ClinicalUseDefinition res) throws IOException, FHIRFormatError {
7713    parseDomainResourceProperties(json, res);
7714    if (json.has("identifier")) {
7715      JsonArray array = getJArray(json, "identifier");
7716      for (int i = 0; i < array.size(); i++) {
7717        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7718      }
7719    };
7720    if (json.has("type"))
7721      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ClinicalUseIssueType.NULL, new Enumerations.ClinicalUseIssueTypeEnumFactory()));
7722    if (json.has("_type"))
7723      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7724    if (json.has("category")) {
7725      JsonArray array = getJArray(json, "category");
7726      for (int i = 0; i < array.size(); i++) {
7727        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7728      }
7729    };
7730    if (json.has("subject")) {
7731      JsonArray array = getJArray(json, "subject");
7732      for (int i = 0; i < array.size(); i++) {
7733        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7734      }
7735    };
7736    if (json.has("status"))
7737      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
7738    if (json.has("contraindication"))
7739      res.setContraindication(parseClinicalUseDefinitionContraindicationComponent(getJObject(json, "contraindication")));
7740    if (json.has("indication"))
7741      res.setIndication(parseClinicalUseDefinitionIndicationComponent(getJObject(json, "indication")));
7742    if (json.has("interaction"))
7743      res.setInteraction(parseClinicalUseDefinitionInteractionComponent(getJObject(json, "interaction")));
7744    if (json.has("population")) {
7745      JsonArray array = getJArray(json, "population");
7746      for (int i = 0; i < array.size(); i++) {
7747        res.getPopulation().add(parseReference(array.get(i).getAsJsonObject()));
7748      }
7749    };
7750    if (json.has("undesirableEffect"))
7751      res.setUndesirableEffect(parseClinicalUseDefinitionUndesirableEffectComponent(getJObject(json, "undesirableEffect")));
7752    if (json.has("warning"))
7753      res.setWarning(parseClinicalUseDefinitionWarningComponent(getJObject(json, "warning")));
7754  }
7755
7756  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent parseClinicalUseDefinitionContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7757    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent();
7758    parseClinicalUseDefinitionContraindicationComponentProperties(json, res);
7759    return res;
7760  }
7761
7762  protected void parseClinicalUseDefinitionContraindicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res) throws IOException, FHIRFormatError {
7763    parseBackboneElementProperties(json, res);
7764    if (json.has("diseaseSymptomProcedure"))
7765      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7766    if (json.has("diseaseStatus"))
7767      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7768    if (json.has("comorbidity")) {
7769      JsonArray array = getJArray(json, "comorbidity");
7770      for (int i = 0; i < array.size(); i++) {
7771        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7772      }
7773    };
7774    if (json.has("indication")) {
7775      JsonArray array = getJArray(json, "indication");
7776      for (int i = 0; i < array.size(); i++) {
7777        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
7778      }
7779    };
7780    if (json.has("otherTherapy")) {
7781      JsonArray array = getJArray(json, "otherTherapy");
7782      for (int i = 0; i < array.size(); i++) {
7783        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7784      }
7785    };
7786  }
7787
7788  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent parseClinicalUseDefinitionContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
7789    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent();
7790    parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(json, res);
7791    return res;
7792  }
7793
7794  protected void parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
7795    parseBackboneElementProperties(json, res);
7796    if (json.has("relationshipType"))
7797      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
7798    if (json.has("therapy"))
7799      res.setTherapy(parseCodeableReference(getJObject(json, "therapy")));
7800  }
7801
7802  protected ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent parseClinicalUseDefinitionIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7803    ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent();
7804    parseClinicalUseDefinitionIndicationComponentProperties(json, res);
7805    return res;
7806  }
7807
7808  protected void parseClinicalUseDefinitionIndicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res) throws IOException, FHIRFormatError {
7809    parseBackboneElementProperties(json, res);
7810    if (json.has("diseaseSymptomProcedure"))
7811      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7812    if (json.has("diseaseStatus"))
7813      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7814    if (json.has("comorbidity")) {
7815      JsonArray array = getJArray(json, "comorbidity");
7816      for (int i = 0; i < array.size(); i++) {
7817        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7818      }
7819    };
7820    if (json.has("intendedEffect"))
7821      res.setIntendedEffect(parseCodeableReference(getJObject(json, "intendedEffect")));
7822    if (json.has("duration"))
7823      res.setDuration(parseQuantity(getJObject(json, "duration")));
7824    if (json.has("undesirableEffect")) {
7825      JsonArray array = getJArray(json, "undesirableEffect");
7826      for (int i = 0; i < array.size(); i++) {
7827        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
7828      }
7829    };
7830    if (json.has("otherTherapy")) {
7831      JsonArray array = getJArray(json, "otherTherapy");
7832      for (int i = 0; i < array.size(); i++) {
7833        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7834      }
7835    };
7836  }
7837
7838  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent parseClinicalUseDefinitionInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
7839    ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent();
7840    parseClinicalUseDefinitionInteractionComponentProperties(json, res);
7841    return res;
7842  }
7843
7844  protected void parseClinicalUseDefinitionInteractionComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res) throws IOException, FHIRFormatError {
7845    parseBackboneElementProperties(json, res);
7846    if (json.has("interactant")) {
7847      JsonArray array = getJArray(json, "interactant");
7848      for (int i = 0; i < array.size(); i++) {
7849        res.getInteractant().add(parseClinicalUseDefinitionInteractionInteractantComponent(array.get(i).getAsJsonObject()));
7850      }
7851    };
7852    if (json.has("type"))
7853      res.setType(parseCodeableConcept(getJObject(json, "type")));
7854    if (json.has("effect"))
7855      res.setEffect(parseCodeableReference(getJObject(json, "effect")));
7856    if (json.has("incidence"))
7857      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
7858    if (json.has("management")) {
7859      JsonArray array = getJArray(json, "management");
7860      for (int i = 0; i < array.size(); i++) {
7861        res.getManagement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7862      }
7863    };
7864  }
7865
7866  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent parseClinicalUseDefinitionInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
7867    ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent();
7868    parseClinicalUseDefinitionInteractionInteractantComponentProperties(json, res);
7869    return res;
7870  }
7871
7872  protected void parseClinicalUseDefinitionInteractionInteractantComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res) throws IOException, FHIRFormatError {
7873    parseBackboneElementProperties(json, res);
7874    DataType item = parseType("item", json);
7875    if (item != null)
7876      res.setItem(item);
7877  }
7878
7879  protected ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent parseClinicalUseDefinitionUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
7880    ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent();
7881    parseClinicalUseDefinitionUndesirableEffectComponentProperties(json, res);
7882    return res;
7883  }
7884
7885  protected void parseClinicalUseDefinitionUndesirableEffectComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res) throws IOException, FHIRFormatError {
7886    parseBackboneElementProperties(json, res);
7887    if (json.has("symptomConditionEffect"))
7888      res.setSymptomConditionEffect(parseCodeableReference(getJObject(json, "symptomConditionEffect")));
7889    if (json.has("classification"))
7890      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
7891    if (json.has("frequencyOfOccurrence"))
7892      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
7893  }
7894
7895  protected ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent parseClinicalUseDefinitionWarningComponent(JsonObject json) throws IOException, FHIRFormatError {
7896    ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent();
7897    parseClinicalUseDefinitionWarningComponentProperties(json, res);
7898    return res;
7899  }
7900
7901  protected void parseClinicalUseDefinitionWarningComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res) throws IOException, FHIRFormatError {
7902    parseBackboneElementProperties(json, res);
7903    if (json.has("description"))
7904      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7905    if (json.has("_description"))
7906      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7907    if (json.has("code"))
7908      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7909  }
7910
7911  protected ClinicalUseIssue parseClinicalUseIssue(JsonObject json) throws IOException, FHIRFormatError {
7912    ClinicalUseIssue res = new ClinicalUseIssue();
7913    parseClinicalUseIssueProperties(json, res);
7914    return res;
7915  }
7916
7917  protected void parseClinicalUseIssueProperties(JsonObject json, ClinicalUseIssue res) throws IOException, FHIRFormatError {
7918    parseDomainResourceProperties(json, res);
7919    if (json.has("identifier")) {
7920      JsonArray array = getJArray(json, "identifier");
7921      for (int i = 0; i < array.size(); i++) {
7922        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7923      }
7924    };
7925    if (json.has("type"))
7926      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ClinicalUseIssueType.NULL, new Enumerations.ClinicalUseIssueTypeEnumFactory()));
7927    if (json.has("_type"))
7928      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7929    if (json.has("category")) {
7930      JsonArray array = getJArray(json, "category");
7931      for (int i = 0; i < array.size(); i++) {
7932        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7933      }
7934    };
7935    if (json.has("subject")) {
7936      JsonArray array = getJArray(json, "subject");
7937      for (int i = 0; i < array.size(); i++) {
7938        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7939      }
7940    };
7941    if (json.has("status"))
7942      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
7943    if (json.has("description"))
7944      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7945    if (json.has("_description"))
7946      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7947    if (json.has("contraindication"))
7948      res.setContraindication(parseClinicalUseIssueContraindicationComponent(getJObject(json, "contraindication")));
7949    if (json.has("indication"))
7950      res.setIndication(parseClinicalUseIssueIndicationComponent(getJObject(json, "indication")));
7951    if (json.has("interaction"))
7952      res.setInteraction(parseClinicalUseIssueInteractionComponent(getJObject(json, "interaction")));
7953    if (json.has("population")) {
7954      JsonArray array = getJArray(json, "population");
7955      for (int i = 0; i < array.size(); i++) {
7956        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
7957      }
7958    };
7959    if (json.has("undesirableEffect"))
7960      res.setUndesirableEffect(parseClinicalUseIssueUndesirableEffectComponent(getJObject(json, "undesirableEffect")));
7961  }
7962
7963  protected ClinicalUseIssue.ClinicalUseIssueContraindicationComponent parseClinicalUseIssueContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7964    ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationComponent();
7965    parseClinicalUseIssueContraindicationComponentProperties(json, res);
7966    return res;
7967  }
7968
7969  protected void parseClinicalUseIssueContraindicationComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res) throws IOException, FHIRFormatError {
7970    parseBackboneElementProperties(json, res);
7971    if (json.has("diseaseSymptomProcedure"))
7972      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7973    if (json.has("diseaseStatus"))
7974      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7975    if (json.has("comorbidity")) {
7976      JsonArray array = getJArray(json, "comorbidity");
7977      for (int i = 0; i < array.size(); i++) {
7978        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7979      }
7980    };
7981    if (json.has("indication")) {
7982      JsonArray array = getJArray(json, "indication");
7983      for (int i = 0; i < array.size(); i++) {
7984        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
7985      }
7986    };
7987    if (json.has("otherTherapy")) {
7988      JsonArray array = getJArray(json, "otherTherapy");
7989      for (int i = 0; i < array.size(); i++) {
7990        res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7991      }
7992    };
7993  }
7994
7995  protected ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent parseClinicalUseIssueContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
7996    ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent();
7997    parseClinicalUseIssueContraindicationOtherTherapyComponentProperties(json, res);
7998    return res;
7999  }
8000
8001  protected void parseClinicalUseIssueContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
8002    parseBackboneElementProperties(json, res);
8003    if (json.has("relationshipType"))
8004      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
8005    if (json.has("therapy"))
8006      res.setTherapy(parseCodeableReference(getJObject(json, "therapy")));
8007  }
8008
8009  protected ClinicalUseIssue.ClinicalUseIssueIndicationComponent parseClinicalUseIssueIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
8010    ClinicalUseIssue.ClinicalUseIssueIndicationComponent res = new ClinicalUseIssue.ClinicalUseIssueIndicationComponent();
8011    parseClinicalUseIssueIndicationComponentProperties(json, res);
8012    return res;
8013  }
8014
8015  protected void parseClinicalUseIssueIndicationComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueIndicationComponent res) throws IOException, FHIRFormatError {
8016    parseBackboneElementProperties(json, res);
8017    if (json.has("diseaseSymptomProcedure"))
8018      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
8019    if (json.has("diseaseStatus"))
8020      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
8021    if (json.has("comorbidity")) {
8022      JsonArray array = getJArray(json, "comorbidity");
8023      for (int i = 0; i < array.size(); i++) {
8024        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8025      }
8026    };
8027    if (json.has("intendedEffect"))
8028      res.setIntendedEffect(parseCodeableReference(getJObject(json, "intendedEffect")));
8029    if (json.has("duration"))
8030      res.setDuration(parseQuantity(getJObject(json, "duration")));
8031    if (json.has("undesirableEffect")) {
8032      JsonArray array = getJArray(json, "undesirableEffect");
8033      for (int i = 0; i < array.size(); i++) {
8034        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
8035      }
8036    };
8037    if (json.has("otherTherapy")) {
8038      JsonArray array = getJArray(json, "otherTherapy");
8039      for (int i = 0; i < array.size(); i++) {
8040        res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
8041      }
8042    };
8043  }
8044
8045  protected ClinicalUseIssue.ClinicalUseIssueInteractionComponent parseClinicalUseIssueInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
8046    ClinicalUseIssue.ClinicalUseIssueInteractionComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionComponent();
8047    parseClinicalUseIssueInteractionComponentProperties(json, res);
8048    return res;
8049  }
8050
8051  protected void parseClinicalUseIssueInteractionComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueInteractionComponent res) throws IOException, FHIRFormatError {
8052    parseBackboneElementProperties(json, res);
8053    if (json.has("interactant")) {
8054      JsonArray array = getJArray(json, "interactant");
8055      for (int i = 0; i < array.size(); i++) {
8056        res.getInteractant().add(parseClinicalUseIssueInteractionInteractantComponent(array.get(i).getAsJsonObject()));
8057      }
8058    };
8059    if (json.has("type"))
8060      res.setType(parseCodeableConcept(getJObject(json, "type")));
8061    if (json.has("effect"))
8062      res.setEffect(parseCodeableReference(getJObject(json, "effect")));
8063    if (json.has("incidence"))
8064      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
8065    if (json.has("management")) {
8066      JsonArray array = getJArray(json, "management");
8067      for (int i = 0; i < array.size(); i++) {
8068        res.getManagement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8069      }
8070    };
8071  }
8072
8073  protected ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent parseClinicalUseIssueInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
8074    ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent();
8075    parseClinicalUseIssueInteractionInteractantComponentProperties(json, res);
8076    return res;
8077  }
8078
8079  protected void parseClinicalUseIssueInteractionInteractantComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res) throws IOException, FHIRFormatError {
8080    parseBackboneElementProperties(json, res);
8081    DataType item = parseType("item", json);
8082    if (item != null)
8083      res.setItem(item);
8084  }
8085
8086  protected ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent parseClinicalUseIssueUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
8087    ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res = new ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent();
8088    parseClinicalUseIssueUndesirableEffectComponentProperties(json, res);
8089    return res;
8090  }
8091
8092  protected void parseClinicalUseIssueUndesirableEffectComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res) throws IOException, FHIRFormatError {
8093    parseBackboneElementProperties(json, res);
8094    if (json.has("symptomConditionEffect"))
8095      res.setSymptomConditionEffect(parseCodeableReference(getJObject(json, "symptomConditionEffect")));
8096    if (json.has("classification"))
8097      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
8098    if (json.has("frequencyOfOccurrence"))
8099      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
8100  }
8101
8102  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
8103    CodeSystem res = new CodeSystem();
8104    parseCodeSystemProperties(json, res);
8105    return res;
8106  }
8107
8108  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
8109    parseCanonicalResourceProperties(json, res);
8110    if (json.has("url"))
8111      res.setUrlElement(parseUri(json.get("url").getAsString()));
8112    if (json.has("_url"))
8113      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8114    if (json.has("identifier")) {
8115      JsonArray array = getJArray(json, "identifier");
8116      for (int i = 0; i < array.size(); i++) {
8117        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8118      }
8119    };
8120    if (json.has("version"))
8121      res.setVersionElement(parseString(json.get("version").getAsString()));
8122    if (json.has("_version"))
8123      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8124    if (json.has("name"))
8125      res.setNameElement(parseString(json.get("name").getAsString()));
8126    if (json.has("_name"))
8127      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8128    if (json.has("title"))
8129      res.setTitleElement(parseString(json.get("title").getAsString()));
8130    if (json.has("_title"))
8131      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8132    if (json.has("status"))
8133      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8134    if (json.has("_status"))
8135      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8136    if (json.has("experimental"))
8137      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8138    if (json.has("_experimental"))
8139      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8140    if (json.has("date"))
8141      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8142    if (json.has("_date"))
8143      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8144    if (json.has("publisher"))
8145      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8146    if (json.has("_publisher"))
8147      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8148    if (json.has("contact")) {
8149      JsonArray array = getJArray(json, "contact");
8150      for (int i = 0; i < array.size(); i++) {
8151        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8152      }
8153    };
8154    if (json.has("description"))
8155      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8156    if (json.has("_description"))
8157      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8158    if (json.has("useContext")) {
8159      JsonArray array = getJArray(json, "useContext");
8160      for (int i = 0; i < array.size(); i++) {
8161        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8162      }
8163    };
8164    if (json.has("jurisdiction")) {
8165      JsonArray array = getJArray(json, "jurisdiction");
8166      for (int i = 0; i < array.size(); i++) {
8167        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8168      }
8169    };
8170    if (json.has("purpose"))
8171      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8172    if (json.has("_purpose"))
8173      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8174    if (json.has("copyright"))
8175      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8176    if (json.has("_copyright"))
8177      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8178    if (json.has("caseSensitive"))
8179      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
8180    if (json.has("_caseSensitive"))
8181      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
8182    if (json.has("valueSet"))
8183      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
8184    if (json.has("_valueSet"))
8185      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
8186    if (json.has("hierarchyMeaning"))
8187      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
8188    if (json.has("_hierarchyMeaning"))
8189      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
8190    if (json.has("compositional"))
8191      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
8192    if (json.has("_compositional"))
8193      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
8194    if (json.has("versionNeeded"))
8195      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
8196    if (json.has("_versionNeeded"))
8197      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
8198    if (json.has("content"))
8199      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
8200    if (json.has("_content"))
8201      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
8202    if (json.has("supplements"))
8203      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
8204    if (json.has("_supplements"))
8205      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
8206    if (json.has("count"))
8207      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
8208    if (json.has("_count"))
8209      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
8210    if (json.has("filter")) {
8211      JsonArray array = getJArray(json, "filter");
8212      for (int i = 0; i < array.size(); i++) {
8213        res.getFilter().add(parseCodeSystemFilterComponent(array.get(i).getAsJsonObject()));
8214      }
8215    };
8216    if (json.has("property")) {
8217      JsonArray array = getJArray(json, "property");
8218      for (int i = 0; i < array.size(); i++) {
8219        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject()));
8220      }
8221    };
8222    if (json.has("concept")) {
8223      JsonArray array = getJArray(json, "concept");
8224      for (int i = 0; i < array.size(); i++) {
8225        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8226      }
8227    };
8228  }
8229
8230  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
8231    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
8232    parseCodeSystemFilterComponentProperties(json, res);
8233    return res;
8234  }
8235
8236  protected void parseCodeSystemFilterComponentProperties(JsonObject json, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
8237    parseBackboneElementProperties(json, res);
8238    if (json.has("code"))
8239      res.setCodeElement(parseCode(json.get("code").getAsString()));
8240    if (json.has("_code"))
8241      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8242    if (json.has("description"))
8243      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8244    if (json.has("_description"))
8245      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8246    if (json.has("operator")) {
8247      JsonArray array = getJArray(json, "operator");
8248      for (int i = 0; i < array.size(); i++) {
8249        if (array.get(i).isJsonNull()) {
8250          res.getOperator().add(new Enumeration<Enumerations.FilterOperator>(new Enumerations.FilterOperatorEnumFactory(), Enumerations.FilterOperator.NULL));
8251        } else {;
8252          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8253        }
8254      }
8255    };
8256    if (json.has("_operator")) {
8257      JsonArray array = getJArray(json, "_operator");
8258      for (int i = 0; i < array.size(); i++) {
8259        if (i == res.getOperator().size())
8260          res.getOperator().add(parseEnumeration(null, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8261        if (array.get(i) instanceof JsonObject) 
8262          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
8263      }
8264    };
8265    if (json.has("value"))
8266      res.setValueElement(parseString(json.get("value").getAsString()));
8267    if (json.has("_value"))
8268      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8269  }
8270
8271  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8272    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
8273    parseCodeSystemPropertyComponentProperties(json, res);
8274    return res;
8275  }
8276
8277  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
8278    parseBackboneElementProperties(json, res);
8279    if (json.has("code"))
8280      res.setCodeElement(parseCode(json.get("code").getAsString()));
8281    if (json.has("_code"))
8282      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8283    if (json.has("uri"))
8284      res.setUriElement(parseUri(json.get("uri").getAsString()));
8285    if (json.has("_uri"))
8286      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
8287    if (json.has("description"))
8288      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8289    if (json.has("_description"))
8290      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8291    if (json.has("type"))
8292      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
8293    if (json.has("_type"))
8294      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8295  }
8296
8297  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
8298    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
8299    parseCodeSystemConceptDefinitionComponentProperties(json, res);
8300    return res;
8301  }
8302
8303  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
8304    parseBackboneElementProperties(json, res);
8305    if (json.has("code"))
8306      res.setCodeElement(parseCode(json.get("code").getAsString()));
8307    if (json.has("_code"))
8308      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8309    if (json.has("display"))
8310      res.setDisplayElement(parseString(json.get("display").getAsString()));
8311    if (json.has("_display"))
8312      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8313    if (json.has("definition"))
8314      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
8315    if (json.has("_definition"))
8316      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
8317    if (json.has("designation")) {
8318      JsonArray array = getJArray(json, "designation");
8319      for (int i = 0; i < array.size(); i++) {
8320        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject()));
8321      }
8322    };
8323    if (json.has("property")) {
8324      JsonArray array = getJArray(json, "property");
8325      for (int i = 0; i < array.size(); i++) {
8326        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject()));
8327      }
8328    };
8329    if (json.has("concept")) {
8330      JsonArray array = getJArray(json, "concept");
8331      for (int i = 0; i < array.size(); i++) {
8332        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8333      }
8334    };
8335  }
8336
8337  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
8338    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
8339    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, res);
8340    return res;
8341  }
8342
8343  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
8344    parseBackboneElementProperties(json, res);
8345    if (json.has("language"))
8346      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8347    if (json.has("_language"))
8348      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8349    if (json.has("use"))
8350      res.setUse(parseCoding(getJObject(json, "use")));
8351    if (json.has("value"))
8352      res.setValueElement(parseString(json.get("value").getAsString()));
8353    if (json.has("_value"))
8354      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8355  }
8356
8357  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8358    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
8359    parseCodeSystemConceptPropertyComponentProperties(json, res);
8360    return res;
8361  }
8362
8363  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
8364    parseBackboneElementProperties(json, res);
8365    if (json.has("code"))
8366      res.setCodeElement(parseCode(json.get("code").getAsString()));
8367    if (json.has("_code"))
8368      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8369    DataType value = parseType("value", json);
8370    if (value != null)
8371      res.setValue(value);
8372  }
8373
8374  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
8375    Communication res = new Communication();
8376    parseCommunicationProperties(json, res);
8377    return res;
8378  }
8379
8380  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
8381    parseDomainResourceProperties(json, res);
8382    if (json.has("identifier")) {
8383      JsonArray array = getJArray(json, "identifier");
8384      for (int i = 0; i < array.size(); i++) {
8385        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8386      }
8387    };
8388    if (json.has("instantiatesCanonical")) {
8389      JsonArray array = getJArray(json, "instantiatesCanonical");
8390      for (int i = 0; i < array.size(); i++) {
8391        if (array.get(i).isJsonNull()) {
8392          res.getInstantiatesCanonical().add(new CanonicalType());
8393        } else {;
8394          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
8395        }
8396      }
8397    };
8398    if (json.has("_instantiatesCanonical")) {
8399      JsonArray array = getJArray(json, "_instantiatesCanonical");
8400      for (int i = 0; i < array.size(); i++) {
8401        if (i == res.getInstantiatesCanonical().size())
8402          res.getInstantiatesCanonical().add(parseCanonical(null));
8403        if (array.get(i) instanceof JsonObject) 
8404          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
8405      }
8406    };
8407    if (json.has("instantiatesUri")) {
8408      JsonArray array = getJArray(json, "instantiatesUri");
8409      for (int i = 0; i < array.size(); i++) {
8410        if (array.get(i).isJsonNull()) {
8411          res.getInstantiatesUri().add(new UriType());
8412        } else {;
8413          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
8414        }
8415      }
8416    };
8417    if (json.has("_instantiatesUri")) {
8418      JsonArray array = getJArray(json, "_instantiatesUri");
8419      for (int i = 0; i < array.size(); i++) {
8420        if (i == res.getInstantiatesUri().size())
8421          res.getInstantiatesUri().add(parseUri(null));
8422        if (array.get(i) instanceof JsonObject) 
8423          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
8424      }
8425    };
8426    if (json.has("basedOn")) {
8427      JsonArray array = getJArray(json, "basedOn");
8428      for (int i = 0; i < array.size(); i++) {
8429        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8430      }
8431    };
8432    if (json.has("partOf")) {
8433      JsonArray array = getJArray(json, "partOf");
8434      for (int i = 0; i < array.size(); i++) {
8435        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
8436      }
8437    };
8438    if (json.has("inResponseTo")) {
8439      JsonArray array = getJArray(json, "inResponseTo");
8440      for (int i = 0; i < array.size(); i++) {
8441        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
8442      }
8443    };
8444    if (json.has("status"))
8445      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
8446    if (json.has("_status"))
8447      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8448    if (json.has("statusReason"))
8449      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8450    if (json.has("category")) {
8451      JsonArray array = getJArray(json, "category");
8452      for (int i = 0; i < array.size(); i++) {
8453        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8454      }
8455    };
8456    if (json.has("priority"))
8457      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
8458    if (json.has("_priority"))
8459      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
8460    if (json.has("medium")) {
8461      JsonArray array = getJArray(json, "medium");
8462      for (int i = 0; i < array.size(); i++) {
8463        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8464      }
8465    };
8466    if (json.has("subject"))
8467      res.setSubject(parseReference(getJObject(json, "subject")));
8468    if (json.has("topic"))
8469      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
8470    if (json.has("about")) {
8471      JsonArray array = getJArray(json, "about");
8472      for (int i = 0; i < array.size(); i++) {
8473        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
8474      }
8475    };
8476    if (json.has("encounter"))
8477      res.setEncounter(parseReference(getJObject(json, "encounter")));
8478    if (json.has("sent"))
8479      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
8480    if (json.has("_sent"))
8481      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
8482    if (json.has("received"))
8483      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
8484    if (json.has("_received"))
8485      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
8486    if (json.has("recipient")) {
8487      JsonArray array = getJArray(json, "recipient");
8488      for (int i = 0; i < array.size(); i++) {
8489        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
8490      }
8491    };
8492    if (json.has("sender"))
8493      res.setSender(parseReference(getJObject(json, "sender")));
8494    if (json.has("reason")) {
8495      JsonArray array = getJArray(json, "reason");
8496      for (int i = 0; i < array.size(); i++) {
8497        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8498      }
8499    };
8500    if (json.has("payload")) {
8501      JsonArray array = getJArray(json, "payload");
8502      for (int i = 0; i < array.size(); i++) {
8503        res.getPayload().add(parseCommunicationPayloadComponent(array.get(i).getAsJsonObject()));
8504      }
8505    };
8506    if (json.has("note")) {
8507      JsonArray array = getJArray(json, "note");
8508      for (int i = 0; i < array.size(); i++) {
8509        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8510      }
8511    };
8512  }
8513
8514  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
8515    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
8516    parseCommunicationPayloadComponentProperties(json, res);
8517    return res;
8518  }
8519
8520  protected void parseCommunicationPayloadComponentProperties(JsonObject json, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
8521    parseBackboneElementProperties(json, res);
8522    DataType content = parseType("content", json);
8523    if (content != null)
8524      res.setContent(content);
8525  }
8526
8527  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
8528    CommunicationRequest res = new CommunicationRequest();
8529    parseCommunicationRequestProperties(json, res);
8530    return res;
8531  }
8532
8533  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
8534    parseDomainResourceProperties(json, res);
8535    if (json.has("identifier")) {
8536      JsonArray array = getJArray(json, "identifier");
8537      for (int i = 0; i < array.size(); i++) {
8538        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8539      }
8540    };
8541    if (json.has("basedOn")) {
8542      JsonArray array = getJArray(json, "basedOn");
8543      for (int i = 0; i < array.size(); i++) {
8544        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8545      }
8546    };
8547    if (json.has("replaces")) {
8548      JsonArray array = getJArray(json, "replaces");
8549      for (int i = 0; i < array.size(); i++) {
8550        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
8551      }
8552    };
8553    if (json.has("groupIdentifier"))
8554      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
8555    if (json.has("status"))
8556      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
8557    if (json.has("_status"))
8558      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8559    if (json.has("statusReason"))
8560      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8561    if (json.has("intent"))
8562      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
8563    if (json.has("_intent"))
8564      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
8565    if (json.has("category")) {
8566      JsonArray array = getJArray(json, "category");
8567      for (int i = 0; i < array.size(); i++) {
8568        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8569      }
8570    };
8571    if (json.has("priority"))
8572      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
8573    if (json.has("_priority"))
8574      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
8575    if (json.has("doNotPerform"))
8576      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8577    if (json.has("_doNotPerform"))
8578      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
8579    if (json.has("medium")) {
8580      JsonArray array = getJArray(json, "medium");
8581      for (int i = 0; i < array.size(); i++) {
8582        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8583      }
8584    };
8585    if (json.has("subject"))
8586      res.setSubject(parseReference(getJObject(json, "subject")));
8587    if (json.has("about")) {
8588      JsonArray array = getJArray(json, "about");
8589      for (int i = 0; i < array.size(); i++) {
8590        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
8591      }
8592    };
8593    if (json.has("encounter"))
8594      res.setEncounter(parseReference(getJObject(json, "encounter")));
8595    if (json.has("payload")) {
8596      JsonArray array = getJArray(json, "payload");
8597      for (int i = 0; i < array.size(); i++) {
8598        res.getPayload().add(parseCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject()));
8599      }
8600    };
8601    DataType occurrence = parseType("occurrence", json);
8602    if (occurrence != null)
8603      res.setOccurrence(occurrence);
8604    if (json.has("authoredOn"))
8605      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
8606    if (json.has("_authoredOn"))
8607      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
8608    if (json.has("requester"))
8609      res.setRequester(parseReference(getJObject(json, "requester")));
8610    if (json.has("recipient")) {
8611      JsonArray array = getJArray(json, "recipient");
8612      for (int i = 0; i < array.size(); i++) {
8613        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
8614      }
8615    };
8616    if (json.has("informationProvider")) {
8617      JsonArray array = getJArray(json, "informationProvider");
8618      for (int i = 0; i < array.size(); i++) {
8619        res.getInformationProvider().add(parseReference(array.get(i).getAsJsonObject()));
8620      }
8621    };
8622    if (json.has("reason")) {
8623      JsonArray array = getJArray(json, "reason");
8624      for (int i = 0; i < array.size(); i++) {
8625        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8626      }
8627    };
8628    if (json.has("note")) {
8629      JsonArray array = getJArray(json, "note");
8630      for (int i = 0; i < array.size(); i++) {
8631        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8632      }
8633    };
8634  }
8635
8636  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
8637    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
8638    parseCommunicationRequestPayloadComponentProperties(json, res);
8639    return res;
8640  }
8641
8642  protected void parseCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
8643    parseBackboneElementProperties(json, res);
8644    DataType content = parseType("content", json);
8645    if (content != null)
8646      res.setContent(content);
8647  }
8648
8649  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
8650    CompartmentDefinition res = new CompartmentDefinition();
8651    parseCompartmentDefinitionProperties(json, res);
8652    return res;
8653  }
8654
8655  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
8656    parseCanonicalResourceProperties(json, res);
8657    if (json.has("url"))
8658      res.setUrlElement(parseUri(json.get("url").getAsString()));
8659    if (json.has("_url"))
8660      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8661    if (json.has("version"))
8662      res.setVersionElement(parseString(json.get("version").getAsString()));
8663    if (json.has("_version"))
8664      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8665    if (json.has("name"))
8666      res.setNameElement(parseString(json.get("name").getAsString()));
8667    if (json.has("_name"))
8668      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8669    if (json.has("status"))
8670      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8671    if (json.has("_status"))
8672      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8673    if (json.has("experimental"))
8674      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8675    if (json.has("_experimental"))
8676      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8677    if (json.has("date"))
8678      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8679    if (json.has("_date"))
8680      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8681    if (json.has("publisher"))
8682      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8683    if (json.has("_publisher"))
8684      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8685    if (json.has("contact")) {
8686      JsonArray array = getJArray(json, "contact");
8687      for (int i = 0; i < array.size(); i++) {
8688        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8689      }
8690    };
8691    if (json.has("description"))
8692      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8693    if (json.has("_description"))
8694      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8695    if (json.has("useContext")) {
8696      JsonArray array = getJArray(json, "useContext");
8697      for (int i = 0; i < array.size(); i++) {
8698        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8699      }
8700    };
8701    if (json.has("purpose"))
8702      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8703    if (json.has("_purpose"))
8704      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8705    if (json.has("code"))
8706      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
8707    if (json.has("_code"))
8708      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8709    if (json.has("search"))
8710      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
8711    if (json.has("_search"))
8712      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
8713    if (json.has("resource")) {
8714      JsonArray array = getJArray(json, "resource");
8715      for (int i = 0; i < array.size(); i++) {
8716        res.getResource().add(parseCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject()));
8717      }
8718    };
8719  }
8720
8721  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
8722    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
8723    parseCompartmentDefinitionResourceComponentProperties(json, res);
8724    return res;
8725  }
8726
8727  protected void parseCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
8728    parseBackboneElementProperties(json, res);
8729    if (json.has("code"))
8730      res.setCodeElement(parseCode(json.get("code").getAsString()));
8731    if (json.has("_code"))
8732      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8733    if (json.has("param")) {
8734      JsonArray array = getJArray(json, "param");
8735      for (int i = 0; i < array.size(); i++) {
8736        if (array.get(i).isJsonNull()) {
8737          res.getParam().add(new StringType());
8738        } else {;
8739          res.getParam().add(parseString(array.get(i).getAsString()));
8740        }
8741      }
8742    };
8743    if (json.has("_param")) {
8744      JsonArray array = getJArray(json, "_param");
8745      for (int i = 0; i < array.size(); i++) {
8746        if (i == res.getParam().size())
8747          res.getParam().add(parseString(null));
8748        if (array.get(i) instanceof JsonObject) 
8749          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
8750      }
8751    };
8752    if (json.has("documentation"))
8753      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
8754    if (json.has("_documentation"))
8755      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
8756  }
8757
8758  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
8759    Composition res = new Composition();
8760    parseCompositionProperties(json, res);
8761    return res;
8762  }
8763
8764  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
8765    parseDomainResourceProperties(json, res);
8766    if (json.has("identifier"))
8767      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8768    if (json.has("status"))
8769      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
8770    if (json.has("_status"))
8771      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8772    if (json.has("type"))
8773      res.setType(parseCodeableConcept(getJObject(json, "type")));
8774    if (json.has("category")) {
8775      JsonArray array = getJArray(json, "category");
8776      for (int i = 0; i < array.size(); i++) {
8777        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8778      }
8779    };
8780    if (json.has("subject"))
8781      res.setSubject(parseReference(getJObject(json, "subject")));
8782    if (json.has("encounter"))
8783      res.setEncounter(parseReference(getJObject(json, "encounter")));
8784    if (json.has("date"))
8785      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8786    if (json.has("_date"))
8787      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8788    if (json.has("author")) {
8789      JsonArray array = getJArray(json, "author");
8790      for (int i = 0; i < array.size(); i++) {
8791        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8792      }
8793    };
8794    if (json.has("title"))
8795      res.setTitleElement(parseString(json.get("title").getAsString()));
8796    if (json.has("_title"))
8797      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8798    if (json.has("confidentiality"))
8799      res.setConfidentialityElement(parseCode(json.get("confidentiality").getAsString()));
8800    if (json.has("_confidentiality"))
8801      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
8802    if (json.has("attester")) {
8803      JsonArray array = getJArray(json, "attester");
8804      for (int i = 0; i < array.size(); i++) {
8805        res.getAttester().add(parseCompositionAttesterComponent(array.get(i).getAsJsonObject()));
8806      }
8807    };
8808    if (json.has("custodian"))
8809      res.setCustodian(parseReference(getJObject(json, "custodian")));
8810    if (json.has("relatesTo")) {
8811      JsonArray array = getJArray(json, "relatesTo");
8812      for (int i = 0; i < array.size(); i++) {
8813        res.getRelatesTo().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
8814      }
8815    };
8816    if (json.has("event")) {
8817      JsonArray array = getJArray(json, "event");
8818      for (int i = 0; i < array.size(); i++) {
8819        res.getEvent().add(parseCompositionEventComponent(array.get(i).getAsJsonObject()));
8820      }
8821    };
8822    if (json.has("section")) {
8823      JsonArray array = getJArray(json, "section");
8824      for (int i = 0; i < array.size(); i++) {
8825        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8826      }
8827    };
8828  }
8829
8830  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
8831    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
8832    parseCompositionAttesterComponentProperties(json, res);
8833    return res;
8834  }
8835
8836  protected void parseCompositionAttesterComponentProperties(JsonObject json, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
8837    parseBackboneElementProperties(json, res);
8838    if (json.has("mode"))
8839      res.setMode(parseCodeableConcept(getJObject(json, "mode")));
8840    if (json.has("time"))
8841      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
8842    if (json.has("_time"))
8843      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
8844    if (json.has("party"))
8845      res.setParty(parseReference(getJObject(json, "party")));
8846  }
8847
8848  protected Composition.CompositionEventComponent parseCompositionEventComponent(JsonObject json) throws IOException, FHIRFormatError {
8849    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
8850    parseCompositionEventComponentProperties(json, res);
8851    return res;
8852  }
8853
8854  protected void parseCompositionEventComponentProperties(JsonObject json, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
8855    parseBackboneElementProperties(json, res);
8856    if (json.has("code")) {
8857      JsonArray array = getJArray(json, "code");
8858      for (int i = 0; i < array.size(); i++) {
8859        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8860      }
8861    };
8862    if (json.has("period"))
8863      res.setPeriod(parsePeriod(getJObject(json, "period")));
8864    if (json.has("detail")) {
8865      JsonArray array = getJArray(json, "detail");
8866      for (int i = 0; i < array.size(); i++) {
8867        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8868      }
8869    };
8870  }
8871
8872  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
8873    Composition.SectionComponent res = new Composition.SectionComponent();
8874    parseCompositionSectionComponentProperties(json, res);
8875    return res;
8876  }
8877
8878  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition.SectionComponent res) throws IOException, FHIRFormatError {
8879    parseBackboneElementProperties(json, res);
8880    if (json.has("title"))
8881      res.setTitleElement(parseString(json.get("title").getAsString()));
8882    if (json.has("_title"))
8883      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8884    if (json.has("code"))
8885      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8886    if (json.has("author")) {
8887      JsonArray array = getJArray(json, "author");
8888      for (int i = 0; i < array.size(); i++) {
8889        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8890      }
8891    };
8892    if (json.has("focus"))
8893      res.setFocus(parseReference(getJObject(json, "focus")));
8894    if (json.has("text"))
8895      res.setText(parseNarrative(getJObject(json, "text")));
8896    if (json.has("mode"))
8897      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
8898    if (json.has("_mode"))
8899      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8900    if (json.has("orderedBy"))
8901      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
8902    if (json.has("entry")) {
8903      JsonArray array = getJArray(json, "entry");
8904      for (int i = 0; i < array.size(); i++) {
8905        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
8906      }
8907    };
8908    if (json.has("emptyReason"))
8909      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
8910    if (json.has("section")) {
8911      JsonArray array = getJArray(json, "section");
8912      for (int i = 0; i < array.size(); i++) {
8913        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8914      }
8915    };
8916  }
8917
8918  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
8919    ConceptMap res = new ConceptMap();
8920    parseConceptMapProperties(json, res);
8921    return res;
8922  }
8923
8924  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
8925    parseCanonicalResourceProperties(json, res);
8926    if (json.has("url"))
8927      res.setUrlElement(parseUri(json.get("url").getAsString()));
8928    if (json.has("_url"))
8929      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8930    if (json.has("identifier")) {
8931      JsonArray array = getJArray(json, "identifier");
8932      for (int i = 0; i < array.size(); i++) {
8933        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8934      }
8935    };
8936    if (json.has("version"))
8937      res.setVersionElement(parseString(json.get("version").getAsString()));
8938    if (json.has("_version"))
8939      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8940    if (json.has("name"))
8941      res.setNameElement(parseString(json.get("name").getAsString()));
8942    if (json.has("_name"))
8943      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8944    if (json.has("title"))