001package org.hl7.fhir.dstu3.formats;
002
003import java.io.IOException;
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
034// Generated on Mon, Apr 17, 2017 08:38+1000 for FHIR v3.0.x
035import org.hl7.fhir.dstu3.model.*;
036import org.hl7.fhir.exceptions.FHIRFormatError;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.utilities.xhtml.XhtmlNode;
039
040import com.google.gson.JsonArray;
041import com.google.gson.JsonObject;
042
043public class JsonParser extends JsonParserBase {
044
045  public JsonParser() {
046    super();
047  }
048
049  public JsonParser(boolean allowUnknownContent) {
050    super();
051    setAllowUnknownContent(allowUnknownContent);
052  }
053
054
055  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
056    super.parseElementProperties(json, element);
057    if (json.has("extension")) {
058      JsonArray array = json.getAsJsonArray("extension");
059      for (int i = 0; i < array.size(); i++) {
060        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
061      }
062    };
063  }
064
065  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
066    parseElementProperties(json, element);
067    if (json.has("modifierExtension")) {
068      JsonArray array = json.getAsJsonArray("modifierExtension");
069      for (int i = 0; i < array.size(); i++) {
070        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
071      }
072    }
073  }
074
075  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
076    parseElementProperties(json, element);
077  }
078
079  @SuppressWarnings("unchecked")
080  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
081    Enumeration<E> res = new Enumeration<E>(e);
082    if (s != null)
083      res.setValue((E) e.fromCode(s));
084    return res;
085  }
086
087  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
088    DateType res = new DateType(v);
089    return res;
090  }
091
092  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
093    DateTimeType res = new DateTimeType(v);
094    return res;
095  }
096
097  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
098    CodeType res = new CodeType(v);
099    return res;
100  }
101
102  protected StringType parseString(String v) throws IOException, FHIRFormatError {
103    StringType res = new StringType(v);
104    return res;
105  }
106
107  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
108    IntegerType res = new IntegerType(v);
109    return res;
110  }
111
112  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
113    OidType res = new OidType(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 InstantType parseInstant(String v) throws IOException, FHIRFormatError {
128    InstantType res = new InstantType(v);
129    return res;
130  }
131
132  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
133    BooleanType res = new BooleanType(v);
134    return res;
135  }
136
137  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
138    Base64BinaryType res = new Base64BinaryType(v);
139    return res;
140  }
141
142  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
143    UnsignedIntType res = new UnsignedIntType(v);
144    return res;
145  }
146
147  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
148    MarkdownType res = new MarkdownType(v);
149    return res;
150  }
151
152  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
153    TimeType res = new TimeType(v);
154    return res;
155  }
156
157  protected IdType parseId(String v) throws IOException, FHIRFormatError {
158    IdType res = new IdType(v);
159    return res;
160  }
161
162  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
163    PositiveIntType res = new PositiveIntType(v);
164    return res;
165  }
166
167  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
168    DecimalType res = new DecimalType(v);
169    return res;
170  }
171
172  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
173    Extension res = new Extension();
174    parseExtensionProperties(json, res);
175    return res;
176  }
177
178  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
179    parseTypeProperties(json, res);
180    if (json.has("url"))
181      res.setUrlElement(parseUri(json.get("url").getAsString()));
182    if (json.has("_url"))
183      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
184    Type value = parseType("value", json);
185    if (value != null)
186      res.setValue(value);
187  }
188
189  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
190    Narrative res = new Narrative();
191    parseNarrativeProperties(json, res);
192    return res;
193  }
194
195  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
196    parseTypeProperties(json, res);
197    if (json.has("status"))
198      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
199    if (json.has("_status"))
200      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
201    if (json.has("div"))
202      res.setDiv(parseXhtml(json.get("div").getAsString()));
203  }
204
205  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
206    Reference res = new Reference();
207    parseReferenceProperties(json, res);
208    return res;
209  }
210
211  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
212    parseTypeProperties(json, res);
213    if (json.has("reference"))
214      res.setReferenceElement(parseString(json.get("reference").getAsString()));
215    if (json.has("_reference"))
216      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
217    if (json.has("identifier"))
218      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
219    if (json.has("display"))
220      res.setDisplayElement(parseString(json.get("display").getAsString()));
221    if (json.has("_display"))
222      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
223  }
224
225  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
226    Quantity res = new Quantity();
227    parseQuantityProperties(json, res);
228    return res;
229  }
230
231  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
232    parseTypeProperties(json, res);
233    if (json.has("value"))
234      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
235    if (json.has("_value"))
236      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
237    if (json.has("comparator"))
238      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
239    if (json.has("_comparator"))
240      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
241    if (json.has("unit"))
242      res.setUnitElement(parseString(json.get("unit").getAsString()));
243    if (json.has("_unit"))
244      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
245    if (json.has("system"))
246      res.setSystemElement(parseUri(json.get("system").getAsString()));
247    if (json.has("_system"))
248      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
249    if (json.has("code"))
250      res.setCodeElement(parseCode(json.get("code").getAsString()));
251    if (json.has("_code"))
252      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
253  }
254
255  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
256    Period res = new Period();
257    parsePeriodProperties(json, res);
258    return res;
259  }
260
261  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
262    parseTypeProperties(json, res);
263    if (json.has("start"))
264      res.setStartElement(parseDateTime(json.get("start").getAsString()));
265    if (json.has("_start"))
266      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
267    if (json.has("end"))
268      res.setEndElement(parseDateTime(json.get("end").getAsString()));
269    if (json.has("_end"))
270      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
271  }
272
273  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
274    Attachment res = new Attachment();
275    parseAttachmentProperties(json, res);
276    return res;
277  }
278
279  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
280    parseTypeProperties(json, res);
281    if (json.has("contentType"))
282      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
283    if (json.has("_contentType"))
284      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
285    if (json.has("language"))
286      res.setLanguageElement(parseCode(json.get("language").getAsString()));
287    if (json.has("_language"))
288      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
289    if (json.has("data"))
290      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
291    if (json.has("_data"))
292      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
293    if (json.has("url"))
294      res.setUrlElement(parseUri(json.get("url").getAsString()));
295    if (json.has("_url"))
296      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
297    if (json.has("size"))
298      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
299    if (json.has("_size"))
300      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
301    if (json.has("hash"))
302      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
303    if (json.has("_hash"))
304      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
305    if (json.has("title"))
306      res.setTitleElement(parseString(json.get("title").getAsString()));
307    if (json.has("_title"))
308      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
309    if (json.has("creation"))
310      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
311    if (json.has("_creation"))
312      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
313  }
314
315  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
316    Duration res = new Duration();
317    parseDurationProperties(json, res);
318    return res;
319  }
320
321  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
322    parseQuantityProperties(json, res);
323  }
324
325  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
326    Count res = new Count();
327    parseCountProperties(json, res);
328    return res;
329  }
330
331  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
332    parseQuantityProperties(json, res);
333  }
334
335  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
336    Range res = new Range();
337    parseRangeProperties(json, res);
338    return res;
339  }
340
341  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
342    parseTypeProperties(json, res);
343    if (json.has("low"))
344      res.setLow(parseSimpleQuantity(getJObject(json, "low")));
345    if (json.has("high"))
346      res.setHigh(parseSimpleQuantity(getJObject(json, "high")));
347  }
348
349  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
350    Annotation res = new Annotation();
351    parseAnnotationProperties(json, res);
352    return res;
353  }
354
355  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
356    parseTypeProperties(json, res);
357    Type author = parseType("author", json);
358    if (author != null)
359      res.setAuthor(author);
360    if (json.has("time"))
361      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
362    if (json.has("_time"))
363      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
364    if (json.has("text"))
365      res.setTextElement(parseString(json.get("text").getAsString()));
366    if (json.has("_text"))
367      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
368  }
369
370  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
371    Money res = new Money();
372    parseMoneyProperties(json, res);
373    return res;
374  }
375
376  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
377    parseQuantityProperties(json, res);
378  }
379
380  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
381    Identifier res = new Identifier();
382    parseIdentifierProperties(json, res);
383    return res;
384  }
385
386  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
387    parseTypeProperties(json, res);
388    if (json.has("use"))
389      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
390    if (json.has("_use"))
391      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
392    if (json.has("type"))
393      res.setType(parseCodeableConcept(getJObject(json, "type")));
394    if (json.has("system"))
395      res.setSystemElement(parseUri(json.get("system").getAsString()));
396    if (json.has("_system"))
397      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
398    if (json.has("value"))
399      res.setValueElement(parseString(json.get("value").getAsString()));
400    if (json.has("_value"))
401      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
402    if (json.has("period"))
403      res.setPeriod(parsePeriod(getJObject(json, "period")));
404    if (json.has("assigner"))
405      res.setAssigner(parseReference(getJObject(json, "assigner")));
406  }
407
408  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
409    Coding res = new Coding();
410    parseCodingProperties(json, res);
411    return res;
412  }
413
414  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
415    parseTypeProperties(json, res);
416    if (json.has("system"))
417      res.setSystemElement(parseUri(json.get("system").getAsString()));
418    if (json.has("_system"))
419      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
420    if (json.has("version"))
421      res.setVersionElement(parseString(json.get("version").getAsString()));
422    if (json.has("_version"))
423      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
424    if (json.has("code"))
425      res.setCodeElement(parseCode(json.get("code").getAsString()));
426    if (json.has("_code"))
427      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
428    if (json.has("display"))
429      res.setDisplayElement(parseString(json.get("display").getAsString()));
430    if (json.has("_display"))
431      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
432    if (json.has("userSelected"))
433      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
434    if (json.has("_userSelected"))
435      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
436  }
437
438  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
439    Signature res = new Signature();
440    parseSignatureProperties(json, res);
441    return res;
442  }
443
444  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
445    parseTypeProperties(json, res);
446    if (json.has("type")) {
447      JsonArray array = json.getAsJsonArray("type");
448      for (int i = 0; i < array.size(); i++) {
449        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
450      }
451    };
452    if (json.has("when"))
453      res.setWhenElement(parseInstant(json.get("when").getAsString()));
454    if (json.has("_when"))
455      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
456    Type who = parseType("who", json);
457    if (who != null)
458      res.setWho(who);
459    Type onBehalfOf = parseType("onBehalfOf", json);
460    if (onBehalfOf != null)
461      res.setOnBehalfOf(onBehalfOf);
462    if (json.has("contentType"))
463      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
464    if (json.has("_contentType"))
465      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
466    if (json.has("blob"))
467      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
468    if (json.has("_blob"))
469      parseElementProperties(getJObject(json, "_blob"), res.getBlobElement());
470  }
471
472  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
473    SampledData res = new SampledData();
474    parseSampledDataProperties(json, res);
475    return res;
476  }
477
478  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
479    parseTypeProperties(json, res);
480    if (json.has("origin"))
481      res.setOrigin(parseSimpleQuantity(getJObject(json, "origin")));
482    if (json.has("period"))
483      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
484    if (json.has("_period"))
485      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
486    if (json.has("factor"))
487      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
488    if (json.has("_factor"))
489      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
490    if (json.has("lowerLimit"))
491      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
492    if (json.has("_lowerLimit"))
493      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
494    if (json.has("upperLimit"))
495      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
496    if (json.has("_upperLimit"))
497      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
498    if (json.has("dimensions"))
499      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
500    if (json.has("_dimensions"))
501      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
502    if (json.has("data"))
503      res.setDataElement(parseString(json.get("data").getAsString()));
504    if (json.has("_data"))
505      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
506  }
507
508  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
509    Ratio res = new Ratio();
510    parseRatioProperties(json, res);
511    return res;
512  }
513
514  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
515    parseTypeProperties(json, res);
516    if (json.has("numerator"))
517      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
518    if (json.has("denominator"))
519      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
520  }
521
522  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
523    Distance res = new Distance();
524    parseDistanceProperties(json, res);
525    return res;
526  }
527
528  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
529    parseQuantityProperties(json, res);
530  }
531
532  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
533    Age res = new Age();
534    parseAgeProperties(json, res);
535    return res;
536  }
537
538  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
539    parseQuantityProperties(json, res);
540  }
541
542  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
543    CodeableConcept res = new CodeableConcept();
544    parseCodeableConceptProperties(json, res);
545    return res;
546  }
547
548  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
549    parseTypeProperties(json, res);
550    if (json.has("coding")) {
551      JsonArray array = json.getAsJsonArray("coding");
552      for (int i = 0; i < array.size(); i++) {
553        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
554      }
555    };
556    if (json.has("text"))
557      res.setTextElement(parseString(json.get("text").getAsString()));
558    if (json.has("_text"))
559      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
560  }
561
562  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
563    SimpleQuantity res = new SimpleQuantity();
564    parseSimpleQuantityProperties(json, res);
565    return res;
566  }
567
568  protected void parseSimpleQuantityProperties(JsonObject json, SimpleQuantity res) throws IOException, FHIRFormatError {
569    parseTypeProperties(json, res);
570    if (json.has("value"))
571      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
572    if (json.has("_value"))
573      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
574    if (json.has("comparator"))
575      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
576    if (json.has("_comparator"))
577      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
578    if (json.has("unit"))
579      res.setUnitElement(parseString(json.get("unit").getAsString()));
580    if (json.has("_unit"))
581      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
582    if (json.has("system"))
583      res.setSystemElement(parseUri(json.get("system").getAsString()));
584    if (json.has("_system"))
585      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
586    if (json.has("code"))
587      res.setCodeElement(parseCode(json.get("code").getAsString()));
588    if (json.has("_code"))
589      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
590  }
591
592  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
593    Meta res = new Meta();
594    parseMetaProperties(json, res);
595    return res;
596  }
597
598  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
599    parseElementProperties(json, res);
600    if (json.has("versionId"))
601      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
602    if (json.has("_versionId"))
603      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
604    if (json.has("lastUpdated"))
605      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
606    if (json.has("_lastUpdated"))
607      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
608    if (json.has("profile")) {
609      JsonArray array = json.getAsJsonArray("profile");
610      for (int i = 0; i < array.size(); i++) {
611        if (array.get(i).isJsonNull()) {
612          res.getProfile().add(new UriType());
613        } else {
614          res.getProfile().add(parseUri(array.get(i).getAsString()));
615        }
616      }
617    };
618    if (json.has("_profile")) {
619      JsonArray array = json.getAsJsonArray("_profile");
620      for (int i = 0; i < array.size(); i++) {
621        if (i == res.getProfile().size())
622          res.getProfile().add(parseUri(null));
623        if (array.get(i) instanceof JsonObject) 
624          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
625      }
626    };
627    if (json.has("security")) {
628      JsonArray array = json.getAsJsonArray("security");
629      for (int i = 0; i < array.size(); i++) {
630        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
631      }
632    };
633    if (json.has("tag")) {
634      JsonArray array = json.getAsJsonArray("tag");
635      for (int i = 0; i < array.size(); i++) {
636        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
637      }
638    };
639  }
640
641  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
642    Address res = new Address();
643    parseAddressProperties(json, res);
644    return res;
645  }
646
647  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
648    parseTypeProperties(json, res);
649    if (json.has("use"))
650      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
651    if (json.has("_use"))
652      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
653    if (json.has("type"))
654      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
655    if (json.has("_type"))
656      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
657    if (json.has("text"))
658      res.setTextElement(parseString(json.get("text").getAsString()));
659    if (json.has("_text"))
660      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
661    if (json.has("line")) {
662      JsonArray array = json.getAsJsonArray("line");
663      for (int i = 0; i < array.size(); i++) {
664        if (array.get(i).isJsonNull()) {
665          res.getLine().add(new StringType());
666        } else {
667          res.getLine().add(parseString(array.get(i).getAsString()));
668        }
669      }
670    };
671    if (json.has("_line")) {
672      JsonArray array = json.getAsJsonArray("_line");
673      for (int i = 0; i < array.size(); i++) {
674        if (i == res.getLine().size())
675          res.getLine().add(parseString(null));
676        if (array.get(i) instanceof JsonObject) 
677          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
678      }
679    };
680    if (json.has("city"))
681      res.setCityElement(parseString(json.get("city").getAsString()));
682    if (json.has("_city"))
683      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
684    if (json.has("district"))
685      res.setDistrictElement(parseString(json.get("district").getAsString()));
686    if (json.has("_district"))
687      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
688    if (json.has("state"))
689      res.setStateElement(parseString(json.get("state").getAsString()));
690    if (json.has("_state"))
691      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
692    if (json.has("postalCode"))
693      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
694    if (json.has("_postalCode"))
695      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
696    if (json.has("country"))
697      res.setCountryElement(parseString(json.get("country").getAsString()));
698    if (json.has("_country"))
699      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
700    if (json.has("period"))
701      res.setPeriod(parsePeriod(getJObject(json, "period")));
702  }
703
704  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
705    TriggerDefinition res = new TriggerDefinition();
706    parseTriggerDefinitionProperties(json, res);
707    return res;
708  }
709
710  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
711    parseTypeProperties(json, res);
712    if (json.has("type"))
713      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
714    if (json.has("_type"))
715      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
716    if (json.has("eventName"))
717      res.setEventNameElement(parseString(json.get("eventName").getAsString()));
718    if (json.has("_eventName"))
719      parseElementProperties(getJObject(json, "_eventName"), res.getEventNameElement());
720    Type eventTiming = parseType("eventTiming", json);
721    if (eventTiming != null)
722      res.setEventTiming(eventTiming);
723    if (json.has("eventData"))
724      res.setEventData(parseDataRequirement(getJObject(json, "eventData")));
725  }
726
727  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
728    Contributor res = new Contributor();
729    parseContributorProperties(json, res);
730    return res;
731  }
732
733  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
734    parseTypeProperties(json, res);
735    if (json.has("type"))
736      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
737    if (json.has("_type"))
738      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
739    if (json.has("name"))
740      res.setNameElement(parseString(json.get("name").getAsString()));
741    if (json.has("_name"))
742      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
743    if (json.has("contact")) {
744      JsonArray array = json.getAsJsonArray("contact");
745      for (int i = 0; i < array.size(); i++) {
746        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
747      }
748    };
749  }
750
751  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
752    DataRequirement res = new DataRequirement();
753    parseDataRequirementProperties(json, res);
754    return res;
755  }
756
757  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
758    parseTypeProperties(json, res);
759    if (json.has("type"))
760      res.setTypeElement(parseCode(json.get("type").getAsString()));
761    if (json.has("_type"))
762      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
763    if (json.has("profile")) {
764      JsonArray array = json.getAsJsonArray("profile");
765      for (int i = 0; i < array.size(); i++) {
766        if (array.get(i).isJsonNull()) {
767          res.getProfile().add(new UriType());
768        } else {
769          res.getProfile().add(parseUri(array.get(i).getAsString()));
770        }
771      }
772    };
773    if (json.has("_profile")) {
774      JsonArray array = json.getAsJsonArray("_profile");
775      for (int i = 0; i < array.size(); i++) {
776        if (i == res.getProfile().size())
777          res.getProfile().add(parseUri(null));
778        if (array.get(i) instanceof JsonObject) 
779          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
780      }
781    };
782    if (json.has("mustSupport")) {
783      JsonArray array = json.getAsJsonArray("mustSupport");
784      for (int i = 0; i < array.size(); i++) {
785        if (array.get(i).isJsonNull()) {
786          res.getMustSupport().add(new StringType());
787        } else {
788          res.getMustSupport().add(parseString(array.get(i).getAsString()));
789        }
790      }
791    };
792    if (json.has("_mustSupport")) {
793      JsonArray array = json.getAsJsonArray("_mustSupport");
794      for (int i = 0; i < array.size(); i++) {
795        if (i == res.getMustSupport().size())
796          res.getMustSupport().add(parseString(null));
797        if (array.get(i) instanceof JsonObject) 
798          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
799      }
800    };
801    if (json.has("codeFilter")) {
802      JsonArray array = json.getAsJsonArray("codeFilter");
803      for (int i = 0; i < array.size(); i++) {
804        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
805      }
806    };
807    if (json.has("dateFilter")) {
808      JsonArray array = json.getAsJsonArray("dateFilter");
809      for (int i = 0; i < array.size(); i++) {
810        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
811      }
812    };
813  }
814
815  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
816    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
817    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
818    return res;
819  }
820
821  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
822    parseTypeProperties(json, res);
823    if (json.has("path"))
824      res.setPathElement(parseString(json.get("path").getAsString()));
825    if (json.has("_path"))
826      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
827    Type valueSet = parseType("valueSet", json);
828    if (valueSet != null)
829      res.setValueSet(valueSet);
830    if (json.has("valueCode")) {
831      JsonArray array = json.getAsJsonArray("valueCode");
832      for (int i = 0; i < array.size(); i++) {
833        if (array.get(i).isJsonNull()) {
834          res.getValueCode().add(new CodeType());
835        } else {
836          res.getValueCode().add(parseCode(array.get(i).getAsString()));
837        }
838      }
839    };
840    if (json.has("_valueCode")) {
841      JsonArray array = json.getAsJsonArray("_valueCode");
842      for (int i = 0; i < array.size(); i++) {
843        if (i == res.getValueCode().size())
844          res.getValueCode().add(parseCode(null));
845        if (array.get(i) instanceof JsonObject) 
846          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueCode().get(i));
847      }
848    };
849    if (json.has("valueCoding")) {
850      JsonArray array = json.getAsJsonArray("valueCoding");
851      for (int i = 0; i < array.size(); i++) {
852        res.getValueCoding().add(parseCoding(array.get(i).getAsJsonObject()));
853      }
854    };
855    if (json.has("valueCodeableConcept")) {
856      JsonArray array = json.getAsJsonArray("valueCodeableConcept");
857      for (int i = 0; i < array.size(); i++) {
858        res.getValueCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
859      }
860    };
861  }
862
863  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
864    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
865    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
866    return res;
867  }
868
869  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
870    parseTypeProperties(json, res);
871    if (json.has("path"))
872      res.setPathElement(parseString(json.get("path").getAsString()));
873    if (json.has("_path"))
874      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
875    Type value = parseType("value", json);
876    if (value != null)
877      res.setValue(value);
878  }
879
880  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
881    Dosage res = new Dosage();
882    parseDosageProperties(json, res);
883    return res;
884  }
885
886  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
887    parseTypeProperties(json, res);
888    if (json.has("sequence"))
889      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
890    if (json.has("_sequence"))
891      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
892    if (json.has("text"))
893      res.setTextElement(parseString(json.get("text").getAsString()));
894    if (json.has("_text"))
895      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
896    if (json.has("additionalInstruction")) {
897      JsonArray array = json.getAsJsonArray("additionalInstruction");
898      for (int i = 0; i < array.size(); i++) {
899        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
900      }
901    };
902    if (json.has("patientInstruction"))
903      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
904    if (json.has("_patientInstruction"))
905      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
906    if (json.has("timing"))
907      res.setTiming(parseTiming(getJObject(json, "timing")));
908    Type asNeeded = parseType("asNeeded", json);
909    if (asNeeded != null)
910      res.setAsNeeded(asNeeded);
911    if (json.has("site"))
912      res.setSite(parseCodeableConcept(getJObject(json, "site")));
913    if (json.has("route"))
914      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
915    if (json.has("method"))
916      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
917    Type dose = parseType("dose", json);
918    if (dose != null)
919      res.setDose(dose);
920    if (json.has("maxDosePerPeriod"))
921      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
922    if (json.has("maxDosePerAdministration"))
923      res.setMaxDosePerAdministration(parseSimpleQuantity(getJObject(json, "maxDosePerAdministration")));
924    if (json.has("maxDosePerLifetime"))
925      res.setMaxDosePerLifetime(parseSimpleQuantity(getJObject(json, "maxDosePerLifetime")));
926    Type rate = parseType("rate", json);
927    if (rate != null)
928      res.setRate(rate);
929  }
930
931  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
932    RelatedArtifact res = new RelatedArtifact();
933    parseRelatedArtifactProperties(json, res);
934    return res;
935  }
936
937  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
938    parseTypeProperties(json, res);
939    if (json.has("type"))
940      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
941    if (json.has("_type"))
942      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
943    if (json.has("display"))
944      res.setDisplayElement(parseString(json.get("display").getAsString()));
945    if (json.has("_display"))
946      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
947    if (json.has("citation"))
948      res.setCitationElement(parseString(json.get("citation").getAsString()));
949    if (json.has("_citation"))
950      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
951    if (json.has("url"))
952      res.setUrlElement(parseUri(json.get("url").getAsString()));
953    if (json.has("_url"))
954      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
955    if (json.has("document"))
956      res.setDocument(parseAttachment(getJObject(json, "document")));
957    if (json.has("resource"))
958      res.setResource(parseReference(getJObject(json, "resource")));
959  }
960
961  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
962    ContactDetail res = new ContactDetail();
963    parseContactDetailProperties(json, res);
964    return res;
965  }
966
967  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
968    parseTypeProperties(json, res);
969    if (json.has("name"))
970      res.setNameElement(parseString(json.get("name").getAsString()));
971    if (json.has("_name"))
972      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
973    if (json.has("telecom")) {
974      JsonArray array = json.getAsJsonArray("telecom");
975      for (int i = 0; i < array.size(); i++) {
976        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
977      }
978    };
979  }
980
981  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
982    HumanName res = new HumanName();
983    parseHumanNameProperties(json, res);
984    return res;
985  }
986
987  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
988    parseTypeProperties(json, res);
989    if (json.has("use"))
990      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
991    if (json.has("_use"))
992      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
993    if (json.has("text"))
994      res.setTextElement(parseString(json.get("text").getAsString()));
995    if (json.has("_text"))
996      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
997    if (json.has("family"))
998      res.setFamilyElement(parseString(json.get("family").getAsString()));
999    if (json.has("_family"))
1000      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1001    if (json.has("given")) {
1002      JsonArray array = json.getAsJsonArray("given");
1003      for (int i = 0; i < array.size(); i++) {
1004        if (array.get(i).isJsonNull()) {
1005          res.getGiven().add(new StringType());
1006        } else {
1007          res.getGiven().add(parseString(array.get(i).getAsString()));
1008        }
1009      }
1010    };
1011    if (json.has("_given")) {
1012      JsonArray array = json.getAsJsonArray("_given");
1013      for (int i = 0; i < array.size(); i++) {
1014        if (i == res.getGiven().size())
1015          res.getGiven().add(parseString(null));
1016        if (array.get(i) instanceof JsonObject) 
1017          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1018      }
1019    };
1020    if (json.has("prefix")) {
1021      JsonArray array = json.getAsJsonArray("prefix");
1022      for (int i = 0; i < array.size(); i++) {
1023        if (array.get(i).isJsonNull()) {
1024          res.getPrefix().add(new StringType());
1025        } else {
1026          res.getPrefix().add(parseString(array.get(i).getAsString()));
1027        }
1028      }
1029    };
1030    if (json.has("_prefix")) {
1031      JsonArray array = json.getAsJsonArray("_prefix");
1032      for (int i = 0; i < array.size(); i++) {
1033        if (i == res.getPrefix().size())
1034          res.getPrefix().add(parseString(null));
1035        if (array.get(i) instanceof JsonObject) 
1036          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1037      }
1038    };
1039    if (json.has("suffix")) {
1040      JsonArray array = json.getAsJsonArray("suffix");
1041      for (int i = 0; i < array.size(); i++) {
1042        if (array.get(i).isJsonNull()) {
1043          res.getSuffix().add(new StringType());
1044        } else {
1045          res.getSuffix().add(parseString(array.get(i).getAsString()));
1046        }
1047      }
1048    };
1049    if (json.has("_suffix")) {
1050      JsonArray array = json.getAsJsonArray("_suffix");
1051      for (int i = 0; i < array.size(); i++) {
1052        if (i == res.getSuffix().size())
1053          res.getSuffix().add(parseString(null));
1054        if (array.get(i) instanceof JsonObject) 
1055          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1056      }
1057    };
1058    if (json.has("period"))
1059      res.setPeriod(parsePeriod(getJObject(json, "period")));
1060  }
1061
1062  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
1063    ContactPoint res = new ContactPoint();
1064    parseContactPointProperties(json, res);
1065    return res;
1066  }
1067
1068  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
1069    parseTypeProperties(json, res);
1070    if (json.has("system"))
1071      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
1072    if (json.has("_system"))
1073      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1074    if (json.has("value"))
1075      res.setValueElement(parseString(json.get("value").getAsString()));
1076    if (json.has("_value"))
1077      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1078    if (json.has("use"))
1079      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
1080    if (json.has("_use"))
1081      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1082    if (json.has("rank"))
1083      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
1084    if (json.has("_rank"))
1085      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
1086    if (json.has("period"))
1087      res.setPeriod(parsePeriod(getJObject(json, "period")));
1088  }
1089
1090  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1091    UsageContext res = new UsageContext();
1092    parseUsageContextProperties(json, res);
1093    return res;
1094  }
1095
1096  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1097    parseTypeProperties(json, res);
1098    if (json.has("code"))
1099      res.setCode(parseCoding(getJObject(json, "code")));
1100    Type value = parseType("value", json);
1101    if (value != null)
1102      res.setValue(value);
1103  }
1104
1105  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1106    Timing res = new Timing();
1107    parseTimingProperties(json, res);
1108    return res;
1109  }
1110
1111  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1112    parseTypeProperties(json, res);
1113    if (json.has("event")) {
1114      JsonArray array = json.getAsJsonArray("event");
1115      for (int i = 0; i < array.size(); i++) {
1116        if (array.get(i).isJsonNull()) {
1117          res.getEvent().add(new DateTimeType());
1118        } else {
1119          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1120        }
1121      }
1122    };
1123    if (json.has("_event")) {
1124      JsonArray array = json.getAsJsonArray("_event");
1125      for (int i = 0; i < array.size(); i++) {
1126        if (i == res.getEvent().size())
1127          res.getEvent().add(parseDateTime(null));
1128        if (array.get(i) instanceof JsonObject) 
1129          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1130      }
1131    };
1132    if (json.has("repeat"))
1133      res.setRepeat(parseTimingTimingRepeatComponent(getJObject(json, "repeat"), res));
1134    if (json.has("code"))
1135      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1136  }
1137
1138  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1139    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1140    parseTimingTimingRepeatComponentProperties(json, owner, res);
1141    return res;
1142  }
1143
1144  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1145    parseTypeProperties(json, res);
1146    Type bounds = parseType("bounds", json);
1147    if (bounds != null)
1148      res.setBounds(bounds);
1149    if (json.has("count"))
1150      res.setCountElement(parseInteger(json.get("count").getAsLong()));
1151    if (json.has("_count"))
1152      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1153    if (json.has("countMax"))
1154      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
1155    if (json.has("_countMax"))
1156      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1157    if (json.has("duration"))
1158      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1159    if (json.has("_duration"))
1160      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1161    if (json.has("durationMax"))
1162      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1163    if (json.has("_durationMax"))
1164      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1165    if (json.has("durationUnit"))
1166      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1167    if (json.has("_durationUnit"))
1168      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1169    if (json.has("frequency"))
1170      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1171    if (json.has("_frequency"))
1172      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1173    if (json.has("frequencyMax"))
1174      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1175    if (json.has("_frequencyMax"))
1176      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1177    if (json.has("period"))
1178      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1179    if (json.has("_period"))
1180      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1181    if (json.has("periodMax"))
1182      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1183    if (json.has("_periodMax"))
1184      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1185    if (json.has("periodUnit"))
1186      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1187    if (json.has("_periodUnit"))
1188      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1189    if (json.has("dayOfWeek")) {
1190      JsonArray array = json.getAsJsonArray("dayOfWeek");
1191      for (int i = 0; i < array.size(); i++) {
1192        if (array.get(i).isJsonNull()) {
1193          res.getDayOfWeek().add(new Enumeration<Timing.DayOfWeek>());
1194        } else {
1195          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1196        }
1197      }
1198    };
1199    if (json.has("_dayOfWeek")) {
1200      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1201      for (int i = 0; i < array.size(); i++) {
1202        if (i == res.getDayOfWeek().size())
1203          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1204        if (array.get(i) instanceof JsonObject) 
1205          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1206      }
1207    };
1208    if (json.has("timeOfDay")) {
1209      JsonArray array = json.getAsJsonArray("timeOfDay");
1210      for (int i = 0; i < array.size(); i++) {
1211        if (array.get(i).isJsonNull()) {
1212          res.getTimeOfDay().add(new TimeType());
1213        } else {
1214          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1215        }
1216      }
1217    };
1218    if (json.has("_timeOfDay")) {
1219      JsonArray array = json.getAsJsonArray("_timeOfDay");
1220      for (int i = 0; i < array.size(); i++) {
1221        if (i == res.getTimeOfDay().size())
1222          res.getTimeOfDay().add(parseTime(null));
1223        if (array.get(i) instanceof JsonObject) 
1224          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1225      }
1226    };
1227    if (json.has("when")) {
1228      JsonArray array = json.getAsJsonArray("when");
1229      for (int i = 0; i < array.size(); i++) {
1230        if (array.get(i).isJsonNull()) {
1231          res.getWhen().add(new Enumeration<Timing.EventTiming>());
1232        } else {
1233          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1234        }
1235      }
1236    };
1237    if (json.has("_when")) {
1238      JsonArray array = json.getAsJsonArray("_when");
1239      for (int i = 0; i < array.size(); i++) {
1240        if (i == res.getWhen().size())
1241          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1242        if (array.get(i) instanceof JsonObject) 
1243          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1244      }
1245    };
1246    if (json.has("offset"))
1247      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1248    if (json.has("_offset"))
1249      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1250  }
1251
1252  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1253    ElementDefinition res = new ElementDefinition();
1254    parseElementDefinitionProperties(json, res);
1255    return res;
1256  }
1257
1258  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1259    parseTypeProperties(json, res);
1260    if (json.has("path"))
1261      res.setPathElement(parseString(json.get("path").getAsString()));
1262    if (json.has("_path"))
1263      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1264    if (json.has("representation")) {
1265      JsonArray array = json.getAsJsonArray("representation");
1266      for (int i = 0; i < array.size(); i++) {
1267        if (array.get(i).isJsonNull()) {
1268          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>());
1269        } else {
1270          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1271        }
1272      }
1273    };
1274    if (json.has("_representation")) {
1275      JsonArray array = json.getAsJsonArray("_representation");
1276      for (int i = 0; i < array.size(); i++) {
1277        if (i == res.getRepresentation().size())
1278          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1279        if (array.get(i) instanceof JsonObject) 
1280          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1281      }
1282    };
1283    if (json.has("sliceName"))
1284      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1285    if (json.has("_sliceName"))
1286      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
1287    if (json.has("label"))
1288      res.setLabelElement(parseString(json.get("label").getAsString()));
1289    if (json.has("_label"))
1290      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1291    if (json.has("code")) {
1292      JsonArray array = json.getAsJsonArray("code");
1293      for (int i = 0; i < array.size(); i++) {
1294        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1295      }
1296    };
1297    if (json.has("slicing"))
1298      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(getJObject(json, "slicing"), res));
1299    if (json.has("short"))
1300      res.setShortElement(parseString(json.get("short").getAsString()));
1301    if (json.has("_short"))
1302      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
1303    if (json.has("definition"))
1304      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1305    if (json.has("_definition"))
1306      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
1307    if (json.has("comment"))
1308      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1309    if (json.has("_comment"))
1310      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1311    if (json.has("requirements"))
1312      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1313    if (json.has("_requirements"))
1314      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1315    if (json.has("alias")) {
1316      JsonArray array = json.getAsJsonArray("alias");
1317      for (int i = 0; i < array.size(); i++) {
1318        if (array.get(i).isJsonNull()) {
1319          res.getAlias().add(new StringType());
1320        } else {
1321          res.getAlias().add(parseString(array.get(i).getAsString()));
1322        }
1323      }
1324    };
1325    if (json.has("_alias")) {
1326      JsonArray array = json.getAsJsonArray("_alias");
1327      for (int i = 0; i < array.size(); i++) {
1328        if (i == res.getAlias().size())
1329          res.getAlias().add(parseString(null));
1330        if (array.get(i) instanceof JsonObject) 
1331          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1332      }
1333    };
1334    if (json.has("min"))
1335      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1336    if (json.has("_min"))
1337      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1338    if (json.has("max"))
1339      res.setMaxElement(parseString(json.get("max").getAsString()));
1340    if (json.has("_max"))
1341      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1342    if (json.has("base"))
1343      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(getJObject(json, "base"), res));
1344    if (json.has("contentReference"))
1345      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1346    if (json.has("_contentReference"))
1347      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
1348    if (json.has("type")) {
1349      JsonArray array = json.getAsJsonArray("type");
1350      for (int i = 0; i < array.size(); i++) {
1351        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1352      }
1353    };
1354    Type defaultValue = parseType("defaultValue", json);
1355    if (defaultValue != null)
1356      res.setDefaultValue(defaultValue);
1357    if (json.has("meaningWhenMissing"))
1358      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1359    if (json.has("_meaningWhenMissing"))
1360      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1361    if (json.has("orderMeaning"))
1362      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1363    if (json.has("_orderMeaning"))
1364      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
1365    Type fixed = parseType("fixed", json);
1366    if (fixed != null)
1367      res.setFixed(fixed);
1368    Type pattern = parseType("pattern", json);
1369    if (pattern != null)
1370      res.setPattern(pattern);
1371    if (json.has("example")) {
1372      JsonArray array = json.getAsJsonArray("example");
1373      for (int i = 0; i < array.size(); i++) {
1374        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1375      }
1376    };
1377    Type minValue = parseType("minValue", json);
1378    if (minValue != null)
1379      res.setMinValue(minValue);
1380    Type maxValue = parseType("maxValue", json);
1381    if (maxValue != null)
1382      res.setMaxValue(maxValue);
1383    if (json.has("maxLength"))
1384      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1385    if (json.has("_maxLength"))
1386      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1387    if (json.has("condition")) {
1388      JsonArray array = json.getAsJsonArray("condition");
1389      for (int i = 0; i < array.size(); i++) {
1390        if (array.get(i).isJsonNull()) {
1391          res.getCondition().add(new IdType());
1392        } else {
1393          res.getCondition().add(parseId(array.get(i).getAsString()));
1394        }
1395      }
1396    };
1397    if (json.has("_condition")) {
1398      JsonArray array = json.getAsJsonArray("_condition");
1399      for (int i = 0; i < array.size(); i++) {
1400        if (i == res.getCondition().size())
1401          res.getCondition().add(parseId(null));
1402        if (array.get(i) instanceof JsonObject) 
1403          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1404      }
1405    };
1406    if (json.has("constraint")) {
1407      JsonArray array = json.getAsJsonArray("constraint");
1408      for (int i = 0; i < array.size(); i++) {
1409        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1410      }
1411    };
1412    if (json.has("mustSupport"))
1413      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1414    if (json.has("_mustSupport"))
1415      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1416    if (json.has("isModifier"))
1417      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1418    if (json.has("_isModifier"))
1419      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1420    if (json.has("isSummary"))
1421      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1422    if (json.has("_isSummary"))
1423      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1424    if (json.has("binding"))
1425      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(getJObject(json, "binding"), res));
1426    if (json.has("mapping")) {
1427      JsonArray array = json.getAsJsonArray("mapping");
1428      for (int i = 0; i < array.size(); i++) {
1429        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1430      }
1431    };
1432  }
1433
1434  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1435    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1436    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1437    return res;
1438  }
1439
1440  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1441    parseTypeProperties(json, res);
1442    if (json.has("discriminator")) {
1443      JsonArray array = json.getAsJsonArray("discriminator");
1444      for (int i = 0; i < array.size(); i++) {
1445        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1446      }
1447    };
1448    if (json.has("description"))
1449      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1450    if (json.has("_description"))
1451      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1452    if (json.has("ordered"))
1453      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1454    if (json.has("_ordered"))
1455      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1456    if (json.has("rules"))
1457      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1458    if (json.has("_rules"))
1459      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1460  }
1461
1462  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1463    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1464    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1465    return res;
1466  }
1467
1468  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1469    parseTypeProperties(json, res);
1470    if (json.has("type"))
1471      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1472    if (json.has("_type"))
1473      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1474    if (json.has("path"))
1475      res.setPathElement(parseString(json.get("path").getAsString()));
1476    if (json.has("_path"))
1477      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1478  }
1479
1480  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1481    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1482    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1483    return res;
1484  }
1485
1486  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1487    parseTypeProperties(json, res);
1488    if (json.has("path"))
1489      res.setPathElement(parseString(json.get("path").getAsString()));
1490    if (json.has("_path"))
1491      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1492    if (json.has("min"))
1493      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1494    if (json.has("_min"))
1495      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1496    if (json.has("max"))
1497      res.setMaxElement(parseString(json.get("max").getAsString()));
1498    if (json.has("_max"))
1499      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1500  }
1501
1502  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1503    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1504    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1505    return res;
1506  }
1507
1508  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1509    parseTypeProperties(json, res);
1510    if (json.has("code"))
1511      res.setCodeElement(parseUri(json.get("code").getAsString()));
1512    if (json.has("_code"))
1513      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1514    if (json.has("profile"))
1515      res.setProfileElement(parseUri(json.get("profile").getAsString()));
1516    if (json.has("_profile"))
1517      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1518    if (json.has("targetProfile"))
1519      res.setTargetProfileElement(parseUri(json.get("targetProfile").getAsString()));
1520    if (json.has("_targetProfile"))
1521      parseElementProperties(getJObject(json, "_targetProfile"), res.getTargetProfileElement());
1522    if (json.has("aggregation")) {
1523      JsonArray array = json.getAsJsonArray("aggregation");
1524      for (int i = 0; i < array.size(); i++) {
1525        if (array.get(i).isJsonNull()) {
1526          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>());
1527        } else {
1528          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1529        }
1530      }
1531    };
1532    if (json.has("_aggregation")) {
1533      JsonArray array = json.getAsJsonArray("_aggregation");
1534      for (int i = 0; i < array.size(); i++) {
1535        if (i == res.getAggregation().size())
1536          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1537        if (array.get(i) instanceof JsonObject) 
1538          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1539      }
1540    };
1541    if (json.has("versioning"))
1542      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1543    if (json.has("_versioning"))
1544      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1545  }
1546
1547  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1548    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1549    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1550    return res;
1551  }
1552
1553  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1554    parseTypeProperties(json, res);
1555    if (json.has("label"))
1556      res.setLabelElement(parseString(json.get("label").getAsString()));
1557    if (json.has("_label"))
1558      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1559    Type value = parseType("value", json);
1560    if (value != null)
1561      res.setValue(value);
1562  }
1563
1564  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1565    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1566    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1567    return res;
1568  }
1569
1570  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1571    parseTypeProperties(json, res);
1572    if (json.has("key"))
1573      res.setKeyElement(parseId(json.get("key").getAsString()));
1574    if (json.has("_key"))
1575      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1576    if (json.has("requirements"))
1577      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1578    if (json.has("_requirements"))
1579      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1580    if (json.has("severity"))
1581      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1582    if (json.has("_severity"))
1583      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1584    if (json.has("human"))
1585      res.setHumanElement(parseString(json.get("human").getAsString()));
1586    if (json.has("_human"))
1587      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1588    if (json.has("expression"))
1589      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1590    if (json.has("_expression"))
1591      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1592    if (json.has("xpath"))
1593      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1594    if (json.has("_xpath"))
1595      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1596    if (json.has("source"))
1597      res.setSourceElement(parseUri(json.get("source").getAsString()));
1598    if (json.has("_source"))
1599      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1600  }
1601
1602  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1603    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1604    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1605    return res;
1606  }
1607
1608  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1609    parseTypeProperties(json, res);
1610    if (json.has("strength"))
1611      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1612    if (json.has("_strength"))
1613      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1614    if (json.has("description"))
1615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1616    if (json.has("_description"))
1617      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1618    Type valueSet = parseType("valueSet", json);
1619    if (valueSet != null)
1620      res.setValueSet(valueSet);
1621  }
1622
1623  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1624    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1625    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1626    return res;
1627  }
1628
1629  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1630    parseTypeProperties(json, res);
1631    if (json.has("identity"))
1632      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1633    if (json.has("_identity"))
1634      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1635    if (json.has("language"))
1636      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1637    if (json.has("_language"))
1638      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1639    if (json.has("map"))
1640      res.setMapElement(parseString(json.get("map").getAsString()));
1641    if (json.has("_map"))
1642      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1643    if (json.has("comment"))
1644      res.setCommentElement(parseString(json.get("comment").getAsString()));
1645    if (json.has("_comment"))
1646      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1647  }
1648
1649  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1650    ParameterDefinition res = new ParameterDefinition();
1651    parseParameterDefinitionProperties(json, res);
1652    return res;
1653  }
1654
1655  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1656    parseTypeProperties(json, res);
1657    if (json.has("name"))
1658      res.setNameElement(parseCode(json.get("name").getAsString()));
1659    if (json.has("_name"))
1660      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1661    if (json.has("use"))
1662      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1663    if (json.has("_use"))
1664      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1665    if (json.has("min"))
1666      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1667    if (json.has("_min"))
1668      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1669    if (json.has("max"))
1670      res.setMaxElement(parseString(json.get("max").getAsString()));
1671    if (json.has("_max"))
1672      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1673    if (json.has("documentation"))
1674      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1675    if (json.has("_documentation"))
1676      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1677    if (json.has("type"))
1678      res.setTypeElement(parseCode(json.get("type").getAsString()));
1679    if (json.has("_type"))
1680      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1681    if (json.has("profile"))
1682      res.setProfile(parseReference(getJObject(json, "profile")));
1683  }
1684
1685  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1686    parseResourceProperties(json, res);
1687    if (json.has("text"))
1688      res.setText(parseNarrative(getJObject(json, "text")));
1689    if (json.has("contained")) {
1690      JsonArray array = json.getAsJsonArray("contained");
1691      for (int i = 0; i < array.size(); i++) {
1692        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1693      }
1694    };
1695    if (json.has("extension")) {
1696      JsonArray array = json.getAsJsonArray("extension");
1697      for (int i = 0; i < array.size(); i++) {
1698        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1699      }
1700    };
1701    if (json.has("modifierExtension")) {
1702      JsonArray array = json.getAsJsonArray("modifierExtension");
1703      for (int i = 0; i < array.size(); i++) {
1704        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1705      }
1706    };
1707  }
1708
1709  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1710    Parameters res = new Parameters();
1711    parseParametersProperties(json, res);
1712    return res;
1713  }
1714
1715  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1716    parseResourceProperties(json, res);
1717    if (json.has("parameter")) {
1718      JsonArray array = json.getAsJsonArray("parameter");
1719      for (int i = 0; i < array.size(); i++) {
1720        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1721      }
1722    };
1723  }
1724
1725  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1726    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1727    parseParametersParametersParameterComponentProperties(json, owner, res);
1728    return res;
1729  }
1730
1731  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1732    parseBackboneProperties(json, res);
1733    if (json.has("name"))
1734      res.setNameElement(parseString(json.get("name").getAsString()));
1735    if (json.has("_name"))
1736      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1737    Type value = parseType("value", json);
1738    if (value != null)
1739      res.setValue(value);
1740    if (json.has("resource"))
1741      res.setResource(parseResource(getJObject(json, "resource")));
1742    if (json.has("part")) {
1743      JsonArray array = json.getAsJsonArray("part");
1744      for (int i = 0; i < array.size(); i++) {
1745        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1746      }
1747    };
1748  }
1749
1750  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1751    if (json.has("id"))
1752      res.setIdElement(parseId(json.get("id").getAsString()));
1753    if (json.has("_id"))
1754      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
1755    if (json.has("meta"))
1756      res.setMeta(parseMeta(getJObject(json, "meta")));
1757    if (json.has("implicitRules"))
1758      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1759    if (json.has("_implicitRules"))
1760      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
1761    if (json.has("language"))
1762      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1763    if (json.has("_language"))
1764      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1765  }
1766
1767  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1768    Account res = new Account();
1769    parseAccountProperties(json, res);
1770    return res;
1771  }
1772
1773  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
1774    parseDomainResourceProperties(json, res);
1775    if (json.has("identifier")) {
1776      JsonArray array = json.getAsJsonArray("identifier");
1777      for (int i = 0; i < array.size(); i++) {
1778        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1779      }
1780    };
1781    if (json.has("status"))
1782      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1783    if (json.has("_status"))
1784      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1785    if (json.has("type"))
1786      res.setType(parseCodeableConcept(getJObject(json, "type")));
1787    if (json.has("name"))
1788      res.setNameElement(parseString(json.get("name").getAsString()));
1789    if (json.has("_name"))
1790      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1791    if (json.has("subject"))
1792      res.setSubject(parseReference(getJObject(json, "subject")));
1793    if (json.has("period"))
1794      res.setPeriod(parsePeriod(getJObject(json, "period")));
1795    if (json.has("active"))
1796      res.setActive(parsePeriod(getJObject(json, "active")));
1797    if (json.has("balance"))
1798      res.setBalance(parseMoney(getJObject(json, "balance")));
1799    if (json.has("coverage")) {
1800      JsonArray array = json.getAsJsonArray("coverage");
1801      for (int i = 0; i < array.size(); i++) {
1802        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
1803      }
1804    };
1805    if (json.has("owner"))
1806      res.setOwner(parseReference(getJObject(json, "owner")));
1807    if (json.has("description"))
1808      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1809    if (json.has("_description"))
1810      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1811    if (json.has("guarantor")) {
1812      JsonArray array = json.getAsJsonArray("guarantor");
1813      for (int i = 0; i < array.size(); i++) {
1814        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
1815      }
1816    };
1817  }
1818
1819  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1820    Account.CoverageComponent res = new Account.CoverageComponent();
1821    parseAccountCoverageComponentProperties(json, owner, res);
1822    return res;
1823  }
1824
1825  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
1826    parseBackboneProperties(json, res);
1827    if (json.has("coverage"))
1828      res.setCoverage(parseReference(getJObject(json, "coverage")));
1829    if (json.has("priority"))
1830      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
1831    if (json.has("_priority"))
1832      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
1833  }
1834
1835  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1836    Account.GuarantorComponent res = new Account.GuarantorComponent();
1837    parseAccountGuarantorComponentProperties(json, owner, res);
1838    return res;
1839  }
1840
1841  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
1842    parseBackboneProperties(json, res);
1843    if (json.has("party"))
1844      res.setParty(parseReference(getJObject(json, "party")));
1845    if (json.has("onHold"))
1846      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
1847    if (json.has("_onHold"))
1848      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
1849    if (json.has("period"))
1850      res.setPeriod(parsePeriod(getJObject(json, "period")));
1851  }
1852
1853  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
1854    ActivityDefinition res = new ActivityDefinition();
1855    parseActivityDefinitionProperties(json, res);
1856    return res;
1857  }
1858
1859  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
1860    parseDomainResourceProperties(json, res);
1861    if (json.has("url"))
1862      res.setUrlElement(parseUri(json.get("url").getAsString()));
1863    if (json.has("_url"))
1864      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1865    if (json.has("identifier")) {
1866      JsonArray array = json.getAsJsonArray("identifier");
1867      for (int i = 0; i < array.size(); i++) {
1868        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1869      }
1870    };
1871    if (json.has("version"))
1872      res.setVersionElement(parseString(json.get("version").getAsString()));
1873    if (json.has("_version"))
1874      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
1875    if (json.has("name"))
1876      res.setNameElement(parseString(json.get("name").getAsString()));
1877    if (json.has("_name"))
1878      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1879    if (json.has("title"))
1880      res.setTitleElement(parseString(json.get("title").getAsString()));
1881    if (json.has("_title"))
1882      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
1883    if (json.has("status"))
1884      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1885    if (json.has("_status"))
1886      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1887    if (json.has("experimental"))
1888      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
1889    if (json.has("_experimental"))
1890      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
1891    if (json.has("date"))
1892      res.setDateElement(parseDateTime(json.get("date").getAsString()));
1893    if (json.has("_date"))
1894      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
1895    if (json.has("publisher"))
1896      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
1897    if (json.has("_publisher"))
1898      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
1899    if (json.has("description"))
1900      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1901    if (json.has("_description"))
1902      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1903    if (json.has("purpose"))
1904      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
1905    if (json.has("_purpose"))
1906      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
1907    if (json.has("usage"))
1908      res.setUsageElement(parseString(json.get("usage").getAsString()));
1909    if (json.has("_usage"))
1910      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
1911    if (json.has("approvalDate"))
1912      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
1913    if (json.has("_approvalDate"))
1914      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
1915    if (json.has("lastReviewDate"))
1916      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
1917    if (json.has("_lastReviewDate"))
1918      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
1919    if (json.has("effectivePeriod"))
1920      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
1921    if (json.has("useContext")) {
1922      JsonArray array = json.getAsJsonArray("useContext");
1923      for (int i = 0; i < array.size(); i++) {
1924        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
1925      }
1926    };
1927    if (json.has("jurisdiction")) {
1928      JsonArray array = json.getAsJsonArray("jurisdiction");
1929      for (int i = 0; i < array.size(); i++) {
1930        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1931      }
1932    };
1933    if (json.has("topic")) {
1934      JsonArray array = json.getAsJsonArray("topic");
1935      for (int i = 0; i < array.size(); i++) {
1936        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1937      }
1938    };
1939    if (json.has("contributor")) {
1940      JsonArray array = json.getAsJsonArray("contributor");
1941      for (int i = 0; i < array.size(); i++) {
1942        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
1943      }
1944    };
1945    if (json.has("contact")) {
1946      JsonArray array = json.getAsJsonArray("contact");
1947      for (int i = 0; i < array.size(); i++) {
1948        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
1949      }
1950    };
1951    if (json.has("copyright"))
1952      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
1953    if (json.has("_copyright"))
1954      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
1955    if (json.has("relatedArtifact")) {
1956      JsonArray array = json.getAsJsonArray("relatedArtifact");
1957      for (int i = 0; i < array.size(); i++) {
1958        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
1959      }
1960    };
1961    if (json.has("library")) {
1962      JsonArray array = json.getAsJsonArray("library");
1963      for (int i = 0; i < array.size(); i++) {
1964        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
1965      }
1966    };
1967    if (json.has("kind"))
1968      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
1969    if (json.has("_kind"))
1970      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
1971    if (json.has("code"))
1972      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1973    Type timing = parseType("timing", json);
1974    if (timing != null)
1975      res.setTiming(timing);
1976    if (json.has("location"))
1977      res.setLocation(parseReference(getJObject(json, "location")));
1978    if (json.has("participant")) {
1979      JsonArray array = json.getAsJsonArray("participant");
1980      for (int i = 0; i < array.size(); i++) {
1981        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
1982      }
1983    };
1984    Type product = parseType("product", json);
1985    if (product != null)
1986      res.setProduct(product);
1987    if (json.has("quantity"))
1988      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
1989    if (json.has("dosage")) {
1990      JsonArray array = json.getAsJsonArray("dosage");
1991      for (int i = 0; i < array.size(); i++) {
1992        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
1993      }
1994    };
1995    if (json.has("bodySite")) {
1996      JsonArray array = json.getAsJsonArray("bodySite");
1997      for (int i = 0; i < array.size(); i++) {
1998        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1999      }
2000    };
2001    if (json.has("transform"))
2002      res.setTransform(parseReference(getJObject(json, "transform")));
2003    if (json.has("dynamicValue")) {
2004      JsonArray array = json.getAsJsonArray("dynamicValue");
2005      for (int i = 0; i < array.size(); i++) {
2006        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2007      }
2008    };
2009  }
2010
2011  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2012    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2013    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2014    return res;
2015  }
2016
2017  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2018    parseBackboneProperties(json, res);
2019    if (json.has("type"))
2020      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2021    if (json.has("_type"))
2022      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2023    if (json.has("role"))
2024      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2025  }
2026
2027  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2028    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2029    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2030    return res;
2031  }
2032
2033  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2034    parseBackboneProperties(json, res);
2035    if (json.has("description"))
2036      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2037    if (json.has("_description"))
2038      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2039    if (json.has("path"))
2040      res.setPathElement(parseString(json.get("path").getAsString()));
2041    if (json.has("_path"))
2042      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2043    if (json.has("language"))
2044      res.setLanguageElement(parseString(json.get("language").getAsString()));
2045    if (json.has("_language"))
2046      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2047    if (json.has("expression"))
2048      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2049    if (json.has("_expression"))
2050      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
2051  }
2052
2053  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2054    AdverseEvent res = new AdverseEvent();
2055    parseAdverseEventProperties(json, res);
2056    return res;
2057  }
2058
2059  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2060    parseDomainResourceProperties(json, res);
2061    if (json.has("identifier"))
2062      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2063    if (json.has("category"))
2064      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AdverseEvent.AdverseEventCategory.NULL, new AdverseEvent.AdverseEventCategoryEnumFactory()));
2065    if (json.has("_category"))
2066      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
2067    if (json.has("type"))
2068      res.setType(parseCodeableConcept(getJObject(json, "type")));
2069    if (json.has("subject"))
2070      res.setSubject(parseReference(getJObject(json, "subject")));
2071    if (json.has("date"))
2072      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2073    if (json.has("_date"))
2074      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2075    if (json.has("reaction")) {
2076      JsonArray array = json.getAsJsonArray("reaction");
2077      for (int i = 0; i < array.size(); i++) {
2078        res.getReaction().add(parseReference(array.get(i).getAsJsonObject()));
2079      }
2080    };
2081    if (json.has("location"))
2082      res.setLocation(parseReference(getJObject(json, "location")));
2083    if (json.has("seriousness"))
2084      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2085    if (json.has("outcome"))
2086      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2087    if (json.has("recorder"))
2088      res.setRecorder(parseReference(getJObject(json, "recorder")));
2089    if (json.has("eventParticipant"))
2090      res.setEventParticipant(parseReference(getJObject(json, "eventParticipant")));
2091    if (json.has("description"))
2092      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2093    if (json.has("_description"))
2094      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2095    if (json.has("suspectEntity")) {
2096      JsonArray array = json.getAsJsonArray("suspectEntity");
2097      for (int i = 0; i < array.size(); i++) {
2098        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2099      }
2100    };
2101    if (json.has("subjectMedicalHistory")) {
2102      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2103      for (int i = 0; i < array.size(); i++) {
2104        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2105      }
2106    };
2107    if (json.has("referenceDocument")) {
2108      JsonArray array = json.getAsJsonArray("referenceDocument");
2109      for (int i = 0; i < array.size(); i++) {
2110        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2111      }
2112    };
2113    if (json.has("study")) {
2114      JsonArray array = json.getAsJsonArray("study");
2115      for (int i = 0; i < array.size(); i++) {
2116        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2117      }
2118    };
2119  }
2120
2121  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2122    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2123    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2124    return res;
2125  }
2126
2127  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2128    parseBackboneProperties(json, res);
2129    if (json.has("instance"))
2130      res.setInstance(parseReference(getJObject(json, "instance")));
2131    if (json.has("causality"))
2132      res.setCausalityElement(parseEnumeration(json.get("causality").getAsString(), AdverseEvent.AdverseEventCausality.NULL, new AdverseEvent.AdverseEventCausalityEnumFactory()));
2133    if (json.has("_causality"))
2134      parseElementProperties(getJObject(json, "_causality"), res.getCausalityElement());
2135    if (json.has("causalityAssessment"))
2136      res.setCausalityAssessment(parseCodeableConcept(getJObject(json, "causalityAssessment")));
2137    if (json.has("causalityProductRelatedness"))
2138      res.setCausalityProductRelatednessElement(parseString(json.get("causalityProductRelatedness").getAsString()));
2139    if (json.has("_causalityProductRelatedness"))
2140      parseElementProperties(getJObject(json, "_causalityProductRelatedness"), res.getCausalityProductRelatednessElement());
2141    if (json.has("causalityMethod"))
2142      res.setCausalityMethod(parseCodeableConcept(getJObject(json, "causalityMethod")));
2143    if (json.has("causalityAuthor"))
2144      res.setCausalityAuthor(parseReference(getJObject(json, "causalityAuthor")));
2145    if (json.has("causalityResult"))
2146      res.setCausalityResult(parseCodeableConcept(getJObject(json, "causalityResult")));
2147  }
2148
2149  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2150    AllergyIntolerance res = new AllergyIntolerance();
2151    parseAllergyIntoleranceProperties(json, res);
2152    return res;
2153  }
2154
2155  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2156    parseDomainResourceProperties(json, res);
2157    if (json.has("identifier")) {
2158      JsonArray array = json.getAsJsonArray("identifier");
2159      for (int i = 0; i < array.size(); i++) {
2160        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2161      }
2162    };
2163    if (json.has("clinicalStatus"))
2164      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2165    if (json.has("_clinicalStatus"))
2166      parseElementProperties(getJObject(json, "_clinicalStatus"), res.getClinicalStatusElement());
2167    if (json.has("verificationStatus"))
2168      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2169    if (json.has("_verificationStatus"))
2170      parseElementProperties(getJObject(json, "_verificationStatus"), res.getVerificationStatusElement());
2171    if (json.has("type"))
2172      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2173    if (json.has("_type"))
2174      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2175    if (json.has("category")) {
2176      JsonArray array = json.getAsJsonArray("category");
2177      for (int i = 0; i < array.size(); i++) {
2178        if (array.get(i).isJsonNull()) {
2179          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>());
2180        } else {
2181          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2182        }
2183      }
2184    };
2185    if (json.has("_category")) {
2186      JsonArray array = json.getAsJsonArray("_category");
2187      for (int i = 0; i < array.size(); i++) {
2188        if (i == res.getCategory().size())
2189          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2190        if (array.get(i) instanceof JsonObject) 
2191          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2192      }
2193    };
2194    if (json.has("criticality"))
2195      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2196    if (json.has("_criticality"))
2197      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2198    if (json.has("code"))
2199      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2200    if (json.has("patient"))
2201      res.setPatient(parseReference(getJObject(json, "patient")));
2202    Type onset = parseType("onset", json);
2203    if (onset != null)
2204      res.setOnset(onset);
2205    if (json.has("assertedDate"))
2206      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
2207    if (json.has("_assertedDate"))
2208      parseElementProperties(getJObject(json, "_assertedDate"), res.getAssertedDateElement());
2209    if (json.has("recorder"))
2210      res.setRecorder(parseReference(getJObject(json, "recorder")));
2211    if (json.has("asserter"))
2212      res.setAsserter(parseReference(getJObject(json, "asserter")));
2213    if (json.has("lastOccurrence"))
2214      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2215    if (json.has("_lastOccurrence"))
2216      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2217    if (json.has("note")) {
2218      JsonArray array = json.getAsJsonArray("note");
2219      for (int i = 0; i < array.size(); i++) {
2220        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2221      }
2222    };
2223    if (json.has("reaction")) {
2224      JsonArray array = json.getAsJsonArray("reaction");
2225      for (int i = 0; i < array.size(); i++) {
2226        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2227      }
2228    };
2229  }
2230
2231  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2232    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2233    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2234    return res;
2235  }
2236
2237  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2238    parseBackboneProperties(json, res);
2239    if (json.has("substance"))
2240      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2241    if (json.has("manifestation")) {
2242      JsonArray array = json.getAsJsonArray("manifestation");
2243      for (int i = 0; i < array.size(); i++) {
2244        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2245      }
2246    };
2247    if (json.has("description"))
2248      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2249    if (json.has("_description"))
2250      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2251    if (json.has("onset"))
2252      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2253    if (json.has("_onset"))
2254      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2255    if (json.has("severity"))
2256      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2257    if (json.has("_severity"))
2258      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2259    if (json.has("exposureRoute"))
2260      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2261    if (json.has("note")) {
2262      JsonArray array = json.getAsJsonArray("note");
2263      for (int i = 0; i < array.size(); i++) {
2264        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2265      }
2266    };
2267  }
2268
2269  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2270    Appointment res = new Appointment();
2271    parseAppointmentProperties(json, res);
2272    return res;
2273  }
2274
2275  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2276    parseDomainResourceProperties(json, res);
2277    if (json.has("identifier")) {
2278      JsonArray array = json.getAsJsonArray("identifier");
2279      for (int i = 0; i < array.size(); i++) {
2280        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2281      }
2282    };
2283    if (json.has("status"))
2284      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2285    if (json.has("_status"))
2286      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2287    if (json.has("serviceCategory"))
2288      res.setServiceCategory(parseCodeableConcept(getJObject(json, "serviceCategory")));
2289    if (json.has("serviceType")) {
2290      JsonArray array = json.getAsJsonArray("serviceType");
2291      for (int i = 0; i < array.size(); i++) {
2292        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2293      }
2294    };
2295    if (json.has("specialty")) {
2296      JsonArray array = json.getAsJsonArray("specialty");
2297      for (int i = 0; i < array.size(); i++) {
2298        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2299      }
2300    };
2301    if (json.has("appointmentType"))
2302      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2303    if (json.has("reason")) {
2304      JsonArray array = json.getAsJsonArray("reason");
2305      for (int i = 0; i < array.size(); i++) {
2306        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2307      }
2308    };
2309    if (json.has("indication")) {
2310      JsonArray array = json.getAsJsonArray("indication");
2311      for (int i = 0; i < array.size(); i++) {
2312        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2313      }
2314    };
2315    if (json.has("priority"))
2316      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2317    if (json.has("_priority"))
2318      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2319    if (json.has("description"))
2320      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2321    if (json.has("_description"))
2322      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2323    if (json.has("supportingInformation")) {
2324      JsonArray array = json.getAsJsonArray("supportingInformation");
2325      for (int i = 0; i < array.size(); i++) {
2326        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2327      }
2328    };
2329    if (json.has("start"))
2330      res.setStartElement(parseInstant(json.get("start").getAsString()));
2331    if (json.has("_start"))
2332      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2333    if (json.has("end"))
2334      res.setEndElement(parseInstant(json.get("end").getAsString()));
2335    if (json.has("_end"))
2336      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2337    if (json.has("minutesDuration"))
2338      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2339    if (json.has("_minutesDuration"))
2340      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2341    if (json.has("slot")) {
2342      JsonArray array = json.getAsJsonArray("slot");
2343      for (int i = 0; i < array.size(); i++) {
2344        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2345      }
2346    };
2347    if (json.has("created"))
2348      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2349    if (json.has("_created"))
2350      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2351    if (json.has("comment"))
2352      res.setCommentElement(parseString(json.get("comment").getAsString()));
2353    if (json.has("_comment"))
2354      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2355    if (json.has("incomingReferral")) {
2356      JsonArray array = json.getAsJsonArray("incomingReferral");
2357      for (int i = 0; i < array.size(); i++) {
2358        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
2359      }
2360    };
2361    if (json.has("participant")) {
2362      JsonArray array = json.getAsJsonArray("participant");
2363      for (int i = 0; i < array.size(); i++) {
2364        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2365      }
2366    };
2367    if (json.has("requestedPeriod")) {
2368      JsonArray array = json.getAsJsonArray("requestedPeriod");
2369      for (int i = 0; i < array.size(); i++) {
2370        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2371      }
2372    };
2373  }
2374
2375  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2376    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2377    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2378    return res;
2379  }
2380
2381  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2382    parseBackboneProperties(json, res);
2383    if (json.has("type")) {
2384      JsonArray array = json.getAsJsonArray("type");
2385      for (int i = 0; i < array.size(); i++) {
2386        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2387      }
2388    };
2389    if (json.has("actor"))
2390      res.setActor(parseReference(getJObject(json, "actor")));
2391    if (json.has("required"))
2392      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2393    if (json.has("_required"))
2394      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
2395    if (json.has("status"))
2396      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2397    if (json.has("_status"))
2398      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2399  }
2400
2401  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2402    AppointmentResponse res = new AppointmentResponse();
2403    parseAppointmentResponseProperties(json, res);
2404    return res;
2405  }
2406
2407  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2408    parseDomainResourceProperties(json, res);
2409    if (json.has("identifier")) {
2410      JsonArray array = json.getAsJsonArray("identifier");
2411      for (int i = 0; i < array.size(); i++) {
2412        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2413      }
2414    };
2415    if (json.has("appointment"))
2416      res.setAppointment(parseReference(getJObject(json, "appointment")));
2417    if (json.has("start"))
2418      res.setStartElement(parseInstant(json.get("start").getAsString()));
2419    if (json.has("_start"))
2420      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2421    if (json.has("end"))
2422      res.setEndElement(parseInstant(json.get("end").getAsString()));
2423    if (json.has("_end"))
2424      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2425    if (json.has("participantType")) {
2426      JsonArray array = json.getAsJsonArray("participantType");
2427      for (int i = 0; i < array.size(); i++) {
2428        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2429      }
2430    };
2431    if (json.has("actor"))
2432      res.setActor(parseReference(getJObject(json, "actor")));
2433    if (json.has("participantStatus"))
2434      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2435    if (json.has("_participantStatus"))
2436      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
2437    if (json.has("comment"))
2438      res.setCommentElement(parseString(json.get("comment").getAsString()));
2439    if (json.has("_comment"))
2440      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2441  }
2442
2443  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2444    AuditEvent res = new AuditEvent();
2445    parseAuditEventProperties(json, res);
2446    return res;
2447  }
2448
2449  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2450    parseDomainResourceProperties(json, res);
2451    if (json.has("type"))
2452      res.setType(parseCoding(getJObject(json, "type")));
2453    if (json.has("subtype")) {
2454      JsonArray array = json.getAsJsonArray("subtype");
2455      for (int i = 0; i < array.size(); i++) {
2456        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2457      }
2458    };
2459    if (json.has("action"))
2460      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2461    if (json.has("_action"))
2462      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
2463    if (json.has("recorded"))
2464      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2465    if (json.has("_recorded"))
2466      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
2467    if (json.has("outcome"))
2468      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2469    if (json.has("_outcome"))
2470      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
2471    if (json.has("outcomeDesc"))
2472      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2473    if (json.has("_outcomeDesc"))
2474      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
2475    if (json.has("purposeOfEvent")) {
2476      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2477      for (int i = 0; i < array.size(); i++) {
2478        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2479      }
2480    };
2481    if (json.has("agent")) {
2482      JsonArray array = json.getAsJsonArray("agent");
2483      for (int i = 0; i < array.size(); i++) {
2484        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2485      }
2486    };
2487    if (json.has("source"))
2488      res.setSource(parseAuditEventAuditEventSourceComponent(getJObject(json, "source"), res));
2489    if (json.has("entity")) {
2490      JsonArray array = json.getAsJsonArray("entity");
2491      for (int i = 0; i < array.size(); i++) {
2492        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2493      }
2494    };
2495  }
2496
2497  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2498    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2499    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2500    return res;
2501  }
2502
2503  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2504    parseBackboneProperties(json, res);
2505    if (json.has("role")) {
2506      JsonArray array = json.getAsJsonArray("role");
2507      for (int i = 0; i < array.size(); i++) {
2508        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2509      }
2510    };
2511    if (json.has("reference"))
2512      res.setReference(parseReference(getJObject(json, "reference")));
2513    if (json.has("userId"))
2514      res.setUserId(parseIdentifier(getJObject(json, "userId")));
2515    if (json.has("altId"))
2516      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2517    if (json.has("_altId"))
2518      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
2519    if (json.has("name"))
2520      res.setNameElement(parseString(json.get("name").getAsString()));
2521    if (json.has("_name"))
2522      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2523    if (json.has("requestor"))
2524      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2525    if (json.has("_requestor"))
2526      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
2527    if (json.has("location"))
2528      res.setLocation(parseReference(getJObject(json, "location")));
2529    if (json.has("policy")) {
2530      JsonArray array = json.getAsJsonArray("policy");
2531      for (int i = 0; i < array.size(); i++) {
2532        if (array.get(i).isJsonNull()) {
2533          res.getPolicy().add(new UriType());
2534        } else {
2535          res.getPolicy().add(parseUri(array.get(i).getAsString()));
2536        }
2537      }
2538    };
2539    if (json.has("_policy")) {
2540      JsonArray array = json.getAsJsonArray("_policy");
2541      for (int i = 0; i < array.size(); i++) {
2542        if (i == res.getPolicy().size())
2543          res.getPolicy().add(parseUri(null));
2544        if (array.get(i) instanceof JsonObject) 
2545          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2546      }
2547    };
2548    if (json.has("media"))
2549      res.setMedia(parseCoding(getJObject(json, "media")));
2550    if (json.has("network"))
2551      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(getJObject(json, "network"), owner));
2552    if (json.has("purposeOfUse")) {
2553      JsonArray array = json.getAsJsonArray("purposeOfUse");
2554      for (int i = 0; i < array.size(); i++) {
2555        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2556      }
2557    };
2558  }
2559
2560  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2561    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2562    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2563    return res;
2564  }
2565
2566  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2567    parseBackboneProperties(json, res);
2568    if (json.has("address"))
2569      res.setAddressElement(parseString(json.get("address").getAsString()));
2570    if (json.has("_address"))
2571      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
2572    if (json.has("type"))
2573      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2574    if (json.has("_type"))
2575      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2576  }
2577
2578  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2579    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2580    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2581    return res;
2582  }
2583
2584  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2585    parseBackboneProperties(json, res);
2586    if (json.has("site"))
2587      res.setSiteElement(parseString(json.get("site").getAsString()));
2588    if (json.has("_site"))
2589      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
2590    if (json.has("identifier"))
2591      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2592    if (json.has("type")) {
2593      JsonArray array = json.getAsJsonArray("type");
2594      for (int i = 0; i < array.size(); i++) {
2595        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2596      }
2597    };
2598  }
2599
2600  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2601    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2602    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2603    return res;
2604  }
2605
2606  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2607    parseBackboneProperties(json, res);
2608    if (json.has("identifier"))
2609      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2610    if (json.has("reference"))
2611      res.setReference(parseReference(getJObject(json, "reference")));
2612    if (json.has("type"))
2613      res.setType(parseCoding(getJObject(json, "type")));
2614    if (json.has("role"))
2615      res.setRole(parseCoding(getJObject(json, "role")));
2616    if (json.has("lifecycle"))
2617      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
2618    if (json.has("securityLabel")) {
2619      JsonArray array = json.getAsJsonArray("securityLabel");
2620      for (int i = 0; i < array.size(); i++) {
2621        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2622      }
2623    };
2624    if (json.has("name"))
2625      res.setNameElement(parseString(json.get("name").getAsString()));
2626    if (json.has("_name"))
2627      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2628    if (json.has("description"))
2629      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2630    if (json.has("_description"))
2631      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2632    if (json.has("query"))
2633      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2634    if (json.has("_query"))
2635      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
2636    if (json.has("detail")) {
2637      JsonArray array = json.getAsJsonArray("detail");
2638      for (int i = 0; i < array.size(); i++) {
2639        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2640      }
2641    };
2642  }
2643
2644  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2645    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2646    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2647    return res;
2648  }
2649
2650  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2651    parseBackboneProperties(json, res);
2652    if (json.has("type"))
2653      res.setTypeElement(parseString(json.get("type").getAsString()));
2654    if (json.has("_type"))
2655      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2656    if (json.has("value"))
2657      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
2658    if (json.has("_value"))
2659      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2660  }
2661
2662  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2663    Basic res = new Basic();
2664    parseBasicProperties(json, res);
2665    return res;
2666  }
2667
2668  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2669    parseDomainResourceProperties(json, res);
2670    if (json.has("identifier")) {
2671      JsonArray array = json.getAsJsonArray("identifier");
2672      for (int i = 0; i < array.size(); i++) {
2673        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2674      }
2675    };
2676    if (json.has("code"))
2677      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2678    if (json.has("subject"))
2679      res.setSubject(parseReference(getJObject(json, "subject")));
2680    if (json.has("created"))
2681      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2682    if (json.has("_created"))
2683      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2684    if (json.has("author"))
2685      res.setAuthor(parseReference(getJObject(json, "author")));
2686  }
2687
2688  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2689    Binary res = new Binary();
2690    parseBinaryProperties(json, res);
2691    return res;
2692  }
2693
2694  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
2695    parseResourceProperties(json, res);
2696    if (json.has("contentType"))
2697      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2698    if (json.has("_contentType"))
2699      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
2700    if (json.has("securityContext"))
2701      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
2702    if (json.has("content"))
2703      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2704    if (json.has("_content"))
2705      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
2706  }
2707
2708  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
2709    BodySite res = new BodySite();
2710    parseBodySiteProperties(json, res);
2711    return res;
2712  }
2713
2714  protected void parseBodySiteProperties(JsonObject json, BodySite res) throws IOException, FHIRFormatError {
2715    parseDomainResourceProperties(json, res);
2716    if (json.has("identifier")) {
2717      JsonArray array = json.getAsJsonArray("identifier");
2718      for (int i = 0; i < array.size(); i++) {
2719        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2720      }
2721    };
2722    if (json.has("active"))
2723      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
2724    if (json.has("_active"))
2725      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
2726    if (json.has("code"))
2727      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2728    if (json.has("qualifier")) {
2729      JsonArray array = json.getAsJsonArray("qualifier");
2730      for (int i = 0; i < array.size(); i++) {
2731        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2732      }
2733    };
2734    if (json.has("description"))
2735      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2736    if (json.has("_description"))
2737      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2738    if (json.has("image")) {
2739      JsonArray array = json.getAsJsonArray("image");
2740      for (int i = 0; i < array.size(); i++) {
2741        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
2742      }
2743    };
2744    if (json.has("patient"))
2745      res.setPatient(parseReference(getJObject(json, "patient")));
2746  }
2747
2748  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
2749    Bundle res = new Bundle();
2750    parseBundleProperties(json, res);
2751    return res;
2752  }
2753
2754  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
2755    parseResourceProperties(json, res);
2756    if (json.has("identifier"))
2757      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2758    if (json.has("type"))
2759      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
2760    if (json.has("_type"))
2761      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2762    if (json.has("total"))
2763      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
2764    if (json.has("_total"))
2765      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
2766    if (json.has("link")) {
2767      JsonArray array = json.getAsJsonArray("link");
2768      for (int i = 0; i < array.size(); i++) {
2769        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
2770      }
2771    };
2772    if (json.has("entry")) {
2773      JsonArray array = json.getAsJsonArray("entry");
2774      for (int i = 0; i < array.size(); i++) {
2775        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
2776      }
2777    };
2778    if (json.has("signature"))
2779      res.setSignature(parseSignature(getJObject(json, "signature")));
2780  }
2781
2782  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2783    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
2784    parseBundleBundleLinkComponentProperties(json, owner, res);
2785    return res;
2786  }
2787
2788  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
2789    parseBackboneProperties(json, res);
2790    if (json.has("relation"))
2791      res.setRelationElement(parseString(json.get("relation").getAsString()));
2792    if (json.has("_relation"))
2793      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
2794    if (json.has("url"))
2795      res.setUrlElement(parseUri(json.get("url").getAsString()));
2796    if (json.has("_url"))
2797      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2798  }
2799
2800  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2801    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
2802    parseBundleBundleEntryComponentProperties(json, owner, res);
2803    return res;
2804  }
2805
2806  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
2807    parseBackboneProperties(json, res);
2808    if (json.has("link")) {
2809      JsonArray array = json.getAsJsonArray("link");
2810      for (int i = 0; i < array.size(); i++) {
2811        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
2812      }
2813    };
2814    if (json.has("fullUrl"))
2815      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
2816    if (json.has("_fullUrl"))
2817      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
2818    if (json.has("resource"))
2819      res.setResource(parseResource(getJObject(json, "resource")));
2820    if (json.has("search"))
2821      res.setSearch(parseBundleBundleEntrySearchComponent(getJObject(json, "search"), owner));
2822    if (json.has("request"))
2823      res.setRequest(parseBundleBundleEntryRequestComponent(getJObject(json, "request"), owner));
2824    if (json.has("response"))
2825      res.setResponse(parseBundleBundleEntryResponseComponent(getJObject(json, "response"), owner));
2826  }
2827
2828  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2829    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
2830    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
2831    return res;
2832  }
2833
2834  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
2835    parseBackboneProperties(json, res);
2836    if (json.has("mode"))
2837      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
2838    if (json.has("_mode"))
2839      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
2840    if (json.has("score"))
2841      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
2842    if (json.has("_score"))
2843      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
2844  }
2845
2846  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2847    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
2848    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
2849    return res;
2850  }
2851
2852  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
2853    parseBackboneProperties(json, res);
2854    if (json.has("method"))
2855      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
2856    if (json.has("_method"))
2857      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
2858    if (json.has("url"))
2859      res.setUrlElement(parseUri(json.get("url").getAsString()));
2860    if (json.has("_url"))
2861      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2862    if (json.has("ifNoneMatch"))
2863      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
2864    if (json.has("_ifNoneMatch"))
2865      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
2866    if (json.has("ifModifiedSince"))
2867      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
2868    if (json.has("_ifModifiedSince"))
2869      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
2870    if (json.has("ifMatch"))
2871      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
2872    if (json.has("_ifMatch"))
2873      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
2874    if (json.has("ifNoneExist"))
2875      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
2876    if (json.has("_ifNoneExist"))
2877      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
2878  }
2879
2880  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2881    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
2882    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
2883    return res;
2884  }
2885
2886  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
2887    parseBackboneProperties(json, res);
2888    if (json.has("status"))
2889      res.setStatusElement(parseString(json.get("status").getAsString()));
2890    if (json.has("_status"))
2891      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2892    if (json.has("location"))
2893      res.setLocationElement(parseUri(json.get("location").getAsString()));
2894    if (json.has("_location"))
2895      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
2896    if (json.has("etag"))
2897      res.setEtagElement(parseString(json.get("etag").getAsString()));
2898    if (json.has("_etag"))
2899      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
2900    if (json.has("lastModified"))
2901      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
2902    if (json.has("_lastModified"))
2903      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
2904    if (json.has("outcome"))
2905      res.setOutcome(parseResource(getJObject(json, "outcome")));
2906  }
2907
2908  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
2909    CapabilityStatement res = new CapabilityStatement();
2910    parseCapabilityStatementProperties(json, res);
2911    return res;
2912  }
2913
2914  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
2915    parseDomainResourceProperties(json, res);
2916    if (json.has("url"))
2917      res.setUrlElement(parseUri(json.get("url").getAsString()));
2918    if (json.has("_url"))
2919      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2920    if (json.has("version"))
2921      res.setVersionElement(parseString(json.get("version").getAsString()));
2922    if (json.has("_version"))
2923      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2924    if (json.has("name"))
2925      res.setNameElement(parseString(json.get("name").getAsString()));
2926    if (json.has("_name"))
2927      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2928    if (json.has("title"))
2929      res.setTitleElement(parseString(json.get("title").getAsString()));
2930    if (json.has("_title"))
2931      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2932    if (json.has("status"))
2933      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2934    if (json.has("_status"))
2935      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2936    if (json.has("experimental"))
2937      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2938    if (json.has("_experimental"))
2939      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2940    if (json.has("date"))
2941      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2942    if (json.has("_date"))
2943      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2944    if (json.has("publisher"))
2945      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2946    if (json.has("_publisher"))
2947      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2948    if (json.has("contact")) {
2949      JsonArray array = json.getAsJsonArray("contact");
2950      for (int i = 0; i < array.size(); i++) {
2951        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2952      }
2953    };
2954    if (json.has("description"))
2955      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2956    if (json.has("_description"))
2957      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2958    if (json.has("useContext")) {
2959      JsonArray array = json.getAsJsonArray("useContext");
2960      for (int i = 0; i < array.size(); i++) {
2961        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2962      }
2963    };
2964    if (json.has("jurisdiction")) {
2965      JsonArray array = json.getAsJsonArray("jurisdiction");
2966      for (int i = 0; i < array.size(); i++) {
2967        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2968      }
2969    };
2970    if (json.has("purpose"))
2971      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2972    if (json.has("_purpose"))
2973      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2974    if (json.has("copyright"))
2975      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2976    if (json.has("_copyright"))
2977      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2978    if (json.has("kind"))
2979      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
2980    if (json.has("_kind"))
2981      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2982    if (json.has("instantiates")) {
2983      JsonArray array = json.getAsJsonArray("instantiates");
2984      for (int i = 0; i < array.size(); i++) {
2985        if (array.get(i).isJsonNull()) {
2986          res.getInstantiates().add(new UriType());
2987        } else {
2988          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
2989        }
2990      }
2991    };
2992    if (json.has("_instantiates")) {
2993      JsonArray array = json.getAsJsonArray("_instantiates");
2994      for (int i = 0; i < array.size(); i++) {
2995        if (i == res.getInstantiates().size())
2996          res.getInstantiates().add(parseUri(null));
2997        if (array.get(i) instanceof JsonObject) 
2998          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
2999      }
3000    };
3001    if (json.has("software"))
3002      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(getJObject(json, "software"), res));
3003    if (json.has("implementation"))
3004      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(getJObject(json, "implementation"), res));
3005    if (json.has("fhirVersion"))
3006      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3007    if (json.has("_fhirVersion"))
3008      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3009    if (json.has("acceptUnknown"))
3010      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), CapabilityStatement.UnknownContentCode.NULL, new CapabilityStatement.UnknownContentCodeEnumFactory()));
3011    if (json.has("_acceptUnknown"))
3012      parseElementProperties(getJObject(json, "_acceptUnknown"), res.getAcceptUnknownElement());
3013    if (json.has("format")) {
3014      JsonArray array = json.getAsJsonArray("format");
3015      for (int i = 0; i < array.size(); i++) {
3016        if (array.get(i).isJsonNull()) {
3017          res.getFormat().add(new CodeType());
3018        } else {
3019          res.getFormat().add(parseCode(array.get(i).getAsString()));
3020        }
3021      }
3022    };
3023    if (json.has("_format")) {
3024      JsonArray array = json.getAsJsonArray("_format");
3025      for (int i = 0; i < array.size(); i++) {
3026        if (i == res.getFormat().size())
3027          res.getFormat().add(parseCode(null));
3028        if (array.get(i) instanceof JsonObject) 
3029          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3030      }
3031    };
3032    if (json.has("patchFormat")) {
3033      JsonArray array = json.getAsJsonArray("patchFormat");
3034      for (int i = 0; i < array.size(); i++) {
3035        if (array.get(i).isJsonNull()) {
3036          res.getPatchFormat().add(new CodeType());
3037        } else {
3038          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3039        }
3040      }
3041    };
3042    if (json.has("_patchFormat")) {
3043      JsonArray array = json.getAsJsonArray("_patchFormat");
3044      for (int i = 0; i < array.size(); i++) {
3045        if (i == res.getPatchFormat().size())
3046          res.getPatchFormat().add(parseCode(null));
3047        if (array.get(i) instanceof JsonObject) 
3048          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3049      }
3050    };
3051    if (json.has("implementationGuide")) {
3052      JsonArray array = json.getAsJsonArray("implementationGuide");
3053      for (int i = 0; i < array.size(); i++) {
3054        if (array.get(i).isJsonNull()) {
3055          res.getImplementationGuide().add(new UriType());
3056        } else {
3057          res.getImplementationGuide().add(parseUri(array.get(i).getAsString()));
3058        }
3059      }
3060    };
3061    if (json.has("_implementationGuide")) {
3062      JsonArray array = json.getAsJsonArray("_implementationGuide");
3063      for (int i = 0; i < array.size(); i++) {
3064        if (i == res.getImplementationGuide().size())
3065          res.getImplementationGuide().add(parseUri(null));
3066        if (array.get(i) instanceof JsonObject) 
3067          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3068      }
3069    };
3070    if (json.has("profile")) {
3071      JsonArray array = json.getAsJsonArray("profile");
3072      for (int i = 0; i < array.size(); i++) {
3073        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
3074      }
3075    };
3076    if (json.has("rest")) {
3077      JsonArray array = json.getAsJsonArray("rest");
3078      for (int i = 0; i < array.size(); i++) {
3079        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3080      }
3081    };
3082    if (json.has("messaging")) {
3083      JsonArray array = json.getAsJsonArray("messaging");
3084      for (int i = 0; i < array.size(); i++) {
3085        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3086      }
3087    };
3088    if (json.has("document")) {
3089      JsonArray array = json.getAsJsonArray("document");
3090      for (int i = 0; i < array.size(); i++) {
3091        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3092      }
3093    };
3094  }
3095
3096  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3097    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3098    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3099    return res;
3100  }
3101
3102  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3103    parseBackboneProperties(json, res);
3104    if (json.has("name"))
3105      res.setNameElement(parseString(json.get("name").getAsString()));
3106    if (json.has("_name"))
3107      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3108    if (json.has("version"))
3109      res.setVersionElement(parseString(json.get("version").getAsString()));
3110    if (json.has("_version"))
3111      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3112    if (json.has("releaseDate"))
3113      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3114    if (json.has("_releaseDate"))
3115      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
3116  }
3117
3118  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3119    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3120    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3121    return res;
3122  }
3123
3124  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3125    parseBackboneProperties(json, res);
3126    if (json.has("description"))
3127      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3128    if (json.has("_description"))
3129      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3130    if (json.has("url"))
3131      res.setUrlElement(parseUri(json.get("url").getAsString()));
3132    if (json.has("_url"))
3133      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3134  }
3135
3136  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3137    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3138    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3139    return res;
3140  }
3141
3142  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3143    parseBackboneProperties(json, res);
3144    if (json.has("mode"))
3145      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3146    if (json.has("_mode"))
3147      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3148    if (json.has("documentation"))
3149      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3150    if (json.has("_documentation"))
3151      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3152    if (json.has("security"))
3153      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(getJObject(json, "security"), owner));
3154    if (json.has("resource")) {
3155      JsonArray array = json.getAsJsonArray("resource");
3156      for (int i = 0; i < array.size(); i++) {
3157        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3158      }
3159    };
3160    if (json.has("interaction")) {
3161      JsonArray array = json.getAsJsonArray("interaction");
3162      for (int i = 0; i < array.size(); i++) {
3163        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3164      }
3165    };
3166    if (json.has("searchParam")) {
3167      JsonArray array = json.getAsJsonArray("searchParam");
3168      for (int i = 0; i < array.size(); i++) {
3169        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3170      }
3171    };
3172    if (json.has("operation")) {
3173      JsonArray array = json.getAsJsonArray("operation");
3174      for (int i = 0; i < array.size(); i++) {
3175        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3176      }
3177    };
3178    if (json.has("compartment")) {
3179      JsonArray array = json.getAsJsonArray("compartment");
3180      for (int i = 0; i < array.size(); i++) {
3181        if (array.get(i).isJsonNull()) {
3182          res.getCompartment().add(new UriType());
3183        } else {
3184          res.getCompartment().add(parseUri(array.get(i).getAsString()));
3185        }
3186      }
3187    };
3188    if (json.has("_compartment")) {
3189      JsonArray array = json.getAsJsonArray("_compartment");
3190      for (int i = 0; i < array.size(); i++) {
3191        if (i == res.getCompartment().size())
3192          res.getCompartment().add(parseUri(null));
3193        if (array.get(i) instanceof JsonObject) 
3194          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3195      }
3196    };
3197  }
3198
3199  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3200    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3201    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3202    return res;
3203  }
3204
3205  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3206    parseBackboneProperties(json, res);
3207    if (json.has("cors"))
3208      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3209    if (json.has("_cors"))
3210      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
3211    if (json.has("service")) {
3212      JsonArray array = json.getAsJsonArray("service");
3213      for (int i = 0; i < array.size(); i++) {
3214        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3215      }
3216    };
3217    if (json.has("description"))
3218      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3219    if (json.has("_description"))
3220      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3221    if (json.has("certificate")) {
3222      JsonArray array = json.getAsJsonArray("certificate");
3223      for (int i = 0; i < array.size(); i++) {
3224        res.getCertificate().add(parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3225      }
3226    };
3227  }
3228
3229  protected CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3230    CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res = new CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
3231    parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(json, owner, res);
3232    return res;
3233  }
3234
3235  protected void parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res) throws IOException, FHIRFormatError {
3236    parseBackboneProperties(json, res);
3237    if (json.has("type"))
3238      res.setTypeElement(parseCode(json.get("type").getAsString()));
3239    if (json.has("_type"))
3240      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3241    if (json.has("blob"))
3242      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3243    if (json.has("_blob"))
3244      parseElementProperties(getJObject(json, "_blob"), res.getBlobElement());
3245  }
3246
3247  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3248    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3249    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3250    return res;
3251  }
3252
3253  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3254    parseBackboneProperties(json, res);
3255    if (json.has("type"))
3256      res.setTypeElement(parseCode(json.get("type").getAsString()));
3257    if (json.has("_type"))
3258      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3259    if (json.has("profile"))
3260      res.setProfile(parseReference(getJObject(json, "profile")));
3261    if (json.has("documentation"))
3262      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3263    if (json.has("_documentation"))
3264      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3265    if (json.has("interaction")) {
3266      JsonArray array = json.getAsJsonArray("interaction");
3267      for (int i = 0; i < array.size(); i++) {
3268        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3269      }
3270    };
3271    if (json.has("versioning"))
3272      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3273    if (json.has("_versioning"))
3274      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
3275    if (json.has("readHistory"))
3276      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3277    if (json.has("_readHistory"))
3278      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
3279    if (json.has("updateCreate"))
3280      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3281    if (json.has("_updateCreate"))
3282      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
3283    if (json.has("conditionalCreate"))
3284      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3285    if (json.has("_conditionalCreate"))
3286      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
3287    if (json.has("conditionalRead"))
3288      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3289    if (json.has("_conditionalRead"))
3290      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
3291    if (json.has("conditionalUpdate"))
3292      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3293    if (json.has("_conditionalUpdate"))
3294      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
3295    if (json.has("conditionalDelete"))
3296      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3297    if (json.has("_conditionalDelete"))
3298      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
3299    if (json.has("referencePolicy")) {
3300      JsonArray array = json.getAsJsonArray("referencePolicy");
3301      for (int i = 0; i < array.size(); i++) {
3302        if (array.get(i).isJsonNull()) {
3303          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>());
3304        } else {
3305          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3306        }
3307      }
3308    };
3309    if (json.has("_referencePolicy")) {
3310      JsonArray array = json.getAsJsonArray("_referencePolicy");
3311      for (int i = 0; i < array.size(); i++) {
3312        if (i == res.getReferencePolicy().size())
3313          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3314        if (array.get(i) instanceof JsonObject) 
3315          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3316      }
3317    };
3318    if (json.has("searchInclude")) {
3319      JsonArray array = json.getAsJsonArray("searchInclude");
3320      for (int i = 0; i < array.size(); i++) {
3321        if (array.get(i).isJsonNull()) {
3322          res.getSearchInclude().add(new StringType());
3323        } else {
3324          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3325        }
3326      }
3327    };
3328    if (json.has("_searchInclude")) {
3329      JsonArray array = json.getAsJsonArray("_searchInclude");
3330      for (int i = 0; i < array.size(); i++) {
3331        if (i == res.getSearchInclude().size())
3332          res.getSearchInclude().add(parseString(null));
3333        if (array.get(i) instanceof JsonObject) 
3334          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3335      }
3336    };
3337    if (json.has("searchRevInclude")) {
3338      JsonArray array = json.getAsJsonArray("searchRevInclude");
3339      for (int i = 0; i < array.size(); i++) {
3340        if (array.get(i).isJsonNull()) {
3341          res.getSearchRevInclude().add(new StringType());
3342        } else {
3343          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3344        }
3345      }
3346    };
3347    if (json.has("_searchRevInclude")) {
3348      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3349      for (int i = 0; i < array.size(); i++) {
3350        if (i == res.getSearchRevInclude().size())
3351          res.getSearchRevInclude().add(parseString(null));
3352        if (array.get(i) instanceof JsonObject) 
3353          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3354      }
3355    };
3356    if (json.has("searchParam")) {
3357      JsonArray array = json.getAsJsonArray("searchParam");
3358      for (int i = 0; i < array.size(); i++) {
3359        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3360      }
3361    };
3362  }
3363
3364  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3365    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3366    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3367    return res;
3368  }
3369
3370  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3371    parseBackboneProperties(json, res);
3372    if (json.has("code"))
3373      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3374    if (json.has("_code"))
3375      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3376    if (json.has("documentation"))
3377      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3378    if (json.has("_documentation"))
3379      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3380  }
3381
3382  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3383    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3384    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3385    return res;
3386  }
3387
3388  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3389    parseBackboneProperties(json, res);
3390    if (json.has("name"))
3391      res.setNameElement(parseString(json.get("name").getAsString()));
3392    if (json.has("_name"))
3393      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3394    if (json.has("definition"))
3395      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3396    if (json.has("_definition"))
3397      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3398    if (json.has("type"))
3399      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3400    if (json.has("_type"))
3401      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3402    if (json.has("documentation"))
3403      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3404    if (json.has("_documentation"))
3405      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3406  }
3407
3408  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3409    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3410    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3411    return res;
3412  }
3413
3414  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3415    parseBackboneProperties(json, res);
3416    if (json.has("code"))
3417      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3418    if (json.has("_code"))
3419      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3420    if (json.has("documentation"))
3421      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3422    if (json.has("_documentation"))
3423      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3424  }
3425
3426  protected CapabilityStatement.CapabilityStatementRestOperationComponent parseCapabilityStatementCapabilityStatementRestOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3427    CapabilityStatement.CapabilityStatementRestOperationComponent res = new CapabilityStatement.CapabilityStatementRestOperationComponent();
3428    parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(json, owner, res);
3429    return res;
3430  }
3431
3432  protected void parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestOperationComponent res) throws IOException, FHIRFormatError {
3433    parseBackboneProperties(json, res);
3434    if (json.has("name"))
3435      res.setNameElement(parseString(json.get("name").getAsString()));
3436    if (json.has("_name"))
3437      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3438    if (json.has("definition"))
3439      res.setDefinition(parseReference(getJObject(json, "definition")));
3440  }
3441
3442  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3443    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3444    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3445    return res;
3446  }
3447
3448  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3449    parseBackboneProperties(json, res);
3450    if (json.has("endpoint")) {
3451      JsonArray array = json.getAsJsonArray("endpoint");
3452      for (int i = 0; i < array.size(); i++) {
3453        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3454      }
3455    };
3456    if (json.has("reliableCache"))
3457      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3458    if (json.has("_reliableCache"))
3459      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
3460    if (json.has("documentation"))
3461      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3462    if (json.has("_documentation"))
3463      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3464    if (json.has("supportedMessage")) {
3465      JsonArray array = json.getAsJsonArray("supportedMessage");
3466      for (int i = 0; i < array.size(); i++) {
3467        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3468      }
3469    };
3470    if (json.has("event")) {
3471      JsonArray array = json.getAsJsonArray("event");
3472      for (int i = 0; i < array.size(); i++) {
3473        res.getEvent().add(parseCapabilityStatementCapabilityStatementMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3474      }
3475    };
3476  }
3477
3478  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3479    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3480    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3481    return res;
3482  }
3483
3484  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3485    parseBackboneProperties(json, res);
3486    if (json.has("protocol"))
3487      res.setProtocol(parseCoding(getJObject(json, "protocol")));
3488    if (json.has("address"))
3489      res.setAddressElement(parseUri(json.get("address").getAsString()));
3490    if (json.has("_address"))
3491      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
3492  }
3493
3494  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3495    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3496    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3497    return res;
3498  }
3499
3500  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3501    parseBackboneProperties(json, res);
3502    if (json.has("mode"))
3503      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3504    if (json.has("_mode"))
3505      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3506    if (json.has("definition"))
3507      res.setDefinition(parseReference(getJObject(json, "definition")));
3508  }
3509
3510  protected CapabilityStatement.CapabilityStatementMessagingEventComponent parseCapabilityStatementCapabilityStatementMessagingEventComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3511    CapabilityStatement.CapabilityStatementMessagingEventComponent res = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
3512    parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(json, owner, res);
3513    return res;
3514  }
3515
3516  protected void parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEventComponent res) throws IOException, FHIRFormatError {
3517    parseBackboneProperties(json, res);
3518    if (json.has("code"))
3519      res.setCode(parseCoding(getJObject(json, "code")));
3520    if (json.has("category"))
3521      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), CapabilityStatement.MessageSignificanceCategory.NULL, new CapabilityStatement.MessageSignificanceCategoryEnumFactory()));
3522    if (json.has("_category"))
3523      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
3524    if (json.has("mode"))
3525      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3526    if (json.has("_mode"))
3527      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3528    if (json.has("focus"))
3529      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3530    if (json.has("_focus"))
3531      parseElementProperties(getJObject(json, "_focus"), res.getFocusElement());
3532    if (json.has("request"))
3533      res.setRequest(parseReference(getJObject(json, "request")));
3534    if (json.has("response"))
3535      res.setResponse(parseReference(getJObject(json, "response")));
3536    if (json.has("documentation"))
3537      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3538    if (json.has("_documentation"))
3539      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3540  }
3541
3542  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3543    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3544    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3545    return res;
3546  }
3547
3548  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3549    parseBackboneProperties(json, res);
3550    if (json.has("mode"))
3551      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3552    if (json.has("_mode"))
3553      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3554    if (json.has("documentation"))
3555      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3556    if (json.has("_documentation"))
3557      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3558    if (json.has("profile"))
3559      res.setProfile(parseReference(getJObject(json, "profile")));
3560  }
3561
3562  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3563    CarePlan res = new CarePlan();
3564    parseCarePlanProperties(json, res);
3565    return res;
3566  }
3567
3568  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3569    parseDomainResourceProperties(json, res);
3570    if (json.has("identifier")) {
3571      JsonArray array = json.getAsJsonArray("identifier");
3572      for (int i = 0; i < array.size(); i++) {
3573        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3574      }
3575    };
3576    if (json.has("definition")) {
3577      JsonArray array = json.getAsJsonArray("definition");
3578      for (int i = 0; i < array.size(); i++) {
3579        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
3580      }
3581    };
3582    if (json.has("basedOn")) {
3583      JsonArray array = json.getAsJsonArray("basedOn");
3584      for (int i = 0; i < array.size(); i++) {
3585        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3586      }
3587    };
3588    if (json.has("replaces")) {
3589      JsonArray array = json.getAsJsonArray("replaces");
3590      for (int i = 0; i < array.size(); i++) {
3591        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3592      }
3593    };
3594    if (json.has("partOf")) {
3595      JsonArray array = json.getAsJsonArray("partOf");
3596      for (int i = 0; i < array.size(); i++) {
3597        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3598      }
3599    };
3600    if (json.has("status"))
3601      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
3602    if (json.has("_status"))
3603      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3604    if (json.has("intent"))
3605      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
3606    if (json.has("_intent"))
3607      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
3608    if (json.has("category")) {
3609      JsonArray array = json.getAsJsonArray("category");
3610      for (int i = 0; i < array.size(); i++) {
3611        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3612      }
3613    };
3614    if (json.has("title"))
3615      res.setTitleElement(parseString(json.get("title").getAsString()));
3616    if (json.has("_title"))
3617      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3618    if (json.has("description"))
3619      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3620    if (json.has("_description"))
3621      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3622    if (json.has("subject"))
3623      res.setSubject(parseReference(getJObject(json, "subject")));
3624    if (json.has("context"))
3625      res.setContext(parseReference(getJObject(json, "context")));
3626    if (json.has("period"))
3627      res.setPeriod(parsePeriod(getJObject(json, "period")));
3628    if (json.has("author")) {
3629      JsonArray array = json.getAsJsonArray("author");
3630      for (int i = 0; i < array.size(); i++) {
3631        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3632      }
3633    };
3634    if (json.has("careTeam")) {
3635      JsonArray array = json.getAsJsonArray("careTeam");
3636      for (int i = 0; i < array.size(); i++) {
3637        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
3638      }
3639    };
3640    if (json.has("addresses")) {
3641      JsonArray array = json.getAsJsonArray("addresses");
3642      for (int i = 0; i < array.size(); i++) {
3643        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
3644      }
3645    };
3646    if (json.has("supportingInfo")) {
3647      JsonArray array = json.getAsJsonArray("supportingInfo");
3648      for (int i = 0; i < array.size(); i++) {
3649        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
3650      }
3651    };
3652    if (json.has("goal")) {
3653      JsonArray array = json.getAsJsonArray("goal");
3654      for (int i = 0; i < array.size(); i++) {
3655        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3656      }
3657    };
3658    if (json.has("activity")) {
3659      JsonArray array = json.getAsJsonArray("activity");
3660      for (int i = 0; i < array.size(); i++) {
3661        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
3662      }
3663    };
3664    if (json.has("note")) {
3665      JsonArray array = json.getAsJsonArray("note");
3666      for (int i = 0; i < array.size(); i++) {
3667        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3668      }
3669    };
3670  }
3671
3672  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3673    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
3674    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
3675    return res;
3676  }
3677
3678  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
3679    parseBackboneProperties(json, res);
3680    if (json.has("outcomeCodeableConcept")) {
3681      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
3682      for (int i = 0; i < array.size(); i++) {
3683        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3684      }
3685    };
3686    if (json.has("outcomeReference")) {
3687      JsonArray array = json.getAsJsonArray("outcomeReference");
3688      for (int i = 0; i < array.size(); i++) {
3689        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
3690      }
3691    };
3692    if (json.has("progress")) {
3693      JsonArray array = json.getAsJsonArray("progress");
3694      for (int i = 0; i < array.size(); i++) {
3695        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
3696      }
3697    };
3698    if (json.has("reference"))
3699      res.setReference(parseReference(getJObject(json, "reference")));
3700    if (json.has("detail"))
3701      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(getJObject(json, "detail"), owner));
3702  }
3703
3704  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3705    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
3706    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
3707    return res;
3708  }
3709
3710  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
3711    parseBackboneProperties(json, res);
3712    if (json.has("category"))
3713      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
3714    if (json.has("definition"))
3715      res.setDefinition(parseReference(getJObject(json, "definition")));
3716    if (json.has("code"))
3717      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3718    if (json.has("reasonCode")) {
3719      JsonArray array = json.getAsJsonArray("reasonCode");
3720      for (int i = 0; i < array.size(); i++) {
3721        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3722      }
3723    };
3724    if (json.has("reasonReference")) {
3725      JsonArray array = json.getAsJsonArray("reasonReference");
3726      for (int i = 0; i < array.size(); i++) {
3727        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3728      }
3729    };
3730    if (json.has("goal")) {
3731      JsonArray array = json.getAsJsonArray("goal");
3732      for (int i = 0; i < array.size(); i++) {
3733        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3734      }
3735    };
3736    if (json.has("status"))
3737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
3738    if (json.has("_status"))
3739      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3740    if (json.has("statusReason"))
3741      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
3742    if (json.has("_statusReason"))
3743      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
3744    if (json.has("prohibited"))
3745      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
3746    if (json.has("_prohibited"))
3747      parseElementProperties(getJObject(json, "_prohibited"), res.getProhibitedElement());
3748    Type scheduled = parseType("scheduled", json);
3749    if (scheduled != null)
3750      res.setScheduled(scheduled);
3751    if (json.has("location"))
3752      res.setLocation(parseReference(getJObject(json, "location")));
3753    if (json.has("performer")) {
3754      JsonArray array = json.getAsJsonArray("performer");
3755      for (int i = 0; i < array.size(); i++) {
3756        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
3757      }
3758    };
3759    Type product = parseType("product", json);
3760    if (product != null)
3761      res.setProduct(product);
3762    if (json.has("dailyAmount"))
3763      res.setDailyAmount(parseSimpleQuantity(getJObject(json, "dailyAmount")));
3764    if (json.has("quantity"))
3765      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
3766    if (json.has("description"))
3767      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3768    if (json.has("_description"))
3769      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3770  }
3771
3772  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
3773    CareTeam res = new CareTeam();
3774    parseCareTeamProperties(json, res);
3775    return res;
3776  }
3777
3778  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
3779    parseDomainResourceProperties(json, res);
3780    if (json.has("identifier")) {
3781      JsonArray array = json.getAsJsonArray("identifier");
3782      for (int i = 0; i < array.size(); i++) {
3783        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3784      }
3785    };
3786    if (json.has("status"))
3787      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
3788    if (json.has("_status"))
3789      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3790    if (json.has("category")) {
3791      JsonArray array = json.getAsJsonArray("category");
3792      for (int i = 0; i < array.size(); i++) {
3793        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3794      }
3795    };
3796    if (json.has("name"))
3797      res.setNameElement(parseString(json.get("name").getAsString()));
3798    if (json.has("_name"))
3799      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3800    if (json.has("subject"))
3801      res.setSubject(parseReference(getJObject(json, "subject")));
3802    if (json.has("context"))
3803      res.setContext(parseReference(getJObject(json, "context")));
3804    if (json.has("period"))
3805      res.setPeriod(parsePeriod(getJObject(json, "period")));
3806    if (json.has("participant")) {
3807      JsonArray array = json.getAsJsonArray("participant");
3808      for (int i = 0; i < array.size(); i++) {
3809        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
3810      }
3811    };
3812    if (json.has("reasonCode")) {
3813      JsonArray array = json.getAsJsonArray("reasonCode");
3814      for (int i = 0; i < array.size(); i++) {
3815        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3816      }
3817    };
3818    if (json.has("reasonReference")) {
3819      JsonArray array = json.getAsJsonArray("reasonReference");
3820      for (int i = 0; i < array.size(); i++) {
3821        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3822      }
3823    };
3824    if (json.has("managingOrganization")) {
3825      JsonArray array = json.getAsJsonArray("managingOrganization");
3826      for (int i = 0; i < array.size(); i++) {
3827        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
3828      }
3829    };
3830    if (json.has("note")) {
3831      JsonArray array = json.getAsJsonArray("note");
3832      for (int i = 0; i < array.size(); i++) {
3833        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3834      }
3835    };
3836  }
3837
3838  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
3839    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
3840    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
3841    return res;
3842  }
3843
3844  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
3845    parseBackboneProperties(json, res);
3846    if (json.has("role"))
3847      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3848    if (json.has("member"))
3849      res.setMember(parseReference(getJObject(json, "member")));
3850    if (json.has("onBehalfOf"))
3851      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
3852    if (json.has("period"))
3853      res.setPeriod(parsePeriod(getJObject(json, "period")));
3854  }
3855
3856  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
3857    ChargeItem res = new ChargeItem();
3858    parseChargeItemProperties(json, res);
3859    return res;
3860  }
3861
3862  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
3863    parseDomainResourceProperties(json, res);
3864    if (json.has("identifier"))
3865      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3866    if (json.has("definition")) {
3867      JsonArray array = json.getAsJsonArray("definition");
3868      for (int i = 0; i < array.size(); i++) {
3869        if (array.get(i).isJsonNull()) {
3870          res.getDefinition().add(new UriType());
3871        } else {
3872          res.getDefinition().add(parseUri(array.get(i).getAsString()));
3873        }
3874      }
3875    };
3876    if (json.has("_definition")) {
3877      JsonArray array = json.getAsJsonArray("_definition");
3878      for (int i = 0; i < array.size(); i++) {
3879        if (i == res.getDefinition().size())
3880          res.getDefinition().add(parseUri(null));
3881        if (array.get(i) instanceof JsonObject) 
3882          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
3883      }
3884    };
3885    if (json.has("status"))
3886      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
3887    if (json.has("_status"))
3888      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3889    if (json.has("partOf")) {
3890      JsonArray array = json.getAsJsonArray("partOf");
3891      for (int i = 0; i < array.size(); i++) {
3892        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3893      }
3894    };
3895    if (json.has("code"))
3896      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3897    if (json.has("subject"))
3898      res.setSubject(parseReference(getJObject(json, "subject")));
3899    if (json.has("context"))
3900      res.setContext(parseReference(getJObject(json, "context")));
3901    Type occurrence = parseType("occurrence", json);
3902    if (occurrence != null)
3903      res.setOccurrence(occurrence);
3904    if (json.has("participant")) {
3905      JsonArray array = json.getAsJsonArray("participant");
3906      for (int i = 0; i < array.size(); i++) {
3907        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(array.get(i).getAsJsonObject(), res));
3908      }
3909    };
3910    if (json.has("performingOrganization"))
3911      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
3912    if (json.has("requestingOrganization"))
3913      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
3914    if (json.has("quantity"))
3915      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
3916    if (json.has("bodysite")) {
3917      JsonArray array = json.getAsJsonArray("bodysite");
3918      for (int i = 0; i < array.size(); i++) {
3919        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3920      }
3921    };
3922    if (json.has("factorOverride"))
3923      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
3924    if (json.has("_factorOverride"))
3925      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
3926    if (json.has("priceOverride"))
3927      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
3928    if (json.has("overrideReason"))
3929      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
3930    if (json.has("_overrideReason"))
3931      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
3932    if (json.has("enterer"))
3933      res.setEnterer(parseReference(getJObject(json, "enterer")));
3934    if (json.has("enteredDate"))
3935      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
3936    if (json.has("_enteredDate"))
3937      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
3938    if (json.has("reason")) {
3939      JsonArray array = json.getAsJsonArray("reason");
3940      for (int i = 0; i < array.size(); i++) {
3941        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3942      }
3943    };
3944    if (json.has("service")) {
3945      JsonArray array = json.getAsJsonArray("service");
3946      for (int i = 0; i < array.size(); i++) {
3947        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
3948      }
3949    };
3950    if (json.has("account")) {
3951      JsonArray array = json.getAsJsonArray("account");
3952      for (int i = 0; i < array.size(); i++) {
3953        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3954      }
3955    };
3956    if (json.has("note")) {
3957      JsonArray array = json.getAsJsonArray("note");
3958      for (int i = 0; i < array.size(); i++) {
3959        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3960      }
3961    };
3962    if (json.has("supportingInformation")) {
3963      JsonArray array = json.getAsJsonArray("supportingInformation");
3964      for (int i = 0; i < array.size(); i++) {
3965        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3966      }
3967    };
3968  }
3969
3970  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
3971    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
3972    parseChargeItemChargeItemParticipantComponentProperties(json, owner, res);
3973    return res;
3974  }
3975
3976  protected void parseChargeItemChargeItemParticipantComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws IOException, FHIRFormatError {
3977    parseBackboneProperties(json, res);
3978    if (json.has("role"))
3979      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3980    if (json.has("actor"))
3981      res.setActor(parseReference(getJObject(json, "actor")));
3982  }
3983
3984  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
3985    Claim res = new Claim();
3986    parseClaimProperties(json, res);
3987    return res;
3988  }
3989
3990  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
3991    parseDomainResourceProperties(json, res);
3992    if (json.has("identifier")) {
3993      JsonArray array = json.getAsJsonArray("identifier");
3994      for (int i = 0; i < array.size(); i++) {
3995        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3996      }
3997    };
3998    if (json.has("status"))
3999      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4000    if (json.has("_status"))
4001      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4002    if (json.has("type"))
4003      res.setType(parseCodeableConcept(getJObject(json, "type")));
4004    if (json.has("subType")) {
4005      JsonArray array = json.getAsJsonArray("subType");
4006      for (int i = 0; i < array.size(); i++) {
4007        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4008      }
4009    };
4010    if (json.has("use"))
4011      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4012    if (json.has("_use"))
4013      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
4014    if (json.has("patient"))
4015      res.setPatient(parseReference(getJObject(json, "patient")));
4016    if (json.has("billablePeriod"))
4017      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
4018    if (json.has("created"))
4019      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4020    if (json.has("_created"))
4021      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4022    if (json.has("enterer"))
4023      res.setEnterer(parseReference(getJObject(json, "enterer")));
4024    if (json.has("insurer"))
4025      res.setInsurer(parseReference(getJObject(json, "insurer")));
4026    if (json.has("provider"))
4027      res.setProvider(parseReference(getJObject(json, "provider")));
4028    if (json.has("organization"))
4029      res.setOrganization(parseReference(getJObject(json, "organization")));
4030    if (json.has("priority"))
4031      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
4032    if (json.has("fundsReserve"))
4033      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
4034    if (json.has("related")) {
4035      JsonArray array = json.getAsJsonArray("related");
4036      for (int i = 0; i < array.size(); i++) {
4037        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4038      }
4039    };
4040    if (json.has("prescription"))
4041      res.setPrescription(parseReference(getJObject(json, "prescription")));
4042    if (json.has("originalPrescription"))
4043      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
4044    if (json.has("payee"))
4045      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee"), res));
4046    if (json.has("referral"))
4047      res.setReferral(parseReference(getJObject(json, "referral")));
4048    if (json.has("facility"))
4049      res.setFacility(parseReference(getJObject(json, "facility")));
4050    if (json.has("careTeam")) {
4051      JsonArray array = json.getAsJsonArray("careTeam");
4052      for (int i = 0; i < array.size(); i++) {
4053        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4054      }
4055    };
4056    if (json.has("information")) {
4057      JsonArray array = json.getAsJsonArray("information");
4058      for (int i = 0; i < array.size(); i++) {
4059        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
4060      }
4061    };
4062    if (json.has("diagnosis")) {
4063      JsonArray array = json.getAsJsonArray("diagnosis");
4064      for (int i = 0; i < array.size(); i++) {
4065        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4066      }
4067    };
4068    if (json.has("procedure")) {
4069      JsonArray array = json.getAsJsonArray("procedure");
4070      for (int i = 0; i < array.size(); i++) {
4071        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4072      }
4073    };
4074    if (json.has("insurance")) {
4075      JsonArray array = json.getAsJsonArray("insurance");
4076      for (int i = 0; i < array.size(); i++) {
4077        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4078      }
4079    };
4080    if (json.has("accident"))
4081      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident"), res));
4082    if (json.has("employmentImpacted"))
4083      res.setEmploymentImpacted(parsePeriod(getJObject(json, "employmentImpacted")));
4084    if (json.has("hospitalization"))
4085      res.setHospitalization(parsePeriod(getJObject(json, "hospitalization")));
4086    if (json.has("item")) {
4087      JsonArray array = json.getAsJsonArray("item");
4088      for (int i = 0; i < array.size(); i++) {
4089        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4090      }
4091    };
4092    if (json.has("total"))
4093      res.setTotal(parseMoney(getJObject(json, "total")));
4094  }
4095
4096  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4097    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4098    parseClaimRelatedClaimComponentProperties(json, owner, res);
4099    return res;
4100  }
4101
4102  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4103    parseBackboneProperties(json, res);
4104    if (json.has("claim"))
4105      res.setClaim(parseReference(getJObject(json, "claim")));
4106    if (json.has("relationship"))
4107      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
4108    if (json.has("reference"))
4109      res.setReference(parseIdentifier(getJObject(json, "reference")));
4110  }
4111
4112  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4113    Claim.PayeeComponent res = new Claim.PayeeComponent();
4114    parseClaimPayeeComponentProperties(json, owner, res);
4115    return res;
4116  }
4117
4118  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4119    parseBackboneProperties(json, res);
4120    if (json.has("type"))
4121      res.setType(parseCodeableConcept(getJObject(json, "type")));
4122    if (json.has("resourceType"))
4123      res.setResourceType(parseCoding(getJObject(json, "resourceType")));
4124    if (json.has("party"))
4125      res.setParty(parseReference(getJObject(json, "party")));
4126  }
4127
4128  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4129    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4130    parseClaimCareTeamComponentProperties(json, owner, res);
4131    return res;
4132  }
4133
4134  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4135    parseBackboneProperties(json, res);
4136    if (json.has("sequence"))
4137      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4138    if (json.has("_sequence"))
4139      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4140    if (json.has("provider"))
4141      res.setProvider(parseReference(getJObject(json, "provider")));
4142    if (json.has("responsible"))
4143      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4144    if (json.has("_responsible"))
4145      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
4146    if (json.has("role"))
4147      res.setRole(parseCodeableConcept(getJObject(json, "role")));
4148    if (json.has("qualification"))
4149      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
4150  }
4151
4152  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4153    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4154    parseClaimSpecialConditionComponentProperties(json, owner, res);
4155    return res;
4156  }
4157
4158  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4159    parseBackboneProperties(json, res);
4160    if (json.has("sequence"))
4161      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4162    if (json.has("_sequence"))
4163      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4164    if (json.has("category"))
4165      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4166    if (json.has("code"))
4167      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4168    Type timing = parseType("timing", json);
4169    if (timing != null)
4170      res.setTiming(timing);
4171    Type value = parseType("value", json);
4172    if (value != null)
4173      res.setValue(value);
4174    if (json.has("reason"))
4175      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
4176  }
4177
4178  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4179    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4180    parseClaimDiagnosisComponentProperties(json, owner, res);
4181    return res;
4182  }
4183
4184  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4185    parseBackboneProperties(json, res);
4186    if (json.has("sequence"))
4187      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4188    if (json.has("_sequence"))
4189      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4190    Type diagnosis = parseType("diagnosis", json);
4191    if (diagnosis != null)
4192      res.setDiagnosis(diagnosis);
4193    if (json.has("type")) {
4194      JsonArray array = json.getAsJsonArray("type");
4195      for (int i = 0; i < array.size(); i++) {
4196        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4197      }
4198    };
4199    if (json.has("packageCode"))
4200      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
4201  }
4202
4203  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4204    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4205    parseClaimProcedureComponentProperties(json, owner, res);
4206    return res;
4207  }
4208
4209  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4210    parseBackboneProperties(json, res);
4211    if (json.has("sequence"))
4212      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4213    if (json.has("_sequence"))
4214      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4215    if (json.has("date"))
4216      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4217    if (json.has("_date"))
4218      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4219    Type procedure = parseType("procedure", json);
4220    if (procedure != null)
4221      res.setProcedure(procedure);
4222  }
4223
4224  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4225    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4226    parseClaimInsuranceComponentProperties(json, owner, res);
4227    return res;
4228  }
4229
4230  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
4231    parseBackboneProperties(json, res);
4232    if (json.has("sequence"))
4233      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4234    if (json.has("_sequence"))
4235      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4236    if (json.has("focal"))
4237      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4238    if (json.has("_focal"))
4239      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
4240    if (json.has("coverage"))
4241      res.setCoverage(parseReference(getJObject(json, "coverage")));
4242    if (json.has("businessArrangement"))
4243      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4244    if (json.has("_businessArrangement"))
4245      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
4246    if (json.has("preAuthRef")) {
4247      JsonArray array = json.getAsJsonArray("preAuthRef");
4248      for (int i = 0; i < array.size(); i++) {
4249        if (array.get(i).isJsonNull()) {
4250          res.getPreAuthRef().add(new StringType());
4251        } else {
4252          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4253        }
4254      }
4255    };
4256    if (json.has("_preAuthRef")) {
4257      JsonArray array = json.getAsJsonArray("_preAuthRef");
4258      for (int i = 0; i < array.size(); i++) {
4259        if (i == res.getPreAuthRef().size())
4260          res.getPreAuthRef().add(parseString(null));
4261        if (array.get(i) instanceof JsonObject) 
4262          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4263      }
4264    };
4265    if (json.has("claimResponse"))
4266      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
4267  }
4268
4269  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4270    Claim.AccidentComponent res = new Claim.AccidentComponent();
4271    parseClaimAccidentComponentProperties(json, owner, res);
4272    return res;
4273  }
4274
4275  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
4276    parseBackboneProperties(json, res);
4277    if (json.has("date"))
4278      res.setDateElement(parseDate(json.get("date").getAsString()));
4279    if (json.has("_date"))
4280      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4281    if (json.has("type"))
4282      res.setType(parseCodeableConcept(getJObject(json, "type")));
4283    Type location = parseType("location", json);
4284    if (location != null)
4285      res.setLocation(location);
4286  }
4287
4288  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4289    Claim.ItemComponent res = new Claim.ItemComponent();
4290    parseClaimItemComponentProperties(json, owner, res);
4291    return res;
4292  }
4293
4294  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
4295    parseBackboneProperties(json, res);
4296    if (json.has("sequence"))
4297      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4298    if (json.has("_sequence"))
4299      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4300    if (json.has("careTeamLinkId")) {
4301      JsonArray array = json.getAsJsonArray("careTeamLinkId");
4302      for (int i = 0; i < array.size(); i++) {
4303        if (array.get(i).isJsonNull()) {
4304          res.getCareTeamLinkId().add(new PositiveIntType());
4305        } else {
4306          res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4307        }
4308      }
4309    };
4310    if (json.has("_careTeamLinkId")) {
4311      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
4312      for (int i = 0; i < array.size(); i++) {
4313        if (i == res.getCareTeamLinkId().size())
4314          res.getCareTeamLinkId().add(parsePositiveInt(null));
4315        if (array.get(i) instanceof JsonObject) 
4316          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
4317      }
4318    };
4319    if (json.has("diagnosisLinkId")) {
4320      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
4321      for (int i = 0; i < array.size(); i++) {
4322        if (array.get(i).isJsonNull()) {
4323          res.getDiagnosisLinkId().add(new PositiveIntType());
4324        } else {
4325          res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4326        }
4327      }
4328    };
4329    if (json.has("_diagnosisLinkId")) {
4330      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
4331      for (int i = 0; i < array.size(); i++) {
4332        if (i == res.getDiagnosisLinkId().size())
4333          res.getDiagnosisLinkId().add(parsePositiveInt(null));
4334        if (array.get(i) instanceof JsonObject) 
4335          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
4336      }
4337    };
4338    if (json.has("procedureLinkId")) {
4339      JsonArray array = json.getAsJsonArray("procedureLinkId");
4340      for (int i = 0; i < array.size(); i++) {
4341        if (array.get(i).isJsonNull()) {
4342          res.getProcedureLinkId().add(new PositiveIntType());
4343        } else {
4344          res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4345        }
4346      }
4347    };
4348    if (json.has("_procedureLinkId")) {
4349      JsonArray array = json.getAsJsonArray("_procedureLinkId");
4350      for (int i = 0; i < array.size(); i++) {
4351        if (i == res.getProcedureLinkId().size())
4352          res.getProcedureLinkId().add(parsePositiveInt(null));
4353        if (array.get(i) instanceof JsonObject) 
4354          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
4355      }
4356    };
4357    if (json.has("informationLinkId")) {
4358      JsonArray array = json.getAsJsonArray("informationLinkId");
4359      for (int i = 0; i < array.size(); i++) {
4360        if (array.get(i).isJsonNull()) {
4361          res.getInformationLinkId().add(new PositiveIntType());
4362        } else {
4363          res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4364        }
4365      }
4366    };
4367    if (json.has("_informationLinkId")) {
4368      JsonArray array = json.getAsJsonArray("_informationLinkId");
4369      for (int i = 0; i < array.size(); i++) {
4370        if (i == res.getInformationLinkId().size())
4371          res.getInformationLinkId().add(parsePositiveInt(null));
4372        if (array.get(i) instanceof JsonObject) 
4373          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
4374      }
4375    };
4376    if (json.has("revenue"))
4377      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4378    if (json.has("category"))
4379      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4380    if (json.has("service"))
4381      res.setService(parseCodeableConcept(getJObject(json, "service")));
4382    if (json.has("modifier")) {
4383      JsonArray array = json.getAsJsonArray("modifier");
4384      for (int i = 0; i < array.size(); i++) {
4385        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4386      }
4387    };
4388    if (json.has("programCode")) {
4389      JsonArray array = json.getAsJsonArray("programCode");
4390      for (int i = 0; i < array.size(); i++) {
4391        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4392      }
4393    };
4394    Type serviced = parseType("serviced", json);
4395    if (serviced != null)
4396      res.setServiced(serviced);
4397    Type location = parseType("location", json);
4398    if (location != null)
4399      res.setLocation(location);
4400    if (json.has("quantity"))
4401      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4402    if (json.has("unitPrice"))
4403      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4404    if (json.has("factor"))
4405      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4406    if (json.has("_factor"))
4407      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4408    if (json.has("net"))
4409      res.setNet(parseMoney(getJObject(json, "net")));
4410    if (json.has("udi")) {
4411      JsonArray array = json.getAsJsonArray("udi");
4412      for (int i = 0; i < array.size(); i++) {
4413        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4414      }
4415    };
4416    if (json.has("bodySite"))
4417      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
4418    if (json.has("subSite")) {
4419      JsonArray array = json.getAsJsonArray("subSite");
4420      for (int i = 0; i < array.size(); i++) {
4421        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4422      }
4423    };
4424    if (json.has("encounter")) {
4425      JsonArray array = json.getAsJsonArray("encounter");
4426      for (int i = 0; i < array.size(); i++) {
4427        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
4428      }
4429    };
4430    if (json.has("detail")) {
4431      JsonArray array = json.getAsJsonArray("detail");
4432      for (int i = 0; i < array.size(); i++) {
4433        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
4434      }
4435    };
4436  }
4437
4438  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4439    Claim.DetailComponent res = new Claim.DetailComponent();
4440    parseClaimDetailComponentProperties(json, owner, res);
4441    return res;
4442  }
4443
4444  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
4445    parseBackboneProperties(json, res);
4446    if (json.has("sequence"))
4447      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4448    if (json.has("_sequence"))
4449      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4450    if (json.has("revenue"))
4451      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4452    if (json.has("category"))
4453      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4454    if (json.has("service"))
4455      res.setService(parseCodeableConcept(getJObject(json, "service")));
4456    if (json.has("modifier")) {
4457      JsonArray array = json.getAsJsonArray("modifier");
4458      for (int i = 0; i < array.size(); i++) {
4459        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4460      }
4461    };
4462    if (json.has("programCode")) {
4463      JsonArray array = json.getAsJsonArray("programCode");
4464      for (int i = 0; i < array.size(); i++) {
4465        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4466      }
4467    };
4468    if (json.has("quantity"))
4469      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4470    if (json.has("unitPrice"))
4471      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4472    if (json.has("factor"))
4473      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4474    if (json.has("_factor"))
4475      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4476    if (json.has("net"))
4477      res.setNet(parseMoney(getJObject(json, "net")));
4478    if (json.has("udi")) {
4479      JsonArray array = json.getAsJsonArray("udi");
4480      for (int i = 0; i < array.size(); i++) {
4481        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4482      }
4483    };
4484    if (json.has("subDetail")) {
4485      JsonArray array = json.getAsJsonArray("subDetail");
4486      for (int i = 0; i < array.size(); i++) {
4487        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4488      }
4489    };
4490  }
4491
4492  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4493    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
4494    parseClaimSubDetailComponentProperties(json, owner, res);
4495    return res;
4496  }
4497
4498  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
4499    parseBackboneProperties(json, res);
4500    if (json.has("sequence"))
4501      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4502    if (json.has("_sequence"))
4503      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4504    if (json.has("revenue"))
4505      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4506    if (json.has("category"))
4507      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4508    if (json.has("service"))
4509      res.setService(parseCodeableConcept(getJObject(json, "service")));
4510    if (json.has("modifier")) {
4511      JsonArray array = json.getAsJsonArray("modifier");
4512      for (int i = 0; i < array.size(); i++) {
4513        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4514      }
4515    };
4516    if (json.has("programCode")) {
4517      JsonArray array = json.getAsJsonArray("programCode");
4518      for (int i = 0; i < array.size(); i++) {
4519        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4520      }
4521    };
4522    if (json.has("quantity"))
4523      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4524    if (json.has("unitPrice"))
4525      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4526    if (json.has("factor"))
4527      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4528    if (json.has("_factor"))
4529      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4530    if (json.has("net"))
4531      res.setNet(parseMoney(getJObject(json, "net")));
4532    if (json.has("udi")) {
4533      JsonArray array = json.getAsJsonArray("udi");
4534      for (int i = 0; i < array.size(); i++) {
4535        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4536      }
4537    };
4538  }
4539
4540  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
4541    ClaimResponse res = new ClaimResponse();
4542    parseClaimResponseProperties(json, res);
4543    return res;
4544  }
4545
4546  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
4547    parseDomainResourceProperties(json, res);
4548    if (json.has("identifier")) {
4549      JsonArray array = json.getAsJsonArray("identifier");
4550      for (int i = 0; i < array.size(); i++) {
4551        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4552      }
4553    };
4554    if (json.has("status"))
4555      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
4556    if (json.has("_status"))
4557      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4558    if (json.has("patient"))
4559      res.setPatient(parseReference(getJObject(json, "patient")));
4560    if (json.has("created"))
4561      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4562    if (json.has("_created"))
4563      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4564    if (json.has("insurer"))
4565      res.setInsurer(parseReference(getJObject(json, "insurer")));
4566    if (json.has("requestProvider"))
4567      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
4568    if (json.has("requestOrganization"))
4569      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
4570    if (json.has("request"))
4571      res.setRequest(parseReference(getJObject(json, "request")));
4572    if (json.has("outcome"))
4573      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
4574    if (json.has("disposition"))
4575      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
4576    if (json.has("_disposition"))
4577      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
4578    if (json.has("payeeType"))
4579      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
4580    if (json.has("item")) {
4581      JsonArray array = json.getAsJsonArray("item");
4582      for (int i = 0; i < array.size(); i++) {
4583        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
4584      }
4585    };
4586    if (json.has("addItem")) {
4587      JsonArray array = json.getAsJsonArray("addItem");
4588      for (int i = 0; i < array.size(); i++) {
4589        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
4590      }
4591    };
4592    if (json.has("error")) {
4593      JsonArray array = json.getAsJsonArray("error");
4594      for (int i = 0; i < array.size(); i++) {
4595        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
4596      }
4597    };
4598    if (json.has("totalCost"))
4599      res.setTotalCost(parseMoney(getJObject(json, "totalCost")));
4600    if (json.has("unallocDeductable"))
4601      res.setUnallocDeductable(parseMoney(getJObject(json, "unallocDeductable")));
4602    if (json.has("totalBenefit"))
4603      res.setTotalBenefit(parseMoney(getJObject(json, "totalBenefit")));
4604    if (json.has("payment"))
4605      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment"), res));
4606    if (json.has("reserved"))
4607      res.setReserved(parseCoding(getJObject(json, "reserved")));
4608    if (json.has("form"))
4609      res.setForm(parseCodeableConcept(getJObject(json, "form")));
4610    if (json.has("processNote")) {
4611      JsonArray array = json.getAsJsonArray("processNote");
4612      for (int i = 0; i < array.size(); i++) {
4613        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
4614      }
4615    };
4616    if (json.has("communicationRequest")) {
4617      JsonArray array = json.getAsJsonArray("communicationRequest");
4618      for (int i = 0; i < array.size(); i++) {
4619        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
4620      }
4621    };
4622    if (json.has("insurance")) {
4623      JsonArray array = json.getAsJsonArray("insurance");
4624      for (int i = 0; i < array.size(); i++) {
4625        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
4626      }
4627    };
4628  }
4629
4630  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4631    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
4632    parseClaimResponseItemComponentProperties(json, owner, res);
4633    return res;
4634  }
4635
4636  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
4637    parseBackboneProperties(json, res);
4638    if (json.has("sequenceLinkId"))
4639      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4640    if (json.has("_sequenceLinkId"))
4641      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4642    if (json.has("noteNumber")) {
4643      JsonArray array = json.getAsJsonArray("noteNumber");
4644      for (int i = 0; i < array.size(); i++) {
4645        if (array.get(i).isJsonNull()) {
4646          res.getNoteNumber().add(new PositiveIntType());
4647        } else {
4648          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4649        }
4650      }
4651    };
4652    if (json.has("_noteNumber")) {
4653      JsonArray array = json.getAsJsonArray("_noteNumber");
4654      for (int i = 0; i < array.size(); i++) {
4655        if (i == res.getNoteNumber().size())
4656          res.getNoteNumber().add(parsePositiveInt(null));
4657        if (array.get(i) instanceof JsonObject) 
4658          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4659      }
4660    };
4661    if (json.has("adjudication")) {
4662      JsonArray array = json.getAsJsonArray("adjudication");
4663      for (int i = 0; i < array.size(); i++) {
4664        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4665      }
4666    };
4667    if (json.has("detail")) {
4668      JsonArray array = json.getAsJsonArray("detail");
4669      for (int i = 0; i < array.size(); i++) {
4670        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
4671      }
4672    };
4673  }
4674
4675  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4676    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
4677    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
4678    return res;
4679  }
4680
4681  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
4682    parseBackboneProperties(json, res);
4683    if (json.has("category"))
4684      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4685    if (json.has("reason"))
4686      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
4687    if (json.has("amount"))
4688      res.setAmount(parseMoney(getJObject(json, "amount")));
4689    if (json.has("value"))
4690      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
4691    if (json.has("_value"))
4692      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
4693  }
4694
4695  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4696    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
4697    parseClaimResponseItemDetailComponentProperties(json, owner, res);
4698    return res;
4699  }
4700
4701  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
4702    parseBackboneProperties(json, res);
4703    if (json.has("sequenceLinkId"))
4704      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4705    if (json.has("_sequenceLinkId"))
4706      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4707    if (json.has("noteNumber")) {
4708      JsonArray array = json.getAsJsonArray("noteNumber");
4709      for (int i = 0; i < array.size(); i++) {
4710        if (array.get(i).isJsonNull()) {
4711          res.getNoteNumber().add(new PositiveIntType());
4712        } else {
4713          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4714        }
4715      }
4716    };
4717    if (json.has("_noteNumber")) {
4718      JsonArray array = json.getAsJsonArray("_noteNumber");
4719      for (int i = 0; i < array.size(); i++) {
4720        if (i == res.getNoteNumber().size())
4721          res.getNoteNumber().add(parsePositiveInt(null));
4722        if (array.get(i) instanceof JsonObject) 
4723          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4724      }
4725    };
4726    if (json.has("adjudication")) {
4727      JsonArray array = json.getAsJsonArray("adjudication");
4728      for (int i = 0; i < array.size(); i++) {
4729        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4730      }
4731    };
4732    if (json.has("subDetail")) {
4733      JsonArray array = json.getAsJsonArray("subDetail");
4734      for (int i = 0; i < array.size(); i++) {
4735        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4736      }
4737    };
4738  }
4739
4740  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4741    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
4742    parseClaimResponseSubDetailComponentProperties(json, owner, res);
4743    return res;
4744  }
4745
4746  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
4747    parseBackboneProperties(json, res);
4748    if (json.has("sequenceLinkId"))
4749      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4750    if (json.has("_sequenceLinkId"))
4751      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4752    if (json.has("noteNumber")) {
4753      JsonArray array = json.getAsJsonArray("noteNumber");
4754      for (int i = 0; i < array.size(); i++) {
4755        if (array.get(i).isJsonNull()) {
4756          res.getNoteNumber().add(new PositiveIntType());
4757        } else {
4758          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4759        }
4760      }
4761    };
4762    if (json.has("_noteNumber")) {
4763      JsonArray array = json.getAsJsonArray("_noteNumber");
4764      for (int i = 0; i < array.size(); i++) {
4765        if (i == res.getNoteNumber().size())
4766          res.getNoteNumber().add(parsePositiveInt(null));
4767        if (array.get(i) instanceof JsonObject) 
4768          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4769      }
4770    };
4771    if (json.has("adjudication")) {
4772      JsonArray array = json.getAsJsonArray("adjudication");
4773      for (int i = 0; i < array.size(); i++) {
4774        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4775      }
4776    };
4777  }
4778
4779  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4780    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
4781    parseClaimResponseAddedItemComponentProperties(json, owner, res);
4782    return res;
4783  }
4784
4785  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
4786    parseBackboneProperties(json, res);
4787    if (json.has("sequenceLinkId")) {
4788      JsonArray array = json.getAsJsonArray("sequenceLinkId");
4789      for (int i = 0; i < array.size(); i++) {
4790        if (array.get(i).isJsonNull()) {
4791          res.getSequenceLinkId().add(new PositiveIntType());
4792        } else {
4793          res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4794        }
4795      }
4796    };
4797    if (json.has("_sequenceLinkId")) {
4798      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
4799      for (int i = 0; i < array.size(); i++) {
4800        if (i == res.getSequenceLinkId().size())
4801          res.getSequenceLinkId().add(parsePositiveInt(null));
4802        if (array.get(i) instanceof JsonObject) 
4803          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
4804      }
4805    };
4806    if (json.has("revenue"))
4807      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4808    if (json.has("category"))
4809      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4810    if (json.has("service"))
4811      res.setService(parseCodeableConcept(getJObject(json, "service")));
4812    if (json.has("modifier")) {
4813      JsonArray array = json.getAsJsonArray("modifier");
4814      for (int i = 0; i < array.size(); i++) {
4815        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4816      }
4817    };
4818    if (json.has("fee"))
4819      res.setFee(parseMoney(getJObject(json, "fee")));
4820    if (json.has("noteNumber")) {
4821      JsonArray array = json.getAsJsonArray("noteNumber");
4822      for (int i = 0; i < array.size(); i++) {
4823        if (array.get(i).isJsonNull()) {
4824          res.getNoteNumber().add(new PositiveIntType());
4825        } else {
4826          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4827        }
4828      }
4829    };
4830    if (json.has("_noteNumber")) {
4831      JsonArray array = json.getAsJsonArray("_noteNumber");
4832      for (int i = 0; i < array.size(); i++) {
4833        if (i == res.getNoteNumber().size())
4834          res.getNoteNumber().add(parsePositiveInt(null));
4835        if (array.get(i) instanceof JsonObject) 
4836          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4837      }
4838    };
4839    if (json.has("adjudication")) {
4840      JsonArray array = json.getAsJsonArray("adjudication");
4841      for (int i = 0; i < array.size(); i++) {
4842        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4843      }
4844    };
4845    if (json.has("detail")) {
4846      JsonArray array = json.getAsJsonArray("detail");
4847      for (int i = 0; i < array.size(); i++) {
4848        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
4849      }
4850    };
4851  }
4852
4853  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4854    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
4855    parseClaimResponseAddedItemsDetailComponentProperties(json, owner, res);
4856    return res;
4857  }
4858
4859  protected void parseClaimResponseAddedItemsDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
4860    parseBackboneProperties(json, res);
4861    if (json.has("revenue"))
4862      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4863    if (json.has("category"))
4864      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4865    if (json.has("service"))
4866      res.setService(parseCodeableConcept(getJObject(json, "service")));
4867    if (json.has("modifier")) {
4868      JsonArray array = json.getAsJsonArray("modifier");
4869      for (int i = 0; i < array.size(); i++) {
4870        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4871      }
4872    };
4873    if (json.has("fee"))
4874      res.setFee(parseMoney(getJObject(json, "fee")));
4875    if (json.has("noteNumber")) {
4876      JsonArray array = json.getAsJsonArray("noteNumber");
4877      for (int i = 0; i < array.size(); i++) {
4878        if (array.get(i).isJsonNull()) {
4879          res.getNoteNumber().add(new PositiveIntType());
4880        } else {
4881          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4882        }
4883      }
4884    };
4885    if (json.has("_noteNumber")) {
4886      JsonArray array = json.getAsJsonArray("_noteNumber");
4887      for (int i = 0; i < array.size(); i++) {
4888        if (i == res.getNoteNumber().size())
4889          res.getNoteNumber().add(parsePositiveInt(null));
4890        if (array.get(i) instanceof JsonObject) 
4891          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4892      }
4893    };
4894    if (json.has("adjudication")) {
4895      JsonArray array = json.getAsJsonArray("adjudication");
4896      for (int i = 0; i < array.size(); i++) {
4897        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4898      }
4899    };
4900  }
4901
4902  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4903    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
4904    parseClaimResponseErrorComponentProperties(json, owner, res);
4905    return res;
4906  }
4907
4908  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
4909    parseBackboneProperties(json, res);
4910    if (json.has("sequenceLinkId"))
4911      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4912    if (json.has("_sequenceLinkId"))
4913      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4914    if (json.has("detailSequenceLinkId"))
4915      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
4916    if (json.has("_detailSequenceLinkId"))
4917      parseElementProperties(getJObject(json, "_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
4918    if (json.has("subdetailSequenceLinkId"))
4919      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
4920    if (json.has("_subdetailSequenceLinkId"))
4921      parseElementProperties(getJObject(json, "_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
4922    if (json.has("code"))
4923      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4924  }
4925
4926  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4927    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
4928    parseClaimResponsePaymentComponentProperties(json, owner, res);
4929    return res;
4930  }
4931
4932  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
4933    parseBackboneProperties(json, res);
4934    if (json.has("type"))
4935      res.setType(parseCodeableConcept(getJObject(json, "type")));
4936    if (json.has("adjustment"))
4937      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
4938    if (json.has("adjustmentReason"))
4939      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
4940    if (json.has("date"))
4941      res.setDateElement(parseDate(json.get("date").getAsString()));
4942    if (json.has("_date"))
4943      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4944    if (json.has("amount"))
4945      res.setAmount(parseMoney(getJObject(json, "amount")));
4946    if (json.has("identifier"))
4947      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
4948  }
4949
4950  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4951    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
4952    parseClaimResponseNoteComponentProperties(json, owner, res);
4953    return res;
4954  }
4955
4956  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
4957    parseBackboneProperties(json, res);
4958    if (json.has("number"))
4959      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
4960    if (json.has("_number"))
4961      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
4962    if (json.has("type"))
4963      res.setType(parseCodeableConcept(getJObject(json, "type")));
4964    if (json.has("text"))
4965      res.setTextElement(parseString(json.get("text").getAsString()));
4966    if (json.has("_text"))
4967      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
4968    if (json.has("language"))
4969      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
4970  }
4971
4972  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4973    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
4974    parseClaimResponseInsuranceComponentProperties(json, owner, res);
4975    return res;
4976  }
4977
4978  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
4979    parseBackboneProperties(json, res);
4980    if (json.has("sequence"))
4981      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4982    if (json.has("_sequence"))
4983      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4984    if (json.has("focal"))
4985      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4986    if (json.has("_focal"))
4987      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
4988    if (json.has("coverage"))
4989      res.setCoverage(parseReference(getJObject(json, "coverage")));
4990    if (json.has("businessArrangement"))
4991      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4992    if (json.has("_businessArrangement"))
4993      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
4994    if (json.has("preAuthRef")) {
4995      JsonArray array = json.getAsJsonArray("preAuthRef");
4996      for (int i = 0; i < array.size(); i++) {
4997        if (array.get(i).isJsonNull()) {
4998          res.getPreAuthRef().add(new StringType());
4999        } else {
5000          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5001        }
5002      }
5003    };
5004    if (json.has("_preAuthRef")) {
5005      JsonArray array = json.getAsJsonArray("_preAuthRef");
5006      for (int i = 0; i < array.size(); i++) {
5007        if (i == res.getPreAuthRef().size())
5008          res.getPreAuthRef().add(parseString(null));
5009        if (array.get(i) instanceof JsonObject) 
5010          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5011      }
5012    };
5013    if (json.has("claimResponse"))
5014      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5015  }
5016
5017  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5018    ClinicalImpression res = new ClinicalImpression();
5019    parseClinicalImpressionProperties(json, res);
5020    return res;
5021  }
5022
5023  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5024    parseDomainResourceProperties(json, res);
5025    if (json.has("identifier")) {
5026      JsonArray array = json.getAsJsonArray("identifier");
5027      for (int i = 0; i < array.size(); i++) {
5028        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5029      }
5030    };
5031    if (json.has("status"))
5032      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5033    if (json.has("_status"))
5034      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5035    if (json.has("code"))
5036      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5037    if (json.has("description"))
5038      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5039    if (json.has("_description"))
5040      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5041    if (json.has("subject"))
5042      res.setSubject(parseReference(getJObject(json, "subject")));
5043    if (json.has("context"))
5044      res.setContext(parseReference(getJObject(json, "context")));
5045    Type effective = parseType("effective", json);
5046    if (effective != null)
5047      res.setEffective(effective);
5048    if (json.has("date"))
5049      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5050    if (json.has("_date"))
5051      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5052    if (json.has("assessor"))
5053      res.setAssessor(parseReference(getJObject(json, "assessor")));
5054    if (json.has("previous"))
5055      res.setPrevious(parseReference(getJObject(json, "previous")));
5056    if (json.has("problem")) {
5057      JsonArray array = json.getAsJsonArray("problem");
5058      for (int i = 0; i < array.size(); i++) {
5059        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5060      }
5061    };
5062    if (json.has("investigation")) {
5063      JsonArray array = json.getAsJsonArray("investigation");
5064      for (int i = 0; i < array.size(); i++) {
5065        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5066      }
5067    };
5068    if (json.has("protocol")) {
5069      JsonArray array = json.getAsJsonArray("protocol");
5070      for (int i = 0; i < array.size(); i++) {
5071        if (array.get(i).isJsonNull()) {
5072          res.getProtocol().add(new UriType());
5073        } else {
5074          res.getProtocol().add(parseUri(array.get(i).getAsString()));
5075        }
5076      }
5077    };
5078    if (json.has("_protocol")) {
5079      JsonArray array = json.getAsJsonArray("_protocol");
5080      for (int i = 0; i < array.size(); i++) {
5081        if (i == res.getProtocol().size())
5082          res.getProtocol().add(parseUri(null));
5083        if (array.get(i) instanceof JsonObject) 
5084          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5085      }
5086    };
5087    if (json.has("summary"))
5088      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5089    if (json.has("_summary"))
5090      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
5091    if (json.has("finding")) {
5092      JsonArray array = json.getAsJsonArray("finding");
5093      for (int i = 0; i < array.size(); i++) {
5094        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5095      }
5096    };
5097    if (json.has("prognosisCodeableConcept")) {
5098      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5099      for (int i = 0; i < array.size(); i++) {
5100        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5101      }
5102    };
5103    if (json.has("prognosisReference")) {
5104      JsonArray array = json.getAsJsonArray("prognosisReference");
5105      for (int i = 0; i < array.size(); i++) {
5106        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5107      }
5108    };
5109    if (json.has("action")) {
5110      JsonArray array = json.getAsJsonArray("action");
5111      for (int i = 0; i < array.size(); i++) {
5112        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
5113      }
5114    };
5115    if (json.has("note")) {
5116      JsonArray array = json.getAsJsonArray("note");
5117      for (int i = 0; i < array.size(); i++) {
5118        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5119      }
5120    };
5121  }
5122
5123  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5124    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
5125    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
5126    return res;
5127  }
5128
5129  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
5130    parseBackboneProperties(json, res);
5131    if (json.has("code"))
5132      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5133    if (json.has("item")) {
5134      JsonArray array = json.getAsJsonArray("item");
5135      for (int i = 0; i < array.size(); i++) {
5136        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
5137      }
5138    };
5139  }
5140
5141  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5142    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
5143    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
5144    return res;
5145  }
5146
5147  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
5148    parseBackboneProperties(json, res);
5149    Type item = parseType("item", json);
5150    if (item != null)
5151      res.setItem(item);
5152    if (json.has("basis"))
5153      res.setBasisElement(parseString(json.get("basis").getAsString()));
5154    if (json.has("_basis"))
5155      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
5156  }
5157
5158  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
5159    CodeSystem res = new CodeSystem();
5160    parseCodeSystemProperties(json, res);
5161    return res;
5162  }
5163
5164  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
5165    parseDomainResourceProperties(json, res);
5166    if (json.has("url"))
5167      res.setUrlElement(parseUri(json.get("url").getAsString()));
5168    if (json.has("_url"))
5169      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5170    if (json.has("identifier"))
5171      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5172    if (json.has("version"))
5173      res.setVersionElement(parseString(json.get("version").getAsString()));
5174    if (json.has("_version"))
5175      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5176    if (json.has("name"))
5177      res.setNameElement(parseString(json.get("name").getAsString()));
5178    if (json.has("_name"))
5179      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5180    if (json.has("title"))
5181      res.setTitleElement(parseString(json.get("title").getAsString()));
5182    if (json.has("_title"))
5183      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5184    if (json.has("status"))
5185      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5186    if (json.has("_status"))
5187      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5188    if (json.has("experimental"))
5189      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5190    if (json.has("_experimental"))
5191      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5192    if (json.has("date"))
5193      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5194    if (json.has("_date"))
5195      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5196    if (json.has("publisher"))
5197      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5198    if (json.has("_publisher"))
5199      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5200    if (json.has("contact")) {
5201      JsonArray array = json.getAsJsonArray("contact");
5202      for (int i = 0; i < array.size(); i++) {
5203        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5204      }
5205    };
5206    if (json.has("description"))
5207      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5208    if (json.has("_description"))
5209      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5210    if (json.has("useContext")) {
5211      JsonArray array = json.getAsJsonArray("useContext");
5212      for (int i = 0; i < array.size(); i++) {
5213        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5214      }
5215    };
5216    if (json.has("jurisdiction")) {
5217      JsonArray array = json.getAsJsonArray("jurisdiction");
5218      for (int i = 0; i < array.size(); i++) {
5219        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5220      }
5221    };
5222    if (json.has("purpose"))
5223      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5224    if (json.has("_purpose"))
5225      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5226    if (json.has("copyright"))
5227      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5228    if (json.has("_copyright"))
5229      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5230    if (json.has("caseSensitive"))
5231      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
5232    if (json.has("_caseSensitive"))
5233      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
5234    if (json.has("valueSet"))
5235      res.setValueSetElement(parseUri(json.get("valueSet").getAsString()));
5236    if (json.has("_valueSet"))
5237      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
5238    if (json.has("hierarchyMeaning"))
5239      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
5240    if (json.has("_hierarchyMeaning"))
5241      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
5242    if (json.has("compositional"))
5243      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
5244    if (json.has("_compositional"))
5245      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
5246    if (json.has("versionNeeded"))
5247      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
5248    if (json.has("_versionNeeded"))
5249      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
5250    if (json.has("content"))
5251      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
5252    if (json.has("_content"))
5253      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
5254    if (json.has("count"))
5255      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
5256    if (json.has("_count"))
5257      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
5258    if (json.has("filter")) {
5259      JsonArray array = json.getAsJsonArray("filter");
5260      for (int i = 0; i < array.size(); i++) {
5261        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
5262      }
5263    };
5264    if (json.has("property")) {
5265      JsonArray array = json.getAsJsonArray("property");
5266      for (int i = 0; i < array.size(); i++) {
5267        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
5268      }
5269    };
5270    if (json.has("concept")) {
5271      JsonArray array = json.getAsJsonArray("concept");
5272      for (int i = 0; i < array.size(); i++) {
5273        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
5274      }
5275    };
5276  }
5277
5278  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5279    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
5280    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
5281    return res;
5282  }
5283
5284  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
5285    parseBackboneProperties(json, res);
5286    if (json.has("code"))
5287      res.setCodeElement(parseCode(json.get("code").getAsString()));
5288    if (json.has("_code"))
5289      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5290    if (json.has("description"))
5291      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5292    if (json.has("_description"))
5293      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5294    if (json.has("operator")) {
5295      JsonArray array = json.getAsJsonArray("operator");
5296      for (int i = 0; i < array.size(); i++) {
5297        if (array.get(i).isJsonNull()) {
5298          res.getOperator().add(new Enumeration<CodeSystem.FilterOperator>());
5299        } else {
5300          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5301        }
5302      }
5303    };
5304    if (json.has("_operator")) {
5305      JsonArray array = json.getAsJsonArray("_operator");
5306      for (int i = 0; i < array.size(); i++) {
5307        if (i == res.getOperator().size())
5308          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5309        if (array.get(i) instanceof JsonObject) 
5310          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
5311      }
5312    };
5313    if (json.has("value"))
5314      res.setValueElement(parseString(json.get("value").getAsString()));
5315    if (json.has("_value"))
5316      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5317  }
5318
5319  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5320    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
5321    parseCodeSystemPropertyComponentProperties(json, owner, res);
5322    return res;
5323  }
5324
5325  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
5326    parseBackboneProperties(json, res);
5327    if (json.has("code"))
5328      res.setCodeElement(parseCode(json.get("code").getAsString()));
5329    if (json.has("_code"))
5330      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5331    if (json.has("uri"))
5332      res.setUriElement(parseUri(json.get("uri").getAsString()));
5333    if (json.has("_uri"))
5334      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
5335    if (json.has("description"))
5336      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5337    if (json.has("_description"))
5338      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5339    if (json.has("type"))
5340      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
5341    if (json.has("_type"))
5342      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5343  }
5344
5345  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5346    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
5347    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
5348    return res;
5349  }
5350
5351  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
5352    parseBackboneProperties(json, res);
5353    if (json.has("code"))
5354      res.setCodeElement(parseCode(json.get("code").getAsString()));
5355    if (json.has("_code"))
5356      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5357    if (json.has("display"))
5358      res.setDisplayElement(parseString(json.get("display").getAsString()));
5359    if (json.has("_display"))
5360      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
5361    if (json.has("definition"))
5362      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
5363    if (json.has("_definition"))
5364      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5365    if (json.has("designation")) {
5366      JsonArray array = json.getAsJsonArray("designation");
5367      for (int i = 0; i < array.size(); i++) {
5368        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
5369      }
5370    };
5371    if (json.has("property")) {
5372      JsonArray array = json.getAsJsonArray("property");
5373      for (int i = 0; i < array.size(); i++) {
5374        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
5375      }
5376    };
5377    if (json.has("concept")) {
5378      JsonArray array = json.getAsJsonArray("concept");
5379      for (int i = 0; i < array.size(); i++) {
5380        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
5381      }
5382    };
5383  }
5384
5385  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5386    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
5387    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
5388    return res;
5389  }
5390
5391  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
5392    parseBackboneProperties(json, res);
5393    if (json.has("language"))
5394      res.setLanguageElement(parseCode(json.get("language").getAsString()));
5395    if (json.has("_language"))
5396      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
5397    if (json.has("use"))
5398      res.setUse(parseCoding(getJObject(json, "use")));
5399    if (json.has("value"))
5400      res.setValueElement(parseString(json.get("value").getAsString()));
5401    if (json.has("_value"))
5402      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5403  }
5404
5405  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5406    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
5407    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
5408    return res;
5409  }
5410
5411  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
5412    parseBackboneProperties(json, res);
5413    if (json.has("code"))
5414      res.setCodeElement(parseCode(json.get("code").getAsString()));
5415    if (json.has("_code"))
5416      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5417    Type value = parseType("value", json);
5418    if (value != null)
5419      res.setValue(value);
5420  }
5421
5422  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
5423    Communication res = new Communication();
5424    parseCommunicationProperties(json, res);
5425    return res;
5426  }
5427
5428  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
5429    parseDomainResourceProperties(json, res);
5430    if (json.has("identifier")) {
5431      JsonArray array = json.getAsJsonArray("identifier");
5432      for (int i = 0; i < array.size(); i++) {
5433        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5434      }
5435    };
5436    if (json.has("definition")) {
5437      JsonArray array = json.getAsJsonArray("definition");
5438      for (int i = 0; i < array.size(); i++) {
5439        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
5440      }
5441    };
5442    if (json.has("basedOn")) {
5443      JsonArray array = json.getAsJsonArray("basedOn");
5444      for (int i = 0; i < array.size(); i++) {
5445        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5446      }
5447    };
5448    if (json.has("partOf")) {
5449      JsonArray array = json.getAsJsonArray("partOf");
5450      for (int i = 0; i < array.size(); i++) {
5451        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5452      }
5453    };
5454    if (json.has("status"))
5455      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
5456    if (json.has("_status"))
5457      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5458    if (json.has("notDone"))
5459      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
5460    if (json.has("_notDone"))
5461      parseElementProperties(getJObject(json, "_notDone"), res.getNotDoneElement());
5462    if (json.has("notDoneReason"))
5463      res.setNotDoneReason(parseCodeableConcept(getJObject(json, "notDoneReason")));
5464    if (json.has("category")) {
5465      JsonArray array = json.getAsJsonArray("category");
5466      for (int i = 0; i < array.size(); i++) {
5467        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5468      }
5469    };
5470    if (json.has("medium")) {
5471      JsonArray array = json.getAsJsonArray("medium");
5472      for (int i = 0; i < array.size(); i++) {
5473        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5474      }
5475    };
5476    if (json.has("subject"))
5477      res.setSubject(parseReference(getJObject(json, "subject")));
5478    if (json.has("recipient")) {
5479      JsonArray array = json.getAsJsonArray("recipient");
5480      for (int i = 0; i < array.size(); i++) {
5481        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5482      }
5483    };
5484    if (json.has("topic")) {
5485      JsonArray array = json.getAsJsonArray("topic");
5486      for (int i = 0; i < array.size(); i++) {
5487        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5488      }
5489    };
5490    if (json.has("context"))
5491      res.setContext(parseReference(getJObject(json, "context")));
5492    if (json.has("sent"))
5493      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
5494    if (json.has("_sent"))
5495      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
5496    if (json.has("received"))
5497      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
5498    if (json.has("_received"))
5499      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
5500    if (json.has("sender"))
5501      res.setSender(parseReference(getJObject(json, "sender")));
5502    if (json.has("reasonCode")) {
5503      JsonArray array = json.getAsJsonArray("reasonCode");
5504      for (int i = 0; i < array.size(); i++) {
5505        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5506      }
5507    };
5508    if (json.has("reasonReference")) {
5509      JsonArray array = json.getAsJsonArray("reasonReference");
5510      for (int i = 0; i < array.size(); i++) {
5511        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5512      }
5513    };
5514    if (json.has("payload")) {
5515      JsonArray array = json.getAsJsonArray("payload");
5516      for (int i = 0; i < array.size(); i++) {
5517        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
5518      }
5519    };
5520    if (json.has("note")) {
5521      JsonArray array = json.getAsJsonArray("note");
5522      for (int i = 0; i < array.size(); i++) {
5523        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5524      }
5525    };
5526  }
5527
5528  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
5529    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
5530    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
5531    return res;
5532  }
5533
5534  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
5535    parseBackboneProperties(json, res);
5536    Type content = parseType("content", json);
5537    if (content != null)
5538      res.setContent(content);
5539  }
5540
5541  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
5542    CommunicationRequest res = new CommunicationRequest();
5543    parseCommunicationRequestProperties(json, res);
5544    return res;
5545  }
5546
5547  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
5548    parseDomainResourceProperties(json, res);
5549    if (json.has("identifier")) {
5550      JsonArray array = json.getAsJsonArray("identifier");
5551      for (int i = 0; i < array.size(); i++) {
5552        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5553      }
5554    };
5555    if (json.has("basedOn")) {
5556      JsonArray array = json.getAsJsonArray("basedOn");
5557      for (int i = 0; i < array.size(); i++) {
5558        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5559      }
5560    };
5561    if (json.has("replaces")) {
5562      JsonArray array = json.getAsJsonArray("replaces");
5563      for (int i = 0; i < array.size(); i++) {
5564        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5565      }
5566    };
5567    if (json.has("groupIdentifier"))
5568      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
5569    if (json.has("status"))
5570      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
5571    if (json.has("_status"))
5572      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5573    if (json.has("category")) {
5574      JsonArray array = json.getAsJsonArray("category");
5575      for (int i = 0; i < array.size(); i++) {
5576        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5577      }
5578    };
5579    if (json.has("priority"))
5580      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
5581    if (json.has("_priority"))
5582      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
5583    if (json.has("medium")) {
5584      JsonArray array = json.getAsJsonArray("medium");
5585      for (int i = 0; i < array.size(); i++) {
5586        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5587      }
5588    };
5589    if (json.has("subject"))
5590      res.setSubject(parseReference(getJObject(json, "subject")));
5591    if (json.has("recipient")) {
5592      JsonArray array = json.getAsJsonArray("recipient");
5593      for (int i = 0; i < array.size(); i++) {
5594        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5595      }
5596    };
5597    if (json.has("topic")) {
5598      JsonArray array = json.getAsJsonArray("topic");
5599      for (int i = 0; i < array.size(); i++) {
5600        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5601      }
5602    };
5603    if (json.has("context"))
5604      res.setContext(parseReference(getJObject(json, "context")));
5605    if (json.has("payload")) {
5606      JsonArray array = json.getAsJsonArray("payload");
5607      for (int i = 0; i < array.size(); i++) {
5608        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
5609      }
5610    };
5611    Type occurrence = parseType("occurrence", json);
5612    if (occurrence != null)
5613      res.setOccurrence(occurrence);
5614    if (json.has("authoredOn"))
5615      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
5616    if (json.has("_authoredOn"))
5617      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
5618    if (json.has("sender"))
5619      res.setSender(parseReference(getJObject(json, "sender")));
5620    if (json.has("requester"))
5621      res.setRequester(parseCommunicationRequestCommunicationRequestRequesterComponent(getJObject(json, "requester"), res));
5622    if (json.has("reasonCode")) {
5623      JsonArray array = json.getAsJsonArray("reasonCode");
5624      for (int i = 0; i < array.size(); i++) {
5625        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5626      }
5627    };
5628    if (json.has("reasonReference")) {
5629      JsonArray array = json.getAsJsonArray("reasonReference");
5630      for (int i = 0; i < array.size(); i++) {
5631        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5632      }
5633    };
5634    if (json.has("note")) {
5635      JsonArray array = json.getAsJsonArray("note");
5636      for (int i = 0; i < array.size(); i++) {
5637        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5638      }
5639    };
5640  }
5641
5642  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5643    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
5644    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
5645    return res;
5646  }
5647
5648  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
5649    parseBackboneProperties(json, res);
5650    Type content = parseType("content", json);
5651    if (content != null)
5652      res.setContent(content);
5653  }
5654
5655  protected CommunicationRequest.CommunicationRequestRequesterComponent parseCommunicationRequestCommunicationRequestRequesterComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5656    CommunicationRequest.CommunicationRequestRequesterComponent res = new CommunicationRequest.CommunicationRequestRequesterComponent();
5657    parseCommunicationRequestCommunicationRequestRequesterComponentProperties(json, owner, res);
5658    return res;
5659  }
5660
5661  protected void parseCommunicationRequestCommunicationRequestRequesterComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
5662    parseBackboneProperties(json, res);
5663    if (json.has("agent"))
5664      res.setAgent(parseReference(getJObject(json, "agent")));
5665    if (json.has("onBehalfOf"))
5666      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
5667  }
5668
5669  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
5670    CompartmentDefinition res = new CompartmentDefinition();
5671    parseCompartmentDefinitionProperties(json, res);
5672    return res;
5673  }
5674
5675  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
5676    parseDomainResourceProperties(json, res);
5677    if (json.has("url"))
5678      res.setUrlElement(parseUri(json.get("url").getAsString()));
5679    if (json.has("_url"))
5680      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5681    if (json.has("name"))
5682      res.setNameElement(parseString(json.get("name").getAsString()));
5683    if (json.has("_name"))
5684      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5685    if (json.has("title"))
5686      res.setTitleElement(parseString(json.get("title").getAsString()));
5687    if (json.has("_title"))
5688      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5689    if (json.has("status"))
5690      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5691    if (json.has("_status"))
5692      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5693    if (json.has("experimental"))
5694      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5695    if (json.has("_experimental"))
5696      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5697    if (json.has("date"))
5698      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5699    if (json.has("_date"))
5700      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5701    if (json.has("publisher"))
5702      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5703    if (json.has("_publisher"))
5704      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5705    if (json.has("contact")) {
5706      JsonArray array = json.getAsJsonArray("contact");
5707      for (int i = 0; i < array.size(); i++) {
5708        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5709      }
5710    };
5711    if (json.has("description"))
5712      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5713    if (json.has("_description"))
5714      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5715    if (json.has("purpose"))
5716      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5717    if (json.has("_purpose"))
5718      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5719    if (json.has("useContext")) {
5720      JsonArray array = json.getAsJsonArray("useContext");
5721      for (int i = 0; i < array.size(); i++) {
5722        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5723      }
5724    };
5725    if (json.has("jurisdiction")) {
5726      JsonArray array = json.getAsJsonArray("jurisdiction");
5727      for (int i = 0; i < array.size(); i++) {
5728        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5729      }
5730    };
5731    if (json.has("code"))
5732      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
5733    if (json.has("_code"))
5734      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5735    if (json.has("search"))
5736      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
5737    if (json.has("_search"))
5738      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
5739    if (json.has("resource")) {
5740      JsonArray array = json.getAsJsonArray("resource");
5741      for (int i = 0; i < array.size(); i++) {
5742        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
5743      }
5744    };
5745  }
5746
5747  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
5748    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
5749    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
5750    return res;
5751  }
5752
5753  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
5754    parseBackboneProperties(json, res);
5755    if (json.has("code"))
5756      res.setCodeElement(parseCode(json.get("code").getAsString()));
5757    if (json.has("_code"))
5758      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5759    if (json.has("param")) {
5760      JsonArray array = json.getAsJsonArray("param");
5761      for (int i = 0; i < array.size(); i++) {
5762        if (array.get(i).isJsonNull()) {
5763          res.getParam().add(new StringType());
5764        } else {
5765          res.getParam().add(parseString(array.get(i).getAsString()));
5766        }
5767      }
5768    };
5769    if (json.has("_param")) {
5770      JsonArray array = json.getAsJsonArray("_param");
5771      for (int i = 0; i < array.size(); i++) {
5772        if (i == res.getParam().size())
5773          res.getParam().add(parseString(null));
5774        if (array.get(i) instanceof JsonObject) 
5775          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
5776      }
5777    };
5778    if (json.has("documentation"))
5779      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
5780    if (json.has("_documentation"))
5781      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5782  }
5783
5784  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
5785    Composition res = new Composition();
5786    parseCompositionProperties(json, res);
5787    return res;
5788  }
5789
5790  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
5791    parseDomainResourceProperties(json, res);
5792    if (json.has("identifier"))
5793      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5794    if (json.has("status"))
5795      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
5796    if (json.has("_status"))
5797      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5798    if (json.has("type"))
5799      res.setType(parseCodeableConcept(getJObject(json, "type")));
5800    if (json.has("class"))
5801      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
5802    if (json.has("subject"))
5803      res.setSubject(parseReference(getJObject(json, "subject")));
5804    if (json.has("encounter"))
5805      res.setEncounter(parseReference(getJObject(json, "encounter")));
5806    if (json.has("date"))
5807      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5808    if (json.has("_date"))
5809      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5810    if (json.has("author")) {
5811      JsonArray array = json.getAsJsonArray("author");
5812      for (int i = 0; i < array.size(); i++) {
5813        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5814      }
5815    };
5816    if (json.has("title"))
5817      res.setTitleElement(parseString(json.get("title").getAsString()));
5818    if (json.has("_title"))
5819      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5820    if (json.has("confidentiality"))
5821      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
5822    if (json.has("_confidentiality"))
5823      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
5824    if (json.has("attester")) {
5825      JsonArray array = json.getAsJsonArray("attester");
5826      for (int i = 0; i < array.size(); i++) {
5827        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
5828      }
5829    };
5830    if (json.has("custodian"))
5831      res.setCustodian(parseReference(getJObject(json, "custodian")));
5832    if (json.has("relatesTo")) {
5833      JsonArray array = json.getAsJsonArray("relatesTo");
5834      for (int i = 0; i < array.size(); i++) {
5835        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
5836      }
5837    };
5838    if (json.has("event")) {
5839      JsonArray array = json.getAsJsonArray("event");
5840      for (int i = 0; i < array.size(); i++) {
5841        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
5842      }
5843    };
5844    if (json.has("section")) {
5845      JsonArray array = json.getAsJsonArray("section");
5846      for (int i = 0; i < array.size(); i++) {
5847        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
5848      }
5849    };
5850  }
5851
5852  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5853    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
5854    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
5855    return res;
5856  }
5857
5858  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
5859    parseBackboneProperties(json, res);
5860    if (json.has("mode")) {
5861      JsonArray array = json.getAsJsonArray("mode");
5862      for (int i = 0; i < array.size(); i++) {
5863        if (array.get(i).isJsonNull()) {
5864          res.getMode().add(new Enumeration<Composition.CompositionAttestationMode>());
5865        } else {
5866          res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5867        }
5868      }
5869    };
5870    if (json.has("_mode")) {
5871      JsonArray array = json.getAsJsonArray("_mode");
5872      for (int i = 0; i < array.size(); i++) {
5873        if (i == res.getMode().size())
5874          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5875        if (array.get(i) instanceof JsonObject) 
5876          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
5877      }
5878    };
5879    if (json.has("time"))
5880      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
5881    if (json.has("_time"))
5882      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
5883    if (json.has("party"))
5884      res.setParty(parseReference(getJObject(json, "party")));
5885  }
5886
5887  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5888    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
5889    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
5890    return res;
5891  }
5892
5893  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
5894    parseBackboneProperties(json, res);
5895    if (json.has("code"))
5896      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
5897    if (json.has("_code"))
5898      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5899    Type target = parseType("target", json);
5900    if (target != null)
5901      res.setTarget(target);
5902  }
5903
5904  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5905    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
5906    parseCompositionCompositionEventComponentProperties(json, owner, res);
5907    return res;
5908  }
5909
5910  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
5911    parseBackboneProperties(json, res);
5912    if (json.has("code")) {
5913      JsonArray array = json.getAsJsonArray("code");
5914      for (int i = 0; i < array.size(); i++) {
5915        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5916      }
5917    };
5918    if (json.has("period"))
5919      res.setPeriod(parsePeriod(getJObject(json, "period")));
5920    if (json.has("detail")) {
5921      JsonArray array = json.getAsJsonArray("detail");
5922      for (int i = 0; i < array.size(); i++) {
5923        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
5924      }
5925    };
5926  }
5927
5928  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5929    Composition.SectionComponent res = new Composition.SectionComponent();
5930    parseCompositionSectionComponentProperties(json, owner, res);
5931    return res;
5932  }
5933
5934  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
5935    parseBackboneProperties(json, res);
5936    if (json.has("title"))
5937      res.setTitleElement(parseString(json.get("title").getAsString()));
5938    if (json.has("_title"))
5939      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5940    if (json.has("code"))
5941      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5942    if (json.has("text"))
5943      res.setText(parseNarrative(getJObject(json, "text")));
5944    if (json.has("mode"))
5945      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
5946    if (json.has("_mode"))
5947      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5948    if (json.has("orderedBy"))
5949      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
5950    if (json.has("entry")) {
5951      JsonArray array = json.getAsJsonArray("entry");
5952      for (int i = 0; i < array.size(); i++) {
5953        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
5954      }
5955    };
5956    if (json.has("emptyReason"))
5957      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
5958    if (json.has("section")) {
5959      JsonArray array = json.getAsJsonArray("section");
5960      for (int i = 0; i < array.size(); i++) {
5961        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
5962      }
5963    };
5964  }
5965
5966  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
5967    ConceptMap res = new ConceptMap();
5968    parseConceptMapProperties(json, res);
5969    return res;
5970  }
5971
5972  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
5973    parseDomainResourceProperties(json, res);
5974    if (json.has("url"))
5975      res.setUrlElement(parseUri(json.get("url").getAsString()));
5976    if (json.has("_url"))
5977      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5978    if (json.has("identifier"))
5979      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5980    if (json.has("version"))
5981      res.setVersionElement(parseString(json.get("version").getAsString()));
5982    if (json.has("_version"))
5983      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5984    if (json.has("name"))
5985      res.setNameElement(parseString(json.get("name").getAsString()));
5986    if (json.has("_name"))
5987      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5988    if (json.has("title"))
5989      res.setTitleElement(parseString(json.get("title").getAsString()));
5990    if (json.has("_title"))
5991      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5992    if (json.has("status"))
5993      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5994    if (json.has("_status"))
5995      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5996    if (json.has("experimental"))
5997      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5998    if (json.has("_experimental"))
5999      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6000    if (json.has("date"))
6001      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6002    if (json.has("_date"))
6003      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6004    if (json.has("publisher"))
6005      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6006    if (json.has("_publisher"))
6007      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6008    if (json.has("contact")) {
6009      JsonArray array = json.getAsJsonArray("contact");
6010      for (int i = 0; i < array.size(); i++) {
6011        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6012      }
6013    };
6014    if (json.has("description"))
6015      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6016    if (json.has("_description"))
6017      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6018    if (json.has("useContext")) {
6019      JsonArray array = json.getAsJsonArray("useContext");
6020      for (int i = 0; i < array.size(); i++) {
6021        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6022      }
6023    };
6024    if (json.has("jurisdiction")) {
6025      JsonArray array = json.getAsJsonArray("jurisdiction");
6026      for (int i = 0; i < array.size(); i++) {
6027        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6028      }
6029    };
6030    if (json.has("purpose"))
6031      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6032    if (json.has("_purpose"))
6033      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6034    if (json.has("copyright"))
6035      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6036    if (json.has("_copyright"))
6037      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6038    Type source = parseType("source", json);
6039    if (source != null)
6040      res.setSource(source);
6041    Type target = parseType("target", json);
6042    if (target != null)
6043      res.setTarget(target);
6044    if (json.has("group")) {
6045      JsonArray array = json.getAsJsonArray("group");
6046      for (int i = 0; i < array.size(); i++) {
6047        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6048      }
6049    };
6050  }
6051
6052  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6053    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6054    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6055    return res;
6056  }
6057
6058  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6059    parseBackboneProperties(json, res);
6060    if (json.has("source"))
6061      res.setSourceElement(parseUri(json.get("source").getAsString()));
6062    if (json.has("_source"))
6063      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
6064    if (json.has("sourceVersion"))
6065      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6066    if (json.has("_sourceVersion"))
6067      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
6068    if (json.has("target"))
6069      res.setTargetElement(parseUri(json.get("target").getAsString()));
6070    if (json.has("_target"))
6071      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
6072    if (json.has("targetVersion"))
6073      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6074    if (json.has("_targetVersion"))
6075      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
6076    if (json.has("element")) {
6077      JsonArray array = json.getAsJsonArray("element");
6078      for (int i = 0; i < array.size(); i++) {
6079        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6080      }
6081    };
6082    if (json.has("unmapped"))
6083      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(getJObject(json, "unmapped"), owner));
6084  }
6085
6086  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6087    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6088    parseConceptMapSourceElementComponentProperties(json, owner, res);
6089    return res;
6090  }
6091
6092  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6093    parseBackboneProperties(json, res);
6094    if (json.has("code"))
6095      res.setCodeElement(parseCode(json.get("code").getAsString()));
6096    if (json.has("_code"))
6097      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6098    if (json.has("display"))
6099      res.setDisplayElement(parseString(json.get("display").getAsString()));
6100    if (json.has("_display"))
6101      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6102    if (json.has("target")) {
6103      JsonArray array = json.getAsJsonArray("target");
6104      for (int i = 0; i < array.size(); i++) {
6105        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
6106      }
6107    };
6108  }
6109
6110  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6111    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
6112    parseConceptMapTargetElementComponentProperties(json, owner, res);
6113    return res;
6114  }
6115
6116  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
6117    parseBackboneProperties(json, res);
6118    if (json.has("code"))
6119      res.setCodeElement(parseCode(json.get("code").getAsString()));
6120    if (json.has("_code"))
6121      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6122    if (json.has("display"))
6123      res.setDisplayElement(parseString(json.get("display").getAsString()));
6124    if (json.has("_display"))
6125      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6126    if (json.has("equivalence"))
6127      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
6128    if (json.has("_equivalence"))
6129      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
6130    if (json.has("comment"))
6131      res.setCommentElement(parseString(json.get("comment").getAsString()));
6132    if (json.has("_comment"))
6133      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
6134    if (json.has("dependsOn")) {
6135      JsonArray array = json.getAsJsonArray("dependsOn");
6136      for (int i = 0; i < array.size(); i++) {
6137        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6138      }
6139    };
6140    if (json.has("product")) {
6141      JsonArray array = json.getAsJsonArray("product");
6142      for (int i = 0; i < array.size(); i++) {
6143        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6144      }
6145    };
6146  }
6147
6148  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6149    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
6150    parseConceptMapOtherElementComponentProperties(json, owner, res);
6151    return res;
6152  }
6153
6154  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
6155    parseBackboneProperties(json, res);
6156    if (json.has("property"))
6157      res.setPropertyElement(parseUri(json.get("property").getAsString()));
6158    if (json.has("_property"))
6159      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
6160    if (json.has("system"))
6161      res.setSystemElement(parseUri(json.get("system").getAsString()));
6162    if (json.has("_system"))
6163      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
6164    if (json.has("code"))
6165      res.setCodeElement(parseString(json.get("code").getAsString()));
6166    if (json.has("_code"))
6167      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6168    if (json.has("display"))
6169      res.setDisplayElement(parseString(json.get("display").getAsString()));
6170    if (json.has("_display"))
6171      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6172  }
6173
6174  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6175    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
6176    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
6177    return res;
6178  }
6179
6180  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
6181    parseBackboneProperties(json, res);
6182    if (json.has("mode"))
6183      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
6184    if (json.has("_mode"))
6185      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
6186    if (json.has("code"))
6187      res.setCodeElement(parseCode(json.get("code").getAsString()));
6188    if (json.has("_code"))
6189      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6190    if (json.has("display"))
6191      res.setDisplayElement(parseString(json.get("display").getAsString()));
6192    if (json.has("_display"))
6193      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6194    if (json.has("url"))
6195      res.setUrlElement(parseUri(json.get("url").getAsString()));
6196    if (json.has("_url"))
6197      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6198  }
6199
6200  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
6201    Condition res = new Condition();
6202    parseConditionProperties(json, res);
6203    return res;
6204  }
6205
6206  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
6207    parseDomainResourceProperties(json, res);
6208    if (json.has("identifier")) {
6209      JsonArray array = json.getAsJsonArray("identifier");
6210      for (int i = 0; i < array.size(); i++) {
6211        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6212      }
6213    };
6214    if (json.has("clinicalStatus"))
6215      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
6216    if (json.has("_clinicalStatus"))
6217      parseElementProperties(getJObject(json, "_clinicalStatus"), res.getClinicalStatusElement());
6218    if (json.has("verificationStatus"))
6219      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
6220    if (json.has("_verificationStatus"))
6221      parseElementProperties(getJObject(json, "_verificationStatus"), res.getVerificationStatusElement());
6222    if (json.has("category")) {
6223      JsonArray array = json.getAsJsonArray("category");
6224      for (int i = 0; i < array.size(); i++) {
6225        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6226      }
6227    };
6228    if (json.has("severity"))
6229      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
6230    if (json.has("code"))
6231      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6232    if (json.has("bodySite")) {
6233      JsonArray array = json.getAsJsonArray("bodySite");
6234      for (int i = 0; i < array.size(); i++) {
6235        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6236      }
6237    };
6238    if (json.has("subject"))
6239      res.setSubject(parseReference(getJObject(json, "subject")));
6240    if (json.has("context"))
6241      res.setContext(parseReference(getJObject(json, "context")));
6242    Type onset = parseType("onset", json);
6243    if (onset != null)
6244      res.setOnset(onset);
6245    Type abatement = parseType("abatement", json);
6246    if (abatement != null)
6247      res.setAbatement(abatement);
6248    if (json.has("assertedDate"))
6249      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
6250    if (json.has("_assertedDate"))
6251      parseElementProperties(getJObject(json, "_assertedDate"), res.getAssertedDateElement());
6252    if (json.has("asserter"))
6253      res.setAsserter(parseReference(getJObject(json, "asserter")));
6254    if (json.has("stage"))
6255      res.setStage(parseConditionConditionStageComponent(getJObject(json, "stage"), res));
6256    if (json.has("evidence")) {
6257      JsonArray array = json.getAsJsonArray("evidence");
6258      for (int i = 0; i < array.size(); i++) {
6259        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
6260      }
6261    };
6262    if (json.has("note")) {
6263      JsonArray array = json.getAsJsonArray("note");
6264      for (int i = 0; i < array.size(); i++) {
6265        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6266      }
6267    };
6268  }
6269
6270  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6271    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
6272    parseConditionConditionStageComponentProperties(json, owner, res);
6273    return res;
6274  }
6275
6276  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
6277    parseBackboneProperties(json, res);
6278    if (json.has("summary"))
6279      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
6280    if (json.has("assessment")) {
6281      JsonArray array = json.getAsJsonArray("assessment");
6282      for (int i = 0; i < array.size(); i++) {
6283        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6284      }
6285    };
6286  }
6287
6288  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6289    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
6290    parseConditionConditionEvidenceComponentProperties(json, owner, res);
6291    return res;
6292  }
6293
6294  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
6295    parseBackboneProperties(json, res);
6296    if (json.has("code")) {
6297      JsonArray array = json.getAsJsonArray("code");
6298      for (int i = 0; i < array.size(); i++) {
6299        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6300      }
6301    };
6302    if (json.has("detail")) {
6303      JsonArray array = json.getAsJsonArray("detail");
6304      for (int i = 0; i < array.size(); i++) {
6305        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6306      }
6307    };
6308  }
6309
6310  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
6311    Consent res = new Consent();
6312    parseConsentProperties(json, res);
6313    return res;
6314  }
6315
6316  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
6317    parseDomainResourceProperties(json, res);
6318    if (json.has("identifier"))
6319      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6320    if (json.has("status"))
6321      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
6322    if (json.has("_status"))
6323      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6324    if (json.has("category")) {
6325      JsonArray array = json.getAsJsonArray("category");
6326      for (int i = 0; i < array.size(); i++) {
6327        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6328      }
6329    };
6330    if (json.has("patient"))
6331      res.setPatient(parseReference(getJObject(json, "patient")));
6332    if (json.has("period"))
6333      res.setPeriod(parsePeriod(getJObject(json, "period")));
6334    if (json.has("dateTime"))
6335      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
6336    if (json.has("_dateTime"))
6337      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
6338    if (json.has("consentingParty")) {
6339      JsonArray array = json.getAsJsonArray("consentingParty");
6340      for (int i = 0; i < array.size(); i++) {
6341        res.getConsentingParty().add(parseReference(array.get(i).getAsJsonObject()));
6342      }
6343    };
6344    if (json.has("actor")) {
6345      JsonArray array = json.getAsJsonArray("actor");
6346      for (int i = 0; i < array.size(); i++) {
6347        res.getActor().add(parseConsentConsentActorComponent(array.get(i).getAsJsonObject(), res));
6348      }
6349    };
6350    if (json.has("action")) {
6351      JsonArray array = json.getAsJsonArray("action");
6352      for (int i = 0; i < array.size(); i++) {
6353        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6354      }
6355    };
6356    if (json.has("organization")) {
6357      JsonArray array = json.getAsJsonArray("organization");
6358      for (int i = 0; i < array.size(); i++) {
6359        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
6360      }
6361    };
6362    Type source = parseType("source", json);
6363    if (source != null)
6364      res.setSource(source);
6365    if (json.has("policy")) {
6366      JsonArray array = json.getAsJsonArray("policy");
6367      for (int i = 0; i < array.size(); i++) {
6368        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
6369      }
6370    };
6371    if (json.has("policyRule"))
6372      res.setPolicyRuleElement(parseUri(json.get("policyRule").getAsString()));
6373    if (json.has("_policyRule"))
6374      parseElementProperties(getJObject(json, "_policyRule"), res.getPolicyRuleElement());
6375    if (json.has("securityLabel")) {
6376      JsonArray array = json.getAsJsonArray("securityLabel");
6377      for (int i = 0; i < array.size(); i++) {
6378        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6379      }
6380    };
6381    if (json.has("purpose")) {
6382      JsonArray array = json.getAsJsonArray("purpose");
6383      for (int i = 0; i < array.size(); i++) {
6384        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6385      }
6386    };
6387    if (json.has("dataPeriod"))
6388      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
6389    if (json.has("data")) {
6390      JsonArray array = json.getAsJsonArray("data");
6391      for (int i = 0; i < array.size(); i++) {
6392        res.getData().add(parseConsentConsentDataComponent(array.get(i).getAsJsonObject(), res));
6393      }
6394    };
6395    if (json.has("except")) {
6396      JsonArray array = json.getAsJsonArray("except");
6397      for (int i = 0; i < array.size(); i++) {
6398        res.getExcept().add(parseConsentExceptComponent(array.get(i).getAsJsonObject(), res));
6399      }
6400    };
6401  }
6402
6403  protected Consent.ConsentActorComponent parseConsentConsentActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6404    Consent.ConsentActorComponent res = new Consent.ConsentActorComponent();
6405    parseConsentConsentActorComponentProperties(json, owner, res);
6406    return res;
6407  }
6408
6409  protected void parseConsentConsentActorComponentProperties(JsonObject json, Consent owner, Consent.ConsentActorComponent res) throws IOException, FHIRFormatError {
6410    parseBackboneProperties(json, res);
6411    if (json.has("role"))
6412      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6413    if (json.has("reference"))
6414      res.setReference(parseReference(getJObject(json, "reference")));
6415  }
6416
6417  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6418    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
6419    parseConsentConsentPolicyComponentProperties(json, owner, res);
6420    return res;
6421  }
6422
6423  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
6424    parseBackboneProperties(json, res);
6425    if (json.has("authority"))
6426      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
6427    if (json.has("_authority"))
6428      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
6429    if (json.has("uri"))
6430      res.setUriElement(parseUri(json.get("uri").getAsString()));
6431    if (json.has("_uri"))
6432      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
6433  }
6434
6435  protected Consent.ConsentDataComponent parseConsentConsentDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6436    Consent.ConsentDataComponent res = new Consent.ConsentDataComponent();
6437    parseConsentConsentDataComponentProperties(json, owner, res);
6438    return res;
6439  }
6440
6441  protected void parseConsentConsentDataComponentProperties(JsonObject json, Consent owner, Consent.ConsentDataComponent res) throws IOException, FHIRFormatError {
6442    parseBackboneProperties(json, res);
6443    if (json.has("meaning"))
6444      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6445    if (json.has("_meaning"))
6446      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
6447    if (json.has("reference"))
6448      res.setReference(parseReference(getJObject(json, "reference")));
6449  }
6450
6451  protected Consent.ExceptComponent parseConsentExceptComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6452    Consent.ExceptComponent res = new Consent.ExceptComponent();
6453    parseConsentExceptComponentProperties(json, owner, res);
6454    return res;
6455  }
6456
6457  protected void parseConsentExceptComponentProperties(JsonObject json, Consent owner, Consent.ExceptComponent res) throws IOException, FHIRFormatError {
6458    parseBackboneProperties(json, res);
6459    if (json.has("type"))
6460      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentExceptType.NULL, new Consent.ConsentExceptTypeEnumFactory()));
6461    if (json.has("_type"))
6462      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6463    if (json.has("period"))
6464      res.setPeriod(parsePeriod(getJObject(json, "period")));
6465    if (json.has("actor")) {
6466      JsonArray array = json.getAsJsonArray("actor");
6467      for (int i = 0; i < array.size(); i++) {
6468        res.getActor().add(parseConsentExceptActorComponent(array.get(i).getAsJsonObject(), owner));
6469      }
6470    };
6471    if (json.has("action")) {
6472      JsonArray array = json.getAsJsonArray("action");
6473      for (int i = 0; i < array.size(); i++) {
6474        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6475      }
6476    };
6477    if (json.has("securityLabel")) {
6478      JsonArray array = json.getAsJsonArray("securityLabel");
6479      for (int i = 0; i < array.size(); i++) {
6480        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6481      }
6482    };
6483    if (json.has("purpose")) {
6484      JsonArray array = json.getAsJsonArray("purpose");
6485      for (int i = 0; i < array.size(); i++) {
6486        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6487      }
6488    };
6489    if (json.has("class")) {
6490      JsonArray array = json.getAsJsonArray("class");
6491      for (int i = 0; i < array.size(); i++) {
6492        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
6493      }
6494    };
6495    if (json.has("code")) {
6496      JsonArray array = json.getAsJsonArray("code");
6497      for (int i = 0; i < array.size(); i++) {
6498        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
6499      }
6500    };
6501    if (json.has("dataPeriod"))
6502      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
6503    if (json.has("data")) {
6504      JsonArray array = json.getAsJsonArray("data");
6505      for (int i = 0; i < array.size(); i++) {
6506        res.getData().add(parseConsentExceptDataComponent(array.get(i).getAsJsonObject(), owner));
6507      }
6508    };
6509  }
6510
6511  protected Consent.ExceptActorComponent parseConsentExceptActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6512    Consent.ExceptActorComponent res = new Consent.ExceptActorComponent();
6513    parseConsentExceptActorComponentProperties(json, owner, res);
6514    return res;
6515  }
6516
6517  protected void parseConsentExceptActorComponentProperties(JsonObject json, Consent owner, Consent.ExceptActorComponent res) throws IOException, FHIRFormatError {
6518    parseBackboneProperties(json, res);
6519    if (json.has("role"))
6520      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6521    if (json.has("reference"))
6522      res.setReference(parseReference(getJObject(json, "reference")));
6523  }
6524
6525  protected Consent.ExceptDataComponent parseConsentExceptDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6526    Consent.ExceptDataComponent res = new Consent.ExceptDataComponent();
6527    parseConsentExceptDataComponentProperties(json, owner, res);
6528    return res;
6529  }
6530
6531  protected void parseConsentExceptDataComponentProperties(JsonObject json, Consent owner, Consent.ExceptDataComponent res) throws IOException, FHIRFormatError {
6532    parseBackboneProperties(json, res);
6533    if (json.has("meaning"))
6534      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6535    if (json.has("_meaning"))
6536      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
6537    if (json.has("reference"))
6538      res.setReference(parseReference(getJObject(json, "reference")));
6539  }
6540
6541  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
6542    Contract res = new Contract();
6543    parseContractProperties(json, res);
6544    return res;
6545  }
6546
6547  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
6548    parseDomainResourceProperties(json, res);
6549    if (json.has("identifier"))
6550      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6551    if (json.has("status"))
6552      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
6553    if (json.has("_status"))
6554      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6555    if (json.has("issued"))
6556      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6557    if (json.has("_issued"))
6558      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
6559    if (json.has("applies"))
6560      res.setApplies(parsePeriod(getJObject(json, "applies")));
6561    if (json.has("subject")) {
6562      JsonArray array = json.getAsJsonArray("subject");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6565      }
6566    };
6567    if (json.has("topic")) {
6568      JsonArray array = json.getAsJsonArray("topic");
6569      for (int i = 0; i < array.size(); i++) {
6570        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6571      }
6572    };
6573    if (json.has("authority")) {
6574      JsonArray array = json.getAsJsonArray("authority");
6575      for (int i = 0; i < array.size(); i++) {
6576        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
6577      }
6578    };
6579    if (json.has("domain")) {
6580      JsonArray array = json.getAsJsonArray("domain");
6581      for (int i = 0; i < array.size(); i++) {
6582        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
6583      }
6584    };
6585    if (json.has("type"))
6586      res.setType(parseCodeableConcept(getJObject(json, "type")));
6587    if (json.has("subType")) {
6588      JsonArray array = json.getAsJsonArray("subType");
6589      for (int i = 0; i < array.size(); i++) {
6590        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6591      }
6592    };
6593    if (json.has("action")) {
6594      JsonArray array = json.getAsJsonArray("action");
6595      for (int i = 0; i < array.size(); i++) {
6596        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6597      }
6598    };
6599    if (json.has("actionReason")) {
6600      JsonArray array = json.getAsJsonArray("actionReason");
6601      for (int i = 0; i < array.size(); i++) {
6602        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6603      }
6604    };
6605    if (json.has("decisionType"))
6606      res.setDecisionType(parseCodeableConcept(getJObject(json, "decisionType")));
6607    if (json.has("contentDerivative"))
6608      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
6609    if (json.has("securityLabel")) {
6610      JsonArray array = json.getAsJsonArray("securityLabel");
6611      for (int i = 0; i < array.size(); i++) {
6612        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6613      }
6614    };
6615    if (json.has("agent")) {
6616      JsonArray array = json.getAsJsonArray("agent");
6617      for (int i = 0; i < array.size(); i++) {
6618        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), res));
6619      }
6620    };
6621    if (json.has("signer")) {
6622      JsonArray array = json.getAsJsonArray("signer");
6623      for (int i = 0; i < array.size(); i++) {
6624        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
6625      }
6626    };
6627    if (json.has("valuedItem")) {
6628      JsonArray array = json.getAsJsonArray("valuedItem");
6629      for (int i = 0; i < array.size(); i++) {
6630        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
6631      }
6632    };
6633    if (json.has("term")) {
6634      JsonArray array = json.getAsJsonArray("term");
6635      for (int i = 0; i < array.size(); i++) {
6636        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
6637      }
6638    };
6639    Type binding = parseType("binding", json);
6640    if (binding != null)
6641      res.setBinding(binding);
6642    if (json.has("friendly")) {
6643      JsonArray array = json.getAsJsonArray("friendly");
6644      for (int i = 0; i < array.size(); i++) {
6645        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
6646      }
6647    };
6648    if (json.has("legal")) {
6649      JsonArray array = json.getAsJsonArray("legal");
6650      for (int i = 0; i < array.size(); i++) {
6651        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
6652      }
6653    };
6654    if (json.has("rule")) {
6655      JsonArray array = json.getAsJsonArray("rule");
6656      for (int i = 0; i < array.size(); i++) {
6657        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
6658      }
6659    };
6660  }
6661
6662  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6663    Contract.AgentComponent res = new Contract.AgentComponent();
6664    parseContractAgentComponentProperties(json, owner, res);
6665    return res;
6666  }
6667
6668  protected void parseContractAgentComponentProperties(JsonObject json, Contract owner, Contract.AgentComponent res) throws IOException, FHIRFormatError {
6669    parseBackboneProperties(json, res);
6670    if (json.has("actor"))
6671      res.setActor(parseReference(getJObject(json, "actor")));
6672    if (json.has("role")) {
6673      JsonArray array = json.getAsJsonArray("role");
6674      for (int i = 0; i < array.size(); i++) {
6675        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6676      }
6677    };
6678  }
6679
6680  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6681    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
6682    parseContractSignatoryComponentProperties(json, owner, res);
6683    return res;
6684  }
6685
6686  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
6687    parseBackboneProperties(json, res);
6688    if (json.has("type"))
6689      res.setType(parseCoding(getJObject(json, "type")));
6690    if (json.has("party"))
6691      res.setParty(parseReference(getJObject(json, "party")));
6692    if (json.has("signature")) {
6693      JsonArray array = json.getAsJsonArray("signature");
6694      for (int i = 0; i < array.size(); i++) {
6695        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
6696      }
6697    };
6698  }
6699
6700  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6701    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
6702    parseContractValuedItemComponentProperties(json, owner, res);
6703    return res;
6704  }
6705
6706  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
6707    parseBackboneProperties(json, res);
6708    Type entity = parseType("entity", json);
6709    if (entity != null)
6710      res.setEntity(entity);
6711    if (json.has("identifier"))
6712      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6713    if (json.has("effectiveTime"))
6714      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6715    if (json.has("_effectiveTime"))
6716      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
6717    if (json.has("quantity"))
6718      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
6719    if (json.has("unitPrice"))
6720      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6721    if (json.has("factor"))
6722      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6723    if (json.has("_factor"))
6724      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6725    if (json.has("points"))
6726      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6727    if (json.has("_points"))
6728      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
6729    if (json.has("net"))
6730      res.setNet(parseMoney(getJObject(json, "net")));
6731  }
6732
6733  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6734    Contract.TermComponent res = new Contract.TermComponent();
6735    parseContractTermComponentProperties(json, owner, res);
6736    return res;
6737  }
6738
6739  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
6740    parseBackboneProperties(json, res);
6741    if (json.has("identifier"))
6742      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6743    if (json.has("issued"))
6744      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6745    if (json.has("_issued"))
6746      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
6747    if (json.has("applies"))
6748      res.setApplies(parsePeriod(getJObject(json, "applies")));
6749    if (json.has("type"))
6750      res.setType(parseCodeableConcept(getJObject(json, "type")));
6751    if (json.has("subType"))
6752      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6753    if (json.has("topic")) {
6754      JsonArray array = json.getAsJsonArray("topic");
6755      for (int i = 0; i < array.size(); i++) {
6756        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6757      }
6758    };
6759    if (json.has("action")) {
6760      JsonArray array = json.getAsJsonArray("action");
6761      for (int i = 0; i < array.size(); i++) {
6762        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6763      }
6764    };
6765    if (json.has("actionReason")) {
6766      JsonArray array = json.getAsJsonArray("actionReason");
6767      for (int i = 0; i < array.size(); i++) {
6768        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6769      }
6770    };
6771    if (json.has("securityLabel")) {
6772      JsonArray array = json.getAsJsonArray("securityLabel");
6773      for (int i = 0; i < array.size(); i++) {
6774        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6775      }
6776    };
6777    if (json.has("agent")) {
6778      JsonArray array = json.getAsJsonArray("agent");
6779      for (int i = 0; i < array.size(); i++) {
6780        res.getAgent().add(parseContractTermAgentComponent(array.get(i).getAsJsonObject(), owner));
6781      }
6782    };
6783    if (json.has("text"))
6784      res.setTextElement(parseString(json.get("text").getAsString()));
6785    if (json.has("_text"))
6786      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6787    if (json.has("valuedItem")) {
6788      JsonArray array = json.getAsJsonArray("valuedItem");
6789      for (int i = 0; i < array.size(); i++) {
6790        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
6791      }
6792    };
6793    if (json.has("group")) {
6794      JsonArray array = json.getAsJsonArray("group");
6795      for (int i = 0; i < array.size(); i++) {
6796        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
6797      }
6798    };
6799  }
6800
6801  protected Contract.TermAgentComponent parseContractTermAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6802    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
6803    parseContractTermAgentComponentProperties(json, owner, res);
6804    return res;
6805  }
6806
6807  protected void parseContractTermAgentComponentProperties(JsonObject json, Contract owner, Contract.TermAgentComponent res) throws IOException, FHIRFormatError {
6808    parseBackboneProperties(json, res);
6809    if (json.has("actor"))
6810      res.setActor(parseReference(getJObject(json, "actor")));
6811    if (json.has("role")) {
6812      JsonArray array = json.getAsJsonArray("role");
6813      for (int i = 0; i < array.size(); i++) {
6814        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6815      }
6816    };
6817  }
6818
6819  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6820    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
6821    parseContractTermValuedItemComponentProperties(json, owner, res);
6822    return res;
6823  }
6824
6825  protected void parseContractTermValuedItemComponentProperties(JsonObject json, Contract owner, Contract.TermValuedItemComponent res) throws IOException, FHIRFormatError {
6826    parseBackboneProperties(json, res);
6827    Type entity = parseType("entity", json);
6828    if (entity != null)
6829      res.setEntity(entity);
6830    if (json.has("identifier"))
6831      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6832    if (json.has("effectiveTime"))
6833      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6834    if (json.has("_effectiveTime"))
6835      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
6836    if (json.has("quantity"))
6837      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
6838    if (json.has("unitPrice"))
6839      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6840    if (json.has("factor"))
6841      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6842    if (json.has("_factor"))
6843      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6844    if (json.has("points"))
6845      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6846    if (json.has("_points"))
6847      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
6848    if (json.has("net"))
6849      res.setNet(parseMoney(getJObject(json, "net")));
6850  }
6851
6852  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6853    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
6854    parseContractFriendlyLanguageComponentProperties(json, owner, res);
6855    return res;
6856  }
6857
6858  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
6859    parseBackboneProperties(json, res);
6860    Type content = parseType("content", json);
6861    if (content != null)
6862      res.setContent(content);
6863  }
6864
6865  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6866    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
6867    parseContractLegalLanguageComponentProperties(json, owner, res);
6868    return res;
6869  }
6870
6871  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
6872    parseBackboneProperties(json, res);
6873    Type content = parseType("content", json);
6874    if (content != null)
6875      res.setContent(content);
6876  }
6877
6878  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6879    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
6880    parseContractComputableLanguageComponentProperties(json, owner, res);
6881    return res;
6882  }
6883
6884  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
6885    parseBackboneProperties(json, res);
6886    Type content = parseType("content", json);
6887    if (content != null)
6888      res.setContent(content);
6889  }
6890
6891  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
6892    Coverage res = new Coverage();
6893    parseCoverageProperties(json, res);
6894    return res;
6895  }
6896
6897  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
6898    parseDomainResourceProperties(json, res);
6899    if (json.has("identifier")) {
6900      JsonArray array = json.getAsJsonArray("identifier");
6901      for (int i = 0; i < array.size(); i++) {
6902        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6903      }
6904    };
6905    if (json.has("status"))
6906      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
6907    if (json.has("_status"))
6908      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6909    if (json.has("type"))
6910      res.setType(parseCodeableConcept(getJObject(json, "type")));
6911    if (json.has("policyHolder"))
6912      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
6913    if (json.has("subscriber"))
6914      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
6915    if (json.has("subscriberId"))
6916      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
6917    if (json.has("_subscriberId"))
6918      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
6919    if (json.has("beneficiary"))
6920      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
6921    if (json.has("relationship"))
6922      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
6923    if (json.has("period"))
6924      res.setPeriod(parsePeriod(getJObject(json, "period")));
6925    if (json.has("payor")) {
6926      JsonArray array = json.getAsJsonArray("payor");
6927      for (int i = 0; i < array.size(); i++) {
6928        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
6929      }
6930    };
6931    if (json.has("grouping"))
6932      res.setGrouping(parseCoverageGroupComponent(getJObject(json, "grouping"), res));
6933    if (json.has("dependent"))
6934      res.setDependentElement(parseString(json.get("dependent").getAsString()));
6935    if (json.has("_dependent"))
6936      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
6937    if (json.has("sequence"))
6938      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
6939    if (json.has("_sequence"))
6940      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6941    if (json.has("order"))
6942      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
6943    if (json.has("_order"))
6944      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
6945    if (json.has("network"))
6946      res.setNetworkElement(parseString(json.get("network").getAsString()));
6947    if (json.has("_network"))
6948      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
6949    if (json.has("contract")) {
6950      JsonArray array = json.getAsJsonArray("contract");
6951      for (int i = 0; i < array.size(); i++) {
6952        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
6953      }
6954    };
6955  }
6956
6957  protected Coverage.GroupComponent parseCoverageGroupComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
6958    Coverage.GroupComponent res = new Coverage.GroupComponent();
6959    parseCoverageGroupComponentProperties(json, owner, res);
6960    return res;
6961  }
6962
6963  protected void parseCoverageGroupComponentProperties(JsonObject json, Coverage owner, Coverage.GroupComponent res) throws IOException, FHIRFormatError {
6964    parseBackboneProperties(json, res);
6965    if (json.has("group"))
6966      res.setGroupElement(parseString(json.get("group").getAsString()));
6967    if (json.has("_group"))
6968      parseElementProperties(getJObject(json, "_group"), res.getGroupElement());
6969    if (json.has("groupDisplay"))
6970      res.setGroupDisplayElement(parseString(json.get("groupDisplay").getAsString()));
6971    if (json.has("_groupDisplay"))
6972      parseElementProperties(getJObject(json, "_groupDisplay"), res.getGroupDisplayElement());
6973    if (json.has("subGroup"))
6974      res.setSubGroupElement(parseString(json.get("subGroup").getAsString()));
6975    if (json.has("_subGroup"))
6976      parseElementProperties(getJObject(json, "_subGroup"), res.getSubGroupElement());
6977    if (json.has("subGroupDisplay"))
6978      res.setSubGroupDisplayElement(parseString(json.get("subGroupDisplay").getAsString()));
6979    if (json.has("_subGroupDisplay"))
6980      parseElementProperties(getJObject(json, "_subGroupDisplay"), res.getSubGroupDisplayElement());
6981    if (json.has("plan"))
6982      res.setPlanElement(parseString(json.get("plan").getAsString()));
6983    if (json.has("_plan"))
6984      parseElementProperties(getJObject(json, "_plan"), res.getPlanElement());
6985    if (json.has("planDisplay"))
6986      res.setPlanDisplayElement(parseString(json.get("planDisplay").getAsString()));
6987    if (json.has("_planDisplay"))
6988      parseElementProperties(getJObject(json, "_planDisplay"), res.getPlanDisplayElement());
6989    if (json.has("subPlan"))
6990      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
6991    if (json.has("_subPlan"))
6992      parseElementProperties(getJObject(json, "_subPlan"), res.getSubPlanElement());
6993    if (json.has("subPlanDisplay"))
6994      res.setSubPlanDisplayElement(parseString(json.get("subPlanDisplay").getAsString()));
6995    if (json.has("_subPlanDisplay"))
6996      parseElementProperties(getJObject(json, "_subPlanDisplay"), res.getSubPlanDisplayElement());
6997    if (json.has("class"))
6998      res.setClass_Element(parseString(json.get("class").getAsString()));
6999    if (json.has("_class"))
7000      parseElementProperties(getJObject(json, "_class"), res.getClass_Element());
7001    if (json.has("classDisplay"))
7002      res.setClassDisplayElement(parseString(json.get("classDisplay").getAsString()));
7003    if (json.has("_classDisplay"))
7004      parseElementProperties(getJObject(json, "_classDisplay"), res.getClassDisplayElement());
7005    if (json.has("subClass"))
7006      res.setSubClassElement(parseString(json.get("subClass").getAsString()));
7007    if (json.has("_subClass"))
7008      parseElementProperties(getJObject(json, "_subClass"), res.getSubClassElement());
7009    if (json.has("subClassDisplay"))
7010      res.setSubClassDisplayElement(parseString(json.get("subClassDisplay").getAsString()));
7011    if (json.has("_subClassDisplay"))
7012      parseElementProperties(getJObject(json, "_subClassDisplay"), res.getSubClassDisplayElement());
7013  }
7014
7015  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
7016    DataElement res = new DataElement();
7017    parseDataElementProperties(json, res);
7018    return res;
7019  }
7020
7021  protected void parseDataElementProperties(JsonObject json, DataElement res) throws IOException, FHIRFormatError {
7022    parseDomainResourceProperties(json, res);
7023    if (json.has("url"))
7024      res.setUrlElement(parseUri(json.get("url").getAsString()));
7025    if (json.has("_url"))
7026      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7027    if (json.has("identifier")) {
7028      JsonArray array = json.getAsJsonArray("identifier");
7029      for (int i = 0; i < array.size(); i++) {
7030        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7031      }
7032    };
7033    if (json.has("version"))
7034      res.setVersionElement(parseString(json.get("version").getAsString()));
7035    if (json.has("_version"))
7036      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7037    if (json.has("status"))
7038      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7039    if (json.has("_status"))
7040      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7041    if (json.has("experimental"))
7042      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7043    if (json.has("_experimental"))
7044      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7045    if (json.has("date"))
7046      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7047    if (json.has("_date"))
7048      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7049    if (json.has("publisher"))
7050      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7051    if (json.has("_publisher"))
7052      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7053    if (json.has("name"))
7054      res.setNameElement(parseString(json.get("name").getAsString()));
7055    if (json.has("_name"))
7056      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7057    if (json.has("title"))
7058      res.setTitleElement(parseString(json.get("title").getAsString()));
7059    if (json.has("_title"))
7060      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7061    if (json.has("contact")) {
7062      JsonArray array = json.getAsJsonArray("contact");
7063      for (int i = 0; i < array.size(); i++) {
7064        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7065      }
7066    };
7067    if (json.has("useContext")) {
7068      JsonArray array = json.getAsJsonArray("useContext");
7069      for (int i = 0; i < array.size(); i++) {
7070        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7071      }
7072    };
7073    if (json.has("jurisdiction")) {
7074      JsonArray array = json.getAsJsonArray("jurisdiction");
7075      for (int i = 0; i < array.size(); i++) {
7076        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7077      }
7078    };
7079    if (json.has("copyright"))
7080      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7081    if (json.has("_copyright"))
7082      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7083    if (json.has("stringency"))
7084      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
7085    if (json.has("_stringency"))
7086      parseElementProperties(getJObject(json, "_stringency"), res.getStringencyElement());
7087    if (json.has("mapping")) {
7088      JsonArray array = json.getAsJsonArray("mapping");
7089      for (int i = 0; i < array.size(); i++) {
7090        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
7091      }
7092    };
7093    if (json.has("element")) {
7094      JsonArray array = json.getAsJsonArray("element");
7095      for (int i = 0; i < array.size(); i++) {
7096        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
7097      }
7098    };
7099  }
7100
7101  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
7102    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
7103    parseDataElementDataElementMappingComponentProperties(json, owner, res);
7104    return res;
7105  }
7106
7107  protected void parseDataElementDataElementMappingComponentProperties(JsonObject json, DataElement owner, DataElement.DataElementMappingComponent res) throws IOException, FHIRFormatError {
7108    parseBackboneProperties(json, res);
7109    if (json.has("identity"))
7110      res.setIdentityElement(parseId(json.get("identity").getAsString()));
7111    if (json.has("_identity"))
7112      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
7113    if (json.has("uri"))
7114      res.setUriElement(parseUri(json.get("uri").getAsString()));
7115    if (json.has("_uri"))
7116      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7117    if (json.has("name"))
7118      res.setNameElement(parseString(json.get("name").getAsString()));
7119    if (json.has("_name"))
7120      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7121    if (json.has("comment"))
7122      res.setCommentElement(parseString(json.get("comment").getAsString()));
7123    if (json.has("_comment"))
7124      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7125  }
7126
7127  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
7128    DetectedIssue res = new DetectedIssue();
7129    parseDetectedIssueProperties(json, res);
7130    return res;
7131  }
7132
7133  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
7134    parseDomainResourceProperties(json, res);
7135    if (json.has("identifier"))
7136      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7137    if (json.has("status"))
7138      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
7139    if (json.has("_status"))
7140      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7141    if (json.has("category"))
7142      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7143    if (json.has("severity"))
7144      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
7145    if (json.has("_severity"))
7146      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
7147    if (json.has("patient"))
7148      res.setPatient(parseReference(getJObject(json, "patient")));
7149    if (json.has("date"))
7150      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7151    if (json.has("_date"))
7152      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7153    if (json.has("author"))
7154      res.setAuthor(parseReference(getJObject(json, "author")));
7155    if (json.has("implicated")) {
7156      JsonArray array = json.getAsJsonArray("implicated");
7157      for (int i = 0; i < array.size(); i++) {
7158        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
7159      }
7160    };
7161    if (json.has("detail"))
7162      res.setDetailElement(parseString(json.get("detail").getAsString()));
7163    if (json.has("_detail"))
7164      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
7165    if (json.has("reference"))
7166      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
7167    if (json.has("_reference"))
7168      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
7169    if (json.has("mitigation")) {
7170      JsonArray array = json.getAsJsonArray("mitigation");
7171      for (int i = 0; i < array.size(); i++) {
7172        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
7173      }
7174    };
7175  }
7176
7177  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
7178    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
7179    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
7180    return res;
7181  }
7182
7183  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
7184    parseBackboneProperties(json, res);
7185    if (json.has("action"))
7186      res.setAction(parseCodeableConcept(getJObject(json, "action")));
7187    if (json.has("date"))
7188      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7189    if (json.has("_date"))
7190      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7191    if (json.has("author"))
7192      res.setAuthor(parseReference(getJObject(json, "author")));
7193  }
7194
7195  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
7196    Device res = new Device();
7197    parseDeviceProperties(json, res);
7198    return res;
7199  }
7200
7201  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
7202    parseDomainResourceProperties(json, res);
7203    if (json.has("identifier")) {
7204      JsonArray array = json.getAsJsonArray("identifier");
7205      for (int i = 0; i < array.size(); i++) {
7206        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7207      }
7208    };
7209    if (json.has("udi"))
7210      res.setUdi(parseDeviceDeviceUdiComponent(getJObject(json, "udi"), res));
7211    if (json.has("status"))
7212      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
7213    if (json.has("_status"))
7214      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7215    if (json.has("type"))
7216      res.setType(parseCodeableConcept(getJObject(json, "type")));
7217    if (json.has("lotNumber"))
7218      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
7219    if (json.has("_lotNumber"))
7220      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
7221    if (json.has("manufacturer"))
7222      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
7223    if (json.has("_manufacturer"))
7224      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
7225    if (json.has("manufactureDate"))
7226      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
7227    if (json.has("_manufactureDate"))
7228      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
7229    if (json.has("expirationDate"))
7230      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
7231    if (json.has("_expirationDate"))
7232      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
7233    if (json.has("model"))
7234      res.setModelElement(parseString(json.get("model").getAsString()));
7235    if (json.has("_model"))
7236      parseElementProperties(getJObject(json, "_model"), res.getModelElement());
7237    if (json.has("version"))
7238      res.setVersionElement(parseString(json.get("version").getAsString()));
7239    if (json.has("_version"))
7240      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7241    if (json.has("patient"))
7242      res.setPatient(parseReference(getJObject(json, "patient")));
7243    if (json.has("owner"))
7244      res.setOwner(parseReference(getJObject(json, "owner")));
7245    if (json.has("contact")) {
7246      JsonArray array = json.getAsJsonArray("contact");
7247      for (int i = 0; i < array.size(); i++) {
7248        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
7249      }
7250    };
7251    if (json.has("location"))
7252      res.setLocation(parseReference(getJObject(json, "location")));
7253    if (json.has("url"))
7254      res.setUrlElement(parseUri(json.get("url").getAsString()));
7255    if (json.has("_url"))
7256      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7257    if (json.has("note")) {
7258      JsonArray array = json.getAsJsonArray("note");
7259      for (int i = 0; i < array.size(); i++) {
7260        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7261      }
7262    };
7263    if (json.has("safety")) {
7264      JsonArray array = json.getAsJsonArray("safety");
7265      for (int i = 0; i < array.size(); i++) {
7266        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7267      }
7268    };
7269  }
7270
7271  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
7272    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
7273    parseDeviceDeviceUdiComponentProperties(json, owner, res);
7274    return res;
7275  }
7276
7277  protected void parseDeviceDeviceUdiComponentProperties(JsonObject json, Device owner, Device.DeviceUdiComponent res) throws IOException, FHIRFormatError {
7278    parseBackboneProperties(json, res);
7279    if (json.has("deviceIdentifier"))
7280      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
7281    if (json.has("_deviceIdentifier"))
7282      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
7283    if (json.has("name"))
7284      res.setNameElement(parseString(json.get("name").getAsString()));
7285    if (json.has("_name"))
7286      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7287    if (json.has("jurisdiction"))
7288      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
7289    if (json.has("_jurisdiction"))
7290      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
7291    if (json.has("carrierHRF"))
7292      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
7293    if (json.has("_carrierHRF"))
7294      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
7295    if (json.has("carrierAIDC"))
7296      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
7297    if (json.has("_carrierAIDC"))
7298      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
7299    if (json.has("issuer"))
7300      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
7301    if (json.has("_issuer"))
7302      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
7303    if (json.has("entryType"))
7304      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
7305    if (json.has("_entryType"))
7306      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
7307  }
7308
7309  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
7310    DeviceComponent res = new DeviceComponent();
7311    parseDeviceComponentProperties(json, res);
7312    return res;
7313  }
7314
7315  protected void parseDeviceComponentProperties(JsonObject json, DeviceComponent res) throws IOException, FHIRFormatError {
7316    parseDomainResourceProperties(json, res);
7317    if (json.has("identifier"))
7318      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7319    if (json.has("type"))
7320      res.setType(parseCodeableConcept(getJObject(json, "type")));
7321    if (json.has("lastSystemChange"))
7322      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
7323    if (json.has("_lastSystemChange"))
7324      parseElementProperties(getJObject(json, "_lastSystemChange"), res.getLastSystemChangeElement());
7325    if (json.has("source"))
7326      res.setSource(parseReference(getJObject(json, "source")));
7327    if (json.has("parent"))
7328      res.setParent(parseReference(getJObject(json, "parent")));
7329    if (json.has("operationalStatus")) {
7330      JsonArray array = json.getAsJsonArray("operationalStatus");
7331      for (int i = 0; i < array.size(); i++) {
7332        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7333      }
7334    };
7335    if (json.has("parameterGroup"))
7336      res.setParameterGroup(parseCodeableConcept(getJObject(json, "parameterGroup")));
7337    if (json.has("measurementPrinciple"))
7338      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
7339    if (json.has("_measurementPrinciple"))
7340      parseElementProperties(getJObject(json, "_measurementPrinciple"), res.getMeasurementPrincipleElement());
7341    if (json.has("productionSpecification")) {
7342      JsonArray array = json.getAsJsonArray("productionSpecification");
7343      for (int i = 0; i < array.size(); i++) {
7344        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
7345      }
7346    };
7347    if (json.has("languageCode"))
7348      res.setLanguageCode(parseCodeableConcept(getJObject(json, "languageCode")));
7349  }
7350
7351  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7352    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
7353    parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(json, owner, res);
7354    return res;
7355  }
7356
7357  protected void parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws IOException, FHIRFormatError {
7358    parseBackboneProperties(json, res);
7359    if (json.has("specType"))
7360      res.setSpecType(parseCodeableConcept(getJObject(json, "specType")));
7361    if (json.has("componentId"))
7362      res.setComponentId(parseIdentifier(getJObject(json, "componentId")));
7363    if (json.has("productionSpec"))
7364      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
7365    if (json.has("_productionSpec"))
7366      parseElementProperties(getJObject(json, "_productionSpec"), res.getProductionSpecElement());
7367  }
7368
7369  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
7370    DeviceMetric res = new DeviceMetric();
7371    parseDeviceMetricProperties(json, res);
7372    return res;
7373  }
7374
7375  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
7376    parseDomainResourceProperties(json, res);
7377    if (json.has("identifier"))
7378      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7379    if (json.has("type"))
7380      res.setType(parseCodeableConcept(getJObject(json, "type")));
7381    if (json.has("unit"))
7382      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
7383    if (json.has("source"))
7384      res.setSource(parseReference(getJObject(json, "source")));
7385    if (json.has("parent"))
7386      res.setParent(parseReference(getJObject(json, "parent")));
7387    if (json.has("operationalStatus"))
7388      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
7389    if (json.has("_operationalStatus"))
7390      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
7391    if (json.has("color"))
7392      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
7393    if (json.has("_color"))
7394      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
7395    if (json.has("category"))
7396      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
7397    if (json.has("_category"))
7398      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
7399    if (json.has("measurementPeriod"))
7400      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
7401    if (json.has("calibration")) {
7402      JsonArray array = json.getAsJsonArray("calibration");
7403      for (int i = 0; i < array.size(); i++) {
7404        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
7405      }
7406    };
7407  }
7408
7409  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
7410    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
7411    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
7412    return res;
7413  }
7414
7415  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
7416    parseBackboneProperties(json, res);
7417    if (json.has("type"))
7418      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
7419    if (json.has("_type"))
7420      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7421    if (json.has("state"))
7422      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
7423    if (json.has("_state"))
7424      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
7425    if (json.has("time"))
7426      res.setTimeElement(parseInstant(json.get("time").getAsString()));
7427    if (json.has("_time"))
7428      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
7429  }
7430
7431  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
7432    DeviceRequest res = new DeviceRequest();
7433    parseDeviceRequestProperties(json, res);
7434    return res;
7435  }
7436
7437  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
7438    parseDomainResourceProperties(json, res);
7439    if (json.has("identifier")) {
7440      JsonArray array = json.getAsJsonArray("identifier");
7441      for (int i = 0; i < array.size(); i++) {
7442        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7443      }
7444    };
7445    if (json.has("definition")) {
7446      JsonArray array = json.getAsJsonArray("definition");
7447      for (int i = 0; i < array.size(); i++) {
7448        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
7449      }
7450    };
7451    if (json.has("basedOn")) {
7452      JsonArray array = json.getAsJsonArray("basedOn");
7453      for (int i = 0; i < array.size(); i++) {
7454        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7455      }
7456    };
7457    if (json.has("priorRequest")) {
7458      JsonArray array = json.getAsJsonArray("priorRequest");
7459      for (int i = 0; i < array.size(); i++) {
7460        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
7461      }
7462    };
7463    if (json.has("groupIdentifier"))
7464      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
7465    if (json.has("status"))
7466      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
7467    if (json.has("_status"))
7468      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7469    if (json.has("intent"))
7470      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
7471    if (json.has("priority"))
7472      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
7473    if (json.has("_priority"))
7474      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7475    Type code = parseType("code", json);
7476    if (code != null)
7477      res.setCode(code);
7478    if (json.has("subject"))
7479      res.setSubject(parseReference(getJObject(json, "subject")));
7480    if (json.has("context"))
7481      res.setContext(parseReference(getJObject(json, "context")));
7482    Type occurrence = parseType("occurrence", json);
7483    if (occurrence != null)
7484      res.setOccurrence(occurrence);
7485    if (json.has("authoredOn"))
7486      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7487    if (json.has("_authoredOn"))
7488      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
7489    if (json.has("requester"))
7490      res.setRequester(parseDeviceRequestDeviceRequestRequesterComponent(getJObject(json, "requester"), res));
7491    if (json.has("performerType"))
7492      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
7493    if (json.has("performer"))
7494      res.setPerformer(parseReference(getJObject(json, "performer")));
7495    if (json.has("reasonCode")) {
7496      JsonArray array = json.getAsJsonArray("reasonCode");
7497      for (int i = 0; i < array.size(); i++) {
7498        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7499      }
7500    };
7501    if (json.has("reasonReference")) {
7502      JsonArray array = json.getAsJsonArray("reasonReference");
7503      for (int i = 0; i < array.size(); i++) {
7504        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7505      }
7506    };
7507    if (json.has("supportingInfo")) {
7508      JsonArray array = json.getAsJsonArray("supportingInfo");
7509      for (int i = 0; i < array.size(); i++) {
7510        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7511      }
7512    };
7513    if (json.has("note")) {
7514      JsonArray array = json.getAsJsonArray("note");
7515      for (int i = 0; i < array.size(); i++) {
7516        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7517      }
7518    };
7519    if (json.has("relevantHistory")) {
7520      JsonArray array = json.getAsJsonArray("relevantHistory");
7521      for (int i = 0; i < array.size(); i++) {
7522        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7523      }
7524    };
7525  }
7526
7527  protected DeviceRequest.DeviceRequestRequesterComponent parseDeviceRequestDeviceRequestRequesterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
7528    DeviceRequest.DeviceRequestRequesterComponent res = new DeviceRequest.DeviceRequestRequesterComponent();
7529    parseDeviceRequestDeviceRequestRequesterComponentProperties(json, owner, res);
7530    return res;
7531  }
7532
7533  protected void parseDeviceRequestDeviceRequestRequesterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestRequesterComponent res) throws IOException, FHIRFormatError {
7534    parseBackboneProperties(json, res);
7535    if (json.has("agent"))
7536      res.setAgent(parseReference(getJObject(json, "agent")));
7537    if (json.has("onBehalfOf"))
7538      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
7539  }
7540
7541  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
7542    DeviceUseStatement res = new DeviceUseStatement();
7543    parseDeviceUseStatementProperties(json, res);
7544    return res;
7545  }
7546
7547  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
7548    parseDomainResourceProperties(json, res);
7549    if (json.has("identifier")) {
7550      JsonArray array = json.getAsJsonArray("identifier");
7551      for (int i = 0; i < array.size(); i++) {
7552        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7553      }
7554    };
7555    if (json.has("status"))
7556      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
7557    if (json.has("_status"))
7558      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7559    if (json.has("subject"))
7560      res.setSubject(parseReference(getJObject(json, "subject")));
7561    if (json.has("whenUsed"))
7562      res.setWhenUsed(parsePeriod(getJObject(json, "whenUsed")));
7563    Type timing = parseType("timing", json);
7564    if (timing != null)
7565      res.setTiming(timing);
7566    if (json.has("recordedOn"))
7567      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
7568    if (json.has("_recordedOn"))
7569      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
7570    if (json.has("source"))
7571      res.setSource(parseReference(getJObject(json, "source")));
7572    if (json.has("device"))
7573      res.setDevice(parseReference(getJObject(json, "device")));
7574    if (json.has("indication")) {
7575      JsonArray array = json.getAsJsonArray("indication");
7576      for (int i = 0; i < array.size(); i++) {
7577        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7578      }
7579    };
7580    if (json.has("bodySite"))
7581      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
7582    if (json.has("note")) {
7583      JsonArray array = json.getAsJsonArray("note");
7584      for (int i = 0; i < array.size(); i++) {
7585        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7586      }
7587    };
7588  }
7589
7590  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
7591    DiagnosticReport res = new DiagnosticReport();
7592    parseDiagnosticReportProperties(json, res);
7593    return res;
7594  }
7595
7596  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
7597    parseDomainResourceProperties(json, res);
7598    if (json.has("identifier")) {
7599      JsonArray array = json.getAsJsonArray("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("basedOn")) {
7605      JsonArray array = json.getAsJsonArray("basedOn");
7606      for (int i = 0; i < array.size(); i++) {
7607        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7608      }
7609    };
7610    if (json.has("status"))
7611      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
7612    if (json.has("_status"))
7613      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7614    if (json.has("category"))
7615      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7616    if (json.has("code"))
7617      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7618    if (json.has("subject"))
7619      res.setSubject(parseReference(getJObject(json, "subject")));
7620    if (json.has("context"))
7621      res.setContext(parseReference(getJObject(json, "context")));
7622    Type effective = parseType("effective", json);
7623    if (effective != null)
7624      res.setEffective(effective);
7625    if (json.has("issued"))
7626      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7627    if (json.has("_issued"))
7628      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7629    if (json.has("performer")) {
7630      JsonArray array = json.getAsJsonArray("performer");
7631      for (int i = 0; i < array.size(); i++) {
7632        res.getPerformer().add(parseDiagnosticReportDiagnosticReportPerformerComponent(array.get(i).getAsJsonObject(), res));
7633      }
7634    };
7635    if (json.has("specimen")) {
7636      JsonArray array = json.getAsJsonArray("specimen");
7637      for (int i = 0; i < array.size(); i++) {
7638        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
7639      }
7640    };
7641    if (json.has("result")) {
7642      JsonArray array = json.getAsJsonArray("result");
7643      for (int i = 0; i < array.size(); i++) {
7644        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
7645      }
7646    };
7647    if (json.has("imagingStudy")) {
7648      JsonArray array = json.getAsJsonArray("imagingStudy");
7649      for (int i = 0; i < array.size(); i++) {
7650        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
7651      }
7652    };
7653    if (json.has("image")) {
7654      JsonArray array = json.getAsJsonArray("image");
7655      for (int i = 0; i < array.size(); i++) {
7656        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
7657      }
7658    };
7659    if (json.has("conclusion"))
7660      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
7661    if (json.has("_conclusion"))
7662      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
7663    if (json.has("codedDiagnosis")) {
7664      JsonArray array = json.getAsJsonArray("codedDiagnosis");
7665      for (int i = 0; i < array.size(); i++) {
7666        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7667      }
7668    };
7669    if (json.has("presentedForm")) {
7670      JsonArray array = json.getAsJsonArray("presentedForm");
7671      for (int i = 0; i < array.size(); i++) {
7672        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
7673      }
7674    };
7675  }
7676
7677  protected DiagnosticReport.DiagnosticReportPerformerComponent parseDiagnosticReportDiagnosticReportPerformerComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7678    DiagnosticReport.DiagnosticReportPerformerComponent res = new DiagnosticReport.DiagnosticReportPerformerComponent();
7679    parseDiagnosticReportDiagnosticReportPerformerComponentProperties(json, owner, res);
7680    return res;
7681  }
7682
7683  protected void parseDiagnosticReportDiagnosticReportPerformerComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportPerformerComponent res) throws IOException, FHIRFormatError {
7684    parseBackboneProperties(json, res);
7685    if (json.has("role"))
7686      res.setRole(parseCodeableConcept(getJObject(json, "role")));
7687    if (json.has("actor"))
7688      res.setActor(parseReference(getJObject(json, "actor")));
7689  }
7690
7691  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7692    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
7693    parseDiagnosticReportDiagnosticReportImageComponentProperties(json, owner, res);
7694    return res;
7695  }
7696
7697  protected void parseDiagnosticReportDiagnosticReportImageComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportImageComponent res) throws IOException, FHIRFormatError {
7698    parseBackboneProperties(json, res);
7699    if (json.has("comment"))
7700      res.setCommentElement(parseString(json.get("comment").getAsString()));
7701    if (json.has("_comment"))
7702      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7703    if (json.has("link"))
7704      res.setLink(parseReference(getJObject(json, "link")));
7705  }
7706
7707  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
7708    DocumentManifest res = new DocumentManifest();
7709    parseDocumentManifestProperties(json, res);
7710    return res;
7711  }
7712
7713  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
7714    parseDomainResourceProperties(json, res);
7715    if (json.has("masterIdentifier"))
7716      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
7717    if (json.has("identifier")) {
7718      JsonArray array = json.getAsJsonArray("identifier");
7719      for (int i = 0; i < array.size(); i++) {
7720        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7721      }
7722    };
7723    if (json.has("status"))
7724      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7725    if (json.has("_status"))
7726      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7727    if (json.has("type"))
7728      res.setType(parseCodeableConcept(getJObject(json, "type")));
7729    if (json.has("subject"))
7730      res.setSubject(parseReference(getJObject(json, "subject")));
7731    if (json.has("created"))
7732      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7733    if (json.has("_created"))
7734      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7735    if (json.has("author")) {
7736      JsonArray array = json.getAsJsonArray("author");
7737      for (int i = 0; i < array.size(); i++) {
7738        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7739      }
7740    };
7741    if (json.has("recipient")) {
7742      JsonArray array = json.getAsJsonArray("recipient");
7743      for (int i = 0; i < array.size(); i++) {
7744        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7745      }
7746    };
7747    if (json.has("source"))
7748      res.setSourceElement(parseUri(json.get("source").getAsString()));
7749    if (json.has("_source"))
7750      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
7751    if (json.has("description"))
7752      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7753    if (json.has("_description"))
7754      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7755    if (json.has("content")) {
7756      JsonArray array = json.getAsJsonArray("content");
7757      for (int i = 0; i < array.size(); i++) {
7758        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
7759      }
7760    };
7761    if (json.has("related")) {
7762      JsonArray array = json.getAsJsonArray("related");
7763      for (int i = 0; i < array.size(); i++) {
7764        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
7765      }
7766    };
7767  }
7768
7769  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7770    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
7771    parseDocumentManifestDocumentManifestContentComponentProperties(json, owner, res);
7772    return res;
7773  }
7774
7775  protected void parseDocumentManifestDocumentManifestContentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestContentComponent res) throws IOException, FHIRFormatError {
7776    parseBackboneProperties(json, res);
7777    Type p = parseType("p", json);
7778    if (p != null)
7779      res.setP(p);
7780  }
7781
7782  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7783    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
7784    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
7785    return res;
7786  }
7787
7788  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
7789    parseBackboneProperties(json, res);
7790    if (json.has("identifier"))
7791      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7792    if (json.has("ref"))
7793      res.setRef(parseReference(getJObject(json, "ref")));
7794  }
7795
7796  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
7797    DocumentReference res = new DocumentReference();
7798    parseDocumentReferenceProperties(json, res);
7799    return res;
7800  }
7801
7802  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
7803    parseDomainResourceProperties(json, res);
7804    if (json.has("masterIdentifier"))
7805      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
7806    if (json.has("identifier")) {
7807      JsonArray array = json.getAsJsonArray("identifier");
7808      for (int i = 0; i < array.size(); i++) {
7809        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7810      }
7811    };
7812    if (json.has("status"))
7813      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7814    if (json.has("_status"))
7815      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7816    if (json.has("docStatus"))
7817      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
7818    if (json.has("_docStatus"))
7819      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
7820    if (json.has("type"))
7821      res.setType(parseCodeableConcept(getJObject(json, "type")));
7822    if (json.has("class"))
7823      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
7824    if (json.has("subject"))
7825      res.setSubject(parseReference(getJObject(json, "subject")));
7826    if (json.has("created"))
7827      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7828    if (json.has("_created"))
7829      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7830    if (json.has("indexed"))
7831      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
7832    if (json.has("_indexed"))
7833      parseElementProperties(getJObject(json, "_indexed"), res.getIndexedElement());
7834    if (json.has("author")) {
7835      JsonArray array = json.getAsJsonArray("author");
7836      for (int i = 0; i < array.size(); i++) {
7837        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7838      }
7839    };
7840    if (json.has("authenticator"))
7841      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
7842    if (json.has("custodian"))
7843      res.setCustodian(parseReference(getJObject(json, "custodian")));
7844    if (json.has("relatesTo")) {
7845      JsonArray array = json.getAsJsonArray("relatesTo");
7846      for (int i = 0; i < array.size(); i++) {
7847        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
7848      }
7849    };
7850    if (json.has("description"))
7851      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7852    if (json.has("_description"))
7853      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7854    if (json.has("securityLabel")) {
7855      JsonArray array = json.getAsJsonArray("securityLabel");
7856      for (int i = 0; i < array.size(); i++) {
7857        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7858      }
7859    };
7860    if (json.has("content")) {
7861      JsonArray array = json.getAsJsonArray("content");
7862      for (int i = 0; i < array.size(); i++) {
7863        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
7864      }
7865    };
7866    if (json.has("context"))
7867      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(getJObject(json, "context"), res));
7868  }
7869
7870  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7871    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
7872    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
7873    return res;
7874  }
7875
7876  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
7877    parseBackboneProperties(json, res);
7878    if (json.has("code"))
7879      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
7880    if (json.has("_code"))
7881      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7882    if (json.has("target"))
7883      res.setTarget(parseReference(getJObject(json, "target")));
7884  }
7885
7886  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7887    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
7888    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
7889    return res;
7890  }
7891
7892  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
7893    parseBackboneProperties(json, res);
7894    if (json.has("attachment"))
7895      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
7896    if (json.has("format"))
7897      res.setFormat(parseCoding(getJObject(json, "format")));
7898  }
7899
7900  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7901    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
7902    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
7903    return res;
7904  }
7905
7906  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
7907    parseBackboneProperties(json, res);
7908    if (json.has("encounter"))
7909      res.setEncounter(parseReference(getJObject(json, "encounter")));
7910    if (json.has("event")) {
7911      JsonArray array = json.getAsJsonArray("event");
7912      for (int i = 0; i < array.size(); i++) {
7913        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7914      }
7915    };
7916    if (json.has("period"))
7917      res.setPeriod(parsePeriod(getJObject(json, "period")));
7918    if (json.has("facilityType"))
7919      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
7920    if (json.has("practiceSetting"))
7921      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
7922    if (json.has("sourcePatientInfo"))
7923      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
7924    if (json.has("related")) {
7925      JsonArray array = json.getAsJsonArray("related");
7926      for (int i = 0; i < array.size(); i++) {
7927        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
7928      }
7929    };
7930  }
7931
7932  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7933    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
7934    parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(json, owner, res);
7935    return res;
7936  }
7937
7938  protected void parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws IOException, FHIRFormatError {
7939    parseBackboneProperties(json, res);
7940    if (json.has("identifier"))
7941      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7942    if (json.has("ref"))
7943      res.setRef(parseReference(getJObject(json, "ref")));
7944  }
7945
7946  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
7947    EligibilityRequest res = new EligibilityRequest();
7948    parseEligibilityRequestProperties(json, res);
7949    return res;
7950  }
7951
7952  protected void parseEligibilityRequestProperties(JsonObject json, EligibilityRequest res) throws IOException, FHIRFormatError {
7953    parseDomainResourceProperties(json, res);
7954    if (json.has("identifier")) {
7955      JsonArray array = json.getAsJsonArray("identifier");
7956      for (int i = 0; i < array.size(); i++) {
7957        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7958      }
7959    };
7960    if (json.has("status"))
7961      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
7962    if (json.has("_status"))
7963      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7964    if (json.has("priority"))
7965      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
7966    if (json.has("patient"))
7967      res.setPatient(parseReference(getJObject(json, "patient")));
7968    Type serviced = parseType("serviced", json);
7969    if (serviced != null)
7970      res.setServiced(serviced);
7971    if (json.has("created"))
7972      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7973    if (json.has("_created"))
7974      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7975    if (json.has("enterer"))
7976      res.setEnterer(parseReference(getJObject(json, "enterer")));
7977    if (json.has("provider"))
7978      res.setProvider(parseReference(getJObject(json, "provider")));
7979    if (json.has("organization"))
7980      res.setOrganization(parseReference(getJObject(json, "organization")));
7981    if (json.has("insurer"))
7982      res.setInsurer(parseReference(getJObject(json, "insurer")));
7983    if (json.has("facility"))
7984      res.setFacility(parseReference(getJObject(json, "facility")));
7985    if (json.has("coverage"))
7986      res.setCoverage(parseReference(getJObject(json, "coverage")));
7987    if (json.has("businessArrangement"))
7988      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7989    if (json.has("_businessArrangement"))
7990      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
7991    if (json.has("benefitCategory"))
7992      res.setBenefitCategory(parseCodeableConcept(getJObject(json, "benefitCategory")));
7993    if (json.has("benefitSubCategory"))
7994      res.setBenefitSubCategory(parseCodeableConcept(getJObject(json, "benefitSubCategory")));
7995  }
7996
7997  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
7998    EligibilityResponse res = new EligibilityResponse();
7999    parseEligibilityResponseProperties(json, res);
8000    return res;
8001  }
8002
8003  protected void parseEligibilityResponseProperties(JsonObject json, EligibilityResponse res) throws IOException, FHIRFormatError {
8004    parseDomainResourceProperties(json, res);
8005    if (json.has("identifier")) {
8006      JsonArray array = json.getAsJsonArray("identifier");
8007      for (int i = 0; i < array.size(); i++) {
8008        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8009      }
8010    };
8011    if (json.has("status"))
8012      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
8013    if (json.has("_status"))
8014      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8015    if (json.has("created"))
8016      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8017    if (json.has("_created"))
8018      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8019    if (json.has("requestProvider"))
8020      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
8021    if (json.has("requestOrganization"))
8022      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
8023    if (json.has("request"))
8024      res.setRequest(parseReference(getJObject(json, "request")));
8025    if (json.has("outcome"))
8026      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
8027    if (json.has("disposition"))
8028      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8029    if (json.has("_disposition"))
8030      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8031    if (json.has("insurer"))
8032      res.setInsurer(parseReference(getJObject(json, "insurer")));
8033    if (json.has("inforce"))
8034      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8035    if (json.has("_inforce"))
8036      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
8037    if (json.has("insurance")) {
8038      JsonArray array = json.getAsJsonArray("insurance");
8039      for (int i = 0; i < array.size(); i++) {
8040        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8041      }
8042    };
8043    if (json.has("form"))
8044      res.setForm(parseCodeableConcept(getJObject(json, "form")));
8045    if (json.has("error")) {
8046      JsonArray array = json.getAsJsonArray("error");
8047      for (int i = 0; i < array.size(); i++) {
8048        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8049      }
8050    };
8051  }
8052
8053  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8054    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
8055    parseEligibilityResponseInsuranceComponentProperties(json, owner, res);
8056    return res;
8057  }
8058
8059  protected void parseEligibilityResponseInsuranceComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8060    parseBackboneProperties(json, res);
8061    if (json.has("coverage"))
8062      res.setCoverage(parseReference(getJObject(json, "coverage")));
8063    if (json.has("contract"))
8064      res.setContract(parseReference(getJObject(json, "contract")));
8065    if (json.has("benefitBalance")) {
8066      JsonArray array = json.getAsJsonArray("benefitBalance");
8067      for (int i = 0; i < array.size(); i++) {
8068        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), owner));
8069      }
8070    };
8071  }
8072
8073  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8074    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
8075    parseEligibilityResponseBenefitsComponentProperties(json, owner, res);
8076    return res;
8077  }
8078
8079  protected void parseEligibilityResponseBenefitsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws IOException, FHIRFormatError {
8080    parseBackboneProperties(json, res);
8081    if (json.has("category"))
8082      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8083    if (json.has("subCategory"))
8084      res.setSubCategory(parseCodeableConcept(getJObject(json, "subCategory")));
8085    if (json.has("excluded"))
8086      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8087    if (json.has("_excluded"))
8088      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
8089    if (json.has("name"))
8090      res.setNameElement(parseString(json.get("name").getAsString()));
8091    if (json.has("_name"))
8092      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8093    if (json.has("description"))
8094      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8095    if (json.has("_description"))
8096      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8097    if (json.has("network"))
8098      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
8099    if (json.has("unit"))
8100      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
8101    if (json.has("term"))
8102      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
8103    if (json.has("financial")) {
8104      JsonArray array = json.getAsJsonArray("financial");
8105      for (int i = 0; i < array.size(); i++) {
8106        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8107      }
8108    };
8109  }
8110
8111  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8112    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
8113    parseEligibilityResponseBenefitComponentProperties(json, owner, res);
8114    return res;
8115  }
8116
8117  protected void parseEligibilityResponseBenefitComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8118    parseBackboneProperties(json, res);
8119    if (json.has("type"))
8120      res.setType(parseCodeableConcept(getJObject(json, "type")));
8121    Type allowed = parseType("allowed", json);
8122    if (allowed != null)
8123      res.setAllowed(allowed);
8124    Type used = parseType("used", json);
8125    if (used != null)
8126      res.setUsed(used);
8127  }
8128
8129  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8130    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
8131    parseEligibilityResponseErrorsComponentProperties(json, owner, res);
8132    return res;
8133  }
8134
8135  protected void parseEligibilityResponseErrorsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8136    parseBackboneProperties(json, res);
8137    if (json.has("code"))
8138      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8139  }
8140
8141  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
8142    Encounter res = new Encounter();
8143    parseEncounterProperties(json, res);
8144    return res;
8145  }
8146
8147  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
8148    parseDomainResourceProperties(json, res);
8149    if (json.has("identifier")) {
8150      JsonArray array = json.getAsJsonArray("identifier");
8151      for (int i = 0; i < array.size(); i++) {
8152        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8153      }
8154    };
8155    if (json.has("status"))
8156      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8157    if (json.has("_status"))
8158      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8159    if (json.has("statusHistory")) {
8160      JsonArray array = json.getAsJsonArray("statusHistory");
8161      for (int i = 0; i < array.size(); i++) {
8162        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8163      }
8164    };
8165    if (json.has("class"))
8166      res.setClass_(parseCoding(getJObject(json, "class")));
8167    if (json.has("classHistory")) {
8168      JsonArray array = json.getAsJsonArray("classHistory");
8169      for (int i = 0; i < array.size(); i++) {
8170        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
8171      }
8172    };
8173    if (json.has("type")) {
8174      JsonArray array = json.getAsJsonArray("type");
8175      for (int i = 0; i < array.size(); i++) {
8176        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8177      }
8178    };
8179    if (json.has("priority"))
8180      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
8181    if (json.has("subject"))
8182      res.setSubject(parseReference(getJObject(json, "subject")));
8183    if (json.has("episodeOfCare")) {
8184      JsonArray array = json.getAsJsonArray("episodeOfCare");
8185      for (int i = 0; i < array.size(); i++) {
8186        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
8187      }
8188    };
8189    if (json.has("incomingReferral")) {
8190      JsonArray array = json.getAsJsonArray("incomingReferral");
8191      for (int i = 0; i < array.size(); i++) {
8192        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
8193      }
8194    };
8195    if (json.has("participant")) {
8196      JsonArray array = json.getAsJsonArray("participant");
8197      for (int i = 0; i < array.size(); i++) {
8198        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
8199      }
8200    };
8201    if (json.has("appointment"))
8202      res.setAppointment(parseReference(getJObject(json, "appointment")));
8203    if (json.has("period"))
8204      res.setPeriod(parsePeriod(getJObject(json, "period")));
8205    if (json.has("length"))
8206      res.setLength(parseDuration(getJObject(json, "length")));
8207    if (json.has("reason")) {
8208      JsonArray array = json.getAsJsonArray("reason");
8209      for (int i = 0; i < array.size(); i++) {
8210        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8211      }
8212    };
8213    if (json.has("diagnosis")) {
8214      JsonArray array = json.getAsJsonArray("diagnosis");
8215      for (int i = 0; i < array.size(); i++) {
8216        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8217      }
8218    };
8219    if (json.has("account")) {
8220      JsonArray array = json.getAsJsonArray("account");
8221      for (int i = 0; i < array.size(); i++) {
8222        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8223      }
8224    };
8225    if (json.has("hospitalization"))
8226      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(getJObject(json, "hospitalization"), res));
8227    if (json.has("location")) {
8228      JsonArray array = json.getAsJsonArray("location");
8229      for (int i = 0; i < array.size(); i++) {
8230        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
8231      }
8232    };
8233    if (json.has("serviceProvider"))
8234      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
8235    if (json.has("partOf"))
8236      res.setPartOf(parseReference(getJObject(json, "partOf")));
8237  }
8238
8239  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8240    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
8241    parseEncounterStatusHistoryComponentProperties(json, owner, res);
8242    return res;
8243  }
8244
8245  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
8246    parseBackboneProperties(json, res);
8247    if (json.has("status"))
8248      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8249    if (json.has("_status"))
8250      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8251    if (json.has("period"))
8252      res.setPeriod(parsePeriod(getJObject(json, "period")));
8253  }
8254
8255  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8256    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
8257    parseEncounterClassHistoryComponentProperties(json, owner, res);
8258    return res;
8259  }
8260
8261  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
8262    parseBackboneProperties(json, res);
8263    if (json.has("class"))
8264      res.setClass_(parseCoding(getJObject(json, "class")));
8265    if (json.has("period"))
8266      res.setPeriod(parsePeriod(getJObject(json, "period")));
8267  }
8268
8269  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8270    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
8271    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
8272    return res;
8273  }
8274
8275  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
8276    parseBackboneProperties(json, res);
8277    if (json.has("type")) {
8278      JsonArray array = json.getAsJsonArray("type");
8279      for (int i = 0; i < array.size(); i++) {
8280        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8281      }
8282    };
8283    if (json.has("period"))
8284      res.setPeriod(parsePeriod(getJObject(json, "period")));
8285    if (json.has("individual"))
8286      res.setIndividual(parseReference(getJObject(json, "individual")));
8287  }
8288
8289  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8290    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
8291    parseEncounterDiagnosisComponentProperties(json, owner, res);
8292    return res;
8293  }
8294
8295  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
8296    parseBackboneProperties(json, res);
8297    if (json.has("condition"))
8298      res.setCondition(parseReference(getJObject(json, "condition")));
8299    if (json.has("role"))
8300      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8301    if (json.has("rank"))
8302      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8303    if (json.has("_rank"))
8304      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
8305  }
8306
8307  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8308    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
8309    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
8310    return res;
8311  }
8312
8313  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
8314    parseBackboneProperties(json, res);
8315    if (json.has("preAdmissionIdentifier"))
8316      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
8317    if (json.has("origin"))
8318      res.setOrigin(parseReference(getJObject(json, "origin")));
8319    if (json.has("admitSource"))
8320      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
8321    if (json.has("reAdmission"))
8322      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
8323    if (json.has("dietPreference")) {
8324      JsonArray array = json.getAsJsonArray("dietPreference");
8325      for (int i = 0; i < array.size(); i++) {
8326        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8327      }
8328    };
8329    if (json.has("specialCourtesy")) {
8330      JsonArray array = json.getAsJsonArray("specialCourtesy");
8331      for (int i = 0; i < array.size(); i++) {
8332        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8333      }
8334    };
8335    if (json.has("specialArrangement")) {
8336      JsonArray array = json.getAsJsonArray("specialArrangement");
8337      for (int i = 0; i < array.size(); i++) {
8338        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8339      }
8340    };
8341    if (json.has("destination"))
8342      res.setDestination(parseReference(getJObject(json, "destination")));
8343    if (json.has("dischargeDisposition"))
8344      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
8345  }
8346
8347  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8348    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
8349    parseEncounterEncounterLocationComponentProperties(json, owner, res);
8350    return res;
8351  }
8352
8353  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
8354    parseBackboneProperties(json, res);
8355    if (json.has("location"))
8356      res.setLocation(parseReference(getJObject(json, "location")));
8357    if (json.has("status"))
8358      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
8359    if (json.has("_status"))
8360      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8361    if (json.has("period"))
8362      res.setPeriod(parsePeriod(getJObject(json, "period")));
8363  }
8364
8365  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
8366    Endpoint res = new Endpoint();
8367    parseEndpointProperties(json, res);
8368    return res;
8369  }
8370
8371  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
8372    parseDomainResourceProperties(json, res);
8373    if (json.has("identifier")) {
8374      JsonArray array = json.getAsJsonArray("identifier");
8375      for (int i = 0; i < array.size(); i++) {
8376        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8377      }
8378    };
8379    if (json.has("status"))
8380      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
8381    if (json.has("_status"))
8382      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8383    if (json.has("connectionType"))
8384      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
8385    if (json.has("name"))
8386      res.setNameElement(parseString(json.get("name").getAsString()));
8387    if (json.has("_name"))
8388      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8389    if (json.has("managingOrganization"))
8390      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
8391    if (json.has("contact")) {
8392      JsonArray array = json.getAsJsonArray("contact");
8393      for (int i = 0; i < array.size(); i++) {
8394        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8395      }
8396    };
8397    if (json.has("period"))
8398      res.setPeriod(parsePeriod(getJObject(json, "period")));
8399    if (json.has("payloadType")) {
8400      JsonArray array = json.getAsJsonArray("payloadType");
8401      for (int i = 0; i < array.size(); i++) {
8402        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8403      }
8404    };
8405    if (json.has("payloadMimeType")) {
8406      JsonArray array = json.getAsJsonArray("payloadMimeType");
8407      for (int i = 0; i < array.size(); i++) {
8408        if (array.get(i).isJsonNull()) {
8409          res.getPayloadMimeType().add(new CodeType());
8410        } else {
8411          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
8412        }
8413      }
8414    };
8415    if (json.has("_payloadMimeType")) {
8416      JsonArray array = json.getAsJsonArray("_payloadMimeType");
8417      for (int i = 0; i < array.size(); i++) {
8418        if (i == res.getPayloadMimeType().size())
8419          res.getPayloadMimeType().add(parseCode(null));
8420        if (array.get(i) instanceof JsonObject) 
8421          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
8422      }
8423    };
8424    if (json.has("address"))
8425      res.setAddressElement(parseUri(json.get("address").getAsString()));
8426    if (json.has("_address"))
8427      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
8428    if (json.has("header")) {
8429      JsonArray array = json.getAsJsonArray("header");
8430      for (int i = 0; i < array.size(); i++) {
8431        if (array.get(i).isJsonNull()) {
8432          res.getHeader().add(new StringType());
8433        } else {
8434          res.getHeader().add(parseString(array.get(i).getAsString()));
8435        }
8436      }
8437    };
8438    if (json.has("_header")) {
8439      JsonArray array = json.getAsJsonArray("_header");
8440      for (int i = 0; i < array.size(); i++) {
8441        if (i == res.getHeader().size())
8442          res.getHeader().add(parseString(null));
8443        if (array.get(i) instanceof JsonObject) 
8444          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
8445      }
8446    };
8447  }
8448
8449  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
8450    EnrollmentRequest res = new EnrollmentRequest();
8451    parseEnrollmentRequestProperties(json, res);
8452    return res;
8453  }
8454
8455  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
8456    parseDomainResourceProperties(json, res);
8457    if (json.has("identifier")) {
8458      JsonArray array = json.getAsJsonArray("identifier");
8459      for (int i = 0; i < array.size(); i++) {
8460        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8461      }
8462    };
8463    if (json.has("status"))
8464      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
8465    if (json.has("_status"))
8466      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8467    if (json.has("created"))
8468      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8469    if (json.has("_created"))
8470      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8471    if (json.has("insurer"))
8472      res.setInsurer(parseReference(getJObject(json, "insurer")));
8473    if (json.has("provider"))
8474      res.setProvider(parseReference(getJObject(json, "provider")));
8475    if (json.has("organization"))
8476      res.setOrganization(parseReference(getJObject(json, "organization")));
8477    if (json.has("subject"))
8478      res.setSubject(parseReference(getJObject(json, "subject")));
8479    if (json.has("coverage"))
8480      res.setCoverage(parseReference(getJObject(json, "coverage")));
8481  }
8482
8483  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
8484    EnrollmentResponse res = new EnrollmentResponse();
8485    parseEnrollmentResponseProperties(json, res);
8486    return res;
8487  }
8488
8489  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
8490    parseDomainResourceProperties(json, res);
8491    if (json.has("identifier")) {
8492      JsonArray array = json.getAsJsonArray("identifier");
8493      for (int i = 0; i < array.size(); i++) {
8494        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8495      }
8496    };
8497    if (json.has("status"))
8498      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
8499    if (json.has("_status"))
8500      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8501    if (json.has("request"))
8502      res.setRequest(parseReference(getJObject(json, "request")));
8503    if (json.has("outcome"))
8504      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
8505    if (json.has("disposition"))
8506      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8507    if (json.has("_disposition"))
8508      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8509    if (json.has("created"))
8510      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8511    if (json.has("_created"))
8512      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8513    if (json.has("organization"))
8514      res.setOrganization(parseReference(getJObject(json, "organization")));
8515    if (json.has("requestProvider"))
8516      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
8517    if (json.has("requestOrganization"))
8518      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
8519  }
8520
8521  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
8522    EpisodeOfCare res = new EpisodeOfCare();
8523    parseEpisodeOfCareProperties(json, res);
8524    return res;
8525  }
8526
8527  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
8528    parseDomainResourceProperties(json, res);
8529    if (json.has("identifier")) {
8530      JsonArray array = json.getAsJsonArray("identifier");
8531      for (int i = 0; i < array.size(); i++) {
8532        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8533      }
8534    };
8535    if (json.has("status"))
8536      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8537    if (json.has("_status"))
8538      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8539    if (json.has("statusHistory")) {
8540      JsonArray array = json.getAsJsonArray("statusHistory");
8541      for (int i = 0; i < array.size(); i++) {
8542        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8543      }
8544    };
8545    if (json.has("type")) {
8546      JsonArray array = json.getAsJsonArray("type");
8547      for (int i = 0; i < array.size(); i++) {
8548        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8549      }
8550    };
8551    if (json.has("diagnosis")) {
8552      JsonArray array = json.getAsJsonArray("diagnosis");
8553      for (int i = 0; i < array.size(); i++) {
8554        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8555      }
8556    };
8557    if (json.has("patient"))
8558      res.setPatient(parseReference(getJObject(json, "patient")));
8559    if (json.has("managingOrganization"))
8560      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
8561    if (json.has("period"))
8562      res.setPeriod(parsePeriod(getJObject(json, "period")));
8563    if (json.has("referralRequest")) {
8564      JsonArray array = json.getAsJsonArray("referralRequest");
8565      for (int i = 0; i < array.size(); i++) {
8566        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
8567      }
8568    };
8569    if (json.has("careManager"))
8570      res.setCareManager(parseReference(getJObject(json, "careManager")));
8571    if (json.has("team")) {
8572      JsonArray array = json.getAsJsonArray("team");
8573      for (int i = 0; i < array.size(); i++) {
8574        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8575      }
8576    };
8577    if (json.has("account")) {
8578      JsonArray array = json.getAsJsonArray("account");
8579      for (int i = 0; i < array.size(); i++) {
8580        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8581      }
8582    };
8583  }
8584
8585  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8586    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
8587    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
8588    return res;
8589  }
8590
8591  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
8592    parseBackboneProperties(json, res);
8593    if (json.has("status"))
8594      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8595    if (json.has("_status"))
8596      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8597    if (json.has("period"))
8598      res.setPeriod(parsePeriod(getJObject(json, "period")));
8599  }
8600
8601  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8602    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
8603    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
8604    return res;
8605  }
8606
8607  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
8608    parseBackboneProperties(json, res);
8609    if (json.has("condition"))
8610      res.setCondition(parseReference(getJObject(json, "condition")));
8611    if (json.has("role"))
8612      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8613    if (json.has("rank"))
8614      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8615    if (json.has("_rank"))
8616      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
8617  }
8618
8619  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
8620    ExpansionProfile res = new ExpansionProfile();
8621    parseExpansionProfileProperties(json, res);
8622    return res;
8623  }
8624
8625  protected void parseExpansionProfileProperties(JsonObject json, ExpansionProfile res) throws IOException, FHIRFormatError {
8626    parseDomainResourceProperties(json, res);
8627    if (json.has("url"))
8628      res.setUrlElement(parseUri(json.get("url").getAsString()));
8629    if (json.has("_url"))
8630      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8631    if (json.has("identifier"))
8632      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8633    if (json.has("version"))
8634      res.setVersionElement(parseString(json.get("version").getAsString()));
8635    if (json.has("_version"))
8636      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8637    if (json.has("name"))
8638      res.setNameElement(parseString(json.get("name").getAsString()));
8639    if (json.has("_name"))
8640      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8641    if (json.has("status"))
8642      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8643    if (json.has("_status"))
8644      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8645    if (json.has("experimental"))
8646      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8647    if (json.has("_experimental"))
8648      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8649    if (json.has("date"))
8650      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8651    if (json.has("_date"))
8652      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8653    if (json.has("publisher"))
8654      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8655    if (json.has("_publisher"))
8656      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8657    if (json.has("contact")) {
8658      JsonArray array = json.getAsJsonArray("contact");
8659      for (int i = 0; i < array.size(); i++) {
8660        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8661      }
8662    };
8663    if (json.has("description"))
8664      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8665    if (json.has("_description"))
8666      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8667    if (json.has("useContext")) {
8668      JsonArray array = json.getAsJsonArray("useContext");
8669      for (int i = 0; i < array.size(); i++) {
8670        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8671      }
8672    };
8673    if (json.has("jurisdiction")) {
8674      JsonArray array = json.getAsJsonArray("jurisdiction");
8675      for (int i = 0; i < array.size(); i++) {
8676        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8677      }
8678    };
8679    if (json.has("fixedVersion")) {
8680      JsonArray array = json.getAsJsonArray("fixedVersion");
8681      for (int i = 0; i < array.size(); i++) {
8682        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(array.get(i).getAsJsonObject(), res));
8683      }
8684    };
8685    if (json.has("excludedSystem"))
8686      res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(getJObject(json, "excludedSystem"), res));
8687    if (json.has("includeDesignations"))
8688      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
8689    if (json.has("_includeDesignations"))
8690      parseElementProperties(getJObject(json, "_includeDesignations"), res.getIncludeDesignationsElement());
8691    if (json.has("designation"))
8692      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(getJObject(json, "designation"), res));
8693    if (json.has("includeDefinition"))
8694      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
8695    if (json.has("_includeDefinition"))
8696      parseElementProperties(getJObject(json, "_includeDefinition"), res.getIncludeDefinitionElement());
8697    if (json.has("activeOnly"))
8698      res.setActiveOnlyElement(parseBoolean(json.get("activeOnly").getAsBoolean()));
8699    if (json.has("_activeOnly"))
8700      parseElementProperties(getJObject(json, "_activeOnly"), res.getActiveOnlyElement());
8701    if (json.has("excludeNested"))
8702      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
8703    if (json.has("_excludeNested"))
8704      parseElementProperties(getJObject(json, "_excludeNested"), res.getExcludeNestedElement());
8705    if (json.has("excludeNotForUI"))
8706      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
8707    if (json.has("_excludeNotForUI"))
8708      parseElementProperties(getJObject(json, "_excludeNotForUI"), res.getExcludeNotForUIElement());
8709    if (json.has("excludePostCoordinated"))
8710      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
8711    if (json.has("_excludePostCoordinated"))
8712      parseElementProperties(getJObject(json, "_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
8713    if (json.has("displayLanguage"))
8714      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
8715    if (json.has("_displayLanguage"))
8716      parseElementProperties(getJObject(json, "_displayLanguage"), res.getDisplayLanguageElement());
8717    if (json.has("limitedExpansion"))
8718      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
8719    if (json.has("_limitedExpansion"))
8720      parseElementProperties(getJObject(json, "_limitedExpansion"), res.getLimitedExpansionElement());
8721  }
8722
8723  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8724    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
8725    parseExpansionProfileExpansionProfileFixedVersionComponentProperties(json, owner, res);
8726    return res;
8727  }
8728
8729  protected void parseExpansionProfileExpansionProfileFixedVersionComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws IOException, FHIRFormatError {
8730    parseBackboneProperties(json, res);
8731    if (json.has("system"))
8732      res.setSystemElement(parseUri(json.get("system").getAsString()));
8733    if (json.has("_system"))
8734      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8735    if (json.has("version"))
8736      res.setVersionElement(parseString(json.get("version").getAsString()));
8737    if (json.has("_version"))
8738      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8739    if (json.has("mode"))
8740      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
8741    if (json.has("_mode"))
8742      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8743  }
8744
8745  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8746    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
8747    parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(json, owner, res);
8748    return res;
8749  }
8750
8751  protected void parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws IOException, FHIRFormatError {
8752    parseBackboneProperties(json, res);
8753    if (json.has("system"))
8754      res.setSystemElement(parseUri(json.get("system").getAsString()));
8755    if (json.has("_system"))
8756      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8757    if (json.has("version"))
8758      res.setVersionElement(parseString(json.get("version").getAsString()));
8759    if (json.has("_version"))
8760      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8761  }
8762
8763  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8764    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
8765    parseExpansionProfileExpansionProfileDesignationComponentProperties(json, owner, res);
8766    return res;
8767  }
8768
8769  protected void parseExpansionProfileExpansionProfileDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws IOException, FHIRFormatError {
8770    parseBackboneProperties(json, res);
8771    if (json.has("include"))
8772      res.setInclude(parseExpansionProfileDesignationIncludeComponent(getJObject(json, "include"), owner));
8773    if (json.has("exclude"))
8774      res.setExclude(parseExpansionProfileDesignationExcludeComponent(getJObject(json, "exclude"), owner));
8775  }
8776
8777  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8778    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
8779    parseExpansionProfileDesignationIncludeComponentProperties(json, owner, res);
8780    return res;
8781  }
8782
8783  protected void parseExpansionProfileDesignationIncludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws IOException, FHIRFormatError {
8784    parseBackboneProperties(json, res);
8785    if (json.has("designation")) {
8786      JsonArray array = json.getAsJsonArray("designation");
8787      for (int i = 0; i < array.size(); i++) {
8788        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8789      }
8790    };
8791  }
8792
8793  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8794    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
8795    parseExpansionProfileDesignationIncludeDesignationComponentProperties(json, owner, res);
8796    return res;
8797  }
8798
8799  protected void parseExpansionProfileDesignationIncludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws IOException, FHIRFormatError {
8800    parseBackboneProperties(json, res);
8801    if (json.has("language"))
8802      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8803    if (json.has("_language"))
8804      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8805    if (json.has("use"))
8806      res.setUse(parseCoding(getJObject(json, "use")));
8807  }
8808
8809  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8810    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
8811    parseExpansionProfileDesignationExcludeComponentProperties(json, owner, res);
8812    return res;
8813  }
8814
8815  protected void parseExpansionProfileDesignationExcludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws IOException, FHIRFormatError {
8816    parseBackboneProperties(json, res);
8817    if (json.has("designation")) {
8818      JsonArray array = json.getAsJsonArray("designation");
8819      for (int i = 0; i < array.size(); i++) {
8820        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8821      }
8822    };
8823  }
8824
8825  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8826    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
8827    parseExpansionProfileDesignationExcludeDesignationComponentProperties(json, owner, res);
8828    return res;
8829  }
8830
8831  protected void parseExpansionProfileDesignationExcludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws IOException, FHIRFormatError {
8832    parseBackboneProperties(json, res);
8833    if (json.has("language"))
8834      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8835    if (json.has("_language"))
8836      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8837    if (json.has("use"))
8838      res.setUse(parseCoding(getJObject(json, "use")));
8839  }
8840
8841  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
8842    ExplanationOfBenefit res = new ExplanationOfBenefit();
8843    parseExplanationOfBenefitProperties(json, res);
8844    return res;
8845  }
8846
8847  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
8848    parseDomainResourceProperties(json, res);
8849    if (json.has("identifier")) {
8850      JsonArray array = json.getAsJsonArray("identifier");
8851      for (int i = 0; i < array.size(); i++) {
8852        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8853      }
8854    };
8855    if (json.has("status"))
8856      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
8857    if (json.has("_status"))
8858      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8859    if (json.has("type"))
8860      res.setType(parseCodeableConcept(getJObject(json, "type")));
8861    if (json.has("subType")) {
8862      JsonArray array = json.getAsJsonArray("subType");
8863      for (int i = 0; i < array.size(); i++) {
8864        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8865      }
8866    };
8867    if (json.has("patient"))
8868      res.setPatient(parseReference(getJObject(json, "patient")));
8869    if (json.has("billablePeriod"))
8870      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
8871    if (json.has("created"))
8872      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8873    if (json.has("_created"))
8874      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8875    if (json.has("enterer"))
8876      res.setEnterer(parseReference(getJObject(json, "enterer")));
8877    if (json.has("insurer"))
8878      res.setInsurer(parseReference(getJObject(json, "insurer")));
8879    if (json.has("provider"))
8880      res.setProvider(parseReference(getJObject(json, "provider")));
8881    if (json.has("organization"))
8882      res.setOrganization(parseReference(getJObject(json, "organization")));
8883    if (json.has("referral"))
8884      res.setReferral(parseReference(getJObject(json, "referral")));
8885    if (json.has("facility"))
8886      res.setFacility(parseReference(getJObject(json, "facility")));
8887    if (json.has("claim"))
8888      res.setClaim(parseReference(getJObject(json, "claim")));
8889    if (json.has("claimR