001package org.hl7.fhir.dstu3.formats;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 08:38+1000 for FHIR v3.0.1
033
034import org.hl7.fhir.dstu3.model.DateType;
035import org.hl7.fhir.dstu3.model.DateTimeType;
036import org.hl7.fhir.dstu3.model.CodeType;
037import org.hl7.fhir.dstu3.model.StringType;
038import org.hl7.fhir.dstu3.model.IntegerType;
039import org.hl7.fhir.dstu3.model.OidType;
040import org.hl7.fhir.dstu3.model.UriType;
041import org.hl7.fhir.dstu3.model.UuidType;
042import org.hl7.fhir.dstu3.model.InstantType;
043import org.hl7.fhir.dstu3.model.BooleanType;
044import org.hl7.fhir.dstu3.model.Base64BinaryType;
045import org.hl7.fhir.dstu3.model.UnsignedIntType;
046import org.hl7.fhir.dstu3.model.MarkdownType;
047import org.hl7.fhir.dstu3.model.TimeType;
048import org.hl7.fhir.dstu3.model.IdType;
049import org.hl7.fhir.dstu3.model.PositiveIntType;
050import org.hl7.fhir.dstu3.model.DecimalType;
051import org.hl7.fhir.dstu3.model.*;
052import org.hl7.fhir.utilities.Utilities;
053import org.hl7.fhir.utilities.xhtml.XhtmlNode;
054import org.hl7.fhir.exceptions.FHIRFormatError;
055import org.hl7.fhir.exceptions.FHIRException;
056import com.google.gson.JsonObject;
057import com.google.gson.JsonArray;
058import java.io.IOException;
059
060public class JsonParser extends JsonParserBase {
061
062  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
063    super.parseElementProperties(json, element);
064    if (json.has("extension")) {
065      JsonArray array = json.getAsJsonArray("extension");
066      for (int i = 0; i < array.size(); i++) {
067        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
068      }
069    };
070  }
071
072  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
073    parseElementProperties(json, element);
074    if (json.has("modifierExtension")) {
075      JsonArray array = json.getAsJsonArray("modifierExtension");
076      for (int i = 0; i < array.size(); i++) {
077        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
078      }
079    }
080  }
081
082  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
083    parseElementProperties(json, element);
084  }
085
086  @SuppressWarnings("unchecked")
087  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
088    Enumeration<E> res = new Enumeration<E>(e);
089    if (s != null)
090      res.setValue((E) e.fromCode(s));
091    return res;
092  }
093
094  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
095    DateType res = new DateType(v);
096    return res;
097  }
098
099  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
100    DateTimeType res = new DateTimeType(v);
101    return res;
102  }
103
104  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
105    CodeType res = new CodeType(v);
106    return res;
107  }
108
109  protected StringType parseString(String v) throws IOException, FHIRFormatError {
110    StringType res = new StringType(v);
111    return res;
112  }
113
114  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
115    IntegerType res = new IntegerType(v);
116    return res;
117  }
118
119  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
120    OidType res = new OidType(v);
121    return res;
122  }
123
124  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
125    UriType res = new UriType(v);
126    return res;
127  }
128
129  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
130    UuidType res = new UuidType(v);
131    return res;
132  }
133
134  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
135    InstantType res = new InstantType(v);
136    return res;
137  }
138
139  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
140    BooleanType res = new BooleanType(v);
141    return res;
142  }
143
144  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
145    Base64BinaryType res = new Base64BinaryType(v);
146    return res;
147  }
148
149  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
150    UnsignedIntType res = new UnsignedIntType(v);
151    return res;
152  }
153
154  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
155    MarkdownType res = new MarkdownType(v);
156    return res;
157  }
158
159  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
160    TimeType res = new TimeType(v);
161    return res;
162  }
163
164  protected IdType parseId(String v) throws IOException, FHIRFormatError {
165    IdType res = new IdType(v);
166    return res;
167  }
168
169  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
170    PositiveIntType res = new PositiveIntType(v);
171    return res;
172  }
173
174  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
175    DecimalType res = new DecimalType(v);
176    return res;
177  }
178
179  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
180    Extension res = new Extension();
181    parseExtensionProperties(json, res);
182    return res;
183  }
184
185  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
186    parseTypeProperties(json, res);
187    if (json.has("url"))
188      res.setUrlElement(parseUri(json.get("url").getAsString()));
189    if (json.has("_url"))
190      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
191    Type value = parseType("value", json);
192    if (value != null)
193      res.setValue(value);
194  }
195
196  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
197    Narrative res = new Narrative();
198    parseNarrativeProperties(json, res);
199    return res;
200  }
201
202  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
203    parseTypeProperties(json, res);
204    if (json.has("status"))
205      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
206    if (json.has("_status"))
207      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
208    if (json.has("div"))
209      res.setDiv(parseXhtml(json.get("div").getAsString()));
210  }
211
212  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
213    Reference res = new Reference();
214    parseReferenceProperties(json, res);
215    return res;
216  }
217
218  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
219    parseTypeProperties(json, res);
220    if (json.has("reference"))
221      res.setReferenceElement(parseString(json.get("reference").getAsString()));
222    if (json.has("_reference"))
223      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
224    if (json.has("identifier"))
225      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
226    if (json.has("display"))
227      res.setDisplayElement(parseString(json.get("display").getAsString()));
228    if (json.has("_display"))
229      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
230  }
231
232  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
233    Quantity res = new Quantity();
234    parseQuantityProperties(json, res);
235    return res;
236  }
237
238  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
239    parseTypeProperties(json, res);
240    if (json.has("value"))
241      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
242    if (json.has("_value"))
243      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
244    if (json.has("comparator"))
245      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
246    if (json.has("_comparator"))
247      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
248    if (json.has("unit"))
249      res.setUnitElement(parseString(json.get("unit").getAsString()));
250    if (json.has("_unit"))
251      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
252    if (json.has("system"))
253      res.setSystemElement(parseUri(json.get("system").getAsString()));
254    if (json.has("_system"))
255      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
256    if (json.has("code"))
257      res.setCodeElement(parseCode(json.get("code").getAsString()));
258    if (json.has("_code"))
259      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
260  }
261
262  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
263    Period res = new Period();
264    parsePeriodProperties(json, res);
265    return res;
266  }
267
268  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
269    parseTypeProperties(json, res);
270    if (json.has("start"))
271      res.setStartElement(parseDateTime(json.get("start").getAsString()));
272    if (json.has("_start"))
273      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
274    if (json.has("end"))
275      res.setEndElement(parseDateTime(json.get("end").getAsString()));
276    if (json.has("_end"))
277      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
278  }
279
280  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
281    Attachment res = new Attachment();
282    parseAttachmentProperties(json, res);
283    return res;
284  }
285
286  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
287    parseTypeProperties(json, res);
288    if (json.has("contentType"))
289      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
290    if (json.has("_contentType"))
291      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
292    if (json.has("language"))
293      res.setLanguageElement(parseCode(json.get("language").getAsString()));
294    if (json.has("_language"))
295      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
296    if (json.has("data"))
297      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
298    if (json.has("_data"))
299      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
300    if (json.has("url"))
301      res.setUrlElement(parseUri(json.get("url").getAsString()));
302    if (json.has("_url"))
303      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
304    if (json.has("size"))
305      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
306    if (json.has("_size"))
307      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
308    if (json.has("hash"))
309      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
310    if (json.has("_hash"))
311      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
312    if (json.has("title"))
313      res.setTitleElement(parseString(json.get("title").getAsString()));
314    if (json.has("_title"))
315      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
316    if (json.has("creation"))
317      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
318    if (json.has("_creation"))
319      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
320  }
321
322  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
323    Duration res = new Duration();
324    parseDurationProperties(json, res);
325    return res;
326  }
327
328  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
329    parseQuantityProperties(json, res);
330  }
331
332  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
333    Count res = new Count();
334    parseCountProperties(json, res);
335    return res;
336  }
337
338  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
339    parseQuantityProperties(json, res);
340  }
341
342  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
343    Range res = new Range();
344    parseRangeProperties(json, res);
345    return res;
346  }
347
348  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
349    parseTypeProperties(json, res);
350    if (json.has("low"))
351      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
352    if (json.has("high"))
353      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
354  }
355
356  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
357    Annotation res = new Annotation();
358    parseAnnotationProperties(json, res);
359    return res;
360  }
361
362  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
363    parseTypeProperties(json, res);
364    Type author = parseType("author", json);
365    if (author != null)
366      res.setAuthor(author);
367    if (json.has("time"))
368      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
369    if (json.has("_time"))
370      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
371    if (json.has("text"))
372      res.setTextElement(parseString(json.get("text").getAsString()));
373    if (json.has("_text"))
374      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
375  }
376
377  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
378    Money res = new Money();
379    parseMoneyProperties(json, res);
380    return res;
381  }
382
383  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
384    parseQuantityProperties(json, res);
385  }
386
387  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
388    Identifier res = new Identifier();
389    parseIdentifierProperties(json, res);
390    return res;
391  }
392
393  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
394    parseTypeProperties(json, res);
395    if (json.has("use"))
396      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
397    if (json.has("_use"))
398      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
399    if (json.has("type"))
400      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
401    if (json.has("system"))
402      res.setSystemElement(parseUri(json.get("system").getAsString()));
403    if (json.has("_system"))
404      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
405    if (json.has("value"))
406      res.setValueElement(parseString(json.get("value").getAsString()));
407    if (json.has("_value"))
408      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
409    if (json.has("period"))
410      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
411    if (json.has("assigner"))
412      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
413  }
414
415  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
416    Coding res = new Coding();
417    parseCodingProperties(json, res);
418    return res;
419  }
420
421  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
422    parseTypeProperties(json, res);
423    if (json.has("system"))
424      res.setSystemElement(parseUri(json.get("system").getAsString()));
425    if (json.has("_system"))
426      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
427    if (json.has("version"))
428      res.setVersionElement(parseString(json.get("version").getAsString()));
429    if (json.has("_version"))
430      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
431    if (json.has("code"))
432      res.setCodeElement(parseCode(json.get("code").getAsString()));
433    if (json.has("_code"))
434      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
435    if (json.has("display"))
436      res.setDisplayElement(parseString(json.get("display").getAsString()));
437    if (json.has("_display"))
438      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
439    if (json.has("userSelected"))
440      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
441    if (json.has("_userSelected"))
442      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
443  }
444
445  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
446    Signature res = new Signature();
447    parseSignatureProperties(json, res);
448    return res;
449  }
450
451  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
452    parseTypeProperties(json, res);
453    if (json.has("type")) {
454      JsonArray array = json.getAsJsonArray("type");
455      for (int i = 0; i < array.size(); i++) {
456        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
457      }
458    };
459    if (json.has("when"))
460      res.setWhenElement(parseInstant(json.get("when").getAsString()));
461    if (json.has("_when"))
462      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
463    Type who = parseType("who", json);
464    if (who != null)
465      res.setWho(who);
466    Type onBehalfOf = parseType("onBehalfOf", json);
467    if (onBehalfOf != null)
468      res.setOnBehalfOf(onBehalfOf);
469    if (json.has("contentType"))
470      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
471    if (json.has("_contentType"))
472      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
473    if (json.has("blob"))
474      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
475    if (json.has("_blob"))
476      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
477  }
478
479  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
480    SampledData res = new SampledData();
481    parseSampledDataProperties(json, res);
482    return res;
483  }
484
485  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
486    parseTypeProperties(json, res);
487    if (json.has("origin"))
488      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
489    if (json.has("period"))
490      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
491    if (json.has("_period"))
492      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
493    if (json.has("factor"))
494      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
495    if (json.has("_factor"))
496      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
497    if (json.has("lowerLimit"))
498      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
499    if (json.has("_lowerLimit"))
500      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
501    if (json.has("upperLimit"))
502      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
503    if (json.has("_upperLimit"))
504      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
505    if (json.has("dimensions"))
506      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
507    if (json.has("_dimensions"))
508      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
509    if (json.has("data"))
510      res.setDataElement(parseString(json.get("data").getAsString()));
511    if (json.has("_data"))
512      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
513  }
514
515  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
516    Ratio res = new Ratio();
517    parseRatioProperties(json, res);
518    return res;
519  }
520
521  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
522    parseTypeProperties(json, res);
523    if (json.has("numerator"))
524      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
525    if (json.has("denominator"))
526      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
527  }
528
529  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
530    Distance res = new Distance();
531    parseDistanceProperties(json, res);
532    return res;
533  }
534
535  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
536    parseQuantityProperties(json, res);
537  }
538
539  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
540    Age res = new Age();
541    parseAgeProperties(json, res);
542    return res;
543  }
544
545  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
546    parseQuantityProperties(json, res);
547  }
548
549  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
550    CodeableConcept res = new CodeableConcept();
551    parseCodeableConceptProperties(json, res);
552    return res;
553  }
554
555  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
556    parseTypeProperties(json, res);
557    if (json.has("coding")) {
558      JsonArray array = json.getAsJsonArray("coding");
559      for (int i = 0; i < array.size(); i++) {
560        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
561      }
562    };
563    if (json.has("text"))
564      res.setTextElement(parseString(json.get("text").getAsString()));
565    if (json.has("_text"))
566      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
567  }
568
569  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
570    SimpleQuantity res = new SimpleQuantity();
571    parseSimpleQuantityProperties(json, res);
572    return res;
573  }
574
575  protected void parseSimpleQuantityProperties(JsonObject json, SimpleQuantity res) throws IOException, FHIRFormatError {
576    parseTypeProperties(json, res);
577    if (json.has("value"))
578      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
579    if (json.has("_value"))
580      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
581    if (json.has("comparator"))
582      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
583    if (json.has("_comparator"))
584      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
585    if (json.has("unit"))
586      res.setUnitElement(parseString(json.get("unit").getAsString()));
587    if (json.has("_unit"))
588      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
589    if (json.has("system"))
590      res.setSystemElement(parseUri(json.get("system").getAsString()));
591    if (json.has("_system"))
592      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
593    if (json.has("code"))
594      res.setCodeElement(parseCode(json.get("code").getAsString()));
595    if (json.has("_code"))
596      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
597  }
598
599  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
600    Meta res = new Meta();
601    parseMetaProperties(json, res);
602    return res;
603  }
604
605  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
606    parseElementProperties(json, res);
607    if (json.has("versionId"))
608      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
609    if (json.has("_versionId"))
610      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
611    if (json.has("lastUpdated"))
612      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
613    if (json.has("_lastUpdated"))
614      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
615    if (json.has("profile")) {
616      JsonArray array = json.getAsJsonArray("profile");
617      for (int i = 0; i < array.size(); i++) {
618        res.getProfile().add(parseUri(array.get(i).getAsString()));
619      }
620    };
621    if (json.has("_profile")) {
622      JsonArray array = json.getAsJsonArray("_profile");
623      for (int i = 0; i < array.size(); i++) {
624        if (i == res.getProfile().size())
625          res.getProfile().add(parseUri(null));
626        if (array.get(i) instanceof JsonObject) 
627          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
628      }
629    };
630    if (json.has("security")) {
631      JsonArray array = json.getAsJsonArray("security");
632      for (int i = 0; i < array.size(); i++) {
633        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
634      }
635    };
636    if (json.has("tag")) {
637      JsonArray array = json.getAsJsonArray("tag");
638      for (int i = 0; i < array.size(); i++) {
639        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
640      }
641    };
642  }
643
644  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
645    Address res = new Address();
646    parseAddressProperties(json, res);
647    return res;
648  }
649
650  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
651    parseTypeProperties(json, res);
652    if (json.has("use"))
653      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
654    if (json.has("_use"))
655      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
656    if (json.has("type"))
657      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
658    if (json.has("_type"))
659      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
660    if (json.has("text"))
661      res.setTextElement(parseString(json.get("text").getAsString()));
662    if (json.has("_text"))
663      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
664    if (json.has("line")) {
665      JsonArray array = json.getAsJsonArray("line");
666      for (int i = 0; i < array.size(); i++) {
667        res.getLine().add(parseString(array.get(i).getAsString()));
668      }
669    };
670    if (json.has("_line")) {
671      JsonArray array = json.getAsJsonArray("_line");
672      for (int i = 0; i < array.size(); i++) {
673        if (i == res.getLine().size())
674          res.getLine().add(parseString(null));
675        if (array.get(i) instanceof JsonObject) 
676          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
677      }
678    };
679    if (json.has("city"))
680      res.setCityElement(parseString(json.get("city").getAsString()));
681    if (json.has("_city"))
682      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
683    if (json.has("district"))
684      res.setDistrictElement(parseString(json.get("district").getAsString()));
685    if (json.has("_district"))
686      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
687    if (json.has("state"))
688      res.setStateElement(parseString(json.get("state").getAsString()));
689    if (json.has("_state"))
690      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
691    if (json.has("postalCode"))
692      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
693    if (json.has("_postalCode"))
694      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
695    if (json.has("country"))
696      res.setCountryElement(parseString(json.get("country").getAsString()));
697    if (json.has("_country"))
698      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
699    if (json.has("period"))
700      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
701  }
702
703  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
704    TriggerDefinition res = new TriggerDefinition();
705    parseTriggerDefinitionProperties(json, res);
706    return res;
707  }
708
709  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
710    parseTypeProperties(json, res);
711    if (json.has("type"))
712      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
713    if (json.has("_type"))
714      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
715    if (json.has("eventName"))
716      res.setEventNameElement(parseString(json.get("eventName").getAsString()));
717    if (json.has("_eventName"))
718      parseElementProperties(json.getAsJsonObject("_eventName"), res.getEventNameElement());
719    Type eventTiming = parseType("eventTiming", json);
720    if (eventTiming != null)
721      res.setEventTiming(eventTiming);
722    if (json.has("eventData"))
723      res.setEventData(parseDataRequirement(json.getAsJsonObject("eventData")));
724  }
725
726  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
727    Contributor res = new Contributor();
728    parseContributorProperties(json, res);
729    return res;
730  }
731
732  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
733    parseTypeProperties(json, res);
734    if (json.has("type"))
735      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
736    if (json.has("_type"))
737      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
738    if (json.has("name"))
739      res.setNameElement(parseString(json.get("name").getAsString()));
740    if (json.has("_name"))
741      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
742    if (json.has("contact")) {
743      JsonArray array = json.getAsJsonArray("contact");
744      for (int i = 0; i < array.size(); i++) {
745        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
746      }
747    };
748  }
749
750  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
751    DataRequirement res = new DataRequirement();
752    parseDataRequirementProperties(json, res);
753    return res;
754  }
755
756  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
757    parseTypeProperties(json, res);
758    if (json.has("type"))
759      res.setTypeElement(parseCode(json.get("type").getAsString()));
760    if (json.has("_type"))
761      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
762    if (json.has("profile")) {
763      JsonArray array = json.getAsJsonArray("profile");
764      for (int i = 0; i < array.size(); i++) {
765        res.getProfile().add(parseUri(array.get(i).getAsString()));
766      }
767    };
768    if (json.has("_profile")) {
769      JsonArray array = json.getAsJsonArray("_profile");
770      for (int i = 0; i < array.size(); i++) {
771        if (i == res.getProfile().size())
772          res.getProfile().add(parseUri(null));
773        if (array.get(i) instanceof JsonObject) 
774          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
775      }
776    };
777    if (json.has("mustSupport")) {
778      JsonArray array = json.getAsJsonArray("mustSupport");
779      for (int i = 0; i < array.size(); i++) {
780        res.getMustSupport().add(parseString(array.get(i).getAsString()));
781      }
782    };
783    if (json.has("_mustSupport")) {
784      JsonArray array = json.getAsJsonArray("_mustSupport");
785      for (int i = 0; i < array.size(); i++) {
786        if (i == res.getMustSupport().size())
787          res.getMustSupport().add(parseString(null));
788        if (array.get(i) instanceof JsonObject) 
789          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
790      }
791    };
792    if (json.has("codeFilter")) {
793      JsonArray array = json.getAsJsonArray("codeFilter");
794      for (int i = 0; i < array.size(); i++) {
795        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
796      }
797    };
798    if (json.has("dateFilter")) {
799      JsonArray array = json.getAsJsonArray("dateFilter");
800      for (int i = 0; i < array.size(); i++) {
801        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
802      }
803    };
804  }
805
806  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
807    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
808    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
809    return res;
810  }
811
812  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
813    parseTypeProperties(json, res);
814    if (json.has("path"))
815      res.setPathElement(parseString(json.get("path").getAsString()));
816    if (json.has("_path"))
817      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
818    Type valueSet = parseType("valueSet", json);
819    if (valueSet != null)
820      res.setValueSet(valueSet);
821    if (json.has("valueCode")) {
822      JsonArray array = json.getAsJsonArray("valueCode");
823      for (int i = 0; i < array.size(); i++) {
824        res.getValueCode().add(parseCode(array.get(i).getAsString()));
825      }
826    };
827    if (json.has("_valueCode")) {
828      JsonArray array = json.getAsJsonArray("_valueCode");
829      for (int i = 0; i < array.size(); i++) {
830        if (i == res.getValueCode().size())
831          res.getValueCode().add(parseCode(null));
832        if (array.get(i) instanceof JsonObject) 
833          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueCode().get(i));
834      }
835    };
836    if (json.has("valueCoding")) {
837      JsonArray array = json.getAsJsonArray("valueCoding");
838      for (int i = 0; i < array.size(); i++) {
839        res.getValueCoding().add(parseCoding(array.get(i).getAsJsonObject()));
840      }
841    };
842    if (json.has("valueCodeableConcept")) {
843      JsonArray array = json.getAsJsonArray("valueCodeableConcept");
844      for (int i = 0; i < array.size(); i++) {
845        res.getValueCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
846      }
847    };
848  }
849
850  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
851    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
852    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
853    return res;
854  }
855
856  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
857    parseTypeProperties(json, res);
858    if (json.has("path"))
859      res.setPathElement(parseString(json.get("path").getAsString()));
860    if (json.has("_path"))
861      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
862    Type value = parseType("value", json);
863    if (value != null)
864      res.setValue(value);
865  }
866
867  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
868    Dosage res = new Dosage();
869    parseDosageProperties(json, res);
870    return res;
871  }
872
873  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
874    parseTypeProperties(json, res);
875    if (json.has("sequence"))
876      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
877    if (json.has("_sequence"))
878      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
879    if (json.has("text"))
880      res.setTextElement(parseString(json.get("text").getAsString()));
881    if (json.has("_text"))
882      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
883    if (json.has("additionalInstruction")) {
884      JsonArray array = json.getAsJsonArray("additionalInstruction");
885      for (int i = 0; i < array.size(); i++) {
886        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
887      }
888    };
889    if (json.has("patientInstruction"))
890      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
891    if (json.has("_patientInstruction"))
892      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
893    if (json.has("timing"))
894      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
895    Type asNeeded = parseType("asNeeded", json);
896    if (asNeeded != null)
897      res.setAsNeeded(asNeeded);
898    if (json.has("site"))
899      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
900    if (json.has("route"))
901      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
902    if (json.has("method"))
903      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
904    Type dose = parseType("dose", json);
905    if (dose != null)
906      res.setDose(dose);
907    if (json.has("maxDosePerPeriod"))
908      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
909    if (json.has("maxDosePerAdministration"))
910      res.setMaxDosePerAdministration(parseSimpleQuantity(json.getAsJsonObject("maxDosePerAdministration")));
911    if (json.has("maxDosePerLifetime"))
912      res.setMaxDosePerLifetime(parseSimpleQuantity(json.getAsJsonObject("maxDosePerLifetime")));
913    Type rate = parseType("rate", json);
914    if (rate != null)
915      res.setRate(rate);
916  }
917
918  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
919    RelatedArtifact res = new RelatedArtifact();
920    parseRelatedArtifactProperties(json, res);
921    return res;
922  }
923
924  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
925    parseTypeProperties(json, res);
926    if (json.has("type"))
927      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
928    if (json.has("_type"))
929      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
930    if (json.has("display"))
931      res.setDisplayElement(parseString(json.get("display").getAsString()));
932    if (json.has("_display"))
933      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
934    if (json.has("citation"))
935      res.setCitationElement(parseString(json.get("citation").getAsString()));
936    if (json.has("_citation"))
937      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
938    if (json.has("url"))
939      res.setUrlElement(parseUri(json.get("url").getAsString()));
940    if (json.has("_url"))
941      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
942    if (json.has("document"))
943      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
944    if (json.has("resource"))
945      res.setResource(parseReference(json.getAsJsonObject("resource")));
946  }
947
948  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
949    ContactDetail res = new ContactDetail();
950    parseContactDetailProperties(json, res);
951    return res;
952  }
953
954  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
955    parseTypeProperties(json, res);
956    if (json.has("name"))
957      res.setNameElement(parseString(json.get("name").getAsString()));
958    if (json.has("_name"))
959      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
960    if (json.has("telecom")) {
961      JsonArray array = json.getAsJsonArray("telecom");
962      for (int i = 0; i < array.size(); i++) {
963        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
964      }
965    };
966  }
967
968  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
969    HumanName res = new HumanName();
970    parseHumanNameProperties(json, res);
971    return res;
972  }
973
974  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
975    parseTypeProperties(json, res);
976    if (json.has("use"))
977      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
978    if (json.has("_use"))
979      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
980    if (json.has("text"))
981      res.setTextElement(parseString(json.get("text").getAsString()));
982    if (json.has("_text"))
983      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
984    if (json.has("family"))
985      res.setFamilyElement(parseString(json.get("family").getAsString()));
986    if (json.has("_family"))
987      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
988    if (json.has("given")) {
989      JsonArray array = json.getAsJsonArray("given");
990      for (int i = 0; i < array.size(); i++) {
991        res.getGiven().add(parseString(array.get(i).getAsString()));
992      }
993    };
994    if (json.has("_given")) {
995      JsonArray array = json.getAsJsonArray("_given");
996      for (int i = 0; i < array.size(); i++) {
997        if (i == res.getGiven().size())
998          res.getGiven().add(parseString(null));
999        if (array.get(i) instanceof JsonObject) 
1000          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1001      }
1002    };
1003    if (json.has("prefix")) {
1004      JsonArray array = json.getAsJsonArray("prefix");
1005      for (int i = 0; i < array.size(); i++) {
1006        res.getPrefix().add(parseString(array.get(i).getAsString()));
1007      }
1008    };
1009    if (json.has("_prefix")) {
1010      JsonArray array = json.getAsJsonArray("_prefix");
1011      for (int i = 0; i < array.size(); i++) {
1012        if (i == res.getPrefix().size())
1013          res.getPrefix().add(parseString(null));
1014        if (array.get(i) instanceof JsonObject) 
1015          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1016      }
1017    };
1018    if (json.has("suffix")) {
1019      JsonArray array = json.getAsJsonArray("suffix");
1020      for (int i = 0; i < array.size(); i++) {
1021        res.getSuffix().add(parseString(array.get(i).getAsString()));
1022      }
1023    };
1024    if (json.has("_suffix")) {
1025      JsonArray array = json.getAsJsonArray("_suffix");
1026      for (int i = 0; i < array.size(); i++) {
1027        if (i == res.getSuffix().size())
1028          res.getSuffix().add(parseString(null));
1029        if (array.get(i) instanceof JsonObject) 
1030          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1031      }
1032    };
1033    if (json.has("period"))
1034      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1035  }
1036
1037  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
1038    ContactPoint res = new ContactPoint();
1039    parseContactPointProperties(json, res);
1040    return res;
1041  }
1042
1043  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
1044    parseTypeProperties(json, res);
1045    if (json.has("system"))
1046      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
1047    if (json.has("_system"))
1048      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1049    if (json.has("value"))
1050      res.setValueElement(parseString(json.get("value").getAsString()));
1051    if (json.has("_value"))
1052      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1053    if (json.has("use"))
1054      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
1055    if (json.has("_use"))
1056      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1057    if (json.has("rank"))
1058      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
1059    if (json.has("_rank"))
1060      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
1061    if (json.has("period"))
1062      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1063  }
1064
1065  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1066    UsageContext res = new UsageContext();
1067    parseUsageContextProperties(json, res);
1068    return res;
1069  }
1070
1071  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1072    parseTypeProperties(json, res);
1073    if (json.has("code"))
1074      res.setCode(parseCoding(json.getAsJsonObject("code")));
1075    Type value = parseType("value", json);
1076    if (value != null)
1077      res.setValue(value);
1078  }
1079
1080  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1081    Timing res = new Timing();
1082    parseTimingProperties(json, res);
1083    return res;
1084  }
1085
1086  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1087    parseTypeProperties(json, res);
1088    if (json.has("event")) {
1089      JsonArray array = json.getAsJsonArray("event");
1090      for (int i = 0; i < array.size(); i++) {
1091        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1092      }
1093    };
1094    if (json.has("_event")) {
1095      JsonArray array = json.getAsJsonArray("_event");
1096      for (int i = 0; i < array.size(); i++) {
1097        if (i == res.getEvent().size())
1098          res.getEvent().add(parseDateTime(null));
1099        if (array.get(i) instanceof JsonObject) 
1100          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1101      }
1102    };
1103    if (json.has("repeat"))
1104      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1105    if (json.has("code"))
1106      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1107  }
1108
1109  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1110    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1111    parseTimingTimingRepeatComponentProperties(json, owner, res);
1112    return res;
1113  }
1114
1115  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1116    parseTypeProperties(json, res);
1117    Type bounds = parseType("bounds", json);
1118    if (bounds != null)
1119      res.setBounds(bounds);
1120    if (json.has("count"))
1121      res.setCountElement(parseInteger(json.get("count").getAsLong()));
1122    if (json.has("_count"))
1123      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1124    if (json.has("countMax"))
1125      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
1126    if (json.has("_countMax"))
1127      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1128    if (json.has("duration"))
1129      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1130    if (json.has("_duration"))
1131      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1132    if (json.has("durationMax"))
1133      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1134    if (json.has("_durationMax"))
1135      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1136    if (json.has("durationUnit"))
1137      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1138    if (json.has("_durationUnit"))
1139      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1140    if (json.has("frequency"))
1141      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1142    if (json.has("_frequency"))
1143      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1144    if (json.has("frequencyMax"))
1145      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1146    if (json.has("_frequencyMax"))
1147      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1148    if (json.has("period"))
1149      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1150    if (json.has("_period"))
1151      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1152    if (json.has("periodMax"))
1153      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1154    if (json.has("_periodMax"))
1155      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1156    if (json.has("periodUnit"))
1157      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1158    if (json.has("_periodUnit"))
1159      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1160    if (json.has("dayOfWeek")) {
1161      JsonArray array = json.getAsJsonArray("dayOfWeek");
1162      for (int i = 0; i < array.size(); i++) {
1163        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1164      }
1165    };
1166    if (json.has("_dayOfWeek")) {
1167      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1168      for (int i = 0; i < array.size(); i++) {
1169        if (i == res.getDayOfWeek().size())
1170          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1171        if (array.get(i) instanceof JsonObject) 
1172          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1173      }
1174    };
1175    if (json.has("timeOfDay")) {
1176      JsonArray array = json.getAsJsonArray("timeOfDay");
1177      for (int i = 0; i < array.size(); i++) {
1178        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1179      }
1180    };
1181    if (json.has("_timeOfDay")) {
1182      JsonArray array = json.getAsJsonArray("_timeOfDay");
1183      for (int i = 0; i < array.size(); i++) {
1184        if (i == res.getTimeOfDay().size())
1185          res.getTimeOfDay().add(parseTime(null));
1186        if (array.get(i) instanceof JsonObject) 
1187          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1188      }
1189    };
1190    if (json.has("when")) {
1191      JsonArray array = json.getAsJsonArray("when");
1192      for (int i = 0; i < array.size(); i++) {
1193        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1194      }
1195    };
1196    if (json.has("_when")) {
1197      JsonArray array = json.getAsJsonArray("_when");
1198      for (int i = 0; i < array.size(); i++) {
1199        if (i == res.getWhen().size())
1200          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1201        if (array.get(i) instanceof JsonObject) 
1202          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1203      }
1204    };
1205    if (json.has("offset"))
1206      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1207    if (json.has("_offset"))
1208      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1209  }
1210
1211  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1212    ElementDefinition res = new ElementDefinition();
1213    parseElementDefinitionProperties(json, res);
1214    return res;
1215  }
1216
1217  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1218    parseTypeProperties(json, res);
1219    if (json.has("path"))
1220      res.setPathElement(parseString(json.get("path").getAsString()));
1221    if (json.has("_path"))
1222      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1223    if (json.has("representation")) {
1224      JsonArray array = json.getAsJsonArray("representation");
1225      for (int i = 0; i < array.size(); i++) {
1226        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1227      }
1228    };
1229    if (json.has("_representation")) {
1230      JsonArray array = json.getAsJsonArray("_representation");
1231      for (int i = 0; i < array.size(); i++) {
1232        if (i == res.getRepresentation().size())
1233          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1234        if (array.get(i) instanceof JsonObject) 
1235          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1236      }
1237    };
1238    if (json.has("sliceName"))
1239      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1240    if (json.has("_sliceName"))
1241      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1242    if (json.has("label"))
1243      res.setLabelElement(parseString(json.get("label").getAsString()));
1244    if (json.has("_label"))
1245      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1246    if (json.has("code")) {
1247      JsonArray array = json.getAsJsonArray("code");
1248      for (int i = 0; i < array.size(); i++) {
1249        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1250      }
1251    };
1252    if (json.has("slicing"))
1253      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1254    if (json.has("short"))
1255      res.setShortElement(parseString(json.get("short").getAsString()));
1256    if (json.has("_short"))
1257      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1258    if (json.has("definition"))
1259      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1260    if (json.has("_definition"))
1261      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1262    if (json.has("comment"))
1263      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1264    if (json.has("_comment"))
1265      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1266    if (json.has("requirements"))
1267      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1268    if (json.has("_requirements"))
1269      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1270    if (json.has("alias")) {
1271      JsonArray array = json.getAsJsonArray("alias");
1272      for (int i = 0; i < array.size(); i++) {
1273        res.getAlias().add(parseString(array.get(i).getAsString()));
1274      }
1275    };
1276    if (json.has("_alias")) {
1277      JsonArray array = json.getAsJsonArray("_alias");
1278      for (int i = 0; i < array.size(); i++) {
1279        if (i == res.getAlias().size())
1280          res.getAlias().add(parseString(null));
1281        if (array.get(i) instanceof JsonObject) 
1282          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1283      }
1284    };
1285    if (json.has("min"))
1286      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1287    if (json.has("_min"))
1288      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1289    if (json.has("max"))
1290      res.setMaxElement(parseString(json.get("max").getAsString()));
1291    if (json.has("_max"))
1292      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1293    if (json.has("base"))
1294      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1295    if (json.has("contentReference"))
1296      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1297    if (json.has("_contentReference"))
1298      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1299    if (json.has("type")) {
1300      JsonArray array = json.getAsJsonArray("type");
1301      for (int i = 0; i < array.size(); i++) {
1302        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1303      }
1304    };
1305    Type defaultValue = parseType("defaultValue", json);
1306    if (defaultValue != null)
1307      res.setDefaultValue(defaultValue);
1308    if (json.has("meaningWhenMissing"))
1309      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1310    if (json.has("_meaningWhenMissing"))
1311      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1312    if (json.has("orderMeaning"))
1313      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1314    if (json.has("_orderMeaning"))
1315      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1316    Type fixed = parseType("fixed", json);
1317    if (fixed != null)
1318      res.setFixed(fixed);
1319    Type pattern = parseType("pattern", json);
1320    if (pattern != null)
1321      res.setPattern(pattern);
1322    if (json.has("example")) {
1323      JsonArray array = json.getAsJsonArray("example");
1324      for (int i = 0; i < array.size(); i++) {
1325        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1326      }
1327    };
1328    Type minValue = parseType("minValue", json);
1329    if (minValue != null)
1330      res.setMinValue(minValue);
1331    Type maxValue = parseType("maxValue", json);
1332    if (maxValue != null)
1333      res.setMaxValue(maxValue);
1334    if (json.has("maxLength"))
1335      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1336    if (json.has("_maxLength"))
1337      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1338    if (json.has("condition")) {
1339      JsonArray array = json.getAsJsonArray("condition");
1340      for (int i = 0; i < array.size(); i++) {
1341        res.getCondition().add(parseId(array.get(i).getAsString()));
1342      }
1343    };
1344    if (json.has("_condition")) {
1345      JsonArray array = json.getAsJsonArray("_condition");
1346      for (int i = 0; i < array.size(); i++) {
1347        if (i == res.getCondition().size())
1348          res.getCondition().add(parseId(null));
1349        if (array.get(i) instanceof JsonObject) 
1350          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1351      }
1352    };
1353    if (json.has("constraint")) {
1354      JsonArray array = json.getAsJsonArray("constraint");
1355      for (int i = 0; i < array.size(); i++) {
1356        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1357      }
1358    };
1359    if (json.has("mustSupport"))
1360      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1361    if (json.has("_mustSupport"))
1362      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1363    if (json.has("isModifier"))
1364      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1365    if (json.has("_isModifier"))
1366      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1367    if (json.has("isSummary"))
1368      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1369    if (json.has("_isSummary"))
1370      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1371    if (json.has("binding"))
1372      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1373    if (json.has("mapping")) {
1374      JsonArray array = json.getAsJsonArray("mapping");
1375      for (int i = 0; i < array.size(); i++) {
1376        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1377      }
1378    };
1379  }
1380
1381  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1382    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1383    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1384    return res;
1385  }
1386
1387  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1388    parseTypeProperties(json, res);
1389    if (json.has("discriminator")) {
1390      JsonArray array = json.getAsJsonArray("discriminator");
1391      for (int i = 0; i < array.size(); i++) {
1392        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1393      }
1394    };
1395    if (json.has("description"))
1396      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1397    if (json.has("_description"))
1398      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1399    if (json.has("ordered"))
1400      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1401    if (json.has("_ordered"))
1402      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1403    if (json.has("rules"))
1404      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1405    if (json.has("_rules"))
1406      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1407  }
1408
1409  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1410    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1411    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1412    return res;
1413  }
1414
1415  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1416    parseTypeProperties(json, res);
1417    if (json.has("type"))
1418      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1419    if (json.has("_type"))
1420      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1421    if (json.has("path"))
1422      res.setPathElement(parseString(json.get("path").getAsString()));
1423    if (json.has("_path"))
1424      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1425  }
1426
1427  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1428    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1429    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1430    return res;
1431  }
1432
1433  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1434    parseTypeProperties(json, res);
1435    if (json.has("path"))
1436      res.setPathElement(parseString(json.get("path").getAsString()));
1437    if (json.has("_path"))
1438      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1439    if (json.has("min"))
1440      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1441    if (json.has("_min"))
1442      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1443    if (json.has("max"))
1444      res.setMaxElement(parseString(json.get("max").getAsString()));
1445    if (json.has("_max"))
1446      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1447  }
1448
1449  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1450    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1451    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1452    return res;
1453  }
1454
1455  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1456    parseTypeProperties(json, res);
1457    if (json.has("code"))
1458      res.setCodeElement(parseUri(json.get("code").getAsString()));
1459    if (json.has("_code"))
1460      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1461    if (json.has("profile"))
1462      res.setProfileElement(parseUri(json.get("profile").getAsString()));
1463    if (json.has("_profile"))
1464      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1465    if (json.has("targetProfile"))
1466      res.setTargetProfileElement(parseUri(json.get("targetProfile").getAsString()));
1467    if (json.has("_targetProfile"))
1468      parseElementProperties(json.getAsJsonObject("_targetProfile"), res.getTargetProfileElement());
1469    if (json.has("aggregation")) {
1470      JsonArray array = json.getAsJsonArray("aggregation");
1471      for (int i = 0; i < array.size(); i++) {
1472        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1473      }
1474    };
1475    if (json.has("_aggregation")) {
1476      JsonArray array = json.getAsJsonArray("_aggregation");
1477      for (int i = 0; i < array.size(); i++) {
1478        if (i == res.getAggregation().size())
1479          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1480        if (array.get(i) instanceof JsonObject) 
1481          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1482      }
1483    };
1484    if (json.has("versioning"))
1485      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1486    if (json.has("_versioning"))
1487      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1488  }
1489
1490  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1491    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1492    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1493    return res;
1494  }
1495
1496  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1497    parseTypeProperties(json, res);
1498    if (json.has("label"))
1499      res.setLabelElement(parseString(json.get("label").getAsString()));
1500    if (json.has("_label"))
1501      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1502    Type value = parseType("value", json);
1503    if (value != null)
1504      res.setValue(value);
1505  }
1506
1507  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1508    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1509    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1510    return res;
1511  }
1512
1513  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1514    parseTypeProperties(json, res);
1515    if (json.has("key"))
1516      res.setKeyElement(parseId(json.get("key").getAsString()));
1517    if (json.has("_key"))
1518      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1519    if (json.has("requirements"))
1520      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1521    if (json.has("_requirements"))
1522      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1523    if (json.has("severity"))
1524      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1525    if (json.has("_severity"))
1526      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1527    if (json.has("human"))
1528      res.setHumanElement(parseString(json.get("human").getAsString()));
1529    if (json.has("_human"))
1530      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1531    if (json.has("expression"))
1532      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1533    if (json.has("_expression"))
1534      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1535    if (json.has("xpath"))
1536      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1537    if (json.has("_xpath"))
1538      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1539    if (json.has("source"))
1540      res.setSourceElement(parseUri(json.get("source").getAsString()));
1541    if (json.has("_source"))
1542      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1543  }
1544
1545  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1546    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1547    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1548    return res;
1549  }
1550
1551  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1552    parseTypeProperties(json, res);
1553    if (json.has("strength"))
1554      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1555    if (json.has("_strength"))
1556      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1557    if (json.has("description"))
1558      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1559    if (json.has("_description"))
1560      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1561    Type valueSet = parseType("valueSet", json);
1562    if (valueSet != null)
1563      res.setValueSet(valueSet);
1564  }
1565
1566  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1567    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1568    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1569    return res;
1570  }
1571
1572  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1573    parseTypeProperties(json, res);
1574    if (json.has("identity"))
1575      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1576    if (json.has("_identity"))
1577      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1578    if (json.has("language"))
1579      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1580    if (json.has("_language"))
1581      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1582    if (json.has("map"))
1583      res.setMapElement(parseString(json.get("map").getAsString()));
1584    if (json.has("_map"))
1585      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1586    if (json.has("comment"))
1587      res.setCommentElement(parseString(json.get("comment").getAsString()));
1588    if (json.has("_comment"))
1589      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1590  }
1591
1592  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1593    ParameterDefinition res = new ParameterDefinition();
1594    parseParameterDefinitionProperties(json, res);
1595    return res;
1596  }
1597
1598  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1599    parseTypeProperties(json, res);
1600    if (json.has("name"))
1601      res.setNameElement(parseCode(json.get("name").getAsString()));
1602    if (json.has("_name"))
1603      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1604    if (json.has("use"))
1605      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1606    if (json.has("_use"))
1607      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1608    if (json.has("min"))
1609      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1610    if (json.has("_min"))
1611      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1612    if (json.has("max"))
1613      res.setMaxElement(parseString(json.get("max").getAsString()));
1614    if (json.has("_max"))
1615      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1616    if (json.has("documentation"))
1617      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1618    if (json.has("_documentation"))
1619      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1620    if (json.has("type"))
1621      res.setTypeElement(parseCode(json.get("type").getAsString()));
1622    if (json.has("_type"))
1623      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1624    if (json.has("profile"))
1625      res.setProfile(parseReference(json.getAsJsonObject("profile")));
1626  }
1627
1628  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1629    parseResourceProperties(json, res);
1630    if (json.has("text"))
1631      res.setText(parseNarrative(json.getAsJsonObject("text")));
1632    if (json.has("contained")) {
1633      JsonArray array = json.getAsJsonArray("contained");
1634      for (int i = 0; i < array.size(); i++) {
1635        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1636      }
1637    };
1638    if (json.has("extension")) {
1639      JsonArray array = json.getAsJsonArray("extension");
1640      for (int i = 0; i < array.size(); i++) {
1641        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1642      }
1643    };
1644    if (json.has("modifierExtension")) {
1645      JsonArray array = json.getAsJsonArray("modifierExtension");
1646      for (int i = 0; i < array.size(); i++) {
1647        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1648      }
1649    };
1650  }
1651
1652  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1653    Parameters res = new Parameters();
1654    parseParametersProperties(json, res);
1655    return res;
1656  }
1657
1658  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1659    parseResourceProperties(json, res);
1660    if (json.has("parameter")) {
1661      JsonArray array = json.getAsJsonArray("parameter");
1662      for (int i = 0; i < array.size(); i++) {
1663        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1664      }
1665    };
1666  }
1667
1668  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1669    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1670    parseParametersParametersParameterComponentProperties(json, owner, res);
1671    return res;
1672  }
1673
1674  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1675    parseBackboneProperties(json, res);
1676    if (json.has("name"))
1677      res.setNameElement(parseString(json.get("name").getAsString()));
1678    if (json.has("_name"))
1679      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1680    Type value = parseType("value", json);
1681    if (value != null)
1682      res.setValue(value);
1683    if (json.has("resource"))
1684      res.setResource(parseResource(json.getAsJsonObject("resource")));
1685    if (json.has("part")) {
1686      JsonArray array = json.getAsJsonArray("part");
1687      for (int i = 0; i < array.size(); i++) {
1688        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1689      }
1690    };
1691  }
1692
1693  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1694    if (json.has("id"))
1695      res.setIdElement(parseId(json.get("id").getAsString()));
1696    if (json.has("_id"))
1697      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1698    if (json.has("meta"))
1699      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1700    if (json.has("implicitRules"))
1701      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1702    if (json.has("_implicitRules"))
1703      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1704    if (json.has("language"))
1705      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1706    if (json.has("_language"))
1707      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1708  }
1709
1710  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1711    Account res = new Account();
1712    parseAccountProperties(json, res);
1713    return res;
1714  }
1715
1716  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
1717    parseDomainResourceProperties(json, res);
1718    if (json.has("identifier")) {
1719      JsonArray array = json.getAsJsonArray("identifier");
1720      for (int i = 0; i < array.size(); i++) {
1721        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1722      }
1723    };
1724    if (json.has("status"))
1725      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1726    if (json.has("_status"))
1727      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1728    if (json.has("type"))
1729      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1730    if (json.has("name"))
1731      res.setNameElement(parseString(json.get("name").getAsString()));
1732    if (json.has("_name"))
1733      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1734    if (json.has("subject"))
1735      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1736    if (json.has("period"))
1737      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1738    if (json.has("active"))
1739      res.setActive(parsePeriod(json.getAsJsonObject("active")));
1740    if (json.has("balance"))
1741      res.setBalance(parseMoney(json.getAsJsonObject("balance")));
1742    if (json.has("coverage")) {
1743      JsonArray array = json.getAsJsonArray("coverage");
1744      for (int i = 0; i < array.size(); i++) {
1745        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
1746      }
1747    };
1748    if (json.has("owner"))
1749      res.setOwner(parseReference(json.getAsJsonObject("owner")));
1750    if (json.has("description"))
1751      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1752    if (json.has("_description"))
1753      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1754    if (json.has("guarantor")) {
1755      JsonArray array = json.getAsJsonArray("guarantor");
1756      for (int i = 0; i < array.size(); i++) {
1757        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
1758      }
1759    };
1760  }
1761
1762  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1763    Account.CoverageComponent res = new Account.CoverageComponent();
1764    parseAccountCoverageComponentProperties(json, owner, res);
1765    return res;
1766  }
1767
1768  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
1769    parseBackboneProperties(json, res);
1770    if (json.has("coverage"))
1771      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
1772    if (json.has("priority"))
1773      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
1774    if (json.has("_priority"))
1775      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
1776  }
1777
1778  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1779    Account.GuarantorComponent res = new Account.GuarantorComponent();
1780    parseAccountGuarantorComponentProperties(json, owner, res);
1781    return res;
1782  }
1783
1784  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
1785    parseBackboneProperties(json, res);
1786    if (json.has("party"))
1787      res.setParty(parseReference(json.getAsJsonObject("party")));
1788    if (json.has("onHold"))
1789      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
1790    if (json.has("_onHold"))
1791      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
1792    if (json.has("period"))
1793      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1794  }
1795
1796  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
1797    ActivityDefinition res = new ActivityDefinition();
1798    parseActivityDefinitionProperties(json, res);
1799    return res;
1800  }
1801
1802  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
1803    parseDomainResourceProperties(json, res);
1804    if (json.has("url"))
1805      res.setUrlElement(parseUri(json.get("url").getAsString()));
1806    if (json.has("_url"))
1807      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1808    if (json.has("identifier")) {
1809      JsonArray array = json.getAsJsonArray("identifier");
1810      for (int i = 0; i < array.size(); i++) {
1811        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1812      }
1813    };
1814    if (json.has("version"))
1815      res.setVersionElement(parseString(json.get("version").getAsString()));
1816    if (json.has("_version"))
1817      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
1818    if (json.has("name"))
1819      res.setNameElement(parseString(json.get("name").getAsString()));
1820    if (json.has("_name"))
1821      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1822    if (json.has("title"))
1823      res.setTitleElement(parseString(json.get("title").getAsString()));
1824    if (json.has("_title"))
1825      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
1826    if (json.has("status"))
1827      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1828    if (json.has("_status"))
1829      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1830    if (json.has("experimental"))
1831      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
1832    if (json.has("_experimental"))
1833      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
1834    if (json.has("date"))
1835      res.setDateElement(parseDateTime(json.get("date").getAsString()));
1836    if (json.has("_date"))
1837      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
1838    if (json.has("publisher"))
1839      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
1840    if (json.has("_publisher"))
1841      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
1842    if (json.has("description"))
1843      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1844    if (json.has("_description"))
1845      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1846    if (json.has("purpose"))
1847      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
1848    if (json.has("_purpose"))
1849      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
1850    if (json.has("usage"))
1851      res.setUsageElement(parseString(json.get("usage").getAsString()));
1852    if (json.has("_usage"))
1853      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
1854    if (json.has("approvalDate"))
1855      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
1856    if (json.has("_approvalDate"))
1857      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
1858    if (json.has("lastReviewDate"))
1859      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
1860    if (json.has("_lastReviewDate"))
1861      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
1862    if (json.has("effectivePeriod"))
1863      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
1864    if (json.has("useContext")) {
1865      JsonArray array = json.getAsJsonArray("useContext");
1866      for (int i = 0; i < array.size(); i++) {
1867        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
1868      }
1869    };
1870    if (json.has("jurisdiction")) {
1871      JsonArray array = json.getAsJsonArray("jurisdiction");
1872      for (int i = 0; i < array.size(); i++) {
1873        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1874      }
1875    };
1876    if (json.has("topic")) {
1877      JsonArray array = json.getAsJsonArray("topic");
1878      for (int i = 0; i < array.size(); i++) {
1879        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1880      }
1881    };
1882    if (json.has("contributor")) {
1883      JsonArray array = json.getAsJsonArray("contributor");
1884      for (int i = 0; i < array.size(); i++) {
1885        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
1886      }
1887    };
1888    if (json.has("contact")) {
1889      JsonArray array = json.getAsJsonArray("contact");
1890      for (int i = 0; i < array.size(); i++) {
1891        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
1892      }
1893    };
1894    if (json.has("copyright"))
1895      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
1896    if (json.has("_copyright"))
1897      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
1898    if (json.has("relatedArtifact")) {
1899      JsonArray array = json.getAsJsonArray("relatedArtifact");
1900      for (int i = 0; i < array.size(); i++) {
1901        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
1902      }
1903    };
1904    if (json.has("library")) {
1905      JsonArray array = json.getAsJsonArray("library");
1906      for (int i = 0; i < array.size(); i++) {
1907        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
1908      }
1909    };
1910    if (json.has("kind"))
1911      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
1912    if (json.has("_kind"))
1913      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
1914    if (json.has("code"))
1915      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1916    Type timing = parseType("timing", json);
1917    if (timing != null)
1918      res.setTiming(timing);
1919    if (json.has("location"))
1920      res.setLocation(parseReference(json.getAsJsonObject("location")));
1921    if (json.has("participant")) {
1922      JsonArray array = json.getAsJsonArray("participant");
1923      for (int i = 0; i < array.size(); i++) {
1924        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
1925      }
1926    };
1927    Type product = parseType("product", json);
1928    if (product != null)
1929      res.setProduct(product);
1930    if (json.has("quantity"))
1931      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
1932    if (json.has("dosage")) {
1933      JsonArray array = json.getAsJsonArray("dosage");
1934      for (int i = 0; i < array.size(); i++) {
1935        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
1936      }
1937    };
1938    if (json.has("bodySite")) {
1939      JsonArray array = json.getAsJsonArray("bodySite");
1940      for (int i = 0; i < array.size(); i++) {
1941        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1942      }
1943    };
1944    if (json.has("transform"))
1945      res.setTransform(parseReference(json.getAsJsonObject("transform")));
1946    if (json.has("dynamicValue")) {
1947      JsonArray array = json.getAsJsonArray("dynamicValue");
1948      for (int i = 0; i < array.size(); i++) {
1949        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
1950      }
1951    };
1952  }
1953
1954  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
1955    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
1956    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
1957    return res;
1958  }
1959
1960  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
1961    parseBackboneProperties(json, res);
1962    if (json.has("type"))
1963      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
1964    if (json.has("_type"))
1965      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1966    if (json.has("role"))
1967      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
1968  }
1969
1970  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
1971    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
1972    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
1973    return res;
1974  }
1975
1976  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
1977    parseBackboneProperties(json, res);
1978    if (json.has("description"))
1979      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1980    if (json.has("_description"))
1981      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1982    if (json.has("path"))
1983      res.setPathElement(parseString(json.get("path").getAsString()));
1984    if (json.has("_path"))
1985      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1986    if (json.has("language"))
1987      res.setLanguageElement(parseString(json.get("language").getAsString()));
1988    if (json.has("_language"))
1989      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1990    if (json.has("expression"))
1991      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1992    if (json.has("_expression"))
1993      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1994  }
1995
1996  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
1997    AdverseEvent res = new AdverseEvent();
1998    parseAdverseEventProperties(json, res);
1999    return res;
2000  }
2001
2002  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2003    parseDomainResourceProperties(json, res);
2004    if (json.has("identifier"))
2005      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2006    if (json.has("category"))
2007      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AdverseEvent.AdverseEventCategory.NULL, new AdverseEvent.AdverseEventCategoryEnumFactory()));
2008    if (json.has("_category"))
2009      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
2010    if (json.has("type"))
2011      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2012    if (json.has("subject"))
2013      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2014    if (json.has("date"))
2015      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2016    if (json.has("_date"))
2017      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2018    if (json.has("reaction")) {
2019      JsonArray array = json.getAsJsonArray("reaction");
2020      for (int i = 0; i < array.size(); i++) {
2021        res.getReaction().add(parseReference(array.get(i).getAsJsonObject()));
2022      }
2023    };
2024    if (json.has("location"))
2025      res.setLocation(parseReference(json.getAsJsonObject("location")));
2026    if (json.has("seriousness"))
2027      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2028    if (json.has("outcome"))
2029      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2030    if (json.has("recorder"))
2031      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2032    if (json.has("eventParticipant"))
2033      res.setEventParticipant(parseReference(json.getAsJsonObject("eventParticipant")));
2034    if (json.has("description"))
2035      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2036    if (json.has("_description"))
2037      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2038    if (json.has("suspectEntity")) {
2039      JsonArray array = json.getAsJsonArray("suspectEntity");
2040      for (int i = 0; i < array.size(); i++) {
2041        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2042      }
2043    };
2044    if (json.has("subjectMedicalHistory")) {
2045      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2046      for (int i = 0; i < array.size(); i++) {
2047        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2048      }
2049    };
2050    if (json.has("referenceDocument")) {
2051      JsonArray array = json.getAsJsonArray("referenceDocument");
2052      for (int i = 0; i < array.size(); i++) {
2053        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2054      }
2055    };
2056    if (json.has("study")) {
2057      JsonArray array = json.getAsJsonArray("study");
2058      for (int i = 0; i < array.size(); i++) {
2059        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2060      }
2061    };
2062  }
2063
2064  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2065    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2066    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2067    return res;
2068  }
2069
2070  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2071    parseBackboneProperties(json, res);
2072    if (json.has("instance"))
2073      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2074    if (json.has("causality"))
2075      res.setCausalityElement(parseEnumeration(json.get("causality").getAsString(), AdverseEvent.AdverseEventCausality.NULL, new AdverseEvent.AdverseEventCausalityEnumFactory()));
2076    if (json.has("_causality"))
2077      parseElementProperties(json.getAsJsonObject("_causality"), res.getCausalityElement());
2078    if (json.has("causalityAssessment"))
2079      res.setCausalityAssessment(parseCodeableConcept(json.getAsJsonObject("causalityAssessment")));
2080    if (json.has("causalityProductRelatedness"))
2081      res.setCausalityProductRelatednessElement(parseString(json.get("causalityProductRelatedness").getAsString()));
2082    if (json.has("_causalityProductRelatedness"))
2083      parseElementProperties(json.getAsJsonObject("_causalityProductRelatedness"), res.getCausalityProductRelatednessElement());
2084    if (json.has("causalityMethod"))
2085      res.setCausalityMethod(parseCodeableConcept(json.getAsJsonObject("causalityMethod")));
2086    if (json.has("causalityAuthor"))
2087      res.setCausalityAuthor(parseReference(json.getAsJsonObject("causalityAuthor")));
2088    if (json.has("causalityResult"))
2089      res.setCausalityResult(parseCodeableConcept(json.getAsJsonObject("causalityResult")));
2090  }
2091
2092  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2093    AllergyIntolerance res = new AllergyIntolerance();
2094    parseAllergyIntoleranceProperties(json, res);
2095    return res;
2096  }
2097
2098  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2099    parseDomainResourceProperties(json, res);
2100    if (json.has("identifier")) {
2101      JsonArray array = json.getAsJsonArray("identifier");
2102      for (int i = 0; i < array.size(); i++) {
2103        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2104      }
2105    };
2106    if (json.has("clinicalStatus"))
2107      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2108    if (json.has("_clinicalStatus"))
2109      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
2110    if (json.has("verificationStatus"))
2111      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2112    if (json.has("_verificationStatus"))
2113      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
2114    if (json.has("type"))
2115      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2116    if (json.has("_type"))
2117      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2118    if (json.has("category")) {
2119      JsonArray array = json.getAsJsonArray("category");
2120      for (int i = 0; i < array.size(); i++) {
2121        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2122      }
2123    };
2124    if (json.has("_category")) {
2125      JsonArray array = json.getAsJsonArray("_category");
2126      for (int i = 0; i < array.size(); i++) {
2127        if (i == res.getCategory().size())
2128          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2129        if (array.get(i) instanceof JsonObject) 
2130          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2131      }
2132    };
2133    if (json.has("criticality"))
2134      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2135    if (json.has("_criticality"))
2136      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2137    if (json.has("code"))
2138      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2139    if (json.has("patient"))
2140      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2141    Type onset = parseType("onset", json);
2142    if (onset != null)
2143      res.setOnset(onset);
2144    if (json.has("assertedDate"))
2145      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
2146    if (json.has("_assertedDate"))
2147      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
2148    if (json.has("recorder"))
2149      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2150    if (json.has("asserter"))
2151      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2152    if (json.has("lastOccurrence"))
2153      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2154    if (json.has("_lastOccurrence"))
2155      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2156    if (json.has("note")) {
2157      JsonArray array = json.getAsJsonArray("note");
2158      for (int i = 0; i < array.size(); i++) {
2159        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2160      }
2161    };
2162    if (json.has("reaction")) {
2163      JsonArray array = json.getAsJsonArray("reaction");
2164      for (int i = 0; i < array.size(); i++) {
2165        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2166      }
2167    };
2168  }
2169
2170  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2171    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2172    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2173    return res;
2174  }
2175
2176  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2177    parseBackboneProperties(json, res);
2178    if (json.has("substance"))
2179      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2180    if (json.has("manifestation")) {
2181      JsonArray array = json.getAsJsonArray("manifestation");
2182      for (int i = 0; i < array.size(); i++) {
2183        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2184      }
2185    };
2186    if (json.has("description"))
2187      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2188    if (json.has("_description"))
2189      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2190    if (json.has("onset"))
2191      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2192    if (json.has("_onset"))
2193      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2194    if (json.has("severity"))
2195      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2196    if (json.has("_severity"))
2197      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2198    if (json.has("exposureRoute"))
2199      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2200    if (json.has("note")) {
2201      JsonArray array = json.getAsJsonArray("note");
2202      for (int i = 0; i < array.size(); i++) {
2203        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2204      }
2205    };
2206  }
2207
2208  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2209    Appointment res = new Appointment();
2210    parseAppointmentProperties(json, res);
2211    return res;
2212  }
2213
2214  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2215    parseDomainResourceProperties(json, res);
2216    if (json.has("identifier")) {
2217      JsonArray array = json.getAsJsonArray("identifier");
2218      for (int i = 0; i < array.size(); i++) {
2219        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2220      }
2221    };
2222    if (json.has("status"))
2223      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2224    if (json.has("_status"))
2225      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2226    if (json.has("serviceCategory"))
2227      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
2228    if (json.has("serviceType")) {
2229      JsonArray array = json.getAsJsonArray("serviceType");
2230      for (int i = 0; i < array.size(); i++) {
2231        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2232      }
2233    };
2234    if (json.has("specialty")) {
2235      JsonArray array = json.getAsJsonArray("specialty");
2236      for (int i = 0; i < array.size(); i++) {
2237        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2238      }
2239    };
2240    if (json.has("appointmentType"))
2241      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2242    if (json.has("reason")) {
2243      JsonArray array = json.getAsJsonArray("reason");
2244      for (int i = 0; i < array.size(); i++) {
2245        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2246      }
2247    };
2248    if (json.has("indication")) {
2249      JsonArray array = json.getAsJsonArray("indication");
2250      for (int i = 0; i < array.size(); i++) {
2251        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2252      }
2253    };
2254    if (json.has("priority"))
2255      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2256    if (json.has("_priority"))
2257      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2258    if (json.has("description"))
2259      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2260    if (json.has("_description"))
2261      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2262    if (json.has("supportingInformation")) {
2263      JsonArray array = json.getAsJsonArray("supportingInformation");
2264      for (int i = 0; i < array.size(); i++) {
2265        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2266      }
2267    };
2268    if (json.has("start"))
2269      res.setStartElement(parseInstant(json.get("start").getAsString()));
2270    if (json.has("_start"))
2271      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2272    if (json.has("end"))
2273      res.setEndElement(parseInstant(json.get("end").getAsString()));
2274    if (json.has("_end"))
2275      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2276    if (json.has("minutesDuration"))
2277      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2278    if (json.has("_minutesDuration"))
2279      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2280    if (json.has("slot")) {
2281      JsonArray array = json.getAsJsonArray("slot");
2282      for (int i = 0; i < array.size(); i++) {
2283        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2284      }
2285    };
2286    if (json.has("created"))
2287      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2288    if (json.has("_created"))
2289      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2290    if (json.has("comment"))
2291      res.setCommentElement(parseString(json.get("comment").getAsString()));
2292    if (json.has("_comment"))
2293      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2294    if (json.has("incomingReferral")) {
2295      JsonArray array = json.getAsJsonArray("incomingReferral");
2296      for (int i = 0; i < array.size(); i++) {
2297        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
2298      }
2299    };
2300    if (json.has("participant")) {
2301      JsonArray array = json.getAsJsonArray("participant");
2302      for (int i = 0; i < array.size(); i++) {
2303        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2304      }
2305    };
2306    if (json.has("requestedPeriod")) {
2307      JsonArray array = json.getAsJsonArray("requestedPeriod");
2308      for (int i = 0; i < array.size(); i++) {
2309        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2310      }
2311    };
2312  }
2313
2314  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2315    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2316    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2317    return res;
2318  }
2319
2320  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2321    parseBackboneProperties(json, res);
2322    if (json.has("type")) {
2323      JsonArray array = json.getAsJsonArray("type");
2324      for (int i = 0; i < array.size(); i++) {
2325        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2326      }
2327    };
2328    if (json.has("actor"))
2329      res.setActor(parseReference(json.getAsJsonObject("actor")));
2330    if (json.has("required"))
2331      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2332    if (json.has("_required"))
2333      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2334    if (json.has("status"))
2335      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2336    if (json.has("_status"))
2337      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2338  }
2339
2340  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2341    AppointmentResponse res = new AppointmentResponse();
2342    parseAppointmentResponseProperties(json, res);
2343    return res;
2344  }
2345
2346  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2347    parseDomainResourceProperties(json, res);
2348    if (json.has("identifier")) {
2349      JsonArray array = json.getAsJsonArray("identifier");
2350      for (int i = 0; i < array.size(); i++) {
2351        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2352      }
2353    };
2354    if (json.has("appointment"))
2355      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2356    if (json.has("start"))
2357      res.setStartElement(parseInstant(json.get("start").getAsString()));
2358    if (json.has("_start"))
2359      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2360    if (json.has("end"))
2361      res.setEndElement(parseInstant(json.get("end").getAsString()));
2362    if (json.has("_end"))
2363      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2364    if (json.has("participantType")) {
2365      JsonArray array = json.getAsJsonArray("participantType");
2366      for (int i = 0; i < array.size(); i++) {
2367        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2368      }
2369    };
2370    if (json.has("actor"))
2371      res.setActor(parseReference(json.getAsJsonObject("actor")));
2372    if (json.has("participantStatus"))
2373      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2374    if (json.has("_participantStatus"))
2375      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2376    if (json.has("comment"))
2377      res.setCommentElement(parseString(json.get("comment").getAsString()));
2378    if (json.has("_comment"))
2379      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2380  }
2381
2382  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2383    AuditEvent res = new AuditEvent();
2384    parseAuditEventProperties(json, res);
2385    return res;
2386  }
2387
2388  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2389    parseDomainResourceProperties(json, res);
2390    if (json.has("type"))
2391      res.setType(parseCoding(json.getAsJsonObject("type")));
2392    if (json.has("subtype")) {
2393      JsonArray array = json.getAsJsonArray("subtype");
2394      for (int i = 0; i < array.size(); i++) {
2395        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2396      }
2397    };
2398    if (json.has("action"))
2399      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2400    if (json.has("_action"))
2401      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2402    if (json.has("recorded"))
2403      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2404    if (json.has("_recorded"))
2405      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2406    if (json.has("outcome"))
2407      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2408    if (json.has("_outcome"))
2409      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2410    if (json.has("outcomeDesc"))
2411      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2412    if (json.has("_outcomeDesc"))
2413      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2414    if (json.has("purposeOfEvent")) {
2415      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2416      for (int i = 0; i < array.size(); i++) {
2417        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2418      }
2419    };
2420    if (json.has("agent")) {
2421      JsonArray array = json.getAsJsonArray("agent");
2422      for (int i = 0; i < array.size(); i++) {
2423        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2424      }
2425    };
2426    if (json.has("source"))
2427      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2428    if (json.has("entity")) {
2429      JsonArray array = json.getAsJsonArray("entity");
2430      for (int i = 0; i < array.size(); i++) {
2431        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2432      }
2433    };
2434  }
2435
2436  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2437    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2438    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2439    return res;
2440  }
2441
2442  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2443    parseBackboneProperties(json, res);
2444    if (json.has("role")) {
2445      JsonArray array = json.getAsJsonArray("role");
2446      for (int i = 0; i < array.size(); i++) {
2447        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2448      }
2449    };
2450    if (json.has("reference"))
2451      res.setReference(parseReference(json.getAsJsonObject("reference")));
2452    if (json.has("userId"))
2453      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
2454    if (json.has("altId"))
2455      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2456    if (json.has("_altId"))
2457      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2458    if (json.has("name"))
2459      res.setNameElement(parseString(json.get("name").getAsString()));
2460    if (json.has("_name"))
2461      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2462    if (json.has("requestor"))
2463      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2464    if (json.has("_requestor"))
2465      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2466    if (json.has("location"))
2467      res.setLocation(parseReference(json.getAsJsonObject("location")));
2468    if (json.has("policy")) {
2469      JsonArray array = json.getAsJsonArray("policy");
2470      for (int i = 0; i < array.size(); i++) {
2471        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2472      }
2473    };
2474    if (json.has("_policy")) {
2475      JsonArray array = json.getAsJsonArray("_policy");
2476      for (int i = 0; i < array.size(); i++) {
2477        if (i == res.getPolicy().size())
2478          res.getPolicy().add(parseUri(null));
2479        if (array.get(i) instanceof JsonObject) 
2480          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2481      }
2482    };
2483    if (json.has("media"))
2484      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2485    if (json.has("network"))
2486      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2487    if (json.has("purposeOfUse")) {
2488      JsonArray array = json.getAsJsonArray("purposeOfUse");
2489      for (int i = 0; i < array.size(); i++) {
2490        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2491      }
2492    };
2493  }
2494
2495  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2496    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2497    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2498    return res;
2499  }
2500
2501  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2502    parseBackboneProperties(json, res);
2503    if (json.has("address"))
2504      res.setAddressElement(parseString(json.get("address").getAsString()));
2505    if (json.has("_address"))
2506      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2507    if (json.has("type"))
2508      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2509    if (json.has("_type"))
2510      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2511  }
2512
2513  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2514    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2515    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2516    return res;
2517  }
2518
2519  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2520    parseBackboneProperties(json, res);
2521    if (json.has("site"))
2522      res.setSiteElement(parseString(json.get("site").getAsString()));
2523    if (json.has("_site"))
2524      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2525    if (json.has("identifier"))
2526      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2527    if (json.has("type")) {
2528      JsonArray array = json.getAsJsonArray("type");
2529      for (int i = 0; i < array.size(); i++) {
2530        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2531      }
2532    };
2533  }
2534
2535  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2536    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2537    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2538    return res;
2539  }
2540
2541  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2542    parseBackboneProperties(json, res);
2543    if (json.has("identifier"))
2544      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2545    if (json.has("reference"))
2546      res.setReference(parseReference(json.getAsJsonObject("reference")));
2547    if (json.has("type"))
2548      res.setType(parseCoding(json.getAsJsonObject("type")));
2549    if (json.has("role"))
2550      res.setRole(parseCoding(json.getAsJsonObject("role")));
2551    if (json.has("lifecycle"))
2552      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2553    if (json.has("securityLabel")) {
2554      JsonArray array = json.getAsJsonArray("securityLabel");
2555      for (int i = 0; i < array.size(); i++) {
2556        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2557      }
2558    };
2559    if (json.has("name"))
2560      res.setNameElement(parseString(json.get("name").getAsString()));
2561    if (json.has("_name"))
2562      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2563    if (json.has("description"))
2564      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2565    if (json.has("_description"))
2566      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2567    if (json.has("query"))
2568      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2569    if (json.has("_query"))
2570      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2571    if (json.has("detail")) {
2572      JsonArray array = json.getAsJsonArray("detail");
2573      for (int i = 0; i < array.size(); i++) {
2574        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2575      }
2576    };
2577  }
2578
2579  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2580    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2581    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2582    return res;
2583  }
2584
2585  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2586    parseBackboneProperties(json, res);
2587    if (json.has("type"))
2588      res.setTypeElement(parseString(json.get("type").getAsString()));
2589    if (json.has("_type"))
2590      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2591    if (json.has("value"))
2592      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
2593    if (json.has("_value"))
2594      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2595  }
2596
2597  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2598    Basic res = new Basic();
2599    parseBasicProperties(json, res);
2600    return res;
2601  }
2602
2603  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2604    parseDomainResourceProperties(json, res);
2605    if (json.has("identifier")) {
2606      JsonArray array = json.getAsJsonArray("identifier");
2607      for (int i = 0; i < array.size(); i++) {
2608        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2609      }
2610    };
2611    if (json.has("code"))
2612      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2613    if (json.has("subject"))
2614      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2615    if (json.has("created"))
2616      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2617    if (json.has("_created"))
2618      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2619    if (json.has("author"))
2620      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2621  }
2622
2623  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2624    Binary res = new Binary();
2625    parseBinaryProperties(json, res);
2626    return res;
2627  }
2628
2629  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
2630    parseResourceProperties(json, res);
2631    if (json.has("contentType"))
2632      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2633    if (json.has("_contentType"))
2634      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
2635    if (json.has("securityContext"))
2636      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
2637    if (json.has("content"))
2638      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2639    if (json.has("_content"))
2640      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
2641  }
2642
2643  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
2644    BodySite res = new BodySite();
2645    parseBodySiteProperties(json, res);
2646    return res;
2647  }
2648
2649  protected void parseBodySiteProperties(JsonObject json, BodySite res) throws IOException, FHIRFormatError {
2650    parseDomainResourceProperties(json, res);
2651    if (json.has("identifier")) {
2652      JsonArray array = json.getAsJsonArray("identifier");
2653      for (int i = 0; i < array.size(); i++) {
2654        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2655      }
2656    };
2657    if (json.has("active"))
2658      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
2659    if (json.has("_active"))
2660      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
2661    if (json.has("code"))
2662      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2663    if (json.has("qualifier")) {
2664      JsonArray array = json.getAsJsonArray("qualifier");
2665      for (int i = 0; i < array.size(); i++) {
2666        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2667      }
2668    };
2669    if (json.has("description"))
2670      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2671    if (json.has("_description"))
2672      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2673    if (json.has("image")) {
2674      JsonArray array = json.getAsJsonArray("image");
2675      for (int i = 0; i < array.size(); i++) {
2676        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
2677      }
2678    };
2679    if (json.has("patient"))
2680      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2681  }
2682
2683  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
2684    Bundle res = new Bundle();
2685    parseBundleProperties(json, res);
2686    return res;
2687  }
2688
2689  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
2690    parseResourceProperties(json, res);
2691    if (json.has("identifier"))
2692      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2693    if (json.has("type"))
2694      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
2695    if (json.has("_type"))
2696      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2697    if (json.has("total"))
2698      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
2699    if (json.has("_total"))
2700      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
2701    if (json.has("link")) {
2702      JsonArray array = json.getAsJsonArray("link");
2703      for (int i = 0; i < array.size(); i++) {
2704        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
2705      }
2706    };
2707    if (json.has("entry")) {
2708      JsonArray array = json.getAsJsonArray("entry");
2709      for (int i = 0; i < array.size(); i++) {
2710        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
2711      }
2712    };
2713    if (json.has("signature"))
2714      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
2715  }
2716
2717  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2718    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
2719    parseBundleBundleLinkComponentProperties(json, owner, res);
2720    return res;
2721  }
2722
2723  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
2724    parseBackboneProperties(json, res);
2725    if (json.has("relation"))
2726      res.setRelationElement(parseString(json.get("relation").getAsString()));
2727    if (json.has("_relation"))
2728      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
2729    if (json.has("url"))
2730      res.setUrlElement(parseUri(json.get("url").getAsString()));
2731    if (json.has("_url"))
2732      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2733  }
2734
2735  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2736    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
2737    parseBundleBundleEntryComponentProperties(json, owner, res);
2738    return res;
2739  }
2740
2741  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
2742    parseBackboneProperties(json, res);
2743    if (json.has("link")) {
2744      JsonArray array = json.getAsJsonArray("link");
2745      for (int i = 0; i < array.size(); i++) {
2746        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
2747      }
2748    };
2749    if (json.has("fullUrl"))
2750      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
2751    if (json.has("_fullUrl"))
2752      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
2753    if (json.has("resource"))
2754      res.setResource(parseResource(json.getAsJsonObject("resource")));
2755    if (json.has("search"))
2756      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
2757    if (json.has("request"))
2758      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
2759    if (json.has("response"))
2760      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
2761  }
2762
2763  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2764    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
2765    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
2766    return res;
2767  }
2768
2769  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
2770    parseBackboneProperties(json, res);
2771    if (json.has("mode"))
2772      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
2773    if (json.has("_mode"))
2774      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
2775    if (json.has("score"))
2776      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
2777    if (json.has("_score"))
2778      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
2779  }
2780
2781  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2782    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
2783    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
2784    return res;
2785  }
2786
2787  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
2788    parseBackboneProperties(json, res);
2789    if (json.has("method"))
2790      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
2791    if (json.has("_method"))
2792      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
2793    if (json.has("url"))
2794      res.setUrlElement(parseUri(json.get("url").getAsString()));
2795    if (json.has("_url"))
2796      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2797    if (json.has("ifNoneMatch"))
2798      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
2799    if (json.has("_ifNoneMatch"))
2800      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
2801    if (json.has("ifModifiedSince"))
2802      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
2803    if (json.has("_ifModifiedSince"))
2804      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
2805    if (json.has("ifMatch"))
2806      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
2807    if (json.has("_ifMatch"))
2808      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
2809    if (json.has("ifNoneExist"))
2810      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
2811    if (json.has("_ifNoneExist"))
2812      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
2813  }
2814
2815  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2816    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
2817    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
2818    return res;
2819  }
2820
2821  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
2822    parseBackboneProperties(json, res);
2823    if (json.has("status"))
2824      res.setStatusElement(parseString(json.get("status").getAsString()));
2825    if (json.has("_status"))
2826      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2827    if (json.has("location"))
2828      res.setLocationElement(parseUri(json.get("location").getAsString()));
2829    if (json.has("_location"))
2830      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
2831    if (json.has("etag"))
2832      res.setEtagElement(parseString(json.get("etag").getAsString()));
2833    if (json.has("_etag"))
2834      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
2835    if (json.has("lastModified"))
2836      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
2837    if (json.has("_lastModified"))
2838      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
2839    if (json.has("outcome"))
2840      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
2841  }
2842
2843  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
2844    CapabilityStatement res = new CapabilityStatement();
2845    parseCapabilityStatementProperties(json, res);
2846    return res;
2847  }
2848
2849  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
2850    parseDomainResourceProperties(json, res);
2851    if (json.has("url"))
2852      res.setUrlElement(parseUri(json.get("url").getAsString()));
2853    if (json.has("_url"))
2854      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2855    if (json.has("version"))
2856      res.setVersionElement(parseString(json.get("version").getAsString()));
2857    if (json.has("_version"))
2858      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2859    if (json.has("name"))
2860      res.setNameElement(parseString(json.get("name").getAsString()));
2861    if (json.has("_name"))
2862      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2863    if (json.has("title"))
2864      res.setTitleElement(parseString(json.get("title").getAsString()));
2865    if (json.has("_title"))
2866      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2867    if (json.has("status"))
2868      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2869    if (json.has("_status"))
2870      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2871    if (json.has("experimental"))
2872      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2873    if (json.has("_experimental"))
2874      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2875    if (json.has("date"))
2876      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2877    if (json.has("_date"))
2878      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2879    if (json.has("publisher"))
2880      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2881    if (json.has("_publisher"))
2882      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2883    if (json.has("contact")) {
2884      JsonArray array = json.getAsJsonArray("contact");
2885      for (int i = 0; i < array.size(); i++) {
2886        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2887      }
2888    };
2889    if (json.has("description"))
2890      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2891    if (json.has("_description"))
2892      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2893    if (json.has("useContext")) {
2894      JsonArray array = json.getAsJsonArray("useContext");
2895      for (int i = 0; i < array.size(); i++) {
2896        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2897      }
2898    };
2899    if (json.has("jurisdiction")) {
2900      JsonArray array = json.getAsJsonArray("jurisdiction");
2901      for (int i = 0; i < array.size(); i++) {
2902        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2903      }
2904    };
2905    if (json.has("purpose"))
2906      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2907    if (json.has("_purpose"))
2908      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2909    if (json.has("copyright"))
2910      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2911    if (json.has("_copyright"))
2912      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2913    if (json.has("kind"))
2914      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
2915    if (json.has("_kind"))
2916      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2917    if (json.has("instantiates")) {
2918      JsonArray array = json.getAsJsonArray("instantiates");
2919      for (int i = 0; i < array.size(); i++) {
2920        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
2921      }
2922    };
2923    if (json.has("_instantiates")) {
2924      JsonArray array = json.getAsJsonArray("_instantiates");
2925      for (int i = 0; i < array.size(); i++) {
2926        if (i == res.getInstantiates().size())
2927          res.getInstantiates().add(parseUri(null));
2928        if (array.get(i) instanceof JsonObject) 
2929          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
2930      }
2931    };
2932    if (json.has("software"))
2933      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
2934    if (json.has("implementation"))
2935      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
2936    if (json.has("fhirVersion"))
2937      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
2938    if (json.has("_fhirVersion"))
2939      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
2940    if (json.has("acceptUnknown"))
2941      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), CapabilityStatement.UnknownContentCode.NULL, new CapabilityStatement.UnknownContentCodeEnumFactory()));
2942    if (json.has("_acceptUnknown"))
2943      parseElementProperties(json.getAsJsonObject("_acceptUnknown"), res.getAcceptUnknownElement());
2944    if (json.has("format")) {
2945      JsonArray array = json.getAsJsonArray("format");
2946      for (int i = 0; i < array.size(); i++) {
2947        res.getFormat().add(parseCode(array.get(i).getAsString()));
2948      }
2949    };
2950    if (json.has("_format")) {
2951      JsonArray array = json.getAsJsonArray("_format");
2952      for (int i = 0; i < array.size(); i++) {
2953        if (i == res.getFormat().size())
2954          res.getFormat().add(parseCode(null));
2955        if (array.get(i) instanceof JsonObject) 
2956          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
2957      }
2958    };
2959    if (json.has("patchFormat")) {
2960      JsonArray array = json.getAsJsonArray("patchFormat");
2961      for (int i = 0; i < array.size(); i++) {
2962        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
2963      }
2964    };
2965    if (json.has("_patchFormat")) {
2966      JsonArray array = json.getAsJsonArray("_patchFormat");
2967      for (int i = 0; i < array.size(); i++) {
2968        if (i == res.getPatchFormat().size())
2969          res.getPatchFormat().add(parseCode(null));
2970        if (array.get(i) instanceof JsonObject) 
2971          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
2972      }
2973    };
2974    if (json.has("implementationGuide")) {
2975      JsonArray array = json.getAsJsonArray("implementationGuide");
2976      for (int i = 0; i < array.size(); i++) {
2977        res.getImplementationGuide().add(parseUri(array.get(i).getAsString()));
2978      }
2979    };
2980    if (json.has("_implementationGuide")) {
2981      JsonArray array = json.getAsJsonArray("_implementationGuide");
2982      for (int i = 0; i < array.size(); i++) {
2983        if (i == res.getImplementationGuide().size())
2984          res.getImplementationGuide().add(parseUri(null));
2985        if (array.get(i) instanceof JsonObject) 
2986          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
2987      }
2988    };
2989    if (json.has("profile")) {
2990      JsonArray array = json.getAsJsonArray("profile");
2991      for (int i = 0; i < array.size(); i++) {
2992        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
2993      }
2994    };
2995    if (json.has("rest")) {
2996      JsonArray array = json.getAsJsonArray("rest");
2997      for (int i = 0; i < array.size(); i++) {
2998        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
2999      }
3000    };
3001    if (json.has("messaging")) {
3002      JsonArray array = json.getAsJsonArray("messaging");
3003      for (int i = 0; i < array.size(); i++) {
3004        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3005      }
3006    };
3007    if (json.has("document")) {
3008      JsonArray array = json.getAsJsonArray("document");
3009      for (int i = 0; i < array.size(); i++) {
3010        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3011      }
3012    };
3013  }
3014
3015  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3016    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3017    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3018    return res;
3019  }
3020
3021  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3022    parseBackboneProperties(json, res);
3023    if (json.has("name"))
3024      res.setNameElement(parseString(json.get("name").getAsString()));
3025    if (json.has("_name"))
3026      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3027    if (json.has("version"))
3028      res.setVersionElement(parseString(json.get("version").getAsString()));
3029    if (json.has("_version"))
3030      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3031    if (json.has("releaseDate"))
3032      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3033    if (json.has("_releaseDate"))
3034      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3035  }
3036
3037  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3038    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3039    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3040    return res;
3041  }
3042
3043  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3044    parseBackboneProperties(json, res);
3045    if (json.has("description"))
3046      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3047    if (json.has("_description"))
3048      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3049    if (json.has("url"))
3050      res.setUrlElement(parseUri(json.get("url").getAsString()));
3051    if (json.has("_url"))
3052      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3053  }
3054
3055  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3056    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3057    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3058    return res;
3059  }
3060
3061  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3062    parseBackboneProperties(json, res);
3063    if (json.has("mode"))
3064      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3065    if (json.has("_mode"))
3066      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3067    if (json.has("documentation"))
3068      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3069    if (json.has("_documentation"))
3070      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3071    if (json.has("security"))
3072      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3073    if (json.has("resource")) {
3074      JsonArray array = json.getAsJsonArray("resource");
3075      for (int i = 0; i < array.size(); i++) {
3076        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3077      }
3078    };
3079    if (json.has("interaction")) {
3080      JsonArray array = json.getAsJsonArray("interaction");
3081      for (int i = 0; i < array.size(); i++) {
3082        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3083      }
3084    };
3085    if (json.has("searchParam")) {
3086      JsonArray array = json.getAsJsonArray("searchParam");
3087      for (int i = 0; i < array.size(); i++) {
3088        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3089      }
3090    };
3091    if (json.has("operation")) {
3092      JsonArray array = json.getAsJsonArray("operation");
3093      for (int i = 0; i < array.size(); i++) {
3094        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3095      }
3096    };
3097    if (json.has("compartment")) {
3098      JsonArray array = json.getAsJsonArray("compartment");
3099      for (int i = 0; i < array.size(); i++) {
3100        res.getCompartment().add(parseUri(array.get(i).getAsString()));
3101      }
3102    };
3103    if (json.has("_compartment")) {
3104      JsonArray array = json.getAsJsonArray("_compartment");
3105      for (int i = 0; i < array.size(); i++) {
3106        if (i == res.getCompartment().size())
3107          res.getCompartment().add(parseUri(null));
3108        if (array.get(i) instanceof JsonObject) 
3109          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3110      }
3111    };
3112  }
3113
3114  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3115    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3116    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3117    return res;
3118  }
3119
3120  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3121    parseBackboneProperties(json, res);
3122    if (json.has("cors"))
3123      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3124    if (json.has("_cors"))
3125      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3126    if (json.has("service")) {
3127      JsonArray array = json.getAsJsonArray("service");
3128      for (int i = 0; i < array.size(); i++) {
3129        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3130      }
3131    };
3132    if (json.has("description"))
3133      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3134    if (json.has("_description"))
3135      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3136    if (json.has("certificate")) {
3137      JsonArray array = json.getAsJsonArray("certificate");
3138      for (int i = 0; i < array.size(); i++) {
3139        res.getCertificate().add(parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3140      }
3141    };
3142  }
3143
3144  protected CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3145    CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res = new CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
3146    parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(json, owner, res);
3147    return res;
3148  }
3149
3150  protected void parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res) throws IOException, FHIRFormatError {
3151    parseBackboneProperties(json, res);
3152    if (json.has("type"))
3153      res.setTypeElement(parseCode(json.get("type").getAsString()));
3154    if (json.has("_type"))
3155      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3156    if (json.has("blob"))
3157      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3158    if (json.has("_blob"))
3159      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
3160  }
3161
3162  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3163    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3164    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3165    return res;
3166  }
3167
3168  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3169    parseBackboneProperties(json, res);
3170    if (json.has("type"))
3171      res.setTypeElement(parseCode(json.get("type").getAsString()));
3172    if (json.has("_type"))
3173      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3174    if (json.has("profile"))
3175      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3176    if (json.has("documentation"))
3177      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3178    if (json.has("_documentation"))
3179      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3180    if (json.has("interaction")) {
3181      JsonArray array = json.getAsJsonArray("interaction");
3182      for (int i = 0; i < array.size(); i++) {
3183        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3184      }
3185    };
3186    if (json.has("versioning"))
3187      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3188    if (json.has("_versioning"))
3189      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3190    if (json.has("readHistory"))
3191      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3192    if (json.has("_readHistory"))
3193      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3194    if (json.has("updateCreate"))
3195      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3196    if (json.has("_updateCreate"))
3197      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3198    if (json.has("conditionalCreate"))
3199      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3200    if (json.has("_conditionalCreate"))
3201      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3202    if (json.has("conditionalRead"))
3203      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3204    if (json.has("_conditionalRead"))
3205      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3206    if (json.has("conditionalUpdate"))
3207      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3208    if (json.has("_conditionalUpdate"))
3209      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3210    if (json.has("conditionalDelete"))
3211      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3212    if (json.has("_conditionalDelete"))
3213      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3214    if (json.has("referencePolicy")) {
3215      JsonArray array = json.getAsJsonArray("referencePolicy");
3216      for (int i = 0; i < array.size(); i++) {
3217        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3218      }
3219    };
3220    if (json.has("_referencePolicy")) {
3221      JsonArray array = json.getAsJsonArray("_referencePolicy");
3222      for (int i = 0; i < array.size(); i++) {
3223        if (i == res.getReferencePolicy().size())
3224          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3225        if (array.get(i) instanceof JsonObject) 
3226          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3227      }
3228    };
3229    if (json.has("searchInclude")) {
3230      JsonArray array = json.getAsJsonArray("searchInclude");
3231      for (int i = 0; i < array.size(); i++) {
3232        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3233      }
3234    };
3235    if (json.has("_searchInclude")) {
3236      JsonArray array = json.getAsJsonArray("_searchInclude");
3237      for (int i = 0; i < array.size(); i++) {
3238        if (i == res.getSearchInclude().size())
3239          res.getSearchInclude().add(parseString(null));
3240        if (array.get(i) instanceof JsonObject) 
3241          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3242      }
3243    };
3244    if (json.has("searchRevInclude")) {
3245      JsonArray array = json.getAsJsonArray("searchRevInclude");
3246      for (int i = 0; i < array.size(); i++) {
3247        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3248      }
3249    };
3250    if (json.has("_searchRevInclude")) {
3251      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3252      for (int i = 0; i < array.size(); i++) {
3253        if (i == res.getSearchRevInclude().size())
3254          res.getSearchRevInclude().add(parseString(null));
3255        if (array.get(i) instanceof JsonObject) 
3256          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3257      }
3258    };
3259    if (json.has("searchParam")) {
3260      JsonArray array = json.getAsJsonArray("searchParam");
3261      for (int i = 0; i < array.size(); i++) {
3262        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3263      }
3264    };
3265  }
3266
3267  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3268    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3269    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3270    return res;
3271  }
3272
3273  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3274    parseBackboneProperties(json, res);
3275    if (json.has("code"))
3276      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3277    if (json.has("_code"))
3278      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3279    if (json.has("documentation"))
3280      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3281    if (json.has("_documentation"))
3282      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3283  }
3284
3285  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3286    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3287    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3288    return res;
3289  }
3290
3291  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3292    parseBackboneProperties(json, res);
3293    if (json.has("name"))
3294      res.setNameElement(parseString(json.get("name").getAsString()));
3295    if (json.has("_name"))
3296      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3297    if (json.has("definition"))
3298      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3299    if (json.has("_definition"))
3300      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3301    if (json.has("type"))
3302      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3303    if (json.has("_type"))
3304      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3305    if (json.has("documentation"))
3306      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3307    if (json.has("_documentation"))
3308      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3309  }
3310
3311  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3312    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3313    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3314    return res;
3315  }
3316
3317  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3318    parseBackboneProperties(json, res);
3319    if (json.has("code"))
3320      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3321    if (json.has("_code"))
3322      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3323    if (json.has("documentation"))
3324      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3325    if (json.has("_documentation"))
3326      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3327  }
3328
3329  protected CapabilityStatement.CapabilityStatementRestOperationComponent parseCapabilityStatementCapabilityStatementRestOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3330    CapabilityStatement.CapabilityStatementRestOperationComponent res = new CapabilityStatement.CapabilityStatementRestOperationComponent();
3331    parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(json, owner, res);
3332    return res;
3333  }
3334
3335  protected void parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestOperationComponent res) throws IOException, FHIRFormatError {
3336    parseBackboneProperties(json, res);
3337    if (json.has("name"))
3338      res.setNameElement(parseString(json.get("name").getAsString()));
3339    if (json.has("_name"))
3340      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3341    if (json.has("definition"))
3342      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3343  }
3344
3345  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3346    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3347    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3348    return res;
3349  }
3350
3351  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3352    parseBackboneProperties(json, res);
3353    if (json.has("endpoint")) {
3354      JsonArray array = json.getAsJsonArray("endpoint");
3355      for (int i = 0; i < array.size(); i++) {
3356        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3357      }
3358    };
3359    if (json.has("reliableCache"))
3360      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3361    if (json.has("_reliableCache"))
3362      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3363    if (json.has("documentation"))
3364      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3365    if (json.has("_documentation"))
3366      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3367    if (json.has("supportedMessage")) {
3368      JsonArray array = json.getAsJsonArray("supportedMessage");
3369      for (int i = 0; i < array.size(); i++) {
3370        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3371      }
3372    };
3373    if (json.has("event")) {
3374      JsonArray array = json.getAsJsonArray("event");
3375      for (int i = 0; i < array.size(); i++) {
3376        res.getEvent().add(parseCapabilityStatementCapabilityStatementMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3377      }
3378    };
3379  }
3380
3381  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3382    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3383    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3384    return res;
3385  }
3386
3387  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3388    parseBackboneProperties(json, res);
3389    if (json.has("protocol"))
3390      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3391    if (json.has("address"))
3392      res.setAddressElement(parseUri(json.get("address").getAsString()));
3393    if (json.has("_address"))
3394      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3395  }
3396
3397  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3398    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3399    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3400    return res;
3401  }
3402
3403  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3404    parseBackboneProperties(json, res);
3405    if (json.has("mode"))
3406      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3407    if (json.has("_mode"))
3408      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3409    if (json.has("definition"))
3410      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3411  }
3412
3413  protected CapabilityStatement.CapabilityStatementMessagingEventComponent parseCapabilityStatementCapabilityStatementMessagingEventComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3414    CapabilityStatement.CapabilityStatementMessagingEventComponent res = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
3415    parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(json, owner, res);
3416    return res;
3417  }
3418
3419  protected void parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEventComponent res) throws IOException, FHIRFormatError {
3420    parseBackboneProperties(json, res);
3421    if (json.has("code"))
3422      res.setCode(parseCoding(json.getAsJsonObject("code")));
3423    if (json.has("category"))
3424      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), CapabilityStatement.MessageSignificanceCategory.NULL, new CapabilityStatement.MessageSignificanceCategoryEnumFactory()));
3425    if (json.has("_category"))
3426      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
3427    if (json.has("mode"))
3428      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3429    if (json.has("_mode"))
3430      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3431    if (json.has("focus"))
3432      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3433    if (json.has("_focus"))
3434      parseElementProperties(json.getAsJsonObject("_focus"), res.getFocusElement());
3435    if (json.has("request"))
3436      res.setRequest(parseReference(json.getAsJsonObject("request")));
3437    if (json.has("response"))
3438      res.setResponse(parseReference(json.getAsJsonObject("response")));
3439    if (json.has("documentation"))
3440      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3441    if (json.has("_documentation"))
3442      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3443  }
3444
3445  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3446    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3447    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3448    return res;
3449  }
3450
3451  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3452    parseBackboneProperties(json, res);
3453    if (json.has("mode"))
3454      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3455    if (json.has("_mode"))
3456      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3457    if (json.has("documentation"))
3458      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3459    if (json.has("_documentation"))
3460      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3461    if (json.has("profile"))
3462      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3463  }
3464
3465  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3466    CarePlan res = new CarePlan();
3467    parseCarePlanProperties(json, res);
3468    return res;
3469  }
3470
3471  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3472    parseDomainResourceProperties(json, res);
3473    if (json.has("identifier")) {
3474      JsonArray array = json.getAsJsonArray("identifier");
3475      for (int i = 0; i < array.size(); i++) {
3476        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3477      }
3478    };
3479    if (json.has("definition")) {
3480      JsonArray array = json.getAsJsonArray("definition");
3481      for (int i = 0; i < array.size(); i++) {
3482        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
3483      }
3484    };
3485    if (json.has("basedOn")) {
3486      JsonArray array = json.getAsJsonArray("basedOn");
3487      for (int i = 0; i < array.size(); i++) {
3488        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3489      }
3490    };
3491    if (json.has("replaces")) {
3492      JsonArray array = json.getAsJsonArray("replaces");
3493      for (int i = 0; i < array.size(); i++) {
3494        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3495      }
3496    };
3497    if (json.has("partOf")) {
3498      JsonArray array = json.getAsJsonArray("partOf");
3499      for (int i = 0; i < array.size(); i++) {
3500        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3501      }
3502    };
3503    if (json.has("status"))
3504      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
3505    if (json.has("_status"))
3506      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3507    if (json.has("intent"))
3508      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
3509    if (json.has("_intent"))
3510      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
3511    if (json.has("category")) {
3512      JsonArray array = json.getAsJsonArray("category");
3513      for (int i = 0; i < array.size(); i++) {
3514        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3515      }
3516    };
3517    if (json.has("title"))
3518      res.setTitleElement(parseString(json.get("title").getAsString()));
3519    if (json.has("_title"))
3520      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3521    if (json.has("description"))
3522      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3523    if (json.has("_description"))
3524      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3525    if (json.has("subject"))
3526      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3527    if (json.has("context"))
3528      res.setContext(parseReference(json.getAsJsonObject("context")));
3529    if (json.has("period"))
3530      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3531    if (json.has("author")) {
3532      JsonArray array = json.getAsJsonArray("author");
3533      for (int i = 0; i < array.size(); i++) {
3534        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3535      }
3536    };
3537    if (json.has("careTeam")) {
3538      JsonArray array = json.getAsJsonArray("careTeam");
3539      for (int i = 0; i < array.size(); i++) {
3540        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
3541      }
3542    };
3543    if (json.has("addresses")) {
3544      JsonArray array = json.getAsJsonArray("addresses");
3545      for (int i = 0; i < array.size(); i++) {
3546        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
3547      }
3548    };
3549    if (json.has("supportingInfo")) {
3550      JsonArray array = json.getAsJsonArray("supportingInfo");
3551      for (int i = 0; i < array.size(); i++) {
3552        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
3553      }
3554    };
3555    if (json.has("goal")) {
3556      JsonArray array = json.getAsJsonArray("goal");
3557      for (int i = 0; i < array.size(); i++) {
3558        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3559      }
3560    };
3561    if (json.has("activity")) {
3562      JsonArray array = json.getAsJsonArray("activity");
3563      for (int i = 0; i < array.size(); i++) {
3564        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
3565      }
3566    };
3567    if (json.has("note")) {
3568      JsonArray array = json.getAsJsonArray("note");
3569      for (int i = 0; i < array.size(); i++) {
3570        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3571      }
3572    };
3573  }
3574
3575  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3576    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
3577    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
3578    return res;
3579  }
3580
3581  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
3582    parseBackboneProperties(json, res);
3583    if (json.has("outcomeCodeableConcept")) {
3584      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
3585      for (int i = 0; i < array.size(); i++) {
3586        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3587      }
3588    };
3589    if (json.has("outcomeReference")) {
3590      JsonArray array = json.getAsJsonArray("outcomeReference");
3591      for (int i = 0; i < array.size(); i++) {
3592        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
3593      }
3594    };
3595    if (json.has("progress")) {
3596      JsonArray array = json.getAsJsonArray("progress");
3597      for (int i = 0; i < array.size(); i++) {
3598        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
3599      }
3600    };
3601    if (json.has("reference"))
3602      res.setReference(parseReference(json.getAsJsonObject("reference")));
3603    if (json.has("detail"))
3604      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
3605  }
3606
3607  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3608    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
3609    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
3610    return res;
3611  }
3612
3613  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
3614    parseBackboneProperties(json, res);
3615    if (json.has("category"))
3616      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3617    if (json.has("definition"))
3618      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3619    if (json.has("code"))
3620      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3621    if (json.has("reasonCode")) {
3622      JsonArray array = json.getAsJsonArray("reasonCode");
3623      for (int i = 0; i < array.size(); i++) {
3624        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3625      }
3626    };
3627    if (json.has("reasonReference")) {
3628      JsonArray array = json.getAsJsonArray("reasonReference");
3629      for (int i = 0; i < array.size(); i++) {
3630        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3631      }
3632    };
3633    if (json.has("goal")) {
3634      JsonArray array = json.getAsJsonArray("goal");
3635      for (int i = 0; i < array.size(); i++) {
3636        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3637      }
3638    };
3639    if (json.has("status"))
3640      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
3641    if (json.has("_status"))
3642      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3643    if (json.has("statusReason"))
3644      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
3645    if (json.has("_statusReason"))
3646      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
3647    if (json.has("prohibited"))
3648      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
3649    if (json.has("_prohibited"))
3650      parseElementProperties(json.getAsJsonObject("_prohibited"), res.getProhibitedElement());
3651    Type scheduled = parseType("scheduled", json);
3652    if (scheduled != null)
3653      res.setScheduled(scheduled);
3654    if (json.has("location"))
3655      res.setLocation(parseReference(json.getAsJsonObject("location")));
3656    if (json.has("performer")) {
3657      JsonArray array = json.getAsJsonArray("performer");
3658      for (int i = 0; i < array.size(); i++) {
3659        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
3660      }
3661    };
3662    Type product = parseType("product", json);
3663    if (product != null)
3664      res.setProduct(product);
3665    if (json.has("dailyAmount"))
3666      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
3667    if (json.has("quantity"))
3668      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
3669    if (json.has("description"))
3670      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3671    if (json.has("_description"))
3672      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3673  }
3674
3675  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
3676    CareTeam res = new CareTeam();
3677    parseCareTeamProperties(json, res);
3678    return res;
3679  }
3680
3681  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
3682    parseDomainResourceProperties(json, res);
3683    if (json.has("identifier")) {
3684      JsonArray array = json.getAsJsonArray("identifier");
3685      for (int i = 0; i < array.size(); i++) {
3686        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3687      }
3688    };
3689    if (json.has("status"))
3690      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
3691    if (json.has("_status"))
3692      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3693    if (json.has("category")) {
3694      JsonArray array = json.getAsJsonArray("category");
3695      for (int i = 0; i < array.size(); i++) {
3696        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3697      }
3698    };
3699    if (json.has("name"))
3700      res.setNameElement(parseString(json.get("name").getAsString()));
3701    if (json.has("_name"))
3702      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3703    if (json.has("subject"))
3704      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3705    if (json.has("context"))
3706      res.setContext(parseReference(json.getAsJsonObject("context")));
3707    if (json.has("period"))
3708      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3709    if (json.has("participant")) {
3710      JsonArray array = json.getAsJsonArray("participant");
3711      for (int i = 0; i < array.size(); i++) {
3712        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
3713      }
3714    };
3715    if (json.has("reasonCode")) {
3716      JsonArray array = json.getAsJsonArray("reasonCode");
3717      for (int i = 0; i < array.size(); i++) {
3718        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3719      }
3720    };
3721    if (json.has("reasonReference")) {
3722      JsonArray array = json.getAsJsonArray("reasonReference");
3723      for (int i = 0; i < array.size(); i++) {
3724        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3725      }
3726    };
3727    if (json.has("managingOrganization")) {
3728      JsonArray array = json.getAsJsonArray("managingOrganization");
3729      for (int i = 0; i < array.size(); i++) {
3730        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
3731      }
3732    };
3733    if (json.has("note")) {
3734      JsonArray array = json.getAsJsonArray("note");
3735      for (int i = 0; i < array.size(); i++) {
3736        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3737      }
3738    };
3739  }
3740
3741  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
3742    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
3743    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
3744    return res;
3745  }
3746
3747  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
3748    parseBackboneProperties(json, res);
3749    if (json.has("role"))
3750      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
3751    if (json.has("member"))
3752      res.setMember(parseReference(json.getAsJsonObject("member")));
3753    if (json.has("onBehalfOf"))
3754      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
3755    if (json.has("period"))
3756      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3757  }
3758
3759  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
3760    ChargeItem res = new ChargeItem();
3761    parseChargeItemProperties(json, res);
3762    return res;
3763  }
3764
3765  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
3766    parseDomainResourceProperties(json, res);
3767    if (json.has("identifier"))
3768      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3769    if (json.has("definition")) {
3770      JsonArray array = json.getAsJsonArray("definition");
3771      for (int i = 0; i < array.size(); i++) {
3772        res.getDefinition().add(parseUri(array.get(i).getAsString()));
3773      }
3774    };
3775    if (json.has("_definition")) {
3776      JsonArray array = json.getAsJsonArray("_definition");
3777      for (int i = 0; i < array.size(); i++) {
3778        if (i == res.getDefinition().size())
3779          res.getDefinition().add(parseUri(null));
3780        if (array.get(i) instanceof JsonObject) 
3781          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
3782      }
3783    };
3784    if (json.has("status"))
3785      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
3786    if (json.has("_status"))
3787      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3788    if (json.has("partOf")) {
3789      JsonArray array = json.getAsJsonArray("partOf");
3790      for (int i = 0; i < array.size(); i++) {
3791        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3792      }
3793    };
3794    if (json.has("code"))
3795      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3796    if (json.has("subject"))
3797      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3798    if (json.has("context"))
3799      res.setContext(parseReference(json.getAsJsonObject("context")));
3800    Type occurrence = parseType("occurrence", json);
3801    if (occurrence != null)
3802      res.setOccurrence(occurrence);
3803    if (json.has("participant")) {
3804      JsonArray array = json.getAsJsonArray("participant");
3805      for (int i = 0; i < array.size(); i++) {
3806        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(array.get(i).getAsJsonObject(), res));
3807      }
3808    };
3809    if (json.has("performingOrganization"))
3810      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
3811    if (json.has("requestingOrganization"))
3812      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
3813    if (json.has("quantity"))
3814      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
3815    if (json.has("bodysite")) {
3816      JsonArray array = json.getAsJsonArray("bodysite");
3817      for (int i = 0; i < array.size(); i++) {
3818        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3819      }
3820    };
3821    if (json.has("factorOverride"))
3822      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
3823    if (json.has("_factorOverride"))
3824      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
3825    if (json.has("priceOverride"))
3826      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
3827    if (json.has("overrideReason"))
3828      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
3829    if (json.has("_overrideReason"))
3830      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
3831    if (json.has("enterer"))
3832      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
3833    if (json.has("enteredDate"))
3834      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
3835    if (json.has("_enteredDate"))
3836      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
3837    if (json.has("reason")) {
3838      JsonArray array = json.getAsJsonArray("reason");
3839      for (int i = 0; i < array.size(); i++) {
3840        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3841      }
3842    };
3843    if (json.has("service")) {
3844      JsonArray array = json.getAsJsonArray("service");
3845      for (int i = 0; i < array.size(); i++) {
3846        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
3847      }
3848    };
3849    if (json.has("account")) {
3850      JsonArray array = json.getAsJsonArray("account");
3851      for (int i = 0; i < array.size(); i++) {
3852        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3853      }
3854    };
3855    if (json.has("note")) {
3856      JsonArray array = json.getAsJsonArray("note");
3857      for (int i = 0; i < array.size(); i++) {
3858        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3859      }
3860    };
3861    if (json.has("supportingInformation")) {
3862      JsonArray array = json.getAsJsonArray("supportingInformation");
3863      for (int i = 0; i < array.size(); i++) {
3864        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3865      }
3866    };
3867  }
3868
3869  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
3870    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
3871    parseChargeItemChargeItemParticipantComponentProperties(json, owner, res);
3872    return res;
3873  }
3874
3875  protected void parseChargeItemChargeItemParticipantComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws IOException, FHIRFormatError {
3876    parseBackboneProperties(json, res);
3877    if (json.has("role"))
3878      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
3879    if (json.has("actor"))
3880      res.setActor(parseReference(json.getAsJsonObject("actor")));
3881  }
3882
3883  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
3884    Claim res = new Claim();
3885    parseClaimProperties(json, res);
3886    return res;
3887  }
3888
3889  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
3890    parseDomainResourceProperties(json, res);
3891    if (json.has("identifier")) {
3892      JsonArray array = json.getAsJsonArray("identifier");
3893      for (int i = 0; i < array.size(); i++) {
3894        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3895      }
3896    };
3897    if (json.has("status"))
3898      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
3899    if (json.has("_status"))
3900      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3901    if (json.has("type"))
3902      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3903    if (json.has("subType")) {
3904      JsonArray array = json.getAsJsonArray("subType");
3905      for (int i = 0; i < array.size(); i++) {
3906        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3907      }
3908    };
3909    if (json.has("use"))
3910      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
3911    if (json.has("_use"))
3912      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
3913    if (json.has("patient"))
3914      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3915    if (json.has("billablePeriod"))
3916      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
3917    if (json.has("created"))
3918      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3919    if (json.has("_created"))
3920      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3921    if (json.has("enterer"))
3922      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
3923    if (json.has("insurer"))
3924      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
3925    if (json.has("provider"))
3926      res.setProvider(parseReference(json.getAsJsonObject("provider")));
3927    if (json.has("organization"))
3928      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
3929    if (json.has("priority"))
3930      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
3931    if (json.has("fundsReserve"))
3932      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
3933    if (json.has("related")) {
3934      JsonArray array = json.getAsJsonArray("related");
3935      for (int i = 0; i < array.size(); i++) {
3936        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
3937      }
3938    };
3939    if (json.has("prescription"))
3940      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
3941    if (json.has("originalPrescription"))
3942      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
3943    if (json.has("payee"))
3944      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
3945    if (json.has("referral"))
3946      res.setReferral(parseReference(json.getAsJsonObject("referral")));
3947    if (json.has("facility"))
3948      res.setFacility(parseReference(json.getAsJsonObject("facility")));
3949    if (json.has("careTeam")) {
3950      JsonArray array = json.getAsJsonArray("careTeam");
3951      for (int i = 0; i < array.size(); i++) {
3952        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
3953      }
3954    };
3955    if (json.has("information")) {
3956      JsonArray array = json.getAsJsonArray("information");
3957      for (int i = 0; i < array.size(); i++) {
3958        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
3959      }
3960    };
3961    if (json.has("diagnosis")) {
3962      JsonArray array = json.getAsJsonArray("diagnosis");
3963      for (int i = 0; i < array.size(); i++) {
3964        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
3965      }
3966    };
3967    if (json.has("procedure")) {
3968      JsonArray array = json.getAsJsonArray("procedure");
3969      for (int i = 0; i < array.size(); i++) {
3970        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
3971      }
3972    };
3973    if (json.has("insurance")) {
3974      JsonArray array = json.getAsJsonArray("insurance");
3975      for (int i = 0; i < array.size(); i++) {
3976        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
3977      }
3978    };
3979    if (json.has("accident"))
3980      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
3981    if (json.has("employmentImpacted"))
3982      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
3983    if (json.has("hospitalization"))
3984      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
3985    if (json.has("item")) {
3986      JsonArray array = json.getAsJsonArray("item");
3987      for (int i = 0; i < array.size(); i++) {
3988        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
3989      }
3990    };
3991    if (json.has("total"))
3992      res.setTotal(parseMoney(json.getAsJsonObject("total")));
3993  }
3994
3995  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
3996    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
3997    parseClaimRelatedClaimComponentProperties(json, owner, res);
3998    return res;
3999  }
4000
4001  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4002    parseBackboneProperties(json, res);
4003    if (json.has("claim"))
4004      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4005    if (json.has("relationship"))
4006      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4007    if (json.has("reference"))
4008      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4009  }
4010
4011  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4012    Claim.PayeeComponent res = new Claim.PayeeComponent();
4013    parseClaimPayeeComponentProperties(json, owner, res);
4014    return res;
4015  }
4016
4017  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4018    parseBackboneProperties(json, res);
4019    if (json.has("type"))
4020      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4021    if (json.has("resourceType"))
4022      res.setResourceType(parseCoding(json.getAsJsonObject("resourceType")));
4023    if (json.has("party"))
4024      res.setParty(parseReference(json.getAsJsonObject("party")));
4025  }
4026
4027  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4028    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4029    parseClaimCareTeamComponentProperties(json, owner, res);
4030    return res;
4031  }
4032
4033  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4034    parseBackboneProperties(json, res);
4035    if (json.has("sequence"))
4036      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4037    if (json.has("_sequence"))
4038      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4039    if (json.has("provider"))
4040      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4041    if (json.has("responsible"))
4042      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4043    if (json.has("_responsible"))
4044      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4045    if (json.has("role"))
4046      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4047    if (json.has("qualification"))
4048      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4049  }
4050
4051  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4052    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4053    parseClaimSpecialConditionComponentProperties(json, owner, res);
4054    return res;
4055  }
4056
4057  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4058    parseBackboneProperties(json, res);
4059    if (json.has("sequence"))
4060      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4061    if (json.has("_sequence"))
4062      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4063    if (json.has("category"))
4064      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4065    if (json.has("code"))
4066      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4067    Type timing = parseType("timing", json);
4068    if (timing != null)
4069      res.setTiming(timing);
4070    Type value = parseType("value", json);
4071    if (value != null)
4072      res.setValue(value);
4073    if (json.has("reason"))
4074      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4075  }
4076
4077  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4078    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4079    parseClaimDiagnosisComponentProperties(json, owner, res);
4080    return res;
4081  }
4082
4083  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4084    parseBackboneProperties(json, res);
4085    if (json.has("sequence"))
4086      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4087    if (json.has("_sequence"))
4088      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4089    Type diagnosis = parseType("diagnosis", json);
4090    if (diagnosis != null)
4091      res.setDiagnosis(diagnosis);
4092    if (json.has("type")) {
4093      JsonArray array = json.getAsJsonArray("type");
4094      for (int i = 0; i < array.size(); i++) {
4095        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4096      }
4097    };
4098    if (json.has("packageCode"))
4099      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4100  }
4101
4102  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4103    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4104    parseClaimProcedureComponentProperties(json, owner, res);
4105    return res;
4106  }
4107
4108  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4109    parseBackboneProperties(json, res);
4110    if (json.has("sequence"))
4111      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4112    if (json.has("_sequence"))
4113      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4114    if (json.has("date"))
4115      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4116    if (json.has("_date"))
4117      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4118    Type procedure = parseType("procedure", json);
4119    if (procedure != null)
4120      res.setProcedure(procedure);
4121  }
4122
4123  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4124    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4125    parseClaimInsuranceComponentProperties(json, owner, res);
4126    return res;
4127  }
4128
4129  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
4130    parseBackboneProperties(json, res);
4131    if (json.has("sequence"))
4132      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4133    if (json.has("_sequence"))
4134      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4135    if (json.has("focal"))
4136      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4137    if (json.has("_focal"))
4138      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
4139    if (json.has("coverage"))
4140      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
4141    if (json.has("businessArrangement"))
4142      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4143    if (json.has("_businessArrangement"))
4144      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
4145    if (json.has("preAuthRef")) {
4146      JsonArray array = json.getAsJsonArray("preAuthRef");
4147      for (int i = 0; i < array.size(); i++) {
4148        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4149      }
4150    };
4151    if (json.has("_preAuthRef")) {
4152      JsonArray array = json.getAsJsonArray("_preAuthRef");
4153      for (int i = 0; i < array.size(); i++) {
4154        if (i == res.getPreAuthRef().size())
4155          res.getPreAuthRef().add(parseString(null));
4156        if (array.get(i) instanceof JsonObject) 
4157          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4158      }
4159    };
4160    if (json.has("claimResponse"))
4161      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
4162  }
4163
4164  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4165    Claim.AccidentComponent res = new Claim.AccidentComponent();
4166    parseClaimAccidentComponentProperties(json, owner, res);
4167    return res;
4168  }
4169
4170  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
4171    parseBackboneProperties(json, res);
4172    if (json.has("date"))
4173      res.setDateElement(parseDate(json.get("date").getAsString()));
4174    if (json.has("_date"))
4175      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4176    if (json.has("type"))
4177      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4178    Type location = parseType("location", json);
4179    if (location != null)
4180      res.setLocation(location);
4181  }
4182
4183  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4184    Claim.ItemComponent res = new Claim.ItemComponent();
4185    parseClaimItemComponentProperties(json, owner, res);
4186    return res;
4187  }
4188
4189  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
4190    parseBackboneProperties(json, res);
4191    if (json.has("sequence"))
4192      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4193    if (json.has("_sequence"))
4194      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4195    if (json.has("careTeamLinkId")) {
4196      JsonArray array = json.getAsJsonArray("careTeamLinkId");
4197      for (int i = 0; i < array.size(); i++) {
4198        res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4199      }
4200    };
4201    if (json.has("_careTeamLinkId")) {
4202      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
4203      for (int i = 0; i < array.size(); i++) {
4204        if (i == res.getCareTeamLinkId().size())
4205          res.getCareTeamLinkId().add(parsePositiveInt(null));
4206        if (array.get(i) instanceof JsonObject) 
4207          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
4208      }
4209    };
4210    if (json.has("diagnosisLinkId")) {
4211      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
4212      for (int i = 0; i < array.size(); i++) {
4213        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4214      }
4215    };
4216    if (json.has("_diagnosisLinkId")) {
4217      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
4218      for (int i = 0; i < array.size(); i++) {
4219        if (i == res.getDiagnosisLinkId().size())
4220          res.getDiagnosisLinkId().add(parsePositiveInt(null));
4221        if (array.get(i) instanceof JsonObject) 
4222          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
4223      }
4224    };
4225    if (json.has("procedureLinkId")) {
4226      JsonArray array = json.getAsJsonArray("procedureLinkId");
4227      for (int i = 0; i < array.size(); i++) {
4228        res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4229      }
4230    };
4231    if (json.has("_procedureLinkId")) {
4232      JsonArray array = json.getAsJsonArray("_procedureLinkId");
4233      for (int i = 0; i < array.size(); i++) {
4234        if (i == res.getProcedureLinkId().size())
4235          res.getProcedureLinkId().add(parsePositiveInt(null));
4236        if (array.get(i) instanceof JsonObject) 
4237          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
4238      }
4239    };
4240    if (json.has("informationLinkId")) {
4241      JsonArray array = json.getAsJsonArray("informationLinkId");
4242      for (int i = 0; i < array.size(); i++) {
4243        res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4244      }
4245    };
4246    if (json.has("_informationLinkId")) {
4247      JsonArray array = json.getAsJsonArray("_informationLinkId");
4248      for (int i = 0; i < array.size(); i++) {
4249        if (i == res.getInformationLinkId().size())
4250          res.getInformationLinkId().add(parsePositiveInt(null));
4251        if (array.get(i) instanceof JsonObject) 
4252          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
4253      }
4254    };
4255    if (json.has("revenue"))
4256      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4257    if (json.has("category"))
4258      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4259    if (json.has("service"))
4260      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4261    if (json.has("modifier")) {
4262      JsonArray array = json.getAsJsonArray("modifier");
4263      for (int i = 0; i < array.size(); i++) {
4264        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4265      }
4266    };
4267    if (json.has("programCode")) {
4268      JsonArray array = json.getAsJsonArray("programCode");
4269      for (int i = 0; i < array.size(); i++) {
4270        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4271      }
4272    };
4273    Type serviced = parseType("serviced", json);
4274    if (serviced != null)
4275      res.setServiced(serviced);
4276    Type location = parseType("location", json);
4277    if (location != null)
4278      res.setLocation(location);
4279    if (json.has("quantity"))
4280      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4281    if (json.has("unitPrice"))
4282      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4283    if (json.has("factor"))
4284      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4285    if (json.has("_factor"))
4286      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4287    if (json.has("net"))
4288      res.setNet(parseMoney(json.getAsJsonObject("net")));
4289    if (json.has("udi")) {
4290      JsonArray array = json.getAsJsonArray("udi");
4291      for (int i = 0; i < array.size(); i++) {
4292        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4293      }
4294    };
4295    if (json.has("bodySite"))
4296      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
4297    if (json.has("subSite")) {
4298      JsonArray array = json.getAsJsonArray("subSite");
4299      for (int i = 0; i < array.size(); i++) {
4300        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4301      }
4302    };
4303    if (json.has("encounter")) {
4304      JsonArray array = json.getAsJsonArray("encounter");
4305      for (int i = 0; i < array.size(); i++) {
4306        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
4307      }
4308    };
4309    if (json.has("detail")) {
4310      JsonArray array = json.getAsJsonArray("detail");
4311      for (int i = 0; i < array.size(); i++) {
4312        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
4313      }
4314    };
4315  }
4316
4317  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4318    Claim.DetailComponent res = new Claim.DetailComponent();
4319    parseClaimDetailComponentProperties(json, owner, res);
4320    return res;
4321  }
4322
4323  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
4324    parseBackboneProperties(json, res);
4325    if (json.has("sequence"))
4326      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4327    if (json.has("_sequence"))
4328      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4329    if (json.has("revenue"))
4330      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4331    if (json.has("category"))
4332      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4333    if (json.has("service"))
4334      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4335    if (json.has("modifier")) {
4336      JsonArray array = json.getAsJsonArray("modifier");
4337      for (int i = 0; i < array.size(); i++) {
4338        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4339      }
4340    };
4341    if (json.has("programCode")) {
4342      JsonArray array = json.getAsJsonArray("programCode");
4343      for (int i = 0; i < array.size(); i++) {
4344        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4345      }
4346    };
4347    if (json.has("quantity"))
4348      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4349    if (json.has("unitPrice"))
4350      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4351    if (json.has("factor"))
4352      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4353    if (json.has("_factor"))
4354      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4355    if (json.has("net"))
4356      res.setNet(parseMoney(json.getAsJsonObject("net")));
4357    if (json.has("udi")) {
4358      JsonArray array = json.getAsJsonArray("udi");
4359      for (int i = 0; i < array.size(); i++) {
4360        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4361      }
4362    };
4363    if (json.has("subDetail")) {
4364      JsonArray array = json.getAsJsonArray("subDetail");
4365      for (int i = 0; i < array.size(); i++) {
4366        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4367      }
4368    };
4369  }
4370
4371  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4372    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
4373    parseClaimSubDetailComponentProperties(json, owner, res);
4374    return res;
4375  }
4376
4377  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
4378    parseBackboneProperties(json, res);
4379    if (json.has("sequence"))
4380      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4381    if (json.has("_sequence"))
4382      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4383    if (json.has("revenue"))
4384      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4385    if (json.has("category"))
4386      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4387    if (json.has("service"))
4388      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4389    if (json.has("modifier")) {
4390      JsonArray array = json.getAsJsonArray("modifier");
4391      for (int i = 0; i < array.size(); i++) {
4392        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4393      }
4394    };
4395    if (json.has("programCode")) {
4396      JsonArray array = json.getAsJsonArray("programCode");
4397      for (int i = 0; i < array.size(); i++) {
4398        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4399      }
4400    };
4401    if (json.has("quantity"))
4402      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4403    if (json.has("unitPrice"))
4404      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4405    if (json.has("factor"))
4406      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4407    if (json.has("_factor"))
4408      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4409    if (json.has("net"))
4410      res.setNet(parseMoney(json.getAsJsonObject("net")));
4411    if (json.has("udi")) {
4412      JsonArray array = json.getAsJsonArray("udi");
4413      for (int i = 0; i < array.size(); i++) {
4414        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4415      }
4416    };
4417  }
4418
4419  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
4420    ClaimResponse res = new ClaimResponse();
4421    parseClaimResponseProperties(json, res);
4422    return res;
4423  }
4424
4425  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
4426    parseDomainResourceProperties(json, res);
4427    if (json.has("identifier")) {
4428      JsonArray array = json.getAsJsonArray("identifier");
4429      for (int i = 0; i < array.size(); i++) {
4430        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4431      }
4432    };
4433    if (json.has("status"))
4434      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
4435    if (json.has("_status"))
4436      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4437    if (json.has("patient"))
4438      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4439    if (json.has("created"))
4440      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4441    if (json.has("_created"))
4442      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4443    if (json.has("insurer"))
4444      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4445    if (json.has("requestProvider"))
4446      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
4447    if (json.has("requestOrganization"))
4448      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
4449    if (json.has("request"))
4450      res.setRequest(parseReference(json.getAsJsonObject("request")));
4451    if (json.has("outcome"))
4452      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
4453    if (json.has("disposition"))
4454      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
4455    if (json.has("_disposition"))
4456      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
4457    if (json.has("payeeType"))
4458      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
4459    if (json.has("item")) {
4460      JsonArray array = json.getAsJsonArray("item");
4461      for (int i = 0; i < array.size(); i++) {
4462        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
4463      }
4464    };
4465    if (json.has("addItem")) {
4466      JsonArray array = json.getAsJsonArray("addItem");
4467      for (int i = 0; i < array.size(); i++) {
4468        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
4469      }
4470    };
4471    if (json.has("error")) {
4472      JsonArray array = json.getAsJsonArray("error");
4473      for (int i = 0; i < array.size(); i++) {
4474        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
4475      }
4476    };
4477    if (json.has("totalCost"))
4478      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
4479    if (json.has("unallocDeductable"))
4480      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
4481    if (json.has("totalBenefit"))
4482      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
4483    if (json.has("payment"))
4484      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
4485    if (json.has("reserved"))
4486      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
4487    if (json.has("form"))
4488      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
4489    if (json.has("processNote")) {
4490      JsonArray array = json.getAsJsonArray("processNote");
4491      for (int i = 0; i < array.size(); i++) {
4492        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
4493      }
4494    };
4495    if (json.has("communicationRequest")) {
4496      JsonArray array = json.getAsJsonArray("communicationRequest");
4497      for (int i = 0; i < array.size(); i++) {
4498        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
4499      }
4500    };
4501    if (json.has("insurance")) {
4502      JsonArray array = json.getAsJsonArray("insurance");
4503      for (int i = 0; i < array.size(); i++) {
4504        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
4505      }
4506    };
4507  }
4508
4509  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4510    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
4511    parseClaimResponseItemComponentProperties(json, owner, res);
4512    return res;
4513  }
4514
4515  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
4516    parseBackboneProperties(json, res);
4517    if (json.has("sequenceLinkId"))
4518      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4519    if (json.has("_sequenceLinkId"))
4520      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4521    if (json.has("noteNumber")) {
4522      JsonArray array = json.getAsJsonArray("noteNumber");
4523      for (int i = 0; i < array.size(); i++) {
4524        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4525      }
4526    };
4527    if (json.has("_noteNumber")) {
4528      JsonArray array = json.getAsJsonArray("_noteNumber");
4529      for (int i = 0; i < array.size(); i++) {
4530        if (i == res.getNoteNumber().size())
4531          res.getNoteNumber().add(parsePositiveInt(null));
4532        if (array.get(i) instanceof JsonObject) 
4533          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4534      }
4535    };
4536    if (json.has("adjudication")) {
4537      JsonArray array = json.getAsJsonArray("adjudication");
4538      for (int i = 0; i < array.size(); i++) {
4539        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4540      }
4541    };
4542    if (json.has("detail")) {
4543      JsonArray array = json.getAsJsonArray("detail");
4544      for (int i = 0; i < array.size(); i++) {
4545        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
4546      }
4547    };
4548  }
4549
4550  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4551    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
4552    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
4553    return res;
4554  }
4555
4556  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
4557    parseBackboneProperties(json, res);
4558    if (json.has("category"))
4559      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4560    if (json.has("reason"))
4561      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4562    if (json.has("amount"))
4563      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4564    if (json.has("value"))
4565      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
4566    if (json.has("_value"))
4567      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
4568  }
4569
4570  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4571    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
4572    parseClaimResponseItemDetailComponentProperties(json, owner, res);
4573    return res;
4574  }
4575
4576  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
4577    parseBackboneProperties(json, res);
4578    if (json.has("sequenceLinkId"))
4579      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4580    if (json.has("_sequenceLinkId"))
4581      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4582    if (json.has("noteNumber")) {
4583      JsonArray array = json.getAsJsonArray("noteNumber");
4584      for (int i = 0; i < array.size(); i++) {
4585        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4586      }
4587    };
4588    if (json.has("_noteNumber")) {
4589      JsonArray array = json.getAsJsonArray("_noteNumber");
4590      for (int i = 0; i < array.size(); i++) {
4591        if (i == res.getNoteNumber().size())
4592          res.getNoteNumber().add(parsePositiveInt(null));
4593        if (array.get(i) instanceof JsonObject) 
4594          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4595      }
4596    };
4597    if (json.has("adjudication")) {
4598      JsonArray array = json.getAsJsonArray("adjudication");
4599      for (int i = 0; i < array.size(); i++) {
4600        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4601      }
4602    };
4603    if (json.has("subDetail")) {
4604      JsonArray array = json.getAsJsonArray("subDetail");
4605      for (int i = 0; i < array.size(); i++) {
4606        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4607      }
4608    };
4609  }
4610
4611  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4612    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
4613    parseClaimResponseSubDetailComponentProperties(json, owner, res);
4614    return res;
4615  }
4616
4617  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
4618    parseBackboneProperties(json, res);
4619    if (json.has("sequenceLinkId"))
4620      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4621    if (json.has("_sequenceLinkId"))
4622      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4623    if (json.has("noteNumber")) {
4624      JsonArray array = json.getAsJsonArray("noteNumber");
4625      for (int i = 0; i < array.size(); i++) {
4626        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4627      }
4628    };
4629    if (json.has("_noteNumber")) {
4630      JsonArray array = json.getAsJsonArray("_noteNumber");
4631      for (int i = 0; i < array.size(); i++) {
4632        if (i == res.getNoteNumber().size())
4633          res.getNoteNumber().add(parsePositiveInt(null));
4634        if (array.get(i) instanceof JsonObject) 
4635          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4636      }
4637    };
4638    if (json.has("adjudication")) {
4639      JsonArray array = json.getAsJsonArray("adjudication");
4640      for (int i = 0; i < array.size(); i++) {
4641        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4642      }
4643    };
4644  }
4645
4646  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4647    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
4648    parseClaimResponseAddedItemComponentProperties(json, owner, res);
4649    return res;
4650  }
4651
4652  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
4653    parseBackboneProperties(json, res);
4654    if (json.has("sequenceLinkId")) {
4655      JsonArray array = json.getAsJsonArray("sequenceLinkId");
4656      for (int i = 0; i < array.size(); i++) {
4657        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4658      }
4659    };
4660    if (json.has("_sequenceLinkId")) {
4661      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
4662      for (int i = 0; i < array.size(); i++) {
4663        if (i == res.getSequenceLinkId().size())
4664          res.getSequenceLinkId().add(parsePositiveInt(null));
4665        if (array.get(i) instanceof JsonObject) 
4666          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
4667      }
4668    };
4669    if (json.has("revenue"))
4670      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4671    if (json.has("category"))
4672      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4673    if (json.has("service"))
4674      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4675    if (json.has("modifier")) {
4676      JsonArray array = json.getAsJsonArray("modifier");
4677      for (int i = 0; i < array.size(); i++) {
4678        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4679      }
4680    };
4681    if (json.has("fee"))
4682      res.setFee(parseMoney(json.getAsJsonObject("fee")));
4683    if (json.has("noteNumber")) {
4684      JsonArray array = json.getAsJsonArray("noteNumber");
4685      for (int i = 0; i < array.size(); i++) {
4686        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4687      }
4688    };
4689    if (json.has("_noteNumber")) {
4690      JsonArray array = json.getAsJsonArray("_noteNumber");
4691      for (int i = 0; i < array.size(); i++) {
4692        if (i == res.getNoteNumber().size())
4693          res.getNoteNumber().add(parsePositiveInt(null));
4694        if (array.get(i) instanceof JsonObject) 
4695          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4696      }
4697    };
4698    if (json.has("adjudication")) {
4699      JsonArray array = json.getAsJsonArray("adjudication");
4700      for (int i = 0; i < array.size(); i++) {
4701        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4702      }
4703    };
4704    if (json.has("detail")) {
4705      JsonArray array = json.getAsJsonArray("detail");
4706      for (int i = 0; i < array.size(); i++) {
4707        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
4708      }
4709    };
4710  }
4711
4712  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4713    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
4714    parseClaimResponseAddedItemsDetailComponentProperties(json, owner, res);
4715    return res;
4716  }
4717
4718  protected void parseClaimResponseAddedItemsDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
4719    parseBackboneProperties(json, res);
4720    if (json.has("revenue"))
4721      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4722    if (json.has("category"))
4723      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4724    if (json.has("service"))
4725      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4726    if (json.has("modifier")) {
4727      JsonArray array = json.getAsJsonArray("modifier");
4728      for (int i = 0; i < array.size(); i++) {
4729        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4730      }
4731    };
4732    if (json.has("fee"))
4733      res.setFee(parseMoney(json.getAsJsonObject("fee")));
4734    if (json.has("noteNumber")) {
4735      JsonArray array = json.getAsJsonArray("noteNumber");
4736      for (int i = 0; i < array.size(); i++) {
4737        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4738      }
4739    };
4740    if (json.has("_noteNumber")) {
4741      JsonArray array = json.getAsJsonArray("_noteNumber");
4742      for (int i = 0; i < array.size(); i++) {
4743        if (i == res.getNoteNumber().size())
4744          res.getNoteNumber().add(parsePositiveInt(null));
4745        if (array.get(i) instanceof JsonObject) 
4746          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4747      }
4748    };
4749    if (json.has("adjudication")) {
4750      JsonArray array = json.getAsJsonArray("adjudication");
4751      for (int i = 0; i < array.size(); i++) {
4752        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4753      }
4754    };
4755  }
4756
4757  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4758    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
4759    parseClaimResponseErrorComponentProperties(json, owner, res);
4760    return res;
4761  }
4762
4763  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
4764    parseBackboneProperties(json, res);
4765    if (json.has("sequenceLinkId"))
4766      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4767    if (json.has("_sequenceLinkId"))
4768      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4769    if (json.has("detailSequenceLinkId"))
4770      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
4771    if (json.has("_detailSequenceLinkId"))
4772      parseElementProperties(json.getAsJsonObject("_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
4773    if (json.has("subdetailSequenceLinkId"))
4774      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
4775    if (json.has("_subdetailSequenceLinkId"))
4776      parseElementProperties(json.getAsJsonObject("_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
4777    if (json.has("code"))
4778      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4779  }
4780
4781  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4782    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
4783    parseClaimResponsePaymentComponentProperties(json, owner, res);
4784    return res;
4785  }
4786
4787  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
4788    parseBackboneProperties(json, res);
4789    if (json.has("type"))
4790      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4791    if (json.has("adjustment"))
4792      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
4793    if (json.has("adjustmentReason"))
4794      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
4795    if (json.has("date"))
4796      res.setDateElement(parseDate(json.get("date").getAsString()));
4797    if (json.has("_date"))
4798      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4799    if (json.has("amount"))
4800      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4801    if (json.has("identifier"))
4802      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4803  }
4804
4805  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4806    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
4807    parseClaimResponseNoteComponentProperties(json, owner, res);
4808    return res;
4809  }
4810
4811  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
4812    parseBackboneProperties(json, res);
4813    if (json.has("number"))
4814      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
4815    if (json.has("_number"))
4816      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
4817    if (json.has("type"))
4818      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4819    if (json.has("text"))
4820      res.setTextElement(parseString(json.get("text").getAsString()));
4821    if (json.has("_text"))
4822      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
4823    if (json.has("language"))
4824      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
4825  }
4826
4827  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4828    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
4829    parseClaimResponseInsuranceComponentProperties(json, owner, res);
4830    return res;
4831  }
4832
4833  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
4834    parseBackboneProperties(json, res);
4835    if (json.has("sequence"))
4836      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4837    if (json.has("_sequence"))
4838      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4839    if (json.has("focal"))
4840      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4841    if (json.has("_focal"))
4842      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
4843    if (json.has("coverage"))
4844      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
4845    if (json.has("businessArrangement"))
4846      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4847    if (json.has("_businessArrangement"))
4848      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
4849    if (json.has("preAuthRef")) {
4850      JsonArray array = json.getAsJsonArray("preAuthRef");
4851      for (int i = 0; i < array.size(); i++) {
4852        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4853      }
4854    };
4855    if (json.has("_preAuthRef")) {
4856      JsonArray array = json.getAsJsonArray("_preAuthRef");
4857      for (int i = 0; i < array.size(); i++) {
4858        if (i == res.getPreAuthRef().size())
4859          res.getPreAuthRef().add(parseString(null));
4860        if (array.get(i) instanceof JsonObject) 
4861          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4862      }
4863    };
4864    if (json.has("claimResponse"))
4865      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
4866  }
4867
4868  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
4869    ClinicalImpression res = new ClinicalImpression();
4870    parseClinicalImpressionProperties(json, res);
4871    return res;
4872  }
4873
4874  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
4875    parseDomainResourceProperties(json, res);
4876    if (json.has("identifier")) {
4877      JsonArray array = json.getAsJsonArray("identifier");
4878      for (int i = 0; i < array.size(); i++) {
4879        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4880      }
4881    };
4882    if (json.has("status"))
4883      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
4884    if (json.has("_status"))
4885      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4886    if (json.has("code"))
4887      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4888    if (json.has("description"))
4889      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4890    if (json.has("_description"))
4891      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4892    if (json.has("subject"))
4893      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4894    if (json.has("context"))
4895      res.setContext(parseReference(json.getAsJsonObject("context")));
4896    Type effective = parseType("effective", json);
4897    if (effective != null)
4898      res.setEffective(effective);
4899    if (json.has("date"))
4900      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4901    if (json.has("_date"))
4902      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4903    if (json.has("assessor"))
4904      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
4905    if (json.has("previous"))
4906      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
4907    if (json.has("problem")) {
4908      JsonArray array = json.getAsJsonArray("problem");
4909      for (int i = 0; i < array.size(); i++) {
4910        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
4911      }
4912    };
4913    if (json.has("investigation")) {
4914      JsonArray array = json.getAsJsonArray("investigation");
4915      for (int i = 0; i < array.size(); i++) {
4916        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
4917      }
4918    };
4919    if (json.has("protocol")) {
4920      JsonArray array = json.getAsJsonArray("protocol");
4921      for (int i = 0; i < array.size(); i++) {
4922        res.getProtocol().add(parseUri(array.get(i).getAsString()));
4923      }
4924    };
4925    if (json.has("_protocol")) {
4926      JsonArray array = json.getAsJsonArray("_protocol");
4927      for (int i = 0; i < array.size(); i++) {
4928        if (i == res.getProtocol().size())
4929          res.getProtocol().add(parseUri(null));
4930        if (array.get(i) instanceof JsonObject) 
4931          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
4932      }
4933    };
4934    if (json.has("summary"))
4935      res.setSummaryElement(parseString(json.get("summary").getAsString()));
4936    if (json.has("_summary"))
4937      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
4938    if (json.has("finding")) {
4939      JsonArray array = json.getAsJsonArray("finding");
4940      for (int i = 0; i < array.size(); i++) {
4941        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
4942      }
4943    };
4944    if (json.has("prognosisCodeableConcept")) {
4945      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
4946      for (int i = 0; i < array.size(); i++) {
4947        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4948      }
4949    };
4950    if (json.has("prognosisReference")) {
4951      JsonArray array = json.getAsJsonArray("prognosisReference");
4952      for (int i = 0; i < array.size(); i++) {
4953        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
4954      }
4955    };
4956    if (json.has("action")) {
4957      JsonArray array = json.getAsJsonArray("action");
4958      for (int i = 0; i < array.size(); i++) {
4959        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
4960      }
4961    };
4962    if (json.has("note")) {
4963      JsonArray array = json.getAsJsonArray("note");
4964      for (int i = 0; i < array.size(); i++) {
4965        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4966      }
4967    };
4968  }
4969
4970  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
4971    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
4972    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
4973    return res;
4974  }
4975
4976  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
4977    parseBackboneProperties(json, res);
4978    if (json.has("code"))
4979      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4980    if (json.has("item")) {
4981      JsonArray array = json.getAsJsonArray("item");
4982      for (int i = 0; i < array.size(); i++) {
4983        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
4984      }
4985    };
4986  }
4987
4988  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
4989    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
4990    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
4991    return res;
4992  }
4993
4994  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
4995    parseBackboneProperties(json, res);
4996    Type item = parseType("item", json);
4997    if (item != null)
4998      res.setItem(item);
4999    if (json.has("basis"))
5000      res.setBasisElement(parseString(json.get("basis").getAsString()));
5001    if (json.has("_basis"))
5002      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
5003  }
5004
5005  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
5006    CodeSystem res = new CodeSystem();
5007    parseCodeSystemProperties(json, res);
5008    return res;
5009  }
5010
5011  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
5012    parseDomainResourceProperties(json, res);
5013    if (json.has("url"))
5014      res.setUrlElement(parseUri(json.get("url").getAsString()));
5015    if (json.has("_url"))
5016      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5017    if (json.has("identifier"))
5018      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5019    if (json.has("version"))
5020      res.setVersionElement(parseString(json.get("version").getAsString()));
5021    if (json.has("_version"))
5022      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5023    if (json.has("name"))
5024      res.setNameElement(parseString(json.get("name").getAsString()));
5025    if (json.has("_name"))
5026      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5027    if (json.has("title"))
5028      res.setTitleElement(parseString(json.get("title").getAsString()));
5029    if (json.has("_title"))
5030      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5031    if (json.has("status"))
5032      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5033    if (json.has("_status"))
5034      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5035    if (json.has("experimental"))
5036      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5037    if (json.has("_experimental"))
5038      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5039    if (json.has("date"))
5040      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5041    if (json.has("_date"))
5042      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5043    if (json.has("publisher"))
5044      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5045    if (json.has("_publisher"))
5046      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5047    if (json.has("contact")) {
5048      JsonArray array = json.getAsJsonArray("contact");
5049      for (int i = 0; i < array.size(); i++) {
5050        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5051      }
5052    };
5053    if (json.has("description"))
5054      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5055    if (json.has("_description"))
5056      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5057    if (json.has("useContext")) {
5058      JsonArray array = json.getAsJsonArray("useContext");
5059      for (int i = 0; i < array.size(); i++) {
5060        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5061      }
5062    };
5063    if (json.has("jurisdiction")) {
5064      JsonArray array = json.getAsJsonArray("jurisdiction");
5065      for (int i = 0; i < array.size(); i++) {
5066        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5067      }
5068    };
5069    if (json.has("purpose"))
5070      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5071    if (json.has("_purpose"))
5072      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5073    if (json.has("copyright"))
5074      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5075    if (json.has("_copyright"))
5076      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5077    if (json.has("caseSensitive"))
5078      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
5079    if (json.has("_caseSensitive"))
5080      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
5081    if (json.has("valueSet"))
5082      res.setValueSetElement(parseUri(json.get("valueSet").getAsString()));
5083    if (json.has("_valueSet"))
5084      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
5085    if (json.has("hierarchyMeaning"))
5086      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
5087    if (json.has("_hierarchyMeaning"))
5088      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
5089    if (json.has("compositional"))
5090      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
5091    if (json.has("_compositional"))
5092      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
5093    if (json.has("versionNeeded"))
5094      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
5095    if (json.has("_versionNeeded"))
5096      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
5097    if (json.has("content"))
5098      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
5099    if (json.has("_content"))
5100      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
5101    if (json.has("count"))
5102      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
5103    if (json.has("_count"))
5104      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
5105    if (json.has("filter")) {
5106      JsonArray array = json.getAsJsonArray("filter");
5107      for (int i = 0; i < array.size(); i++) {
5108        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
5109      }
5110    };
5111    if (json.has("property")) {
5112      JsonArray array = json.getAsJsonArray("property");
5113      for (int i = 0; i < array.size(); i++) {
5114        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
5115      }
5116    };
5117    if (json.has("concept")) {
5118      JsonArray array = json.getAsJsonArray("concept");
5119      for (int i = 0; i < array.size(); i++) {
5120        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
5121      }
5122    };
5123  }
5124
5125  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5126    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
5127    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
5128    return res;
5129  }
5130
5131  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
5132    parseBackboneProperties(json, res);
5133    if (json.has("code"))
5134      res.setCodeElement(parseCode(json.get("code").getAsString()));
5135    if (json.has("_code"))
5136      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5137    if (json.has("description"))
5138      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5139    if (json.has("_description"))
5140      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5141    if (json.has("operator")) {
5142      JsonArray array = json.getAsJsonArray("operator");
5143      for (int i = 0; i < array.size(); i++) {
5144        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5145      }
5146    };
5147    if (json.has("_operator")) {
5148      JsonArray array = json.getAsJsonArray("_operator");
5149      for (int i = 0; i < array.size(); i++) {
5150        if (i == res.getOperator().size())
5151          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5152        if (array.get(i) instanceof JsonObject) 
5153          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
5154      }
5155    };
5156    if (json.has("value"))
5157      res.setValueElement(parseString(json.get("value").getAsString()));
5158    if (json.has("_value"))
5159      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5160  }
5161
5162  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5163    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
5164    parseCodeSystemPropertyComponentProperties(json, owner, res);
5165    return res;
5166  }
5167
5168  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
5169    parseBackboneProperties(json, res);
5170    if (json.has("code"))
5171      res.setCodeElement(parseCode(json.get("code").getAsString()));
5172    if (json.has("_code"))
5173      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5174    if (json.has("uri"))
5175      res.setUriElement(parseUri(json.get("uri").getAsString()));
5176    if (json.has("_uri"))
5177      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
5178    if (json.has("description"))
5179      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5180    if (json.has("_description"))
5181      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5182    if (json.has("type"))
5183      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
5184    if (json.has("_type"))
5185      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5186  }
5187
5188  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5189    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
5190    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
5191    return res;
5192  }
5193
5194  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
5195    parseBackboneProperties(json, res);
5196    if (json.has("code"))
5197      res.setCodeElement(parseCode(json.get("code").getAsString()));
5198    if (json.has("_code"))
5199      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5200    if (json.has("display"))
5201      res.setDisplayElement(parseString(json.get("display").getAsString()));
5202    if (json.has("_display"))
5203      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5204    if (json.has("definition"))
5205      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
5206    if (json.has("_definition"))
5207      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
5208    if (json.has("designation")) {
5209      JsonArray array = json.getAsJsonArray("designation");
5210      for (int i = 0; i < array.size(); i++) {
5211        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
5212      }
5213    };
5214    if (json.has("property")) {
5215      JsonArray array = json.getAsJsonArray("property");
5216      for (int i = 0; i < array.size(); i++) {
5217        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
5218      }
5219    };
5220    if (json.has("concept")) {
5221      JsonArray array = json.getAsJsonArray("concept");
5222      for (int i = 0; i < array.size(); i++) {
5223        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
5224      }
5225    };
5226  }
5227
5228  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5229    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
5230    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
5231    return res;
5232  }
5233
5234  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
5235    parseBackboneProperties(json, res);
5236    if (json.has("language"))
5237      res.setLanguageElement(parseCode(json.get("language").getAsString()));
5238    if (json.has("_language"))
5239      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
5240    if (json.has("use"))
5241      res.setUse(parseCoding(json.getAsJsonObject("use")));
5242    if (json.has("value"))
5243      res.setValueElement(parseString(json.get("value").getAsString()));
5244    if (json.has("_value"))
5245      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5246  }
5247
5248  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5249    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
5250    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
5251    return res;
5252  }
5253
5254  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
5255    parseBackboneProperties(json, res);
5256    if (json.has("code"))
5257      res.setCodeElement(parseCode(json.get("code").getAsString()));
5258    if (json.has("_code"))
5259      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5260    Type value = parseType("value", json);
5261    if (value != null)
5262      res.setValue(value);
5263  }
5264
5265  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
5266    Communication res = new Communication();
5267    parseCommunicationProperties(json, res);
5268    return res;
5269  }
5270
5271  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
5272    parseDomainResourceProperties(json, res);
5273    if (json.has("identifier")) {
5274      JsonArray array = json.getAsJsonArray("identifier");
5275      for (int i = 0; i < array.size(); i++) {
5276        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5277      }
5278    };
5279    if (json.has("definition")) {
5280      JsonArray array = json.getAsJsonArray("definition");
5281      for (int i = 0; i < array.size(); i++) {
5282        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
5283      }
5284    };
5285    if (json.has("basedOn")) {
5286      JsonArray array = json.getAsJsonArray("basedOn");
5287      for (int i = 0; i < array.size(); i++) {
5288        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5289      }
5290    };
5291    if (json.has("partOf")) {
5292      JsonArray array = json.getAsJsonArray("partOf");
5293      for (int i = 0; i < array.size(); i++) {
5294        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5295      }
5296    };
5297    if (json.has("status"))
5298      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
5299    if (json.has("_status"))
5300      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5301    if (json.has("notDone"))
5302      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
5303    if (json.has("_notDone"))
5304      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
5305    if (json.has("notDoneReason"))
5306      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
5307    if (json.has("category")) {
5308      JsonArray array = json.getAsJsonArray("category");
5309      for (int i = 0; i < array.size(); i++) {
5310        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5311      }
5312    };
5313    if (json.has("medium")) {
5314      JsonArray array = json.getAsJsonArray("medium");
5315      for (int i = 0; i < array.size(); i++) {
5316        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5317      }
5318    };
5319    if (json.has("subject"))
5320      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5321    if (json.has("recipient")) {
5322      JsonArray array = json.getAsJsonArray("recipient");
5323      for (int i = 0; i < array.size(); i++) {
5324        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5325      }
5326    };
5327    if (json.has("topic")) {
5328      JsonArray array = json.getAsJsonArray("topic");
5329      for (int i = 0; i < array.size(); i++) {
5330        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5331      }
5332    };
5333    if (json.has("context"))
5334      res.setContext(parseReference(json.getAsJsonObject("context")));
5335    if (json.has("sent"))
5336      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
5337    if (json.has("_sent"))
5338      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
5339    if (json.has("received"))
5340      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
5341    if (json.has("_received"))
5342      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
5343    if (json.has("sender"))
5344      res.setSender(parseReference(json.getAsJsonObject("sender")));
5345    if (json.has("reasonCode")) {
5346      JsonArray array = json.getAsJsonArray("reasonCode");
5347      for (int i = 0; i < array.size(); i++) {
5348        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5349      }
5350    };
5351    if (json.has("reasonReference")) {
5352      JsonArray array = json.getAsJsonArray("reasonReference");
5353      for (int i = 0; i < array.size(); i++) {
5354        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5355      }
5356    };
5357    if (json.has("payload")) {
5358      JsonArray array = json.getAsJsonArray("payload");
5359      for (int i = 0; i < array.size(); i++) {
5360        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
5361      }
5362    };
5363    if (json.has("note")) {
5364      JsonArray array = json.getAsJsonArray("note");
5365      for (int i = 0; i < array.size(); i++) {
5366        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5367      }
5368    };
5369  }
5370
5371  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
5372    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
5373    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
5374    return res;
5375  }
5376
5377  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
5378    parseBackboneProperties(json, res);
5379    Type content = parseType("content", json);
5380    if (content != null)
5381      res.setContent(content);
5382  }
5383
5384  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
5385    CommunicationRequest res = new CommunicationRequest();
5386    parseCommunicationRequestProperties(json, res);
5387    return res;
5388  }
5389
5390  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
5391    parseDomainResourceProperties(json, res);
5392    if (json.has("identifier")) {
5393      JsonArray array = json.getAsJsonArray("identifier");
5394      for (int i = 0; i < array.size(); i++) {
5395        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5396      }
5397    };
5398    if (json.has("basedOn")) {
5399      JsonArray array = json.getAsJsonArray("basedOn");
5400      for (int i = 0; i < array.size(); i++) {
5401        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5402      }
5403    };
5404    if (json.has("replaces")) {
5405      JsonArray array = json.getAsJsonArray("replaces");
5406      for (int i = 0; i < array.size(); i++) {
5407        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5408      }
5409    };
5410    if (json.has("groupIdentifier"))
5411      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
5412    if (json.has("status"))
5413      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
5414    if (json.has("_status"))
5415      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5416    if (json.has("category")) {
5417      JsonArray array = json.getAsJsonArray("category");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5420      }
5421    };
5422    if (json.has("priority"))
5423      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
5424    if (json.has("_priority"))
5425      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5426    if (json.has("medium")) {
5427      JsonArray array = json.getAsJsonArray("medium");
5428      for (int i = 0; i < array.size(); i++) {
5429        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5430      }
5431    };
5432    if (json.has("subject"))
5433      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5434    if (json.has("recipient")) {
5435      JsonArray array = json.getAsJsonArray("recipient");
5436      for (int i = 0; i < array.size(); i++) {
5437        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5438      }
5439    };
5440    if (json.has("topic")) {
5441      JsonArray array = json.getAsJsonArray("topic");
5442      for (int i = 0; i < array.size(); i++) {
5443        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5444      }
5445    };
5446    if (json.has("context"))
5447      res.setContext(parseReference(json.getAsJsonObject("context")));
5448    if (json.has("payload")) {
5449      JsonArray array = json.getAsJsonArray("payload");
5450      for (int i = 0; i < array.size(); i++) {
5451        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
5452      }
5453    };
5454    Type occurrence = parseType("occurrence", json);
5455    if (occurrence != null)
5456      res.setOccurrence(occurrence);
5457    if (json.has("authoredOn"))
5458      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
5459    if (json.has("_authoredOn"))
5460      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
5461    if (json.has("sender"))
5462      res.setSender(parseReference(json.getAsJsonObject("sender")));
5463    if (json.has("requester"))
5464      res.setRequester(parseCommunicationRequestCommunicationRequestRequesterComponent(json.getAsJsonObject("requester"), res));
5465    if (json.has("reasonCode")) {
5466      JsonArray array = json.getAsJsonArray("reasonCode");
5467      for (int i = 0; i < array.size(); i++) {
5468        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5469      }
5470    };
5471    if (json.has("reasonReference")) {
5472      JsonArray array = json.getAsJsonArray("reasonReference");
5473      for (int i = 0; i < array.size(); i++) {
5474        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5475      }
5476    };
5477    if (json.has("note")) {
5478      JsonArray array = json.getAsJsonArray("note");
5479      for (int i = 0; i < array.size(); i++) {
5480        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5481      }
5482    };
5483  }
5484
5485  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5486    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
5487    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
5488    return res;
5489  }
5490
5491  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
5492    parseBackboneProperties(json, res);
5493    Type content = parseType("content", json);
5494    if (content != null)
5495      res.setContent(content);
5496  }
5497
5498  protected CommunicationRequest.CommunicationRequestRequesterComponent parseCommunicationRequestCommunicationRequestRequesterComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5499    CommunicationRequest.CommunicationRequestRequesterComponent res = new CommunicationRequest.CommunicationRequestRequesterComponent();
5500    parseCommunicationRequestCommunicationRequestRequesterComponentProperties(json, owner, res);
5501    return res;
5502  }
5503
5504  protected void parseCommunicationRequestCommunicationRequestRequesterComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
5505    parseBackboneProperties(json, res);
5506    if (json.has("agent"))
5507      res.setAgent(parseReference(json.getAsJsonObject("agent")));
5508    if (json.has("onBehalfOf"))
5509      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
5510  }
5511
5512  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
5513    CompartmentDefinition res = new CompartmentDefinition();
5514    parseCompartmentDefinitionProperties(json, res);
5515    return res;
5516  }
5517
5518  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
5519    parseDomainResourceProperties(json, res);
5520    if (json.has("url"))
5521      res.setUrlElement(parseUri(json.get("url").getAsString()));
5522    if (json.has("_url"))
5523      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5524    if (json.has("name"))
5525      res.setNameElement(parseString(json.get("name").getAsString()));
5526    if (json.has("_name"))
5527      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5528    if (json.has("title"))
5529      res.setTitleElement(parseString(json.get("title").getAsString()));
5530    if (json.has("_title"))
5531      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5532    if (json.has("status"))
5533      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5534    if (json.has("_status"))
5535      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5536    if (json.has("experimental"))
5537      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5538    if (json.has("_experimental"))
5539      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5540    if (json.has("date"))
5541      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5542    if (json.has("_date"))
5543      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5544    if (json.has("publisher"))
5545      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5546    if (json.has("_publisher"))
5547      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5548    if (json.has("contact")) {
5549      JsonArray array = json.getAsJsonArray("contact");
5550      for (int i = 0; i < array.size(); i++) {
5551        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5552      }
5553    };
5554    if (json.has("description"))
5555      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5556    if (json.has("_description"))
5557      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5558    if (json.has("purpose"))
5559      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5560    if (json.has("_purpose"))
5561      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5562    if (json.has("useContext")) {
5563      JsonArray array = json.getAsJsonArray("useContext");
5564      for (int i = 0; i < array.size(); i++) {
5565        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5566      }
5567    };
5568    if (json.has("jurisdiction")) {
5569      JsonArray array = json.getAsJsonArray("jurisdiction");
5570      for (int i = 0; i < array.size(); i++) {
5571        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5572      }
5573    };
5574    if (json.has("code"))
5575      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
5576    if (json.has("_code"))
5577      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5578    if (json.has("search"))
5579      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
5580    if (json.has("_search"))
5581      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
5582    if (json.has("resource")) {
5583      JsonArray array = json.getAsJsonArray("resource");
5584      for (int i = 0; i < array.size(); i++) {
5585        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
5586      }
5587    };
5588  }
5589
5590  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
5591    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
5592    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
5593    return res;
5594  }
5595
5596  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
5597    parseBackboneProperties(json, res);
5598    if (json.has("code"))
5599      res.setCodeElement(parseCode(json.get("code").getAsString()));
5600    if (json.has("_code"))
5601      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5602    if (json.has("param")) {
5603      JsonArray array = json.getAsJsonArray("param");
5604      for (int i = 0; i < array.size(); i++) {
5605        res.getParam().add(parseString(array.get(i).getAsString()));
5606      }
5607    };
5608    if (json.has("_param")) {
5609      JsonArray array = json.getAsJsonArray("_param");
5610      for (int i = 0; i < array.size(); i++) {
5611        if (i == res.getParam().size())
5612          res.getParam().add(parseString(null));
5613        if (array.get(i) instanceof JsonObject) 
5614          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
5615      }
5616    };
5617    if (json.has("documentation"))
5618      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
5619    if (json.has("_documentation"))
5620      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
5621  }
5622
5623  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
5624    Composition res = new Composition();
5625    parseCompositionProperties(json, res);
5626    return res;
5627  }
5628
5629  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
5630    parseDomainResourceProperties(json, res);
5631    if (json.has("identifier"))
5632      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5633    if (json.has("status"))
5634      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
5635    if (json.has("_status"))
5636      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5637    if (json.has("type"))
5638      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5639    if (json.has("class"))
5640      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
5641    if (json.has("subject"))
5642      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5643    if (json.has("encounter"))
5644      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5645    if (json.has("date"))
5646      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5647    if (json.has("_date"))
5648      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5649    if (json.has("author")) {
5650      JsonArray array = json.getAsJsonArray("author");
5651      for (int i = 0; i < array.size(); i++) {
5652        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5653      }
5654    };
5655    if (json.has("title"))
5656      res.setTitleElement(parseString(json.get("title").getAsString()));
5657    if (json.has("_title"))
5658      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5659    if (json.has("confidentiality"))
5660      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
5661    if (json.has("_confidentiality"))
5662      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
5663    if (json.has("attester")) {
5664      JsonArray array = json.getAsJsonArray("attester");
5665      for (int i = 0; i < array.size(); i++) {
5666        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
5667      }
5668    };
5669    if (json.has("custodian"))
5670      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
5671    if (json.has("relatesTo")) {
5672      JsonArray array = json.getAsJsonArray("relatesTo");
5673      for (int i = 0; i < array.size(); i++) {
5674        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
5675      }
5676    };
5677    if (json.has("event")) {
5678      JsonArray array = json.getAsJsonArray("event");
5679      for (int i = 0; i < array.size(); i++) {
5680        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
5681      }
5682    };
5683    if (json.has("section")) {
5684      JsonArray array = json.getAsJsonArray("section");
5685      for (int i = 0; i < array.size(); i++) {
5686        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
5687      }
5688    };
5689  }
5690
5691  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5692    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
5693    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
5694    return res;
5695  }
5696
5697  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
5698    parseBackboneProperties(json, res);
5699    if (json.has("mode")) {
5700      JsonArray array = json.getAsJsonArray("mode");
5701      for (int i = 0; i < array.size(); i++) {
5702        res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5703      }
5704    };
5705    if (json.has("_mode")) {
5706      JsonArray array = json.getAsJsonArray("_mode");
5707      for (int i = 0; i < array.size(); i++) {
5708        if (i == res.getMode().size())
5709          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5710        if (array.get(i) instanceof JsonObject) 
5711          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
5712      }
5713    };
5714    if (json.has("time"))
5715      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
5716    if (json.has("_time"))
5717      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
5718    if (json.has("party"))
5719      res.setParty(parseReference(json.getAsJsonObject("party")));
5720  }
5721
5722  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5723    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
5724    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
5725    return res;
5726  }
5727
5728  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
5729    parseBackboneProperties(json, res);
5730    if (json.has("code"))
5731      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
5732    if (json.has("_code"))
5733      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5734    Type target = parseType("target", json);
5735    if (target != null)
5736      res.setTarget(target);
5737  }
5738
5739  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5740    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
5741    parseCompositionCompositionEventComponentProperties(json, owner, res);
5742    return res;
5743  }
5744
5745  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
5746    parseBackboneProperties(json, res);
5747    if (json.has("code")) {
5748      JsonArray array = json.getAsJsonArray("code");
5749      for (int i = 0; i < array.size(); i++) {
5750        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5751      }
5752    };
5753    if (json.has("period"))
5754      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5755    if (json.has("detail")) {
5756      JsonArray array = json.getAsJsonArray("detail");
5757      for (int i = 0; i < array.size(); i++) {
5758        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
5759      }
5760    };
5761  }
5762
5763  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5764    Composition.SectionComponent res = new Composition.SectionComponent();
5765    parseCompositionSectionComponentProperties(json, owner, res);
5766    return res;
5767  }
5768
5769  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
5770    parseBackboneProperties(json, res);
5771    if (json.has("title"))
5772      res.setTitleElement(parseString(json.get("title").getAsString()));
5773    if (json.has("_title"))
5774      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5775    if (json.has("code"))
5776      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5777    if (json.has("text"))
5778      res.setText(parseNarrative(json.getAsJsonObject("text")));
5779    if (json.has("mode"))
5780      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
5781    if (json.has("_mode"))
5782      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
5783    if (json.has("orderedBy"))
5784      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
5785    if (json.has("entry")) {
5786      JsonArray array = json.getAsJsonArray("entry");
5787      for (int i = 0; i < array.size(); i++) {
5788        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
5789      }
5790    };
5791    if (json.has("emptyReason"))
5792      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
5793    if (json.has("section")) {
5794      JsonArray array = json.getAsJsonArray("section");
5795      for (int i = 0; i < array.size(); i++) {
5796        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
5797      }
5798    };
5799  }
5800
5801  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
5802    ConceptMap res = new ConceptMap();
5803    parseConceptMapProperties(json, res);
5804    return res;
5805  }
5806
5807  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
5808    parseDomainResourceProperties(json, res);
5809    if (json.has("url"))
5810      res.setUrlElement(parseUri(json.get("url").getAsString()));
5811    if (json.has("_url"))
5812      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5813    if (json.has("identifier"))
5814      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5815    if (json.has("version"))
5816      res.setVersionElement(parseString(json.get("version").getAsString()));
5817    if (json.has("_version"))
5818      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5819    if (json.has("name"))
5820      res.setNameElement(parseString(json.get("name").getAsString()));
5821    if (json.has("_name"))
5822      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5823    if (json.has("title"))
5824      res.setTitleElement(parseString(json.get("title").getAsString()));
5825    if (json.has("_title"))
5826      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5827    if (json.has("status"))
5828      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5829    if (json.has("_status"))
5830      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5831    if (json.has("experimental"))
5832      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5833    if (json.has("_experimental"))
5834      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5835    if (json.has("date"))
5836      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5837    if (json.has("_date"))
5838      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5839    if (json.has("publisher"))
5840      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5841    if (json.has("_publisher"))
5842      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5843    if (json.has("contact")) {
5844      JsonArray array = json.getAsJsonArray("contact");
5845      for (int i = 0; i < array.size(); i++) {
5846        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5847      }
5848    };
5849    if (json.has("description"))
5850      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5851    if (json.has("_description"))
5852      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5853    if (json.has("useContext")) {
5854      JsonArray array = json.getAsJsonArray("useContext");
5855      for (int i = 0; i < array.size(); i++) {
5856        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5857      }
5858    };
5859    if (json.has("jurisdiction")) {
5860      JsonArray array = json.getAsJsonArray("jurisdiction");
5861      for (int i = 0; i < array.size(); i++) {
5862        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5863      }
5864    };
5865    if (json.has("purpose"))
5866      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5867    if (json.has("_purpose"))
5868      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5869    if (json.has("copyright"))
5870      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5871    if (json.has("_copyright"))
5872      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5873    Type source = parseType("source", json);
5874    if (source != null)
5875      res.setSource(source);
5876    Type target = parseType("target", json);
5877    if (target != null)
5878      res.setTarget(target);
5879    if (json.has("group")) {
5880      JsonArray array = json.getAsJsonArray("group");
5881      for (int i = 0; i < array.size(); i++) {
5882        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
5883      }
5884    };
5885  }
5886
5887  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5888    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
5889    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
5890    return res;
5891  }
5892
5893  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
5894    parseBackboneProperties(json, res);
5895    if (json.has("source"))
5896      res.setSourceElement(parseUri(json.get("source").getAsString()));
5897    if (json.has("_source"))
5898      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
5899    if (json.has("sourceVersion"))
5900      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
5901    if (json.has("_sourceVersion"))
5902      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
5903    if (json.has("target"))
5904      res.setTargetElement(parseUri(json.get("target").getAsString()));
5905    if (json.has("_target"))
5906      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
5907    if (json.has("targetVersion"))
5908      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
5909    if (json.has("_targetVersion"))
5910      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
5911    if (json.has("element")) {
5912      JsonArray array = json.getAsJsonArray("element");
5913      for (int i = 0; i < array.size(); i++) {
5914        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
5915      }
5916    };
5917    if (json.has("unmapped"))
5918      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
5919  }
5920
5921  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5922    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
5923    parseConceptMapSourceElementComponentProperties(json, owner, res);
5924    return res;
5925  }
5926
5927  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
5928    parseBackboneProperties(json, res);
5929    if (json.has("code"))
5930      res.setCodeElement(parseCode(json.get("code").getAsString()));
5931    if (json.has("_code"))
5932      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5933    if (json.has("display"))
5934      res.setDisplayElement(parseString(json.get("display").getAsString()));
5935    if (json.has("_display"))
5936      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5937    if (json.has("target")) {
5938      JsonArray array = json.getAsJsonArray("target");
5939      for (int i = 0; i < array.size(); i++) {
5940        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
5941      }
5942    };
5943  }
5944
5945  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5946    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
5947    parseConceptMapTargetElementComponentProperties(json, owner, res);
5948    return res;
5949  }
5950
5951  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
5952    parseBackboneProperties(json, res);
5953    if (json.has("code"))
5954      res.setCodeElement(parseCode(json.get("code").getAsString()));
5955    if (json.has("_code"))
5956      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5957    if (json.has("display"))
5958      res.setDisplayElement(parseString(json.get("display").getAsString()));
5959    if (json.has("_display"))
5960      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5961    if (json.has("equivalence"))
5962      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
5963    if (json.has("_equivalence"))
5964      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
5965    if (json.has("comment"))
5966      res.setCommentElement(parseString(json.get("comment").getAsString()));
5967    if (json.has("_comment"))
5968      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
5969    if (json.has("dependsOn")) {
5970      JsonArray array = json.getAsJsonArray("dependsOn");
5971      for (int i = 0; i < array.size(); i++) {
5972        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
5973      }
5974    };
5975    if (json.has("product")) {
5976      JsonArray array = json.getAsJsonArray("product");
5977      for (int i = 0; i < array.size(); i++) {
5978        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
5979      }
5980    };
5981  }
5982
5983  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5984    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
5985    parseConceptMapOtherElementComponentProperties(json, owner, res);
5986    return res;
5987  }
5988
5989  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
5990    parseBackboneProperties(json, res);
5991    if (json.has("property"))
5992      res.setPropertyElement(parseUri(json.get("property").getAsString()));
5993    if (json.has("_property"))
5994      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
5995    if (json.has("system"))
5996      res.setSystemElement(parseUri(json.get("system").getAsString()));
5997    if (json.has("_system"))
5998      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
5999    if (json.has("code"))
6000      res.setCodeElement(parseString(json.get("code").getAsString()));
6001    if (json.has("_code"))
6002      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6003    if (json.has("display"))
6004      res.setDisplayElement(parseString(json.get("display").getAsString()));
6005    if (json.has("_display"))
6006      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6007  }
6008
6009  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6010    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
6011    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
6012    return res;
6013  }
6014
6015  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
6016    parseBackboneProperties(json, res);
6017    if (json.has("mode"))
6018      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
6019    if (json.has("_mode"))
6020      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6021    if (json.has("code"))
6022      res.setCodeElement(parseCode(json.get("code").getAsString()));
6023    if (json.has("_code"))
6024      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6025    if (json.has("display"))
6026      res.setDisplayElement(parseString(json.get("display").getAsString()));
6027    if (json.has("_display"))
6028      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6029    if (json.has("url"))
6030      res.setUrlElement(parseUri(json.get("url").getAsString()));
6031    if (json.has("_url"))
6032      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6033  }
6034
6035  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
6036    Condition res = new Condition();
6037    parseConditionProperties(json, res);
6038    return res;
6039  }
6040
6041  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
6042    parseDomainResourceProperties(json, res);
6043    if (json.has("identifier")) {
6044      JsonArray array = json.getAsJsonArray("identifier");
6045      for (int i = 0; i < array.size(); i++) {
6046        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6047      }
6048    };
6049    if (json.has("clinicalStatus"))
6050      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
6051    if (json.has("_clinicalStatus"))
6052      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
6053    if (json.has("verificationStatus"))
6054      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
6055    if (json.has("_verificationStatus"))
6056      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
6057    if (json.has("category")) {
6058      JsonArray array = json.getAsJsonArray("category");
6059      for (int i = 0; i < array.size(); i++) {
6060        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6061      }
6062    };
6063    if (json.has("severity"))
6064      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
6065    if (json.has("code"))
6066      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6067    if (json.has("bodySite")) {
6068      JsonArray array = json.getAsJsonArray("bodySite");
6069      for (int i = 0; i < array.size(); i++) {
6070        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6071      }
6072    };
6073    if (json.has("subject"))
6074      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6075    if (json.has("context"))
6076      res.setContext(parseReference(json.getAsJsonObject("context")));
6077    Type onset = parseType("onset", json);
6078    if (onset != null)
6079      res.setOnset(onset);
6080    Type abatement = parseType("abatement", json);
6081    if (abatement != null)
6082      res.setAbatement(abatement);
6083    if (json.has("assertedDate"))
6084      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
6085    if (json.has("_assertedDate"))
6086      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
6087    if (json.has("asserter"))
6088      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
6089    if (json.has("stage"))
6090      res.setStage(parseConditionConditionStageComponent(json.getAsJsonObject("stage"), res));
6091    if (json.has("evidence")) {
6092      JsonArray array = json.getAsJsonArray("evidence");
6093      for (int i = 0; i < array.size(); i++) {
6094        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
6095      }
6096    };
6097    if (json.has("note")) {
6098      JsonArray array = json.getAsJsonArray("note");
6099      for (int i = 0; i < array.size(); i++) {
6100        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6101      }
6102    };
6103  }
6104
6105  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6106    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
6107    parseConditionConditionStageComponentProperties(json, owner, res);
6108    return res;
6109  }
6110
6111  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
6112    parseBackboneProperties(json, res);
6113    if (json.has("summary"))
6114      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
6115    if (json.has("assessment")) {
6116      JsonArray array = json.getAsJsonArray("assessment");
6117      for (int i = 0; i < array.size(); i++) {
6118        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6119      }
6120    };
6121  }
6122
6123  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6124    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
6125    parseConditionConditionEvidenceComponentProperties(json, owner, res);
6126    return res;
6127  }
6128
6129  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
6130    parseBackboneProperties(json, res);
6131    if (json.has("code")) {
6132      JsonArray array = json.getAsJsonArray("code");
6133      for (int i = 0; i < array.size(); i++) {
6134        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6135      }
6136    };
6137    if (json.has("detail")) {
6138      JsonArray array = json.getAsJsonArray("detail");
6139      for (int i = 0; i < array.size(); i++) {
6140        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6141      }
6142    };
6143  }
6144
6145  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
6146    Consent res = new Consent();
6147    parseConsentProperties(json, res);
6148    return res;
6149  }
6150
6151  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
6152    parseDomainResourceProperties(json, res);
6153    if (json.has("identifier"))
6154      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6155    if (json.has("status"))
6156      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
6157    if (json.has("_status"))
6158      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6159    if (json.has("category")) {
6160      JsonArray array = json.getAsJsonArray("category");
6161      for (int i = 0; i < array.size(); i++) {
6162        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6163      }
6164    };
6165    if (json.has("patient"))
6166      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6167    if (json.has("period"))
6168      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6169    if (json.has("dateTime"))
6170      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
6171    if (json.has("_dateTime"))
6172      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
6173    if (json.has("consentingParty")) {
6174      JsonArray array = json.getAsJsonArray("consentingParty");
6175      for (int i = 0; i < array.size(); i++) {
6176        res.getConsentingParty().add(parseReference(array.get(i).getAsJsonObject()));
6177      }
6178    };
6179    if (json.has("actor")) {
6180      JsonArray array = json.getAsJsonArray("actor");
6181      for (int i = 0; i < array.size(); i++) {
6182        res.getActor().add(parseConsentConsentActorComponent(array.get(i).getAsJsonObject(), res));
6183      }
6184    };
6185    if (json.has("action")) {
6186      JsonArray array = json.getAsJsonArray("action");
6187      for (int i = 0; i < array.size(); i++) {
6188        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6189      }
6190    };
6191    if (json.has("organization")) {
6192      JsonArray array = json.getAsJsonArray("organization");
6193      for (int i = 0; i < array.size(); i++) {
6194        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
6195      }
6196    };
6197    Type source = parseType("source", json);
6198    if (source != null)
6199      res.setSource(source);
6200    if (json.has("policy")) {
6201      JsonArray array = json.getAsJsonArray("policy");
6202      for (int i = 0; i < array.size(); i++) {
6203        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
6204      }
6205    };
6206    if (json.has("policyRule"))
6207      res.setPolicyRuleElement(parseUri(json.get("policyRule").getAsString()));
6208    if (json.has("_policyRule"))
6209      parseElementProperties(json.getAsJsonObject("_policyRule"), res.getPolicyRuleElement());
6210    if (json.has("securityLabel")) {
6211      JsonArray array = json.getAsJsonArray("securityLabel");
6212      for (int i = 0; i < array.size(); i++) {
6213        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6214      }
6215    };
6216    if (json.has("purpose")) {
6217      JsonArray array = json.getAsJsonArray("purpose");
6218      for (int i = 0; i < array.size(); i++) {
6219        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6220      }
6221    };
6222    if (json.has("dataPeriod"))
6223      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
6224    if (json.has("data")) {
6225      JsonArray array = json.getAsJsonArray("data");
6226      for (int i = 0; i < array.size(); i++) {
6227        res.getData().add(parseConsentConsentDataComponent(array.get(i).getAsJsonObject(), res));
6228      }
6229    };
6230    if (json.has("except")) {
6231      JsonArray array = json.getAsJsonArray("except");
6232      for (int i = 0; i < array.size(); i++) {
6233        res.getExcept().add(parseConsentExceptComponent(array.get(i).getAsJsonObject(), res));
6234      }
6235    };
6236  }
6237
6238  protected Consent.ConsentActorComponent parseConsentConsentActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6239    Consent.ConsentActorComponent res = new Consent.ConsentActorComponent();
6240    parseConsentConsentActorComponentProperties(json, owner, res);
6241    return res;
6242  }
6243
6244  protected void parseConsentConsentActorComponentProperties(JsonObject json, Consent owner, Consent.ConsentActorComponent res) throws IOException, FHIRFormatError {
6245    parseBackboneProperties(json, res);
6246    if (json.has("role"))
6247      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
6248    if (json.has("reference"))
6249      res.setReference(parseReference(json.getAsJsonObject("reference")));
6250  }
6251
6252  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6253    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
6254    parseConsentConsentPolicyComponentProperties(json, owner, res);
6255    return res;
6256  }
6257
6258  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
6259    parseBackboneProperties(json, res);
6260    if (json.has("authority"))
6261      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
6262    if (json.has("_authority"))
6263      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
6264    if (json.has("uri"))
6265      res.setUriElement(parseUri(json.get("uri").getAsString()));
6266    if (json.has("_uri"))
6267      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6268  }
6269
6270  protected Consent.ConsentDataComponent parseConsentConsentDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6271    Consent.ConsentDataComponent res = new Consent.ConsentDataComponent();
6272    parseConsentConsentDataComponentProperties(json, owner, res);
6273    return res;
6274  }
6275
6276  protected void parseConsentConsentDataComponentProperties(JsonObject json, Consent owner, Consent.ConsentDataComponent res) throws IOException, FHIRFormatError {
6277    parseBackboneProperties(json, res);
6278    if (json.has("meaning"))
6279      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6280    if (json.has("_meaning"))
6281      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
6282    if (json.has("reference"))
6283      res.setReference(parseReference(json.getAsJsonObject("reference")));
6284  }
6285
6286  protected Consent.ExceptComponent parseConsentExceptComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6287    Consent.ExceptComponent res = new Consent.ExceptComponent();
6288    parseConsentExceptComponentProperties(json, owner, res);
6289    return res;
6290  }
6291
6292  protected void parseConsentExceptComponentProperties(JsonObject json, Consent owner, Consent.ExceptComponent res) throws IOException, FHIRFormatError {
6293    parseBackboneProperties(json, res);
6294    if (json.has("type"))
6295      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentExceptType.NULL, new Consent.ConsentExceptTypeEnumFactory()));
6296    if (json.has("_type"))
6297      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6298    if (json.has("period"))
6299      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6300    if (json.has("actor")) {
6301      JsonArray array = json.getAsJsonArray("actor");
6302      for (int i = 0; i < array.size(); i++) {
6303        res.getActor().add(parseConsentExceptActorComponent(array.get(i).getAsJsonObject(), owner));
6304      }
6305    };
6306    if (json.has("action")) {
6307      JsonArray array = json.getAsJsonArray("action");
6308      for (int i = 0; i < array.size(); i++) {
6309        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6310      }
6311    };
6312    if (json.has("securityLabel")) {
6313      JsonArray array = json.getAsJsonArray("securityLabel");
6314      for (int i = 0; i < array.size(); i++) {
6315        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6316      }
6317    };
6318    if (json.has("purpose")) {
6319      JsonArray array = json.getAsJsonArray("purpose");
6320      for (int i = 0; i < array.size(); i++) {
6321        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6322      }
6323    };
6324    if (json.has("class")) {
6325      JsonArray array = json.getAsJsonArray("class");
6326      for (int i = 0; i < array.size(); i++) {
6327        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
6328      }
6329    };
6330    if (json.has("code")) {
6331      JsonArray array = json.getAsJsonArray("code");
6332      for (int i = 0; i < array.size(); i++) {
6333        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
6334      }
6335    };
6336    if (json.has("dataPeriod"))
6337      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
6338    if (json.has("data")) {
6339      JsonArray array = json.getAsJsonArray("data");
6340      for (int i = 0; i < array.size(); i++) {
6341        res.getData().add(parseConsentExceptDataComponent(array.get(i).getAsJsonObject(), owner));
6342      }
6343    };
6344  }
6345
6346  protected Consent.ExceptActorComponent parseConsentExceptActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6347    Consent.ExceptActorComponent res = new Consent.ExceptActorComponent();
6348    parseConsentExceptActorComponentProperties(json, owner, res);
6349    return res;
6350  }
6351
6352  protected void parseConsentExceptActorComponentProperties(JsonObject json, Consent owner, Consent.ExceptActorComponent res) throws IOException, FHIRFormatError {
6353    parseBackboneProperties(json, res);
6354    if (json.has("role"))
6355      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
6356    if (json.has("reference"))
6357      res.setReference(parseReference(json.getAsJsonObject("reference")));
6358  }
6359
6360  protected Consent.ExceptDataComponent parseConsentExceptDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6361    Consent.ExceptDataComponent res = new Consent.ExceptDataComponent();
6362    parseConsentExceptDataComponentProperties(json, owner, res);
6363    return res;
6364  }
6365
6366  protected void parseConsentExceptDataComponentProperties(JsonObject json, Consent owner, Consent.ExceptDataComponent res) throws IOException, FHIRFormatError {
6367    parseBackboneProperties(json, res);
6368    if (json.has("meaning"))
6369      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6370    if (json.has("_meaning"))
6371      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
6372    if (json.has("reference"))
6373      res.setReference(parseReference(json.getAsJsonObject("reference")));
6374  }
6375
6376  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
6377    Contract res = new Contract();
6378    parseContractProperties(json, res);
6379    return res;
6380  }
6381
6382  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
6383    parseDomainResourceProperties(json, res);
6384    if (json.has("identifier"))
6385      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6386    if (json.has("status"))
6387      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
6388    if (json.has("_status"))
6389      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6390    if (json.has("issued"))
6391      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6392    if (json.has("_issued"))
6393      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6394    if (json.has("applies"))
6395      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6396    if (json.has("subject")) {
6397      JsonArray array = json.getAsJsonArray("subject");
6398      for (int i = 0; i < array.size(); i++) {
6399        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6400      }
6401    };
6402    if (json.has("topic")) {
6403      JsonArray array = json.getAsJsonArray("topic");
6404      for (int i = 0; i < array.size(); i++) {
6405        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6406      }
6407    };
6408    if (json.has("authority")) {
6409      JsonArray array = json.getAsJsonArray("authority");
6410      for (int i = 0; i < array.size(); i++) {
6411        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
6412      }
6413    };
6414    if (json.has("domain")) {
6415      JsonArray array = json.getAsJsonArray("domain");
6416      for (int i = 0; i < array.size(); i++) {
6417        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
6418      }
6419    };
6420    if (json.has("type"))
6421      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6422    if (json.has("subType")) {
6423      JsonArray array = json.getAsJsonArray("subType");
6424      for (int i = 0; i < array.size(); i++) {
6425        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6426      }
6427    };
6428    if (json.has("action")) {
6429      JsonArray array = json.getAsJsonArray("action");
6430      for (int i = 0; i < array.size(); i++) {
6431        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6432      }
6433    };
6434    if (json.has("actionReason")) {
6435      JsonArray array = json.getAsJsonArray("actionReason");
6436      for (int i = 0; i < array.size(); i++) {
6437        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6438      }
6439    };
6440    if (json.has("decisionType"))
6441      res.setDecisionType(parseCodeableConcept(json.getAsJsonObject("decisionType")));
6442    if (json.has("contentDerivative"))
6443      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
6444    if (json.has("securityLabel")) {
6445      JsonArray array = json.getAsJsonArray("securityLabel");
6446      for (int i = 0; i < array.size(); i++) {
6447        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6448      }
6449    };
6450    if (json.has("agent")) {
6451      JsonArray array = json.getAsJsonArray("agent");
6452      for (int i = 0; i < array.size(); i++) {
6453        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), res));
6454      }
6455    };
6456    if (json.has("signer")) {
6457      JsonArray array = json.getAsJsonArray("signer");
6458      for (int i = 0; i < array.size(); i++) {
6459        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
6460      }
6461    };
6462    if (json.has("valuedItem")) {
6463      JsonArray array = json.getAsJsonArray("valuedItem");
6464      for (int i = 0; i < array.size(); i++) {
6465        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
6466      }
6467    };
6468    if (json.has("term")) {
6469      JsonArray array = json.getAsJsonArray("term");
6470      for (int i = 0; i < array.size(); i++) {
6471        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
6472      }
6473    };
6474    Type binding = parseType("binding", json);
6475    if (binding != null)
6476      res.setBinding(binding);
6477    if (json.has("friendly")) {
6478      JsonArray array = json.getAsJsonArray("friendly");
6479      for (int i = 0; i < array.size(); i++) {
6480        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
6481      }
6482    };
6483    if (json.has("legal")) {
6484      JsonArray array = json.getAsJsonArray("legal");
6485      for (int i = 0; i < array.size(); i++) {
6486        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
6487      }
6488    };
6489    if (json.has("rule")) {
6490      JsonArray array = json.getAsJsonArray("rule");
6491      for (int i = 0; i < array.size(); i++) {
6492        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
6493      }
6494    };
6495  }
6496
6497  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6498    Contract.AgentComponent res = new Contract.AgentComponent();
6499    parseContractAgentComponentProperties(json, owner, res);
6500    return res;
6501  }
6502
6503  protected void parseContractAgentComponentProperties(JsonObject json, Contract owner, Contract.AgentComponent res) throws IOException, FHIRFormatError {
6504    parseBackboneProperties(json, res);
6505    if (json.has("actor"))
6506      res.setActor(parseReference(json.getAsJsonObject("actor")));
6507    if (json.has("role")) {
6508      JsonArray array = json.getAsJsonArray("role");
6509      for (int i = 0; i < array.size(); i++) {
6510        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6511      }
6512    };
6513  }
6514
6515  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6516    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
6517    parseContractSignatoryComponentProperties(json, owner, res);
6518    return res;
6519  }
6520
6521  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
6522    parseBackboneProperties(json, res);
6523    if (json.has("type"))
6524      res.setType(parseCoding(json.getAsJsonObject("type")));
6525    if (json.has("party"))
6526      res.setParty(parseReference(json.getAsJsonObject("party")));
6527    if (json.has("signature")) {
6528      JsonArray array = json.getAsJsonArray("signature");
6529      for (int i = 0; i < array.size(); i++) {
6530        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
6531      }
6532    };
6533  }
6534
6535  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6536    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
6537    parseContractValuedItemComponentProperties(json, owner, res);
6538    return res;
6539  }
6540
6541  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
6542    parseBackboneProperties(json, res);
6543    Type entity = parseType("entity", json);
6544    if (entity != null)
6545      res.setEntity(entity);
6546    if (json.has("identifier"))
6547      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6548    if (json.has("effectiveTime"))
6549      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6550    if (json.has("_effectiveTime"))
6551      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
6552    if (json.has("quantity"))
6553      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
6554    if (json.has("unitPrice"))
6555      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6556    if (json.has("factor"))
6557      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6558    if (json.has("_factor"))
6559      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6560    if (json.has("points"))
6561      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6562    if (json.has("_points"))
6563      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
6564    if (json.has("net"))
6565      res.setNet(parseMoney(json.getAsJsonObject("net")));
6566  }
6567
6568  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6569    Contract.TermComponent res = new Contract.TermComponent();
6570    parseContractTermComponentProperties(json, owner, res);
6571    return res;
6572  }
6573
6574  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
6575    parseBackboneProperties(json, res);
6576    if (json.has("identifier"))
6577      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6578    if (json.has("issued"))
6579      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6580    if (json.has("_issued"))
6581      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6582    if (json.has("applies"))
6583      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6584    if (json.has("type"))
6585      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6586    if (json.has("subType"))
6587      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
6588    if (json.has("topic")) {
6589      JsonArray array = json.getAsJsonArray("topic");
6590      for (int i = 0; i < array.size(); i++) {
6591        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6592      }
6593    };
6594    if (json.has("action")) {
6595      JsonArray array = json.getAsJsonArray("action");
6596      for (int i = 0; i < array.size(); i++) {
6597        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6598      }
6599    };
6600    if (json.has("actionReason")) {
6601      JsonArray array = json.getAsJsonArray("actionReason");
6602      for (int i = 0; i < array.size(); i++) {
6603        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6604      }
6605    };
6606    if (json.has("securityLabel")) {
6607      JsonArray array = json.getAsJsonArray("securityLabel");
6608      for (int i = 0; i < array.size(); i++) {
6609        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6610      }
6611    };
6612    if (json.has("agent")) {
6613      JsonArray array = json.getAsJsonArray("agent");
6614      for (int i = 0; i < array.size(); i++) {
6615        res.getAgent().add(parseContractTermAgentComponent(array.get(i).getAsJsonObject(), owner));
6616      }
6617    };
6618    if (json.has("text"))
6619      res.setTextElement(parseString(json.get("text").getAsString()));
6620    if (json.has("_text"))
6621      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
6622    if (json.has("valuedItem")) {
6623      JsonArray array = json.getAsJsonArray("valuedItem");
6624      for (int i = 0; i < array.size(); i++) {
6625        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
6626      }
6627    };
6628    if (json.has("group")) {
6629      JsonArray array = json.getAsJsonArray("group");
6630      for (int i = 0; i < array.size(); i++) {
6631        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
6632      }
6633    };
6634  }
6635
6636  protected Contract.TermAgentComponent parseContractTermAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6637    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
6638    parseContractTermAgentComponentProperties(json, owner, res);
6639    return res;
6640  }
6641
6642  protected void parseContractTermAgentComponentProperties(JsonObject json, Contract owner, Contract.TermAgentComponent res) throws IOException, FHIRFormatError {
6643    parseBackboneProperties(json, res);
6644    if (json.has("actor"))
6645      res.setActor(parseReference(json.getAsJsonObject("actor")));
6646    if (json.has("role")) {
6647      JsonArray array = json.getAsJsonArray("role");
6648      for (int i = 0; i < array.size(); i++) {
6649        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6650      }
6651    };
6652  }
6653
6654  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6655    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
6656    parseContractTermValuedItemComponentProperties(json, owner, res);
6657    return res;
6658  }
6659
6660  protected void parseContractTermValuedItemComponentProperties(JsonObject json, Contract owner, Contract.TermValuedItemComponent res) throws IOException, FHIRFormatError {
6661    parseBackboneProperties(json, res);
6662    Type entity = parseType("entity", json);
6663    if (entity != null)
6664      res.setEntity(entity);
6665    if (json.has("identifier"))
6666      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6667    if (json.has("effectiveTime"))
6668      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6669    if (json.has("_effectiveTime"))
6670      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
6671    if (json.has("quantity"))
6672      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
6673    if (json.has("unitPrice"))
6674      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6675    if (json.has("factor"))
6676      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6677    if (json.has("_factor"))
6678      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6679    if (json.has("points"))
6680      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6681    if (json.has("_points"))
6682      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
6683    if (json.has("net"))
6684      res.setNet(parseMoney(json.getAsJsonObject("net")));
6685  }
6686
6687  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6688    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
6689    parseContractFriendlyLanguageComponentProperties(json, owner, res);
6690    return res;
6691  }
6692
6693  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
6694    parseBackboneProperties(json, res);
6695    Type content = parseType("content", json);
6696    if (content != null)
6697      res.setContent(content);
6698  }
6699
6700  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6701    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
6702    parseContractLegalLanguageComponentProperties(json, owner, res);
6703    return res;
6704  }
6705
6706  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
6707    parseBackboneProperties(json, res);
6708    Type content = parseType("content", json);
6709    if (content != null)
6710      res.setContent(content);
6711  }
6712
6713  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6714    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
6715    parseContractComputableLanguageComponentProperties(json, owner, res);
6716    return res;
6717  }
6718
6719  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
6720    parseBackboneProperties(json, res);
6721    Type content = parseType("content", json);
6722    if (content != null)
6723      res.setContent(content);
6724  }
6725
6726  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
6727    Coverage res = new Coverage();
6728    parseCoverageProperties(json, res);
6729    return res;
6730  }
6731
6732  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
6733    parseDomainResourceProperties(json, res);
6734    if (json.has("identifier")) {
6735      JsonArray array = json.getAsJsonArray("identifier");
6736      for (int i = 0; i < array.size(); i++) {
6737        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6738      }
6739    };
6740    if (json.has("status"))
6741      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
6742    if (json.has("_status"))
6743      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6744    if (json.has("type"))
6745      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6746    if (json.has("policyHolder"))
6747      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
6748    if (json.has("subscriber"))
6749      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
6750    if (json.has("subscriberId"))
6751      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
6752    if (json.has("_subscriberId"))
6753      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
6754    if (json.has("beneficiary"))
6755      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
6756    if (json.has("relationship"))
6757      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
6758    if (json.has("period"))
6759      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6760    if (json.has("payor")) {
6761      JsonArray array = json.getAsJsonArray("payor");
6762      for (int i = 0; i < array.size(); i++) {
6763        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
6764      }
6765    };
6766    if (json.has("grouping"))
6767      res.setGrouping(parseCoverageGroupComponent(json.getAsJsonObject("grouping"), res));
6768    if (json.has("dependent"))
6769      res.setDependentElement(parseString(json.get("dependent").getAsString()));
6770    if (json.has("_dependent"))
6771      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
6772    if (json.has("sequence"))
6773      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
6774    if (json.has("_sequence"))
6775      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6776    if (json.has("order"))
6777      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
6778    if (json.has("_order"))
6779      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
6780    if (json.has("network"))
6781      res.setNetworkElement(parseString(json.get("network").getAsString()));
6782    if (json.has("_network"))
6783      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
6784    if (json.has("contract")) {
6785      JsonArray array = json.getAsJsonArray("contract");
6786      for (int i = 0; i < array.size(); i++) {
6787        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
6788      }
6789    };
6790  }
6791
6792  protected Coverage.GroupComponent parseCoverageGroupComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
6793    Coverage.GroupComponent res = new Coverage.GroupComponent();
6794    parseCoverageGroupComponentProperties(json, owner, res);
6795    return res;
6796  }
6797
6798  protected void parseCoverageGroupComponentProperties(JsonObject json, Coverage owner, Coverage.GroupComponent res) throws IOException, FHIRFormatError {
6799    parseBackboneProperties(json, res);
6800    if (json.has("group"))
6801      res.setGroupElement(parseString(json.get("group").getAsString()));
6802    if (json.has("_group"))
6803      parseElementProperties(json.getAsJsonObject("_group"), res.getGroupElement());
6804    if (json.has("groupDisplay"))
6805      res.setGroupDisplayElement(parseString(json.get("groupDisplay").getAsString()));
6806    if (json.has("_groupDisplay"))
6807      parseElementProperties(json.getAsJsonObject("_groupDisplay"), res.getGroupDisplayElement());
6808    if (json.has("subGroup"))
6809      res.setSubGroupElement(parseString(json.get("subGroup").getAsString()));
6810    if (json.has("_subGroup"))
6811      parseElementProperties(json.getAsJsonObject("_subGroup"), res.getSubGroupElement());
6812    if (json.has("subGroupDisplay"))
6813      res.setSubGroupDisplayElement(parseString(json.get("subGroupDisplay").getAsString()));
6814    if (json.has("_subGroupDisplay"))
6815      parseElementProperties(json.getAsJsonObject("_subGroupDisplay"), res.getSubGroupDisplayElement());
6816    if (json.has("plan"))
6817      res.setPlanElement(parseString(json.get("plan").getAsString()));
6818    if (json.has("_plan"))
6819      parseElementProperties(json.getAsJsonObject("_plan"), res.getPlanElement());
6820    if (json.has("planDisplay"))
6821      res.setPlanDisplayElement(parseString(json.get("planDisplay").getAsString()));
6822    if (json.has("_planDisplay"))
6823      parseElementProperties(json.getAsJsonObject("_planDisplay"), res.getPlanDisplayElement());
6824    if (json.has("subPlan"))
6825      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
6826    if (json.has("_subPlan"))
6827      parseElementProperties(json.getAsJsonObject("_subPlan"), res.getSubPlanElement());
6828    if (json.has("subPlanDisplay"))
6829      res.setSubPlanDisplayElement(parseString(json.get("subPlanDisplay").getAsString()));
6830    if (json.has("_subPlanDisplay"))
6831      parseElementProperties(json.getAsJsonObject("_subPlanDisplay"), res.getSubPlanDisplayElement());
6832    if (json.has("class"))
6833      res.setClass_Element(parseString(json.get("class").getAsString()));
6834    if (json.has("_class"))
6835      parseElementProperties(json.getAsJsonObject("_class"), res.getClass_Element());
6836    if (json.has("classDisplay"))
6837      res.setClassDisplayElement(parseString(json.get("classDisplay").getAsString()));
6838    if (json.has("_classDisplay"))
6839      parseElementProperties(json.getAsJsonObject("_classDisplay"), res.getClassDisplayElement());
6840    if (json.has("subClass"))
6841      res.setSubClassElement(parseString(json.get("subClass").getAsString()));
6842    if (json.has("_subClass"))
6843      parseElementProperties(json.getAsJsonObject("_subClass"), res.getSubClassElement());
6844    if (json.has("subClassDisplay"))
6845      res.setSubClassDisplayElement(parseString(json.get("subClassDisplay").getAsString()));
6846    if (json.has("_subClassDisplay"))
6847      parseElementProperties(json.getAsJsonObject("_subClassDisplay"), res.getSubClassDisplayElement());
6848  }
6849
6850  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
6851    DataElement res = new DataElement();
6852    parseDataElementProperties(json, res);
6853    return res;
6854  }
6855
6856  protected void parseDataElementProperties(JsonObject json, DataElement res) throws IOException, FHIRFormatError {
6857    parseDomainResourceProperties(json, res);
6858    if (json.has("url"))
6859      res.setUrlElement(parseUri(json.get("url").getAsString()));
6860    if (json.has("_url"))
6861      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6862    if (json.has("identifier")) {
6863      JsonArray array = json.getAsJsonArray("identifier");
6864      for (int i = 0; i < array.size(); i++) {
6865        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6866      }
6867    };
6868    if (json.has("version"))
6869      res.setVersionElement(parseString(json.get("version").getAsString()));
6870    if (json.has("_version"))
6871      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6872    if (json.has("status"))
6873      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6874    if (json.has("_status"))
6875      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6876    if (json.has("experimental"))
6877      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6878    if (json.has("_experimental"))
6879      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6880    if (json.has("date"))
6881      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6882    if (json.has("_date"))
6883      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6884    if (json.has("publisher"))
6885      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6886    if (json.has("_publisher"))
6887      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6888    if (json.has("name"))
6889      res.setNameElement(parseString(json.get("name").getAsString()));
6890    if (json.has("_name"))
6891      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6892    if (json.has("title"))
6893      res.setTitleElement(parseString(json.get("title").getAsString()));
6894    if (json.has("_title"))
6895      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6896    if (json.has("contact")) {
6897      JsonArray array = json.getAsJsonArray("contact");
6898      for (int i = 0; i < array.size(); i++) {
6899        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6900      }
6901    };
6902    if (json.has("useContext")) {
6903      JsonArray array = json.getAsJsonArray("useContext");
6904      for (int i = 0; i < array.size(); i++) {
6905        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6906      }
6907    };
6908    if (json.has("jurisdiction")) {
6909      JsonArray array = json.getAsJsonArray("jurisdiction");
6910      for (int i = 0; i < array.size(); i++) {
6911        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6912      }
6913    };
6914    if (json.has("copyright"))
6915      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6916    if (json.has("_copyright"))
6917      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6918    if (json.has("stringency"))
6919      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
6920    if (json.has("_stringency"))
6921      parseElementProperties(json.getAsJsonObject("_stringency"), res.getStringencyElement());
6922    if (json.has("mapping")) {
6923      JsonArray array = json.getAsJsonArray("mapping");
6924      for (int i = 0; i < array.size(); i++) {
6925        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
6926      }
6927    };
6928    if (json.has("element")) {
6929      JsonArray array = json.getAsJsonArray("element");
6930      for (int i = 0; i < array.size(); i++) {
6931        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
6932      }
6933    };
6934  }
6935
6936  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
6937    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
6938    parseDataElementDataElementMappingComponentProperties(json, owner, res);
6939    return res;
6940  }
6941
6942  protected void parseDataElementDataElementMappingComponentProperties(JsonObject json, DataElement owner, DataElement.DataElementMappingComponent res) throws IOException, FHIRFormatError {
6943    parseBackboneProperties(json, res);
6944    if (json.has("identity"))
6945      res.setIdentityElement(parseId(json.get("identity").getAsString()));
6946    if (json.has("_identity"))
6947      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
6948    if (json.has("uri"))
6949      res.setUriElement(parseUri(json.get("uri").getAsString()));
6950    if (json.has("_uri"))
6951      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6952    if (json.has("name"))
6953      res.setNameElement(parseString(json.get("name").getAsString()));
6954    if (json.has("_name"))
6955      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6956    if (json.has("comment"))
6957      res.setCommentElement(parseString(json.get("comment").getAsString()));
6958    if (json.has("_comment"))
6959      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
6960  }
6961
6962  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
6963    DetectedIssue res = new DetectedIssue();
6964    parseDetectedIssueProperties(json, res);
6965    return res;
6966  }
6967
6968  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
6969    parseDomainResourceProperties(json, res);
6970    if (json.has("identifier"))
6971      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6972    if (json.has("status"))
6973      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
6974    if (json.has("_status"))
6975      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6976    if (json.has("category"))
6977      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6978    if (json.has("severity"))
6979      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
6980    if (json.has("_severity"))
6981      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
6982    if (json.has("patient"))
6983      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6984    if (json.has("date"))
6985      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6986    if (json.has("_date"))
6987      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6988    if (json.has("author"))
6989      res.setAuthor(parseReference(json.getAsJsonObject("author")));
6990    if (json.has("implicated")) {
6991      JsonArray array = json.getAsJsonArray("implicated");
6992      for (int i = 0; i < array.size(); i++) {
6993        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
6994      }
6995    };
6996    if (json.has("detail"))
6997      res.setDetailElement(parseString(json.get("detail").getAsString()));
6998    if (json.has("_detail"))
6999      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
7000    if (json.has("reference"))
7001      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
7002    if (json.has("_reference"))
7003      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
7004    if (json.has("mitigation")) {
7005      JsonArray array = json.getAsJsonArray("mitigation");
7006      for (int i = 0; i < array.size(); i++) {
7007        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
7008      }
7009    };
7010  }
7011
7012  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
7013    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
7014    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
7015    return res;
7016  }
7017
7018  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
7019    parseBackboneProperties(json, res);
7020    if (json.has("action"))
7021      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
7022    if (json.has("date"))
7023      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7024    if (json.has("_date"))
7025      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7026    if (json.has("author"))
7027      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7028  }
7029
7030  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
7031    Device res = new Device();
7032    parseDeviceProperties(json, res);
7033    return res;
7034  }
7035
7036  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
7037    parseDomainResourceProperties(json, res);
7038    if (json.has("identifier")) {
7039      JsonArray array = json.getAsJsonArray("identifier");
7040      for (int i = 0; i < array.size(); i++) {
7041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7042      }
7043    };
7044    if (json.has("udi"))
7045      res.setUdi(parseDeviceDeviceUdiComponent(json.getAsJsonObject("udi"), res));
7046    if (json.has("status"))
7047      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
7048    if (json.has("_status"))
7049      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7050    if (json.has("type"))
7051      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7052    if (json.has("lotNumber"))
7053      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
7054    if (json.has("_lotNumber"))
7055      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
7056    if (json.has("manufacturer"))
7057      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
7058    if (json.has("_manufacturer"))
7059      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
7060    if (json.has("manufactureDate"))
7061      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
7062    if (json.has("_manufactureDate"))
7063      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
7064    if (json.has("expirationDate"))
7065      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
7066    if (json.has("_expirationDate"))
7067      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
7068    if (json.has("model"))
7069      res.setModelElement(parseString(json.get("model").getAsString()));
7070    if (json.has("_model"))
7071      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
7072    if (json.has("version"))
7073      res.setVersionElement(parseString(json.get("version").getAsString()));
7074    if (json.has("_version"))
7075      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7076    if (json.has("patient"))
7077      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7078    if (json.has("owner"))
7079      res.setOwner(parseReference(json.getAsJsonObject("owner")));
7080    if (json.has("contact")) {
7081      JsonArray array = json.getAsJsonArray("contact");
7082      for (int i = 0; i < array.size(); i++) {
7083        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
7084      }
7085    };
7086    if (json.has("location"))
7087      res.setLocation(parseReference(json.getAsJsonObject("location")));
7088    if (json.has("url"))
7089      res.setUrlElement(parseUri(json.get("url").getAsString()));
7090    if (json.has("_url"))
7091      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7092    if (json.has("note")) {
7093      JsonArray array = json.getAsJsonArray("note");
7094      for (int i = 0; i < array.size(); i++) {
7095        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7096      }
7097    };
7098    if (json.has("safety")) {
7099      JsonArray array = json.getAsJsonArray("safety");
7100      for (int i = 0; i < array.size(); i++) {
7101        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7102      }
7103    };
7104  }
7105
7106  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
7107    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
7108    parseDeviceDeviceUdiComponentProperties(json, owner, res);
7109    return res;
7110  }
7111
7112  protected void parseDeviceDeviceUdiComponentProperties(JsonObject json, Device owner, Device.DeviceUdiComponent res) throws IOException, FHIRFormatError {
7113    parseBackboneProperties(json, res);
7114    if (json.has("deviceIdentifier"))
7115      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
7116    if (json.has("_deviceIdentifier"))
7117      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
7118    if (json.has("name"))
7119      res.setNameElement(parseString(json.get("name").getAsString()));
7120    if (json.has("_name"))
7121      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7122    if (json.has("jurisdiction"))
7123      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
7124    if (json.has("_jurisdiction"))
7125      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
7126    if (json.has("carrierHRF"))
7127      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
7128    if (json.has("_carrierHRF"))
7129      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
7130    if (json.has("carrierAIDC"))
7131      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
7132    if (json.has("_carrierAIDC"))
7133      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
7134    if (json.has("issuer"))
7135      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
7136    if (json.has("_issuer"))
7137      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
7138    if (json.has("entryType"))
7139      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
7140    if (json.has("_entryType"))
7141      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
7142  }
7143
7144  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
7145    DeviceComponent res = new DeviceComponent();
7146    parseDeviceComponentProperties(json, res);
7147    return res;
7148  }
7149
7150  protected void parseDeviceComponentProperties(JsonObject json, DeviceComponent res) throws IOException, FHIRFormatError {
7151    parseDomainResourceProperties(json, res);
7152    if (json.has("identifier"))
7153      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7154    if (json.has("type"))
7155      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7156    if (json.has("lastSystemChange"))
7157      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
7158    if (json.has("_lastSystemChange"))
7159      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
7160    if (json.has("source"))
7161      res.setSource(parseReference(json.getAsJsonObject("source")));
7162    if (json.has("parent"))
7163      res.setParent(parseReference(json.getAsJsonObject("parent")));
7164    if (json.has("operationalStatus")) {
7165      JsonArray array = json.getAsJsonArray("operationalStatus");
7166      for (int i = 0; i < array.size(); i++) {
7167        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7168      }
7169    };
7170    if (json.has("parameterGroup"))
7171      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
7172    if (json.has("measurementPrinciple"))
7173      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
7174    if (json.has("_measurementPrinciple"))
7175      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
7176    if (json.has("productionSpecification")) {
7177      JsonArray array = json.getAsJsonArray("productionSpecification");
7178      for (int i = 0; i < array.size(); i++) {
7179        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
7180      }
7181    };
7182    if (json.has("languageCode"))
7183      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
7184  }
7185
7186  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7187    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
7188    parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(json, owner, res);
7189    return res;
7190  }
7191
7192  protected void parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws IOException, FHIRFormatError {
7193    parseBackboneProperties(json, res);
7194    if (json.has("specType"))
7195      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
7196    if (json.has("componentId"))
7197      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
7198    if (json.has("productionSpec"))
7199      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
7200    if (json.has("_productionSpec"))
7201      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
7202  }
7203
7204  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
7205    DeviceMetric res = new DeviceMetric();
7206    parseDeviceMetricProperties(json, res);
7207    return res;
7208  }
7209
7210  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
7211    parseDomainResourceProperties(json, res);
7212    if (json.has("identifier"))
7213      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7214    if (json.has("type"))
7215      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7216    if (json.has("unit"))
7217      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
7218    if (json.has("source"))
7219      res.setSource(parseReference(json.getAsJsonObject("source")));
7220    if (json.has("parent"))
7221      res.setParent(parseReference(json.getAsJsonObject("parent")));
7222    if (json.has("operationalStatus"))
7223      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
7224    if (json.has("_operationalStatus"))
7225      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
7226    if (json.has("color"))
7227      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
7228    if (json.has("_color"))
7229      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
7230    if (json.has("category"))
7231      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
7232    if (json.has("_category"))
7233      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
7234    if (json.has("measurementPeriod"))
7235      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
7236    if (json.has("calibration")) {
7237      JsonArray array = json.getAsJsonArray("calibration");
7238      for (int i = 0; i < array.size(); i++) {
7239        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
7240      }
7241    };
7242  }
7243
7244  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
7245    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
7246    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
7247    return res;
7248  }
7249
7250  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
7251    parseBackboneProperties(json, res);
7252    if (json.has("type"))
7253      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
7254    if (json.has("_type"))
7255      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7256    if (json.has("state"))
7257      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
7258    if (json.has("_state"))
7259      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
7260    if (json.has("time"))
7261      res.setTimeElement(parseInstant(json.get("time").getAsString()));
7262    if (json.has("_time"))
7263      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
7264  }
7265
7266  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
7267    DeviceRequest res = new DeviceRequest();
7268    parseDeviceRequestProperties(json, res);
7269    return res;
7270  }
7271
7272  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
7273    parseDomainResourceProperties(json, res);
7274    if (json.has("identifier")) {
7275      JsonArray array = json.getAsJsonArray("identifier");
7276      for (int i = 0; i < array.size(); i++) {
7277        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7278      }
7279    };
7280    if (json.has("definition")) {
7281      JsonArray array = json.getAsJsonArray("definition");
7282      for (int i = 0; i < array.size(); i++) {
7283        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
7284      }
7285    };
7286    if (json.has("basedOn")) {
7287      JsonArray array = json.getAsJsonArray("basedOn");
7288      for (int i = 0; i < array.size(); i++) {
7289        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7290      }
7291    };
7292    if (json.has("priorRequest")) {
7293      JsonArray array = json.getAsJsonArray("priorRequest");
7294      for (int i = 0; i < array.size(); i++) {
7295        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
7296      }
7297    };
7298    if (json.has("groupIdentifier"))
7299      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
7300    if (json.has("status"))
7301      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
7302    if (json.has("_status"))
7303      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7304    if (json.has("intent"))
7305      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
7306    if (json.has("priority"))
7307      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
7308    if (json.has("_priority"))
7309      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7310    Type code = parseType("code", json);
7311    if (code != null)
7312      res.setCode(code);
7313    if (json.has("subject"))
7314      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7315    if (json.has("context"))
7316      res.setContext(parseReference(json.getAsJsonObject("context")));
7317    Type occurrence = parseType("occurrence", json);
7318    if (occurrence != null)
7319      res.setOccurrence(occurrence);
7320    if (json.has("authoredOn"))
7321      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7322    if (json.has("_authoredOn"))
7323      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
7324    if (json.has("requester"))
7325      res.setRequester(parseDeviceRequestDeviceRequestRequesterComponent(json.getAsJsonObject("requester"), res));
7326    if (json.has("performerType"))
7327      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
7328    if (json.has("performer"))
7329      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
7330    if (json.has("reasonCode")) {
7331      JsonArray array = json.getAsJsonArray("reasonCode");
7332      for (int i = 0; i < array.size(); i++) {
7333        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7334      }
7335    };
7336    if (json.has("reasonReference")) {
7337      JsonArray array = json.getAsJsonArray("reasonReference");
7338      for (int i = 0; i < array.size(); i++) {
7339        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7340      }
7341    };
7342    if (json.has("supportingInfo")) {
7343      JsonArray array = json.getAsJsonArray("supportingInfo");
7344      for (int i = 0; i < array.size(); i++) {
7345        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7346      }
7347    };
7348    if (json.has("note")) {
7349      JsonArray array = json.getAsJsonArray("note");
7350      for (int i = 0; i < array.size(); i++) {
7351        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7352      }
7353    };
7354    if (json.has("relevantHistory")) {
7355      JsonArray array = json.getAsJsonArray("relevantHistory");
7356      for (int i = 0; i < array.size(); i++) {
7357        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7358      }
7359    };
7360  }
7361
7362  protected DeviceRequest.DeviceRequestRequesterComponent parseDeviceRequestDeviceRequestRequesterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
7363    DeviceRequest.DeviceRequestRequesterComponent res = new DeviceRequest.DeviceRequestRequesterComponent();
7364    parseDeviceRequestDeviceRequestRequesterComponentProperties(json, owner, res);
7365    return res;
7366  }
7367
7368  protected void parseDeviceRequestDeviceRequestRequesterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestRequesterComponent res) throws IOException, FHIRFormatError {
7369    parseBackboneProperties(json, res);
7370    if (json.has("agent"))
7371      res.setAgent(parseReference(json.getAsJsonObject("agent")));
7372    if (json.has("onBehalfOf"))
7373      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
7374  }
7375
7376  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
7377    DeviceUseStatement res = new DeviceUseStatement();
7378    parseDeviceUseStatementProperties(json, res);
7379    return res;
7380  }
7381
7382  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
7383    parseDomainResourceProperties(json, res);
7384    if (json.has("identifier")) {
7385      JsonArray array = json.getAsJsonArray("identifier");
7386      for (int i = 0; i < array.size(); i++) {
7387        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7388      }
7389    };
7390    if (json.has("status"))
7391      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
7392    if (json.has("_status"))
7393      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7394    if (json.has("subject"))
7395      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7396    if (json.has("whenUsed"))
7397      res.setWhenUsed(parsePeriod(json.getAsJsonObject("whenUsed")));
7398    Type timing = parseType("timing", json);
7399    if (timing != null)
7400      res.setTiming(timing);
7401    if (json.has("recordedOn"))
7402      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
7403    if (json.has("_recordedOn"))
7404      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
7405    if (json.has("source"))
7406      res.setSource(parseReference(json.getAsJsonObject("source")));
7407    if (json.has("device"))
7408      res.setDevice(parseReference(json.getAsJsonObject("device")));
7409    if (json.has("indication")) {
7410      JsonArray array = json.getAsJsonArray("indication");
7411      for (int i = 0; i < array.size(); i++) {
7412        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7413      }
7414    };
7415    if (json.has("bodySite"))
7416      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
7417    if (json.has("note")) {
7418      JsonArray array = json.getAsJsonArray("note");
7419      for (int i = 0; i < array.size(); i++) {
7420        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7421      }
7422    };
7423  }
7424
7425  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
7426    DiagnosticReport res = new DiagnosticReport();
7427    parseDiagnosticReportProperties(json, res);
7428    return res;
7429  }
7430
7431  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
7432    parseDomainResourceProperties(json, res);
7433    if (json.has("identifier")) {
7434      JsonArray array = json.getAsJsonArray("identifier");
7435      for (int i = 0; i < array.size(); i++) {
7436        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7437      }
7438    };
7439    if (json.has("basedOn")) {
7440      JsonArray array = json.getAsJsonArray("basedOn");
7441      for (int i = 0; i < array.size(); i++) {
7442        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7443      }
7444    };
7445    if (json.has("status"))
7446      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
7447    if (json.has("_status"))
7448      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7449    if (json.has("category"))
7450      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7451    if (json.has("code"))
7452      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7453    if (json.has("subject"))
7454      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7455    if (json.has("context"))
7456      res.setContext(parseReference(json.getAsJsonObject("context")));
7457    Type effective = parseType("effective", json);
7458    if (effective != null)
7459      res.setEffective(effective);
7460    if (json.has("issued"))
7461      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7462    if (json.has("_issued"))
7463      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7464    if (json.has("performer")) {
7465      JsonArray array = json.getAsJsonArray("performer");
7466      for (int i = 0; i < array.size(); i++) {
7467        res.getPerformer().add(parseDiagnosticReportDiagnosticReportPerformerComponent(array.get(i).getAsJsonObject(), res));
7468      }
7469    };
7470    if (json.has("specimen")) {
7471      JsonArray array = json.getAsJsonArray("specimen");
7472      for (int i = 0; i < array.size(); i++) {
7473        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
7474      }
7475    };
7476    if (json.has("result")) {
7477      JsonArray array = json.getAsJsonArray("result");
7478      for (int i = 0; i < array.size(); i++) {
7479        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
7480      }
7481    };
7482    if (json.has("imagingStudy")) {
7483      JsonArray array = json.getAsJsonArray("imagingStudy");
7484      for (int i = 0; i < array.size(); i++) {
7485        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
7486      }
7487    };
7488    if (json.has("image")) {
7489      JsonArray array = json.getAsJsonArray("image");
7490      for (int i = 0; i < array.size(); i++) {
7491        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
7492      }
7493    };
7494    if (json.has("conclusion"))
7495      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
7496    if (json.has("_conclusion"))
7497      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
7498    if (json.has("codedDiagnosis")) {
7499      JsonArray array = json.getAsJsonArray("codedDiagnosis");
7500      for (int i = 0; i < array.size(); i++) {
7501        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7502      }
7503    };
7504    if (json.has("presentedForm")) {
7505      JsonArray array = json.getAsJsonArray("presentedForm");
7506      for (int i = 0; i < array.size(); i++) {
7507        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
7508      }
7509    };
7510  }
7511
7512  protected DiagnosticReport.DiagnosticReportPerformerComponent parseDiagnosticReportDiagnosticReportPerformerComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7513    DiagnosticReport.DiagnosticReportPerformerComponent res = new DiagnosticReport.DiagnosticReportPerformerComponent();
7514    parseDiagnosticReportDiagnosticReportPerformerComponentProperties(json, owner, res);
7515    return res;
7516  }
7517
7518  protected void parseDiagnosticReportDiagnosticReportPerformerComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportPerformerComponent res) throws IOException, FHIRFormatError {
7519    parseBackboneProperties(json, res);
7520    if (json.has("role"))
7521      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7522    if (json.has("actor"))
7523      res.setActor(parseReference(json.getAsJsonObject("actor")));
7524  }
7525
7526  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7527    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
7528    parseDiagnosticReportDiagnosticReportImageComponentProperties(json, owner, res);
7529    return res;
7530  }
7531
7532  protected void parseDiagnosticReportDiagnosticReportImageComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportImageComponent res) throws IOException, FHIRFormatError {
7533    parseBackboneProperties(json, res);
7534    if (json.has("comment"))
7535      res.setCommentElement(parseString(json.get("comment").getAsString()));
7536    if (json.has("_comment"))
7537      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7538    if (json.has("link"))
7539      res.setLink(parseReference(json.getAsJsonObject("link")));
7540  }
7541
7542  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
7543    DocumentManifest res = new DocumentManifest();
7544    parseDocumentManifestProperties(json, res);
7545    return res;
7546  }
7547
7548  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
7549    parseDomainResourceProperties(json, res);
7550    if (json.has("masterIdentifier"))
7551      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
7552    if (json.has("identifier")) {
7553      JsonArray array = json.getAsJsonArray("identifier");
7554      for (int i = 0; i < array.size(); i++) {
7555        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7556      }
7557    };
7558    if (json.has("status"))
7559      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7560    if (json.has("_status"))
7561      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7562    if (json.has("type"))
7563      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7564    if (json.has("subject"))
7565      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7566    if (json.has("created"))
7567      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7568    if (json.has("_created"))
7569      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7570    if (json.has("author")) {
7571      JsonArray array = json.getAsJsonArray("author");
7572      for (int i = 0; i < array.size(); i++) {
7573        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7574      }
7575    };
7576    if (json.has("recipient")) {
7577      JsonArray array = json.getAsJsonArray("recipient");
7578      for (int i = 0; i < array.size(); i++) {
7579        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7580      }
7581    };
7582    if (json.has("source"))
7583      res.setSourceElement(parseUri(json.get("source").getAsString()));
7584    if (json.has("_source"))
7585      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
7586    if (json.has("description"))
7587      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7588    if (json.has("_description"))
7589      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7590    if (json.has("content")) {
7591      JsonArray array = json.getAsJsonArray("content");
7592      for (int i = 0; i < array.size(); i++) {
7593        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
7594      }
7595    };
7596    if (json.has("related")) {
7597      JsonArray array = json.getAsJsonArray("related");
7598      for (int i = 0; i < array.size(); i++) {
7599        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
7600      }
7601    };
7602  }
7603
7604  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7605    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
7606    parseDocumentManifestDocumentManifestContentComponentProperties(json, owner, res);
7607    return res;
7608  }
7609
7610  protected void parseDocumentManifestDocumentManifestContentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestContentComponent res) throws IOException, FHIRFormatError {
7611    parseBackboneProperties(json, res);
7612    Type p = parseType("p", json);
7613    if (p != null)
7614      res.setP(p);
7615  }
7616
7617  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7618    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
7619    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
7620    return res;
7621  }
7622
7623  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
7624    parseBackboneProperties(json, res);
7625    if (json.has("identifier"))
7626      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7627    if (json.has("ref"))
7628      res.setRef(parseReference(json.getAsJsonObject("ref")));
7629  }
7630
7631  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
7632    DocumentReference res = new DocumentReference();
7633    parseDocumentReferenceProperties(json, res);
7634    return res;
7635  }
7636
7637  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
7638    parseDomainResourceProperties(json, res);
7639    if (json.has("masterIdentifier"))
7640      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
7641    if (json.has("identifier")) {
7642      JsonArray array = json.getAsJsonArray("identifier");
7643      for (int i = 0; i < array.size(); i++) {
7644        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7645      }
7646    };
7647    if (json.has("status"))
7648      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7649    if (json.has("_status"))
7650      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7651    if (json.has("docStatus"))
7652      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
7653    if (json.has("_docStatus"))
7654      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
7655    if (json.has("type"))
7656      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7657    if (json.has("class"))
7658      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
7659    if (json.has("subject"))
7660      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7661    if (json.has("created"))
7662      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7663    if (json.has("_created"))
7664      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7665    if (json.has("indexed"))
7666      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
7667    if (json.has("_indexed"))
7668      parseElementProperties(json.getAsJsonObject("_indexed"), res.getIndexedElement());
7669    if (json.has("author")) {
7670      JsonArray array = json.getAsJsonArray("author");
7671      for (int i = 0; i < array.size(); i++) {
7672        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7673      }
7674    };
7675    if (json.has("authenticator"))
7676      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
7677    if (json.has("custodian"))
7678      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
7679    if (json.has("relatesTo")) {
7680      JsonArray array = json.getAsJsonArray("relatesTo");
7681      for (int i = 0; i < array.size(); i++) {
7682        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
7683      }
7684    };
7685    if (json.has("description"))
7686      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7687    if (json.has("_description"))
7688      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7689    if (json.has("securityLabel")) {
7690      JsonArray array = json.getAsJsonArray("securityLabel");
7691      for (int i = 0; i < array.size(); i++) {
7692        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7693      }
7694    };
7695    if (json.has("content")) {
7696      JsonArray array = json.getAsJsonArray("content");
7697      for (int i = 0; i < array.size(); i++) {
7698        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
7699      }
7700    };
7701    if (json.has("context"))
7702      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
7703  }
7704
7705  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7706    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
7707    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
7708    return res;
7709  }
7710
7711  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
7712    parseBackboneProperties(json, res);
7713    if (json.has("code"))
7714      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
7715    if (json.has("_code"))
7716      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7717    if (json.has("target"))
7718      res.setTarget(parseReference(json.getAsJsonObject("target")));
7719  }
7720
7721  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7722    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
7723    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
7724    return res;
7725  }
7726
7727  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
7728    parseBackboneProperties(json, res);
7729    if (json.has("attachment"))
7730      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
7731    if (json.has("format"))
7732      res.setFormat(parseCoding(json.getAsJsonObject("format")));
7733  }
7734
7735  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7736    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
7737    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
7738    return res;
7739  }
7740
7741  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
7742    parseBackboneProperties(json, res);
7743    if (json.has("encounter"))
7744      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7745    if (json.has("event")) {
7746      JsonArray array = json.getAsJsonArray("event");
7747      for (int i = 0; i < array.size(); i++) {
7748        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7749      }
7750    };
7751    if (json.has("period"))
7752      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7753    if (json.has("facilityType"))
7754      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
7755    if (json.has("practiceSetting"))
7756      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
7757    if (json.has("sourcePatientInfo"))
7758      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
7759    if (json.has("related")) {
7760      JsonArray array = json.getAsJsonArray("related");
7761      for (int i = 0; i < array.size(); i++) {
7762        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
7763      }
7764    };
7765  }
7766
7767  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7768    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
7769    parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(json, owner, res);
7770    return res;
7771  }
7772
7773  protected void parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws IOException, FHIRFormatError {
7774    parseBackboneProperties(json, res);
7775    if (json.has("identifier"))
7776      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7777    if (json.has("ref"))
7778      res.setRef(parseReference(json.getAsJsonObject("ref")));
7779  }
7780
7781  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
7782    EligibilityRequest res = new EligibilityRequest();
7783    parseEligibilityRequestProperties(json, res);
7784    return res;
7785  }
7786
7787  protected void parseEligibilityRequestProperties(JsonObject json, EligibilityRequest res) throws IOException, FHIRFormatError {
7788    parseDomainResourceProperties(json, res);
7789    if (json.has("identifier")) {
7790      JsonArray array = json.getAsJsonArray("identifier");
7791      for (int i = 0; i < array.size(); i++) {
7792        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7793      }
7794    };
7795    if (json.has("status"))
7796      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
7797    if (json.has("_status"))
7798      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7799    if (json.has("priority"))
7800      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
7801    if (json.has("patient"))
7802      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7803    Type serviced = parseType("serviced", json);
7804    if (serviced != null)
7805      res.setServiced(serviced);
7806    if (json.has("created"))
7807      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7808    if (json.has("_created"))
7809      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7810    if (json.has("enterer"))
7811      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
7812    if (json.has("provider"))
7813      res.setProvider(parseReference(json.getAsJsonObject("provider")));
7814    if (json.has("organization"))
7815      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
7816    if (json.has("insurer"))
7817      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
7818    if (json.has("facility"))
7819      res.setFacility(parseReference(json.getAsJsonObject("facility")));
7820    if (json.has("coverage"))
7821      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
7822    if (json.has("businessArrangement"))
7823      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7824    if (json.has("_businessArrangement"))
7825      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
7826    if (json.has("benefitCategory"))
7827      res.setBenefitCategory(parseCodeableConcept(json.getAsJsonObject("benefitCategory")));
7828    if (json.has("benefitSubCategory"))
7829      res.setBenefitSubCategory(parseCodeableConcept(json.getAsJsonObject("benefitSubCategory")));
7830  }
7831
7832  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
7833    EligibilityResponse res = new EligibilityResponse();
7834    parseEligibilityResponseProperties(json, res);
7835    return res;
7836  }
7837
7838  protected void parseEligibilityResponseProperties(JsonObject json, EligibilityResponse res) throws IOException, FHIRFormatError {
7839    parseDomainResourceProperties(json, res);
7840    if (json.has("identifier")) {
7841      JsonArray array = json.getAsJsonArray("identifier");
7842      for (int i = 0; i < array.size(); i++) {
7843        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7844      }
7845    };
7846    if (json.has("status"))
7847      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
7848    if (json.has("_status"))
7849      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7850    if (json.has("created"))
7851      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7852    if (json.has("_created"))
7853      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7854    if (json.has("requestProvider"))
7855      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
7856    if (json.has("requestOrganization"))
7857      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
7858    if (json.has("request"))
7859      res.setRequest(parseReference(json.getAsJsonObject("request")));
7860    if (json.has("outcome"))
7861      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
7862    if (json.has("disposition"))
7863      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
7864    if (json.has("_disposition"))
7865      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
7866    if (json.has("insurer"))
7867      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
7868    if (json.has("inforce"))
7869      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
7870    if (json.has("_inforce"))
7871      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
7872    if (json.has("insurance")) {
7873      JsonArray array = json.getAsJsonArray("insurance");
7874      for (int i = 0; i < array.size(); i++) {
7875        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
7876      }
7877    };
7878    if (json.has("form"))
7879      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
7880    if (json.has("error")) {
7881      JsonArray array = json.getAsJsonArray("error");
7882      for (int i = 0; i < array.size(); i++) {
7883        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
7884      }
7885    };
7886  }
7887
7888  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7889    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
7890    parseEligibilityResponseInsuranceComponentProperties(json, owner, res);
7891    return res;
7892  }
7893
7894  protected void parseEligibilityResponseInsuranceComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
7895    parseBackboneProperties(json, res);
7896    if (json.has("coverage"))
7897      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
7898    if (json.has("contract"))
7899      res.setContract(parseReference(json.getAsJsonObject("contract")));
7900    if (json.has("benefitBalance")) {
7901      JsonArray array = json.getAsJsonArray("benefitBalance");
7902      for (int i = 0; i < array.size(); i++) {
7903        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), owner));
7904      }
7905    };
7906  }
7907
7908  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7909    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
7910    parseEligibilityResponseBenefitsComponentProperties(json, owner, res);
7911    return res;
7912  }
7913
7914  protected void parseEligibilityResponseBenefitsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws IOException, FHIRFormatError {
7915    parseBackboneProperties(json, res);
7916    if (json.has("category"))
7917      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7918    if (json.has("subCategory"))
7919      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
7920    if (json.has("excluded"))
7921      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
7922    if (json.has("_excluded"))
7923      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
7924    if (json.has("name"))
7925      res.setNameElement(parseString(json.get("name").getAsString()));
7926    if (json.has("_name"))
7927      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7928    if (json.has("description"))
7929      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7930    if (json.has("_description"))
7931      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7932    if (json.has("network"))
7933      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
7934    if (json.has("unit"))
7935      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
7936    if (json.has("term"))
7937      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
7938    if (json.has("financial")) {
7939      JsonArray array = json.getAsJsonArray("financial");
7940      for (int i = 0; i < array.size(); i++) {
7941        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
7942      }
7943    };
7944  }
7945
7946  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7947    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
7948    parseEligibilityResponseBenefitComponentProperties(json, owner, res);
7949    return res;
7950  }
7951
7952  protected void parseEligibilityResponseBenefitComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
7953    parseBackboneProperties(json, res);
7954    if (json.has("type"))
7955      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7956    Type allowed = parseType("allowed", json);
7957    if (allowed != null)
7958      res.setAllowed(allowed);
7959    Type used = parseType("used", json);
7960    if (used != null)
7961      res.setUsed(used);
7962  }
7963
7964  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7965    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
7966    parseEligibilityResponseErrorsComponentProperties(json, owner, res);
7967    return res;
7968  }
7969
7970  protected void parseEligibilityResponseErrorsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
7971    parseBackboneProperties(json, res);
7972    if (json.has("code"))
7973      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7974  }
7975
7976  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
7977    Encounter res = new Encounter();
7978    parseEncounterProperties(json, res);
7979    return res;
7980  }
7981
7982  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
7983    parseDomainResourceProperties(json, res);
7984    if (json.has("identifier")) {
7985      JsonArray array = json.getAsJsonArray("identifier");
7986      for (int i = 0; i < array.size(); i++) {
7987        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7988      }
7989    };
7990    if (json.has("status"))
7991      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
7992    if (json.has("_status"))
7993      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7994    if (json.has("statusHistory")) {
7995      JsonArray array = json.getAsJsonArray("statusHistory");
7996      for (int i = 0; i < array.size(); i++) {
7997        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
7998      }
7999    };
8000    if (json.has("class"))
8001      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8002    if (json.has("classHistory")) {
8003      JsonArray array = json.getAsJsonArray("classHistory");
8004      for (int i = 0; i < array.size(); i++) {
8005        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
8006      }
8007    };
8008    if (json.has("type")) {
8009      JsonArray array = json.getAsJsonArray("type");
8010      for (int i = 0; i < array.size(); i++) {
8011        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8012      }
8013    };
8014    if (json.has("priority"))
8015      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8016    if (json.has("subject"))
8017      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8018    if (json.has("episodeOfCare")) {
8019      JsonArray array = json.getAsJsonArray("episodeOfCare");
8020      for (int i = 0; i < array.size(); i++) {
8021        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
8022      }
8023    };
8024    if (json.has("incomingReferral")) {
8025      JsonArray array = json.getAsJsonArray("incomingReferral");
8026      for (int i = 0; i < array.size(); i++) {
8027        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
8028      }
8029    };
8030    if (json.has("participant")) {
8031      JsonArray array = json.getAsJsonArray("participant");
8032      for (int i = 0; i < array.size(); i++) {
8033        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
8034      }
8035    };
8036    if (json.has("appointment"))
8037      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
8038    if (json.has("period"))
8039      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8040    if (json.has("length"))
8041      res.setLength(parseDuration(json.getAsJsonObject("length")));
8042    if (json.has("reason")) {
8043      JsonArray array = json.getAsJsonArray("reason");
8044      for (int i = 0; i < array.size(); i++) {
8045        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8046      }
8047    };
8048    if (json.has("diagnosis")) {
8049      JsonArray array = json.getAsJsonArray("diagnosis");
8050      for (int i = 0; i < array.size(); i++) {
8051        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8052      }
8053    };
8054    if (json.has("account")) {
8055      JsonArray array = json.getAsJsonArray("account");
8056      for (int i = 0; i < array.size(); i++) {
8057        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8058      }
8059    };
8060    if (json.has("hospitalization"))
8061      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
8062    if (json.has("location")) {
8063      JsonArray array = json.getAsJsonArray("location");
8064      for (int i = 0; i < array.size(); i++) {
8065        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
8066      }
8067    };
8068    if (json.has("serviceProvider"))
8069      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
8070    if (json.has("partOf"))
8071      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
8072  }
8073
8074  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8075    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
8076    parseEncounterStatusHistoryComponentProperties(json, owner, res);
8077    return res;
8078  }
8079
8080  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
8081    parseBackboneProperties(json, res);
8082    if (json.has("status"))
8083      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8084    if (json.has("_status"))
8085      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8086    if (json.has("period"))
8087      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8088  }
8089
8090  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8091    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
8092    parseEncounterClassHistoryComponentProperties(json, owner, res);
8093    return res;
8094  }
8095
8096  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
8097    parseBackboneProperties(json, res);
8098    if (json.has("class"))
8099      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8100    if (json.has("period"))
8101      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8102  }
8103
8104  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8105    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
8106    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
8107    return res;
8108  }
8109
8110  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
8111    parseBackboneProperties(json, res);
8112    if (json.has("type")) {
8113      JsonArray array = json.getAsJsonArray("type");
8114      for (int i = 0; i < array.size(); i++) {
8115        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8116      }
8117    };
8118    if (json.has("period"))
8119      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8120    if (json.has("individual"))
8121      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
8122  }
8123
8124  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8125    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
8126    parseEncounterDiagnosisComponentProperties(json, owner, res);
8127    return res;
8128  }
8129
8130  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
8131    parseBackboneProperties(json, res);
8132    if (json.has("condition"))
8133      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8134    if (json.has("role"))
8135      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8136    if (json.has("rank"))
8137      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8138    if (json.has("_rank"))
8139      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8140  }
8141
8142  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8143    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
8144    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
8145    return res;
8146  }
8147
8148  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
8149    parseBackboneProperties(json, res);
8150    if (json.has("preAdmissionIdentifier"))
8151      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
8152    if (json.has("origin"))
8153      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
8154    if (json.has("admitSource"))
8155      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
8156    if (json.has("reAdmission"))
8157      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
8158    if (json.has("dietPreference")) {
8159      JsonArray array = json.getAsJsonArray("dietPreference");
8160      for (int i = 0; i < array.size(); i++) {
8161        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8162      }
8163    };
8164    if (json.has("specialCourtesy")) {
8165      JsonArray array = json.getAsJsonArray("specialCourtesy");
8166      for (int i = 0; i < array.size(); i++) {
8167        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8168      }
8169    };
8170    if (json.has("specialArrangement")) {
8171      JsonArray array = json.getAsJsonArray("specialArrangement");
8172      for (int i = 0; i < array.size(); i++) {
8173        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8174      }
8175    };
8176    if (json.has("destination"))
8177      res.setDestination(parseReference(json.getAsJsonObject("destination")));
8178    if (json.has("dischargeDisposition"))
8179      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
8180  }
8181
8182  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8183    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
8184    parseEncounterEncounterLocationComponentProperties(json, owner, res);
8185    return res;
8186  }
8187
8188  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
8189    parseBackboneProperties(json, res);
8190    if (json.has("location"))
8191      res.setLocation(parseReference(json.getAsJsonObject("location")));
8192    if (json.has("status"))
8193      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
8194    if (json.has("_status"))
8195      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8196    if (json.has("period"))
8197      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8198  }
8199
8200  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
8201    Endpoint res = new Endpoint();
8202    parseEndpointProperties(json, res);
8203    return res;
8204  }
8205
8206  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
8207    parseDomainResourceProperties(json, res);
8208    if (json.has("identifier")) {
8209      JsonArray array = json.getAsJsonArray("identifier");
8210      for (int i = 0; i < array.size(); i++) {
8211        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8212      }
8213    };
8214    if (json.has("status"))
8215      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
8216    if (json.has("_status"))
8217      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8218    if (json.has("connectionType"))
8219      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
8220    if (json.has("name"))
8221      res.setNameElement(parseString(json.get("name").getAsString()));
8222    if (json.has("_name"))
8223      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8224    if (json.has("managingOrganization"))
8225      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8226    if (json.has("contact")) {
8227      JsonArray array = json.getAsJsonArray("contact");
8228      for (int i = 0; i < array.size(); i++) {
8229        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8230      }
8231    };
8232    if (json.has("period"))
8233      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8234    if (json.has("payloadType")) {
8235      JsonArray array = json.getAsJsonArray("payloadType");
8236      for (int i = 0; i < array.size(); i++) {
8237        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8238      }
8239    };
8240    if (json.has("payloadMimeType")) {
8241      JsonArray array = json.getAsJsonArray("payloadMimeType");
8242      for (int i = 0; i < array.size(); i++) {
8243        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
8244      }
8245    };
8246    if (json.has("_payloadMimeType")) {
8247      JsonArray array = json.getAsJsonArray("_payloadMimeType");
8248      for (int i = 0; i < array.size(); i++) {
8249        if (i == res.getPayloadMimeType().size())
8250          res.getPayloadMimeType().add(parseCode(null));
8251        if (array.get(i) instanceof JsonObject) 
8252          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
8253      }
8254    };
8255    if (json.has("address"))
8256      res.setAddressElement(parseUri(json.get("address").getAsString()));
8257    if (json.has("_address"))
8258      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
8259    if (json.has("header")) {
8260      JsonArray array = json.getAsJsonArray("header");
8261      for (int i = 0; i < array.size(); i++) {
8262        res.getHeader().add(parseString(array.get(i).getAsString()));
8263      }
8264    };
8265    if (json.has("_header")) {
8266      JsonArray array = json.getAsJsonArray("_header");
8267      for (int i = 0; i < array.size(); i++) {
8268        if (i == res.getHeader().size())
8269          res.getHeader().add(parseString(null));
8270        if (array.get(i) instanceof JsonObject) 
8271          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
8272      }
8273    };
8274  }
8275
8276  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
8277    EnrollmentRequest res = new EnrollmentRequest();
8278    parseEnrollmentRequestProperties(json, res);
8279    return res;
8280  }
8281
8282  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
8283    parseDomainResourceProperties(json, res);
8284    if (json.has("identifier")) {
8285      JsonArray array = json.getAsJsonArray("identifier");
8286      for (int i = 0; i < array.size(); i++) {
8287        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8288      }
8289    };
8290    if (json.has("status"))
8291      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
8292    if (json.has("_status"))
8293      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8294    if (json.has("created"))
8295      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8296    if (json.has("_created"))
8297      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8298    if (json.has("insurer"))
8299      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8300    if (json.has("provider"))
8301      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8302    if (json.has("organization"))
8303      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8304    if (json.has("subject"))
8305      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8306    if (json.has("coverage"))
8307      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8308  }
8309
8310  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
8311    EnrollmentResponse res = new EnrollmentResponse();
8312    parseEnrollmentResponseProperties(json, res);
8313    return res;
8314  }
8315
8316  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
8317    parseDomainResourceProperties(json, res);
8318    if (json.has("identifier")) {
8319      JsonArray array = json.getAsJsonArray("identifier");
8320      for (int i = 0; i < array.size(); i++) {
8321        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8322      }
8323    };
8324    if (json.has("status"))
8325      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
8326    if (json.has("_status"))
8327      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8328    if (json.has("request"))
8329      res.setRequest(parseReference(json.getAsJsonObject("request")));
8330    if (json.has("outcome"))
8331      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8332    if (json.has("disposition"))
8333      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8334    if (json.has("_disposition"))
8335      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8336    if (json.has("created"))
8337      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8338    if (json.has("_created"))
8339      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8340    if (json.has("organization"))
8341      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8342    if (json.has("requestProvider"))
8343      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8344    if (json.has("requestOrganization"))
8345      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
8346  }
8347
8348  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
8349    EpisodeOfCare res = new EpisodeOfCare();
8350    parseEpisodeOfCareProperties(json, res);
8351    return res;
8352  }
8353
8354  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
8355    parseDomainResourceProperties(json, res);
8356    if (json.has("identifier")) {
8357      JsonArray array = json.getAsJsonArray("identifier");
8358      for (int i = 0; i < array.size(); i++) {
8359        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8360      }
8361    };
8362    if (json.has("status"))
8363      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8364    if (json.has("_status"))
8365      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8366    if (json.has("statusHistory")) {
8367      JsonArray array = json.getAsJsonArray("statusHistory");
8368      for (int i = 0; i < array.size(); i++) {
8369        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8370      }
8371    };
8372    if (json.has("type")) {
8373      JsonArray array = json.getAsJsonArray("type");
8374      for (int i = 0; i < array.size(); i++) {
8375        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8376      }
8377    };
8378    if (json.has("diagnosis")) {
8379      JsonArray array = json.getAsJsonArray("diagnosis");
8380      for (int i = 0; i < array.size(); i++) {
8381        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8382      }
8383    };
8384    if (json.has("patient"))
8385      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8386    if (json.has("managingOrganization"))
8387      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8388    if (json.has("period"))
8389      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8390    if (json.has("referralRequest")) {
8391      JsonArray array = json.getAsJsonArray("referralRequest");
8392      for (int i = 0; i < array.size(); i++) {
8393        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
8394      }
8395    };
8396    if (json.has("careManager"))
8397      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
8398    if (json.has("team")) {
8399      JsonArray array = json.getAsJsonArray("team");
8400      for (int i = 0; i < array.size(); i++) {
8401        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8402      }
8403    };
8404    if (json.has("account")) {
8405      JsonArray array = json.getAsJsonArray("account");
8406      for (int i = 0; i < array.size(); i++) {
8407        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8408      }
8409    };
8410  }
8411
8412  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8413    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
8414    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
8415    return res;
8416  }
8417
8418  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
8419    parseBackboneProperties(json, res);
8420    if (json.has("status"))
8421      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8422    if (json.has("_status"))
8423      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8424    if (json.has("period"))
8425      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8426  }
8427
8428  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8429    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
8430    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
8431    return res;
8432  }
8433
8434  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
8435    parseBackboneProperties(json, res);
8436    if (json.has("condition"))
8437      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8438    if (json.has("role"))
8439      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8440    if (json.has("rank"))
8441      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8442    if (json.has("_rank"))
8443      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8444  }
8445
8446  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
8447    ExpansionProfile res = new ExpansionProfile();
8448    parseExpansionProfileProperties(json, res);
8449    return res;
8450  }
8451
8452  protected void parseExpansionProfileProperties(JsonObject json, ExpansionProfile res) throws IOException, FHIRFormatError {
8453    parseDomainResourceProperties(json, res);
8454    if (json.has("url"))
8455      res.setUrlElement(parseUri(json.get("url").getAsString()));
8456    if (json.has("_url"))
8457      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8458    if (json.has("identifier"))
8459      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8460    if (json.has("version"))
8461      res.setVersionElement(parseString(json.get("version").getAsString()));
8462    if (json.has("_version"))
8463      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8464    if (json.has("name"))
8465      res.setNameElement(parseString(json.get("name").getAsString()));
8466    if (json.has("_name"))
8467      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8468    if (json.has("status"))
8469      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8470    if (json.has("_status"))
8471      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8472    if (json.has("experimental"))
8473      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8474    if (json.has("_experimental"))
8475      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8476    if (json.has("date"))
8477      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8478    if (json.has("_date"))
8479      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8480    if (json.has("publisher"))
8481      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8482    if (json.has("_publisher"))
8483      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8484    if (json.has("contact")) {
8485      JsonArray array = json.getAsJsonArray("contact");
8486      for (int i = 0; i < array.size(); i++) {
8487        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8488      }
8489    };
8490    if (json.has("description"))
8491      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8492    if (json.has("_description"))
8493      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8494    if (json.has("useContext")) {
8495      JsonArray array = json.getAsJsonArray("useContext");
8496      for (int i = 0; i < array.size(); i++) {
8497        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8498      }
8499    };
8500    if (json.has("jurisdiction")) {
8501      JsonArray array = json.getAsJsonArray("jurisdiction");
8502      for (int i = 0; i < array.size(); i++) {
8503        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8504      }
8505    };
8506    if (json.has("fixedVersion")) {
8507      JsonArray array = json.getAsJsonArray("fixedVersion");
8508      for (int i = 0; i < array.size(); i++) {
8509        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(array.get(i).getAsJsonObject(), res));
8510      }
8511    };
8512    if (json.has("excludedSystem"))
8513      res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(json.getAsJsonObject("excludedSystem"), res));
8514    if (json.has("includeDesignations"))
8515      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
8516    if (json.has("_includeDesignations"))
8517      parseElementProperties(json.getAsJsonObject("_includeDesignations"), res.getIncludeDesignationsElement());
8518    if (json.has("designation"))
8519      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(json.getAsJsonObject("designation"), res));
8520    if (json.has("includeDefinition"))
8521      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
8522    if (json.has("_includeDefinition"))
8523      parseElementProperties(json.getAsJsonObject("_includeDefinition"), res.getIncludeDefinitionElement());
8524    if (json.has("activeOnly"))
8525      res.setActiveOnlyElement(parseBoolean(json.get("activeOnly").getAsBoolean()));
8526    if (json.has("_activeOnly"))
8527      parseElementProperties(json.getAsJsonObject("_activeOnly"), res.getActiveOnlyElement());
8528    if (json.has("excludeNested"))
8529      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
8530    if (json.has("_excludeNested"))
8531      parseElementProperties(json.getAsJsonObject("_excludeNested"), res.getExcludeNestedElement());
8532    if (json.has("excludeNotForUI"))
8533      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
8534    if (json.has("_excludeNotForUI"))
8535      parseElementProperties(json.getAsJsonObject("_excludeNotForUI"), res.getExcludeNotForUIElement());
8536    if (json.has("excludePostCoordinated"))
8537      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
8538    if (json.has("_excludePostCoordinated"))
8539      parseElementProperties(json.getAsJsonObject("_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
8540    if (json.has("displayLanguage"))
8541      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
8542    if (json.has("_displayLanguage"))
8543      parseElementProperties(json.getAsJsonObject("_displayLanguage"), res.getDisplayLanguageElement());
8544    if (json.has("limitedExpansion"))
8545      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
8546    if (json.has("_limitedExpansion"))
8547      parseElementProperties(json.getAsJsonObject("_limitedExpansion"), res.getLimitedExpansionElement());
8548  }
8549
8550  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8551    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
8552    parseExpansionProfileExpansionProfileFixedVersionComponentProperties(json, owner, res);
8553    return res;
8554  }
8555
8556  protected void parseExpansionProfileExpansionProfileFixedVersionComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws IOException, FHIRFormatError {
8557    parseBackboneProperties(json, res);
8558    if (json.has("system"))
8559      res.setSystemElement(parseUri(json.get("system").getAsString()));
8560    if (json.has("_system"))
8561      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8562    if (json.has("version"))
8563      res.setVersionElement(parseString(json.get("version").getAsString()));
8564    if (json.has("_version"))
8565      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8566    if (json.has("mode"))
8567      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
8568    if (json.has("_mode"))
8569      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8570  }
8571
8572  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8573    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
8574    parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(json, owner, res);
8575    return res;
8576  }
8577
8578  protected void parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws IOException, FHIRFormatError {
8579    parseBackboneProperties(json, res);
8580    if (json.has("system"))
8581      res.setSystemElement(parseUri(json.get("system").getAsString()));
8582    if (json.has("_system"))
8583      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8584    if (json.has("version"))
8585      res.setVersionElement(parseString(json.get("version").getAsString()));
8586    if (json.has("_version"))
8587      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8588  }
8589
8590  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8591    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
8592    parseExpansionProfileExpansionProfileDesignationComponentProperties(json, owner, res);
8593    return res;
8594  }
8595
8596  protected void parseExpansionProfileExpansionProfileDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws IOException, FHIRFormatError {
8597    parseBackboneProperties(json, res);
8598    if (json.has("include"))
8599      res.setInclude(parseExpansionProfileDesignationIncludeComponent(json.getAsJsonObject("include"), owner));
8600    if (json.has("exclude"))
8601      res.setExclude(parseExpansionProfileDesignationExcludeComponent(json.getAsJsonObject("exclude"), owner));
8602  }
8603
8604  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8605    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
8606    parseExpansionProfileDesignationIncludeComponentProperties(json, owner, res);
8607    return res;
8608  }
8609
8610  protected void parseExpansionProfileDesignationIncludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws IOException, FHIRFormatError {
8611    parseBackboneProperties(json, res);
8612    if (json.has("designation")) {
8613      JsonArray array = json.getAsJsonArray("designation");
8614      for (int i = 0; i < array.size(); i++) {
8615        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8616      }
8617    };
8618  }
8619
8620  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8621    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
8622    parseExpansionProfileDesignationIncludeDesignationComponentProperties(json, owner, res);
8623    return res;
8624  }
8625
8626  protected void parseExpansionProfileDesignationIncludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws IOException, FHIRFormatError {
8627    parseBackboneProperties(json, res);
8628    if (json.has("language"))
8629      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8630    if (json.has("_language"))
8631      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
8632    if (json.has("use"))
8633      res.setUse(parseCoding(json.getAsJsonObject("use")));
8634  }
8635
8636  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8637    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
8638    parseExpansionProfileDesignationExcludeComponentProperties(json, owner, res);
8639    return res;
8640  }
8641
8642  protected void parseExpansionProfileDesignationExcludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws IOException, FHIRFormatError {
8643    parseBackboneProperties(json, res);
8644    if (json.has("designation")) {
8645      JsonArray array = json.getAsJsonArray("designation");
8646      for (int i = 0; i < array.size(); i++) {
8647        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8648      }
8649    };
8650  }
8651
8652  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8653    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
8654    parseExpansionProfileDesignationExcludeDesignationComponentProperties(json, owner, res);
8655    return res;
8656  }
8657
8658  protected void parseExpansionProfileDesignationExcludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws IOException, FHIRFormatError {
8659    parseBackboneProperties(json, res);
8660    if (json.has("language"))
8661      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8662    if (json.has("_language"))
8663      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
8664    if (json.has("use"))
8665      res.setUse(parseCoding(json.getAsJsonObject("use")));
8666  }
8667
8668  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
8669    ExplanationOfBenefit res = new ExplanationOfBenefit();
8670    parseExplanationOfBenefitProperties(json, res);
8671    return res;
8672  }
8673
8674  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
8675    parseDomainResourceProperties(json, res);
8676    if (json.has("identifier")) {
8677      JsonArray array = json.getAsJsonArray("identifier");
8678      for (int i = 0; i < array.size(); i++) {
8679        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8680      }
8681    };
8682    if (json.has("status"))
8683      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
8684    if (json.has("_status"))
8685      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8686    if (json.has("type"))
8687      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8688    if (json.has("subType")) {
8689      JsonArray array = json.getAsJsonArray("subType");
8690      for (int i = 0; i < array.size(); i++) {
8691        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8692      }
8693    };
8694    if (json.has("patient"))
8695      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8696    if (json.has("billablePeriod"))
8697      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
8698    if (json.has("created"))
8699      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8700    if (json.has("_created"))
8701      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8702    if (json.has("enterer"))
8703      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8704    if (json.has("insurer"))
8705      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8706    if (json.has("provider"))
8707      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8708    if (json.has("organization"))
8709      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8710    if (json.has("referral"))
8711      res.setReferral(parseReference(json.getAsJsonObject("referral")));
8712    if (json.has("facility"))
8713      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8714    if (json.has("claim"))
8715      res.setClaim(parseReference(json.getAsJsonObject("claim")));
8716    if (json.has("claimResponse"))
8717      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
8718    if (json.has("outcome"))
8719      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8720    if (json.has("disposition"))
8721      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8722    if (json.has("_disposition"))
8723      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8724    if (json.has("related")) {
8725      JsonArray array = json.getAsJsonArray("related");
8726      for (int i = 0; i < array.size(); i++) {
8727        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
8728      }
8729    };
8730    if (json.has("prescription"))
8731      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
8732    if (json.has("originalPrescription"))
8733      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
8734    if (json.has("payee"))
8735      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
8736    if (json.has("information")) {
8737      JsonArray array = json.getAsJsonArray("information");
8738      for (int i = 0; i < array.size(); i++) {
8739        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8740      }
8741    };
8742    if (json.has("careTeam")) {
8743      JsonArray array = json.getAsJsonArray("careTeam");
8744      for (int i = 0; i < array.size(); i++) {
8745        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
8746      }
8747    };
8748    if (json.has("diagnosis")) {
8749      JsonArray array = json.getAsJsonArray("diagnosis");
8750      for (int i = 0; i < array.size(); i++) {
8751        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8752      }
8753    };
8754    if (json.has("procedure")) {
8755      JsonArray array = json.getAsJsonArray("procedure");
8756      for (int i = 0; i < array.size(); i++) {
8757        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
8758      }
8759    };
8760    if (json.has("precedence"))
8761      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
8762    if (json.has("_precedence"))
8763      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
8764    if (json.has("insurance"))
8765      res.setInsurance(parseExplanationOfBenefitInsuranceComponent(json.getAsJsonObject("insurance"), res));
8766    if (json.has("accident"))
8767      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
8768    if (json.has("employmentImpacted"))
8769      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
8770    if (json.has("hospitalization"))
8771      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
8772    if (json.has("item")) {
8773      JsonArray array = json.getAsJsonArray("item");
8774      for (int i = 0; i < array.size(); i++) {
8775        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
8776      }
8777    };
8778    if (json.has("addItem")) {
8779      JsonArray array = json.getAsJsonArray("addItem");
8780      for (int i = 0; i < array.size(); i++) {
8781        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
8782      }
8783    };
8784    if (json.has("totalCost"))
8785      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
8786    if (json.has("unallocDeductable"))
8787      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
8788    if (json.has("totalBenefit"))
8789      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
8790    if (json.has("payment"))
8791      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
8792    if (json.has("form"))
8793      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8794    if (json.has("processNote")) {
8795      JsonArray array = json.getAsJsonArray("processNote");
8796      for (int i = 0; i < array.size(); i++) {
8797        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
8798      }
8799    };
8800    if (json.has("benefitBalance")) {
8801      JsonArray array = json.getAsJsonArray("benefitBalance");
8802      for (int i = 0; i < array.size(); i++) {
8803        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
8804      }
8805    };
8806  }
8807
8808  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8809    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
8810    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
8811    return res;
8812  }
8813
8814  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
8815    parseBackboneProperties(json, res);
8816    if (json.has("claim"))
8817      res.setClaim(parseReference(json.getAsJsonObject("claim")));
8818    if (json.has("relationship"))
8819      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
8820    if (json.has("reference"))
8821      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
8822  }
8823
8824  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8825    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
8826    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
8827    return res;
8828  }
8829
8830  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
8831    parseBackboneProperties(json, res);
8832    if (json.has("type"))
8833      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8834    if (json.has("resourceType"))
8835      res.setResourceType(parseCodeableConcept(json.getAsJsonObject("resourceType")));
8836    if (json.has("party"))
8837      res.setParty(parseReference(json.getAsJsonObject("party")));
8838  }
8839
8840  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8841    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
8842    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
8843    return res;
8844  }
8845
8846  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8847    parseBackboneProperties(json, res);
8848    if (json.has("sequence"))
8849      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8850    if (json.has("_sequence"))
8851      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8852    if (json.has("category"))
8853      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8854    if (json.has("code"))
8855      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8856    Type timing = parseType("timing", json);
8857    if (timing != null)
8858      res.setTiming(timing);
8859    Type value = parseType("value", json);
8860    if (value != null)
8861      res.setValue(value);
8862    if (json.has("reason"))
8863      res.setReason(parseCoding(json.getAsJsonObject("reason")));
8864  }
8865
8866  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8867    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
8868    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
8869    return res;
8870  }
8871
8872  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
8873    parseBackboneProperties(json, res);
8874    if (json.has("sequence"))
8875      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8876    if (json.has("_sequence"))
8877      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8878    if (json.has("provider"))
8879      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8880    if (json.has("responsible"))
8881      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
8882    if (json.has("_responsible"))
8883      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
8884    if (json.has("role"))
8885      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8886    if (json.has("qualification"))
8887      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
8888  }
8889
8890  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8891    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
8892    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
8893    return res;
8894  }
8895
8896  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
8897    parseBackboneProperties(json, res);
8898    if (json.has("sequence"))
8899      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8900    if (json.has("_sequence"))
8901      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8902    Type diagnosis = parseType("diagnosis", json);
8903    if (diagnosis != null)
8904      res.setDiagnosis(diagnosis);
8905    if (json.has("type")) {
8906      JsonArray array = json.getAsJsonArray("type");
8907      for (int i = 0; i < array.size(); i++) {
8908        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8909      }
8910    };
8911    if (json.has("packageCode"))
8912      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
8913  }
8914
8915  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8916    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
8917    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
8918    return res;
8919  }
8920
8921  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
8922    parseBackboneProperties(json, res);
8923    if (json.has("sequence"))
8924      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8925    if (json.has("_sequence"))
8926      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8927    if (json.has("date"))
8928      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8929    if (json.has("_date"))
8930      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8931    Type procedure = parseType("procedure", json);
8932    if (procedure != null)
8933      res.setProcedure(procedure);
8934  }
8935
8936  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8937    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
8938    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
8939    return res;
8940  }
8941
8942  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
8943    parseBackboneProperties(json, res);
8944    if (json.has("coverage"))
8945      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8946    if (json.has("preAuthRef")) {
8947      JsonArray array = json.getAsJsonArray("preAuthRef");
8948      for (int i = 0; i < array.size(); i++) {
8949        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
8950      }
8951    };
8952    if (json.has("_preAuthRef")) {
8953      JsonArray array = json.getAsJsonArray("_preAuthRef");
8954      for (int i = 0; i < array.size(); i++) {
8955        if (i == res.getPreAuthRef().size())
8956          res.getPreAuthRef().add(parseString(null));
8957        if (array.get(i) instanceof JsonObject) 
8958          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
8959      }
8960    };
8961  }
8962
8963  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8964    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
8965    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
8966    return res;
8967  }
8968
8969  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
8970    parseBackboneProperties(json, res);
8971    if (json.has("date"))
8972      res.setDateElement(parseDate(json.get("date").getAsString()));
8973    if (json.has("_date"))
8974      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8975    if (json.has("type"))
8976      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8977    Type location = parseType("location", json);
8978    if (location != null)
8979      res.setLocation(location);
8980  }
8981
8982  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8983    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
8984    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
8985    return res;
8986  }
8987
8988  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
8989    parseBackboneProperties(json, res);
8990    if (json.has("sequence"))
8991      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8992    if (json.has("_sequence"))
8993      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8994    if (json.has("careTeamLinkId")) {
8995      JsonArray array = json.getAsJsonArray("careTeamLinkId");
8996      for (int i = 0; i < array.size(); i++) {
8997        res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
8998      }
8999    };
9000    if (json.has("_careTeamLinkId")) {
9001      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
9002      for (int i = 0; i < array.size(); i++) {
9003        if (i == res.getCareTeamLinkId().size())
9004          res.getCareTeamLinkId().add(parsePositiveInt(null));
9005        if (array.get(i) instanceof JsonObject) 
9006          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
9007      }
9008    };
9009    if (json.has("diagnosisLinkId")) {
9010      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
9011      for (int i = 0; i < array.size(); i++) {
9012        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9013      }
9014    };
9015    if (json.has("_diagnosisLinkId")) {
9016      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
9017      for (int i = 0; i < array.size(); i++) {
9018        if (i == res.getDiagnosisLinkId().size())
9019          res.getDiagnosisLinkId().add(parsePositiveInt(null));
9020        if (array.get(i) instanceof JsonObject) 
9021          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
9022      }
9023    };
9024    if (json.has("procedureLinkId")) {
9025      JsonArray array = json.getAsJsonArray("procedureLinkId");
9026      for (int i = 0; i < array.size(); i++) {
9027        res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9028      }
9029    };
9030    if (json.has("_procedureLinkId")) {
9031      JsonArray array = json.getAsJsonArray("_procedureLinkId");
9032      for (int i = 0; i < array.size(); i++) {
9033        if (i == res.getProcedureLinkId().size())
9034          res.getProcedureLinkId().add(parsePositiveInt(null));
9035        if (array.get(i) instanceof JsonObject) 
9036          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
9037      }
9038    };
9039    if (json.has("informationLinkId")) {
9040      JsonArray array = json.getAsJsonArray("informationLinkId");
9041      for (int i = 0; i < array.size(); i++) {
9042        res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9043      }
9044    };
9045    if (json.has("_informationLinkId")) {
9046      JsonArray array = json.getAsJsonArray("_informationLinkId");
9047      for (int i = 0; i < array.size(); i++) {
9048        if (i == res.getInformationLinkId().size())
9049          res.getInformationLinkId().add(parsePositiveInt(null));
9050        if (array.get(i) instanceof JsonObject) 
9051          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
9052      }
9053    };
9054    if (json.has("revenue"))
9055      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9056    if (json.has("category"))
9057      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9058    if (json.has("service"))
9059      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9060    if (json.has("modifier")) {
9061      JsonArray array = json.getAsJsonArray("modifier");
9062      for (int i = 0; i < array.size(); i++) {
9063        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9064      }
9065    };
9066    if (json.has("programCode")) {
9067      JsonArray array = json.getAsJsonArray("programCode");
9068      for (int i = 0; i < array.size(); i++) {
9069        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9070      }
9071    };
9072    Type serviced = parseType("serviced", json);
9073    if (serviced != null)
9074      res.setServiced(serviced);
9075    Type location = parseType("location", json);
9076    if (location != null)
9077      res.setLocation(location);
9078    if (json.has("quantity"))
9079      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9080    if (json.has("unitPrice"))
9081      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9082    if (json.has("factor"))
9083      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9084    if (json.has("_factor"))
9085      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9086    if (json.has("net"))
9087      res.setNet(parseMoney(json.getAsJsonObject("net")));
9088    if (json.has("udi")) {
9089      JsonArray array = json.getAsJsonArray("udi");
9090      for (int i = 0; i < array.size(); i++) {
9091        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9092      }
9093    };
9094    if (json.has("bodySite"))
9095      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9096    if (json.has("subSite")) {
9097      JsonArray array = json.getAsJsonArray("subSite");
9098      for (int i = 0; i < array.size(); i++) {
9099        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9100      }
9101    };
9102    if (json.has("encounter")) {
9103      JsonArray array = json.getAsJsonArray("encounter");
9104      for (int i = 0; i < array.size(); i++) {
9105        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9106      }
9107    };
9108    if (json.has("noteNumber")) {
9109      JsonArray array = json.getAsJsonArray("noteNumber");
9110      for (int i = 0; i < array.size(); i++) {
9111        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9112      }
9113    };
9114    if (json.has("_noteNumber")) {
9115      JsonArray array = json.getAsJsonArray("_noteNumber");
9116      for (int i = 0; i < array.size(); i++) {
9117        if (i == res.getNoteNumber().size())
9118          res.getNoteNumber().add(parsePositiveInt(null));
9119        if (array.get(i) instanceof JsonObject) 
9120          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9121      }
9122    };
9123    if (json.has("adjudication")) {
9124      JsonArray array = json.getAsJsonArray("adjudication");
9125      for (int i = 0; i < array.size(); i++) {
9126        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9127      }
9128    };
9129    if (json.has("detail")) {
9130      JsonArray array = json.getAsJsonArray("detail");
9131      for (int i = 0; i < array.size(); i++) {
9132        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
9133      }
9134    };
9135  }
9136
9137  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9138    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
9139    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
9140    return res;
9141  }
9142
9143  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
9144    parseBackboneProperties(json, res);
9145    if (json.has("category"))
9146      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9147    if (json.has("reason"))
9148      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
9149    if (json.has("amount"))
9150      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
9151    if (json.has("value"))
9152      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
9153    if (json.has("_value"))
9154      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9155  }
9156
9157  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9158    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
9159    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
9160    return res;
9161  }
9162
9163  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
9164    parseBackboneProperties(json, res);
9165    if (json.has("sequence"))
9166      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9167    if (json.has("_sequence"))
9168      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9169    if (json.has("type"))
9170      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9171    if (json.has("revenue"))
9172      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9173    if (json.has("category"))
9174      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9175    if (json.has("service"))
9176      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9177    if (json.has("modifier")) {
9178      JsonArray array = json.getAsJsonArray("modifier");
9179      for (int i = 0; i < array.size(); i++) {
9180        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9181      }
9182    };
9183    if (json.has("programCode")) {
9184      JsonArray array = json.getAsJsonArray("programCode");
9185      for (int i = 0; i < array.size(); i++) {
9186        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9187      }
9188    };
9189    if (json.has("quantity"))
9190      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9191    if (json.has("unitPrice"))
9192      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9193    if (json.has("factor"))
9194      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9195    if (json.has("_factor"))
9196      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9197    if (json.has("net"))
9198      res.setNet(parseMoney(json.getAsJsonObject("net")));
9199    if (json.has("udi")) {
9200      JsonArray array = json.getAsJsonArray("udi");
9201      for (int i = 0; i < array.size(); i++) {
9202        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9203      }
9204    };
9205    if (json.has("noteNumber")) {
9206      JsonArray array = json.getAsJsonArray("noteNumber");
9207      for (int i = 0; i < array.size(); i++) {
9208        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9209      }
9210    };
9211    if (json.has("_noteNumber")) {
9212      JsonArray array = json.getAsJsonArray("_noteNumber");
9213      for (int i = 0; i < array.size(); i++) {
9214        if (i == res.getNoteNumber().size())
9215          res.getNoteNumber().add(parsePositiveInt(null));
9216        if (array.get(i) instanceof JsonObject) 
9217          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9218      }
9219    };
9220    if (json.has("adjudication")) {
9221      JsonArray array = json.getAsJsonArray("adjudication");
9222      for (int i = 0; i < array.size(); i++) {
9223        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9224      }
9225    };
9226    if (json.has("subDetail")) {
9227      JsonArray array = json.getAsJsonArray("subDetail");
9228      for (int i = 0; i < array.size(); i++) {
9229        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
9230      }
9231    };
9232  }
9233
9234  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9235    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
9236    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
9237    return res;
9238  }
9239
9240  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
9241    parseBackboneProperties(json, res);
9242    if (json.has("sequence"))
9243      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9244    if (json.has("_sequence"))
9245      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9246    if (json.has("type"))
9247      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9248    if (json.has("revenue"))
9249      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9250    if (json.has("category"))
9251      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9252    if (json.has("service"))
9253      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9254    if (json.has("modifier")) {
9255      JsonArray array = json.getAsJsonArray("modifier");
9256      for (int i = 0; i < array.size(); i++) {
9257        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9258      }
9259    };
9260    if (json.has("programCode")) {
9261      JsonArray array = json.getAsJsonArray("programCode");
9262      for (int i = 0; i < array.size(); i++) {
9263        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9264      }
9265    };
9266    if (json.has("quantity"))
9267      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9268    if (json.has("unitPrice"))
9269      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9270    if (json.has("factor"))
9271      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9272    if (json.has("_factor"))
9273      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9274    if (json.has("net"))
9275      res.setNet(parseMoney(json.getAsJsonObject("net")));
9276    if (json.has("udi")) {
9277      JsonArray array = json.getAsJsonArray("udi");
9278      for (int i = 0; i < array.size(); i++) {
9279        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9280      }
9281    };
9282    if (json.has("noteNumber")) {
9283      JsonArray array = json.getAsJsonArray("noteNumber");
9284      for (int i = 0; i < array.size(); i++) {
9285        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9286      }
9287    };
9288    if (json.has("_noteNumber")) {
9289      JsonArray array = json.getAsJsonArray("_noteNumber");
9290      for (int i = 0; i < array.size(); i++) {
9291        if (i == res.getNoteNumber().size())
9292          res.getNoteNumber().add(parsePositiveInt(null));
9293        if (array.get(i) instanceof JsonObject) 
9294          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9295      }
9296    };
9297    if (json.has("adjudication")) {
9298      JsonArray array = json.getAsJsonArray("adjudication");
9299      for (int i = 0; i < array.size(); i++) {
9300        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9301      }
9302    };
9303  }
9304
9305  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9306    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
9307    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
9308    return res;
9309  }
9310
9311  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
9312    parseBackboneProperties(json, res);
9313    if (json.has("sequenceLinkId")) {
9314      JsonArray array = json.getAsJsonArray("sequenceLinkId");
9315      for (int i = 0; i < array.size(); i++) {
9316        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9317      }
9318    };
9319    if (json.has("_sequenceLinkId")) {
9320      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
9321      for (int i = 0; i < array.size(); i++) {
9322        if (i == res.getSequenceLinkId().size())
9323          res.getSequenceLinkId().add(parsePositiveInt(null));
9324        if (array.get(i) instanceof JsonObject) 
9325          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
9326      }
9327    };
9328    if (json.has("revenue"))
9329      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9330    if (json.has("category"))
9331      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9332    if (json.has("service"))
9333      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9334    if (json.has("modifier")) {
9335      JsonArray array = json.getAsJsonArray("modifier");
9336      for (int i = 0; i < array.size(); i++) {
9337        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9338      }
9339    };
9340    if (json.has("fee"))
9341      res.setFee(parseMoney(json.getAsJsonObject("fee")));
9342    if (json.has("noteNumber")) {
9343      JsonArray array = json.getAsJsonArray("noteNumber");
9344      for (int i = 0; i < array.size(); i++) {
9345        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9346      }
9347    };
9348    if (json.has("_noteNumber")) {
9349      JsonArray array = json.getAsJsonArray("_noteNumber");
9350      for (int i = 0; i < array.size(); i++) {
9351        if (i == res.getNoteNumber().size())
9352          res.getNoteNumber().add(parsePositiveInt(null));
9353        if (array.get(i) instanceof JsonObject) 
9354          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9355      }
9356    };
9357    if (json.has("adjudication")) {
9358      JsonArray array = json.getAsJsonArray("adjudication");
9359      for (int i = 0; i < array.size(); i++) {
9360        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9361      }
9362    };
9363    if (json.has("detail")) {
9364      JsonArray array = json.getAsJsonArray("detail");
9365      for (int i = 0; i < array.size(); i++) {
9366        res.getDetail().add(parseExplanationOfBenefitAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
9367      }
9368    };
9369  }
9370
9371  protected ExplanationOfBenefit.AddedItemsDetailComponent parseExplanationOfBenefitAddedItemsDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9372    ExplanationOfBenefit.AddedItemsDetailComponent res = new ExplanationOfBenefit.AddedItemsDetailComponent();
9373    parseExplanationOfBenefitAddedItemsDetailComponentProperties(json, owner, res);
9374    return res;
9375  }
9376
9377  protected void parseExplanationOfBenefitAddedItemsDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
9378    parseBackboneProperties(json, res);
9379    if (json.has("revenue"))
9380      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9381    if (json.has("category"))
9382      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9383    if (json.has("service"))
9384      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9385    if (json.has("modifier")) {
9386      JsonArray array = json.getAsJsonArray("modifier");
9387      for (int i = 0; i < array.size(); i++) {
9388        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9389      }
9390    };
9391    if (json.has("fee"))
9392      res.setFee(parseMoney(json.getAsJsonObject("fee")));
9393    if (json.has("noteNumber")) {
9394      JsonArray array = json.getAsJsonArray("noteNumber");
9395      for (int i = 0; i < array.size(); i++) {
9396        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9397      }
9398    };
9399    if (json.has("_noteNumber")) {
9400      JsonArray array = json.getAsJsonArray("_noteNumber");
9401      for (int i = 0; i < array.size(); i++) {
9402        if (i == res.getNoteNumber().size())
9403          res.getNoteNumber().add(parsePositiveInt(null));
9404        if (array.get(i) instanceof JsonObject) 
9405          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9406      }
9407    };
9408    if (json.has("adjudication")) {
9409      JsonArray array = json.getAsJsonArray("adjudication");
9410      for (int i = 0; i < array.size(); i++) {
9411        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9412      }
9413    };
9414  }
9415
9416  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9417    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
9418    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
9419    return res;
9420  }
9421
9422  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
9423    parseBackboneProperties(json, res);
9424    if (json.has("type"))
9425      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9426    if (json.has("adjustment"))
9427      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
9428    if (json.has("adjustmentReason"))
9429      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
9430    if (json.has("date"))
9431      res.setDateElement(parseDate(json.get("date").getAsString()));
9432    if (json.has("_date"))
9433      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9434    if (json.has("amount"))
9435      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
9436    if (json.has("identifier"))
9437      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9438  }
9439
9440  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9441    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
9442    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
9443    return res;
9444  }
9445
9446  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
9447    parseBackboneProperties(json, res);
9448    if (json.has("number"))
9449      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
9450    if (json.has("_number"))
9451      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
9452    if (json.has("type"))
9453      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9454    if (json.has("text"))
9455      res.setTextElement(parseString(json.get("text").getAsString()));
9456    if (json.has("_text"))
9457      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9458    if (json.has("language"))
9459      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
9460  }
9461
9462  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9463    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
9464    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
9465    return res;
9466  }
9467
9468  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
9469    parseBackboneProperties(json, res);
9470    if (json.has("category"))
9471      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9472    if (json.has("subCategory"))
9473      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
9474    if (json.has("excluded"))
9475      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
9476    if (json.has("_excluded"))
9477      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
9478    if (json.has("name"))
9479      res.setNameElement(parseString(json.get("name").getAsString()));
9480    if (json.has("_name"))
9481      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9482    if (json.has("description"))
9483      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9484    if (json.has("_description"))
9485      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9486    if (json.has("network"))
9487      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
9488    if (json.has("unit"))
9489      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9490    if (json.has("term"))
9491      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
9492    if (json.has("financial")) {
9493      JsonArray array = json.getAsJsonArray("financial");
9494      for (int i = 0; i < array.size(); i++) {
9495        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
9496      }
9497    };
9498  }
9499
9500  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9501    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
9502    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
9503    return res;
9504  }
9505
9506  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
9507    parseBackboneProperties(json, res);
9508    if (json.has("type"))
9509      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9510    Type allowed = parseType("allowed", json);
9511    if (allowed != null)
9512      res.setAllowed(allowed);
9513    Type used = parseType("used", json);
9514    if (used != null)
9515      res.setUsed(used);
9516  }
9517
9518  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
9519    FamilyMemberHistory res = new FamilyMemberHistory();
9520    parseFamilyMemberHistoryProperties(json, res);
9521    return res;
9522  }
9523
9524  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
9525    parseDomainResourceProperties(json, res);
9526    if (json.has("identifier")) {
9527      JsonArray array = json.getAsJsonArray("identifier");
9528      for (int i = 0; i < array.size(); i++) {
9529        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9530      }
9531    };
9532    if (json.has("definition")) {
9533      JsonArray array = json.getAsJsonArray("definition");
9534      for (int i = 0; i < array.size(); i++) {
9535        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
9536      }
9537    };
9538    if (json.has("status"))
9539      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
9540    if (json.has("_status"))
9541      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9542    if (json.has("notDone"))
9543      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
9544    if (json.has("_notDone"))
9545      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
9546    if (json.has("notDoneReason"))
9547      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
9548    if (json.has("patient"))
9549      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9550    if (json.has("date"))
9551      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9552    if (json.has("_date"))
9553      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9554    if (json.has("name"))
9555      res.setNameElement(parseString(json.get("name").getAsString()));
9556    if (json.has("_name"))
9557      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9558    if (json.has("relationship"))
9559      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9560    if (json.has("gender"))
9561      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
9562    if (json.has("_gender"))
9563      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
9564    Type born = parseType("born", json);
9565    if (born != null)
9566      res.setBorn(born);
9567    Type age = parseType("age", json);
9568    if (age != null)
9569      res.setAge(age);
9570    if (json.has("estimatedAge"))
9571      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
9572    if (json.has("_estimatedAge"))
9573      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
9574    Type deceased = parseType("deceased", json);
9575    if (deceased != null)
9576      res.setDeceased(deceased);
9577    if (json.has("reasonCode")) {
9578      JsonArray array = json.getAsJsonArray("reasonCode");
9579      for (int i = 0; i < array.size(); i++) {
9580        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9581      }
9582    };
9583    if (json.has("reasonReference")) {
9584      JsonArray array = json.getAsJsonArray("reasonReference");
9585      for (int i = 0; i < array.size(); i++) {
9586        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9587      }
9588    };
9589    if (json.has("note")) {
9590      JsonArray array = json.getAsJsonArray("note");
9591      for (int i = 0; i < array.size(); i++) {
9592        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9593      }
9594    };
9595    if (json.has("condition")) {
9596      JsonArray array = json.getAsJsonArray("condition");
9597      for (int i = 0; i < array.size(); i++) {
9598        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
9599      }
9600    };
9601  }
9602
9603  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
9604    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
9605    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
9606    return res;
9607  }
9608
9609  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
9610    parseBackboneProperties(json, res);
9611    if (json.has("code"))
9612      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9613    if (json.has("outcome"))
9614      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
9615    Type onset = parseType("onset", json);
9616    if (onset != null)
9617      res.setOnset(onset);
9618    if (json.has("note")) {
9619      JsonArray array = json.getAsJsonArray("note");
9620      for (int i = 0; i < array.size(); i++) {
9621        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9622      }
9623    };
9624  }
9625
9626  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
9627    Flag res = new Flag();
9628    parseFlagProperties(json, res);
9629    return res;
9630  }
9631
9632  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
9633    parseDomainResourceProperties(json, res);
9634    if (json.has("identifier")) {
9635      JsonArray array = json.getAsJsonArray("identifier");
9636      for (int i = 0; i < array.size(); i++) {
9637        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9638      }
9639    };
9640    if (json.has("status"))
9641      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
9642    if (json.has("_status"))
9643      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9644    if (json.has("category"))
9645      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9646    if (json.has("code"))
9647      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9648    if (json.has("subject"))
9649      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9650    if (json.has("period"))
9651      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9652    if (json.has("encounter"))
9653      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9654    if (json.has("author"))
9655      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9656  }
9657
9658  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
9659    Goal res = new Goal();
9660    parseGoalProperties(json, res);
9661    return res;
9662  }
9663
9664  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
9665    parseDomainResourceProperties(json, res);
9666    if (json.has("identifier")) {
9667      JsonArray array = json.getAsJsonArray("identifier");
9668      for (int i = 0; i < array.size(); i++) {
9669        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9670      }
9671    };
9672    if (json.has("status"))
9673      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
9674    if (json.has("_status"))
9675      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9676    if (json.has("category")) {
9677      JsonArray array = json.getAsJsonArray("category");
9678      for (int i = 0; i < array.size(); i++) {
9679        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9680      }
9681    };
9682    if (json.has("priority"))
9683      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9684    if (json.has("description"))
9685      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
9686    if (json.has("subject"))
9687      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9688    Type start = parseType("start", json);
9689    if (start != null)
9690      res.setStart(start);
9691    if (json.has("target"))
9692      res.setTarget(parseGoalGoalTargetComponent(json.getAsJsonObject("target"), res));
9693    if (json.has("statusDate"))
9694      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
9695    if (json.has("_statusDate"))
9696      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
9697    if (json.has("statusReason"))
9698      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
9699    if (json.has("_statusReason"))
9700      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
9701    if (json.has("expressedBy"))
9702      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
9703    if (json.has("addresses")) {
9704      JsonArray array = json.getAsJsonArray("addresses");
9705      for (int i = 0; i < array.size(); i++) {
9706        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
9707      }
9708    };
9709    if (json.has("note")) {
9710      JsonArray array = json.getAsJsonArray("note");
9711      for (int i = 0; i < array.size(); i++) {
9712        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9713      }
9714    };
9715    if (json.has("outcomeCode")) {
9716      JsonArray array = json.getAsJsonArray("outcomeCode");
9717      for (int i = 0; i < array.size(); i++) {
9718        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9719      }
9720    };
9721    if (json.has("outcomeReference")) {
9722      JsonArray array = json.getAsJsonArray("outcomeReference");
9723      for (int i = 0; i < array.size(); i++) {
9724        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
9725      }
9726    };
9727  }
9728
9729  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
9730    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
9731    parseGoalGoalTargetComponentProperties(json, owner, res);
9732    return res;
9733  }
9734
9735  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
9736    parseBackboneProperties(json, res);
9737    if (json.has("measure"))
9738      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
9739    Type detail = parseType("detail", json);
9740    if (detail != null)
9741      res.setDetail(detail);
9742    Type due = parseType("due", json);
9743    if (due != null)
9744      res.setDue(due);
9745  }
9746
9747  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
9748    GraphDefinition res = new GraphDefinition();
9749    parseGraphDefinitionProperties(json, res);
9750    return res;
9751  }
9752
9753  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
9754    parseDomainResourceProperties(json, res);
9755    if (json.has("url"))
9756      res.setUrlElement(parseUri(json.get("url").getAsString()));
9757    if (json.has("_url"))
9758      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9759    if (json.has("version"))
9760      res.setVersionElement(parseString(json.get("version").getAsString()));
9761    if (json.has("_version"))
9762      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9763    if (json.has("name"))
9764      res.setNameElement(parseString(json.get("name").getAsString()));
9765    if (json.has("_name"))
9766      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9767    if (json.has("status"))
9768      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9769    if (json.has("_status"))
9770      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9771    if (json.has("experimental"))
9772      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9773    if (json.has("_experimental"))
9774      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9775    if (json.has("date"))
9776      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9777    if (json.has("_date"))
9778      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9779    if (json.has("publisher"))
9780      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9781    if (json.has("_publisher"))
9782      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9783    if (json.has("contact")) {
9784      JsonArray array = json.getAsJsonArray("contact");
9785      for (int i = 0; i < array.size(); i++) {
9786        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9787      }
9788    };
9789    if (json.has("description"))
9790      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9791    if (json.has("_description"))
9792      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9793    if (json.has("useContext")) {
9794      JsonArray array = json.getAsJsonArray("useContext");
9795      for (int i = 0; i < array.size(); i++) {
9796        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9797      }
9798    };
9799    if (json.has("jurisdiction")) {
9800      JsonArray array = json.getAsJsonArray("jurisdiction");
9801      for (int i = 0; i < array.size(); i++) {
9802        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9803      }
9804    };
9805    if (json.has("purpose"))
9806      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9807    if (json.has("_purpose"))
9808      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
9809    if (json.has("start"))
9810      res.setStartElement(parseCode(json.get("start").getAsString()));
9811    if (json.has("_start"))
9812      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
9813    if (json.has("profile"))
9814      res.setProfileElement(parseUri(json.get("profile").getAsString()));
9815    if (json.has("_profile"))
9816      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
9817    if (json.has("link")) {
9818      JsonArray array = json.getAsJsonArray("link");
9819      for (int i = 0; i < array.size(); i++) {
9820        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
9821      }
9822    };
9823  }
9824
9825  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9826    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
9827    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
9828    return res;
9829  }
9830
9831  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
9832    parseBackboneProperties(json, res);
9833    if (json.has("path"))
9834      res.setPathElement(parseString(json.get("path").getAsString()));
9835    if (json.has("_path"))
9836      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
9837    if (json.has("sliceName"))
9838      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
9839    if (json.has("_sliceName"))
9840      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
9841    if (json.has("min"))
9842      res.setMinElement(parseInteger(json.get("min").getAsLong()));
9843    if (json.has("_min"))
9844      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
9845    if (json.has("max"))
9846      res.setMaxElement(parseString(json.get("max").getAsString()));
9847    if (json.has("_max"))
9848      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
9849    if (json.has("description"))
9850      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9851    if (json.has("_description"))
9852      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9853    if (json.has("target")) {
9854      JsonArray array = json.getAsJsonArray("target");
9855      for (int i = 0; i < array.size(); i++) {
9856        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
9857      }
9858    };
9859  }
9860
9861  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9862    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
9863    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
9864    return res;
9865  }
9866
9867  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
9868    parseBackboneProperties(json, res);
9869    if (json.has("type"))
9870      res.setTypeElement(parseCode(json.get("type").getAsString()));
9871    if (json.has("_type"))
9872      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9873    if (json.has("profile"))
9874      res.setProfileElement(parseUri(json.get("profile").getAsString()));
9875    if (json.has("_profile"))
9876      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
9877    if (json.has("compartment")) {
9878      JsonArray array = json.getAsJsonArray("compartment");
9879      for (int i = 0; i < array.size(); i++) {
9880        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
9881      }
9882    };
9883    if (json.has("link")) {
9884      JsonArray array = json.getAsJsonArray("link");
9885      for (int i = 0; i < array.size(); i++) {
9886        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
9887      }
9888    };
9889  }
9890
9891  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9892    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
9893    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
9894    return res;
9895  }
9896
9897  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
9898    parseBackboneProperties(json, res);
9899    if (json.has("code"))
9900      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
9901    if (json.has("_code"))
9902      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9903    if (json.has("rule"))
9904      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
9905    if (json.has("_rule"))
9906      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
9907    if (json.has("expression"))
9908      res.setExpressionElement(parseString(json.get("expression").getAsString()));
9909    if (json.has("_expression"))
9910      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
9911    if (json.has("description"))
9912      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9913    if (json.has("_description"))
9914      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9915  }
9916
9917  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
9918    Group res = new Group();
9919    parseGroupProperties(json, res);
9920    return res;
9921  }
9922
9923  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
9924    parseDomainResourceProperties(json, res);
9925    if (json.has("identifier")) {
9926      JsonArray array = json.getAsJsonArray("identifier");
9927      for (int i = 0; i < array.size(); i++) {
9928        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9929      }
9930    };
9931    if (json.has("active"))
9932      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
9933    if (json.has("_active"))
9934      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
9935    if (json.has("type"))
9936      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
9937    if (json.has("_type"))
9938      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9939    if (json.has("actual"))
9940      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
9941    if (json.has("_actual"))
9942      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
9943    if (json.has("code"))
9944      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9945    if (json.has("name"))
9946      res.setNameElement(parseString(json.get("name").getAsString()));
9947    if (json.has("_name"))
9948      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9949    if (json.has("quantity"))
9950      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
9951    if (json.has("_quantity"))
9952      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
9953    if (json.has("characteristic")) {
9954      JsonArray array = json.getAsJsonArray("characteristic");
9955      for (int i = 0; i < array.size(); i++) {
9956        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
9957      }
9958    };
9959    if (json.has("member")) {
9960      JsonArray array = json.getAsJsonArray("member");
9961      for (int i = 0; i < array.size(); i++) {
9962        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
9963      }
9964    };
9965  }
9966
9967  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
9968    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
9969    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
9970    return res;
9971  }
9972
9973  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
9974    parseBackboneProperties(json, res);
9975    if (json.has("code"))
9976      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9977    Type value = parseType("value", json);
9978    if (value != null)
9979      res.setValue(value);
9980    if (json.has("exclude"))
9981      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
9982    if (json.has("_exclude"))
9983      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
9984    if (json.has("period"))
9985      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9986  }
9987
9988  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
9989    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
9990    parseGroupGroupMemberComponentProperties(json, owner, res);
9991    return res;
9992  }
9993
9994  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
9995    parseBackboneProperties(json, res);
9996    if (json.has("entity"))
9997      res.setEntity(parseReference(json.getAsJsonObject("entity")));
9998    if (json.has("period"))
9999      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10000    if (json.has("inactive"))
10001      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
10002    if (json.has("_inactive"))
10003      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
10004  }
10005
10006  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
10007    GuidanceResponse res = new GuidanceResponse();
10008    parseGuidanceResponseProperties(json, res);
10009    return res;
10010  }
10011
10012  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
10013    parseDomainResourceProperties(json, res);
10014    if (json.has("requestId"))
10015      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
10016    if (json.has("_requestId"))
10017      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
10018    if (json.has("identifier"))
10019      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10020    if (json.has("module"))
10021      res.setModule(parseReference(json.getAsJsonObject("module")));
10022    if (json.has("status"))
10023      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
10024    if (json.has("_status"))
10025      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10026    if (json.has("subject"))
10027      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10028    if (json.has("context"))
10029      res.setContext(parseReference(json.getAsJsonObject("context")));
10030    if (json.has("occurrenceDateTime"))
10031      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
10032    if (json.has("_occurrenceDateTime"))
10033      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
10034    if (json.has("performer"))
10035      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
10036    Type reason = parseType("reason", json);
10037    if (reason != null)
10038      res.setReason(reason);
10039    if (json.has("note")) {
10040      JsonArray array = json.getAsJsonArray("note");
10041      for (int i = 0; i < array.size(); i++) {
10042        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10043      }
10044    };
10045    if (json.has("evaluationMessage")) {
10046      JsonArray array = json.getAsJsonArray("evaluationMessage");
10047      for (int i = 0; i < array.size(); i++) {
10048        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
10049      }
10050    };
10051    if (json.has("outputParameters"))
10052      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
10053    if (json.has("result"))
10054      res.setResult(parseReference(json.getAsJsonObject("result")));
10055    if (json.has("dataRequirement")) {
10056      JsonArray array = json.getAsJsonArray("dataRequirement");
10057      for (int i = 0; i < array.size(); i++) {
10058        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
10059      }
10060    };
10061  }
10062
10063  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
10064    HealthcareService res = new HealthcareService();
10065    parseHealthcareServiceProperties(json, res);
10066    return res;
10067  }
10068
10069  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
10070    parseDomainResourceProperties(json, res);
10071    if (json.has("identifier")) {
10072      JsonArray array = json.getAsJsonArray("identifier");
10073      for (int i = 0; i < array.size(); i++) {
10074        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10075      }
10076    };
10077    if (json.has("active"))
10078      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
10079    if (json.has("_active"))
10080      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
10081    if (json.has("providedBy"))
10082      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
10083    if (json.has("category"))
10084      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10085    if (json.has("type")) {
10086      JsonArray array = json.getAsJsonArray("type");
10087      for (int i = 0; i < array.size(); i++) {
10088        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10089      }
10090    };
10091    if (json.has("specialty")) {
10092      JsonArray array = json.getAsJsonArray("specialty");
10093      for (int i = 0; i < array.size(); i++) {
10094        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10095      }
10096    };
10097    if (json.has("location")) {
10098      JsonArray array = json.getAsJsonArray("location");
10099      for (int i = 0; i < array.size(); i++) {
10100        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
10101      }
10102    };
10103    if (json.has("name"))
10104      res.setNameElement(parseString(json.get("name").getAsString()));
10105    if (json.has("_name"))
10106      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10107    if (json.has("comment"))
10108      res.setCommentElement(parseString(json.get("comment").getAsString()));
10109    if (json.has("_comment"))
10110      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
10111    if (json.has("extraDetails"))
10112      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
10113    if (json.has("_extraDetails"))
10114      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
10115    if (json.has("photo"))
10116      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
10117    if (json.has("telecom")) {
10118      JsonArray array = json.getAsJsonArray("telecom");
10119      for (int i = 0; i < array.size(); i++) {
10120        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10121      }
10122    };
10123    if (json.has("coverageArea")) {
10124      JsonArray array = json.getAsJsonArray("coverageArea");
10125      for (int i = 0; i < array.size(); i++) {
10126        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
10127      }
10128    };
10129    if (json.has("serviceProvisionCode")) {
10130      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
10131      for (int i = 0; i < array.size(); i++) {
10132        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10133      }
10134    };
10135    if (json.has("eligibility"))
10136      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
10137    if (json.has("eligibilityNote"))
10138      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
10139    if (json.has("_eligibilityNote"))
10140      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
10141    if (json.has("programName")) {
10142      JsonArray array = json.getAsJsonArray("programName");
10143      for (int i = 0; i < array.size(); i++) {
10144        res.getProgramName().add(parseString(array.get(i).getAsString()));
10145      }
10146    };
10147    if (json.has("_programName")) {
10148      JsonArray array = json.getAsJsonArray("_programName");
10149      for (int i = 0; i < array.size(); i++) {
10150        if (i == res.getProgramName().size())
10151          res.getProgramName().add(parseString(null));
10152        if (array.get(i) instanceof JsonObject) 
10153          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
10154      }
10155    };
10156    if (json.has("characteristic")) {
10157      JsonArray array = json.getAsJsonArray("characteristic");
10158      for (int i = 0; i < array.size(); i++) {
10159        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10160      }
10161    };
10162    if (json.has("referralMethod")) {
10163      JsonArray array = json.getAsJsonArray("referralMethod");
10164      for (int i = 0; i < array.size(); i++) {
10165        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10166      }
10167    };
10168    if (json.has("appointmentRequired"))
10169      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
10170    if (json.has("_appointmentRequired"))
10171      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
10172    if (json.has("availableTime")) {
10173      JsonArray array = json.getAsJsonArray("availableTime");
10174      for (int i = 0; i < array.size(); i++) {
10175        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
10176      }
10177    };
10178    if (json.has("notAvailable")) {
10179      JsonArray array = json.getAsJsonArray("notAvailable");
10180      for (int i = 0; i < array.size(); i++) {
10181        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
10182      }
10183    };
10184    if (json.has("availabilityExceptions"))
10185      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
10186    if (json.has("_availabilityExceptions"))
10187      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
10188    if (json.has("endpoint")) {
10189      JsonArray array = json.getAsJsonArray("endpoint");
10190      for (int i = 0; i < array.size(); i++) {
10191        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10192      }
10193    };
10194  }
10195
10196  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10197    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
10198    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
10199    return res;
10200  }
10201
10202  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
10203    parseBackboneProperties(json, res);
10204    if (json.has("daysOfWeek")) {
10205      JsonArray array = json.getAsJsonArray("daysOfWeek");
10206      for (int i = 0; i < array.size(); i++) {
10207        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10208      }
10209    };
10210    if (json.has("_daysOfWeek")) {
10211      JsonArray array = json.getAsJsonArray("_daysOfWeek");
10212      for (int i = 0; i < array.size(); i++) {
10213        if (i == res.getDaysOfWeek().size())
10214          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10215        if (array.get(i) instanceof JsonObject) 
10216          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
10217      }
10218    };
10219    if (json.has("allDay"))
10220      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
10221    if (json.has("_allDay"))
10222      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
10223    if (json.has("availableStartTime"))
10224      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
10225    if (json.has("_availableStartTime"))
10226      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
10227    if (json.has("availableEndTime"))
10228      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
10229    if (json.has("_availableEndTime"))
10230      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
10231  }
10232
10233  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10234    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
10235    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
10236    return res;
10237  }
10238
10239  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
10240    parseBackboneProperties(json, res);
10241    if (json.has("description"))
10242      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10243    if (json.has("_description"))
10244      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10245    if (json.has("during"))
10246      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
10247  }
10248
10249  protected ImagingManifest parseImagingManifest(JsonObject json) throws IOException, FHIRFormatError {
10250    ImagingManifest res = new ImagingManifest();
10251    parseImagingManifestProperties(json, res);
10252    return res;
10253  }
10254
10255  protected void parseImagingManifestProperties(JsonObject json, ImagingManifest res) throws IOException, FHIRFormatError {
10256    parseDomainResourceProperties(json, res);
10257    if (json.has("identifier"))
10258      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10259    if (json.has("patient"))
10260      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10261    if (json.has("authoringTime"))
10262      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
10263    if (json.has("_authoringTime"))
10264      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
10265    if (json.has("author"))
10266      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10267    if (json.has("description"))
10268      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10269    if (json.has("_description"))
10270      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10271    if (json.has("study")) {
10272      JsonArray array = json.getAsJsonArray("study");
10273      for (int i = 0; i < array.size(); i++) {
10274        res.getStudy().add(parseImagingManifestStudyComponent(array.get(i).getAsJsonObject(), res));
10275      }
10276    };
10277  }
10278
10279  protected ImagingManifest.StudyComponent parseImagingManifestStudyComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10280    ImagingManifest.StudyComponent res = new ImagingManifest.StudyComponent();
10281    parseImagingManifestStudyComponentProperties(json, owner, res);
10282    return res;
10283  }
10284
10285  protected void parseImagingManifestStudyComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.StudyComponent res) throws IOException, FHIRFormatError {
10286    parseBackboneProperties(json, res);
10287    if (json.has("uid"))
10288      res.setUidElement(parseOid(json.get("uid").getAsString()));
10289    if (json.has("_uid"))
10290      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10291    if (json.has("imagingStudy"))
10292      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
10293    if (json.has("endpoint")) {
10294      JsonArray array = json.getAsJsonArray("endpoint");
10295      for (int i = 0; i < array.size(); i++) {
10296        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10297      }
10298    };
10299    if (json.has("series")) {
10300      JsonArray array = json.getAsJsonArray("series");
10301      for (int i = 0; i < array.size(); i++) {
10302        res.getSeries().add(parseImagingManifestSeriesComponent(array.get(i).getAsJsonObject(), owner));
10303      }
10304    };
10305  }
10306
10307  protected ImagingManifest.SeriesComponent parseImagingManifestSeriesComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10308    ImagingManifest.SeriesComponent res = new ImagingManifest.SeriesComponent();
10309    parseImagingManifestSeriesComponentProperties(json, owner, res);
10310    return res;
10311  }
10312
10313  protected void parseImagingManifestSeriesComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.SeriesComponent res) throws IOException, FHIRFormatError {
10314    parseBackboneProperties(json, res);
10315    if (json.has("uid"))
10316      res.setUidElement(parseOid(json.get("uid").getAsString()));
10317    if (json.has("_uid"))
10318      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10319    if (json.has("endpoint")) {
10320      JsonArray array = json.getAsJsonArray("endpoint");
10321      for (int i = 0; i < array.size(); i++) {
10322        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10323      }
10324    };
10325    if (json.has("instance")) {
10326      JsonArray array = json.getAsJsonArray("instance");
10327      for (int i = 0; i < array.size(); i++) {
10328        res.getInstance().add(parseImagingManifestInstanceComponent(array.get(i).getAsJsonObject(), owner));
10329      }
10330    };
10331  }
10332
10333  protected ImagingManifest.InstanceComponent parseImagingManifestInstanceComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10334    ImagingManifest.InstanceComponent res = new ImagingManifest.InstanceComponent();
10335    parseImagingManifestInstanceComponentProperties(json, owner, res);
10336    return res;
10337  }
10338
10339  protected void parseImagingManifestInstanceComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.InstanceComponent res) throws IOException, FHIRFormatError {
10340    parseBackboneProperties(json, res);
10341    if (json.has("sopClass"))
10342      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10343    if (json.has("_sopClass"))
10344      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
10345    if (json.has("uid"))
10346      res.setUidElement(parseOid(json.get("uid").getAsString()));
10347    if (json.has("_uid"))
10348      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10349  }
10350
10351  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
10352    ImagingStudy res = new ImagingStudy();
10353    parseImagingStudyProperties(json, res);
10354    return res;
10355  }
10356
10357  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
10358    parseDomainResourceProperties(json, res);
10359    if (json.has("uid"))
10360      res.setUidElement(parseOid(json.get("uid").getAsString()));
10361    if (json.has("_uid"))
10362      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10363    if (json.has("accession"))
10364      res.setAccession(parseIdentifier(json.getAsJsonObject("accession")));
10365    if (json.has("identifier")) {
10366      JsonArray array = json.getAsJsonArray("identifier");
10367      for (int i = 0; i < array.size(); i++) {
10368        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10369      }
10370    };
10371    if (json.has("availability"))
10372      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10373    if (json.has("_availability"))
10374      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
10375    if (json.has("modalityList")) {
10376      JsonArray array = json.getAsJsonArray("modalityList");
10377      for (int i = 0; i < array.size(); i++) {
10378        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
10379      }
10380    };
10381    if (json.has("patient"))
10382      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10383    if (json.has("context"))
10384      res.setContext(parseReference(json.getAsJsonObject("context")));
10385    if (json.has("started"))
10386      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10387    if (json.has("_started"))
10388      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
10389    if (json.has("basedOn")) {
10390      JsonArray array = json.getAsJsonArray("basedOn");
10391      for (int i = 0; i < array.size(); i++) {
10392        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10393      }
10394    };
10395    if (json.has("referrer"))
10396      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
10397    if (json.has("interpreter")) {
10398      JsonArray array = json.getAsJsonArray("interpreter");
10399      for (int i = 0; i < array.size(); i++) {
10400        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
10401      }
10402    };
10403    if (json.has("endpoint")) {
10404      JsonArray array = json.getAsJsonArray("endpoint");
10405      for (int i = 0; i < array.size(); i++) {
10406        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10407      }
10408    };
10409    if (json.has("numberOfSeries"))
10410      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
10411    if (json.has("_numberOfSeries"))
10412      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
10413    if (json.has("numberOfInstances"))
10414      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10415    if (json.has("_numberOfInstances"))
10416      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
10417    if (json.has("procedureReference")) {
10418      JsonArray array = json.getAsJsonArray("procedureReference");
10419      for (int i = 0; i < array.size(); i++) {
10420        res.getProcedureReference().add(parseReference(array.get(i).getAsJsonObject()));
10421      }
10422    };
10423    if (json.has("procedureCode")) {
10424      JsonArray array = json.getAsJsonArray("procedureCode");
10425      for (int i = 0; i < array.size(); i++) {
10426        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10427      }
10428    };
10429    if (json.has("reason"))
10430      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
10431    if (json.has("description"))
10432      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10433    if (json.has("_description"))
10434      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10435    if (json.has("series")) {
10436      JsonArray array = json.getAsJsonArray("series");
10437      for (int i = 0; i < array.size(); i++) {
10438        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
10439      }
10440    };
10441  }
10442
10443  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10444    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
10445    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
10446    return res;
10447  }
10448
10449  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
10450    parseBackboneProperties(json, res);
10451    if (json.has("uid"))
10452      res.setUidElement(parseOid(json.get("uid").getAsString()));
10453    if (json.has("_uid"))
10454      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10455    if (json.has("number"))
10456      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10457    if (json.has("_number"))
10458      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10459    if (json.has("modality"))
10460      res.setModality(parseCoding(json.getAsJsonObject("modality")));
10461    if (json.has("description"))
10462      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10463    if (json.has("_description"))
10464      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10465    if (json.has("numberOfInstances"))
10466      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10467    if (json.has("_numberOfInstances"))
10468      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
10469    if (json.has("availability"))
10470      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10471    if (json.has("_availability"))
10472      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
10473    if (json.has("endpoint")) {
10474      JsonArray array = json.getAsJsonArray("endpoint");
10475      for (int i = 0; i < array.size(); i++) {
10476        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10477      }
10478    };
10479    if (json.has("bodySite"))
10480      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
10481    if (json.has("laterality"))
10482      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
10483    if (json.has("started"))
10484      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10485    if (json.has("_started"))
10486      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
10487    if (json.has("performer")) {
10488      JsonArray array = json.getAsJsonArray("performer");
10489      for (int i = 0; i < array.size(); i++) {
10490        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
10491      }
10492    };
10493    if (json.has("instance")) {
10494      JsonArray array = json.getAsJsonArray("instance");
10495      for (int i = 0; i < array.size(); i++) {
10496        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
10497      }
10498    };
10499  }
10500
10501  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10502    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
10503    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
10504    return res;
10505  }
10506
10507  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
10508    parseBackboneProperties(json, res);
10509    if (json.has("uid"))
10510      res.setUidElement(parseOid(json.get("uid").getAsString()));
10511    if (json.has("_uid"))
10512      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10513    if (json.has("number"))
10514      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10515    if (json.has("_number"))
10516      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10517    if (json.has("sopClass"))
10518      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10519    if (json.has("_sopClass"))
10520      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
10521    if (json.has("title"))
10522      res.setTitleElement(parseString(json.get("title").getAsString()));
10523    if (json.has("_title"))
10524      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10525  }
10526
10527  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
10528    Immunization res = new Immunization();
10529    parseImmunizationProperties(json, res);
10530    return res;
10531  }
10532
10533  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
10534    parseDomainResourceProperties(json, res);
10535    if (json.has("identifier")) {
10536      JsonArray array = json.getAsJsonArray("identifier");
10537      for (int i = 0; i < array.size(); i++) {
10538        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10539      }
10540    };
10541    if (json.has("status"))
10542      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
10543    if (json.has("_status"))
10544      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10545    if (json.has("notGiven"))
10546      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
10547    if (json.has("_notGiven"))
10548      parseElementProperties(json.getAsJsonObject("_notGiven"), res.getNotGivenElement());
10549    if (json.has("vaccineCode"))
10550      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
10551    if (json.has("patient"))
10552      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10553    if (json.has("encounter"))
10554      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10555    if (json.has("date"))
10556      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10557    if (json.has("_date"))
10558      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10559    if (json.has("primarySource"))
10560      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
10561    if (json.has("_primarySource"))
10562      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
10563    if (json.has("reportOrigin"))
10564      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
10565    if (json.has("location"))
10566      res.setLocation(parseReference(json.getAsJsonObject("location")));
10567    if (json.has("manufacturer"))
10568      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
10569    if (json.has("lotNumber"))
10570      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10571    if (json.has("_lotNumber"))
10572      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
10573    if (json.has("expirationDate"))
10574      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
10575    if (json.has("_expirationDate"))
10576      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
10577    if (json.has("site"))
10578      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
10579    if (json.has("route"))
10580      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10581    if (json.has("doseQuantity"))
10582      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
10583    if (json.has("practitioner")) {
10584      JsonArray array = json.getAsJsonArray("practitioner");
10585      for (int i = 0; i < array.size(); i++) {
10586        res.getPractitioner().add(parseImmunizationImmunizationPractitionerComponent(array.get(i).getAsJsonObject(), res));
10587      }
10588    };
10589    if (json.has("note")) {
10590      JsonArray array = json.getAsJsonArray("note");
10591      for (int i = 0; i < array.size(); i++) {
10592        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10593      }
10594    };
10595    if (json.has("explanation"))
10596      res.setExplanation(parseImmunizationImmunizationExplanationComponent(json.getAsJsonObject("explanation"), res));
10597    if (json.has("reaction")) {
10598      JsonArray array = json.getAsJsonArray("reaction");
10599      for (int i = 0; i < array.size(); i++) {
10600        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
10601      }
10602    };
10603    if (json.has("vaccinationProtocol")) {
10604      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
10605      for (int i = 0; i < array.size(); i++) {
10606        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
10607      }
10608    };
10609  }
10610
10611  protected Immunization.ImmunizationPractitionerComponent parseImmunizationImmunizationPractitionerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10612    Immunization.ImmunizationPractitionerComponent res = new Immunization.ImmunizationPractitionerComponent();
10613    parseImmunizationImmunizationPractitionerComponentProperties(json, owner, res);
10614    return res;
10615  }
10616
10617  protected void parseImmunizationImmunizationPractitionerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPractitionerComponent res) throws IOException, FHIRFormatError {
10618    parseBackboneProperties(json, res);
10619    if (json.has("role"))
10620      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10621    if (json.has("actor"))
10622      res.setActor(parseReference(json.getAsJsonObject("actor")));
10623  }
10624
10625  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10626    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
10627    parseImmunizationImmunizationExplanationComponentProperties(json, owner, res);
10628    return res;
10629  }
10630
10631  protected void parseImmunizationImmunizationExplanationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationExplanationComponent res) throws IOException, FHIRFormatError {
10632    parseBackboneProperties(json, res);
10633    if (json.has("reason")) {
10634      JsonArray array = json.getAsJsonArray("reason");
10635      for (int i = 0; i < array.size(); i++) {
10636        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10637      }
10638    };
10639    if (json.has("reasonNotGiven")) {
10640      JsonArray array = json.getAsJsonArray("reasonNotGiven");
10641      for (int i = 0; i < array.size(); i++) {
10642        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10643      }
10644    };
10645  }
10646
10647  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10648    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
10649    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
10650    return res;
10651  }
10652
10653  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
10654    parseBackboneProperties(json, res);
10655    if (json.has("date"))
10656      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10657    if (json.has("_date"))
10658      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10659    if (json.has("detail"))
10660      res.setDetail(parseReference(json.getAsJsonObject("detail")));
10661    if (json.has("reported"))
10662      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
10663    if (json.has("_reported"))
10664      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
10665  }
10666
10667  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10668    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
10669    parseImmunizationImmunizationVaccinationProtocolComponentProperties(json, owner, res);
10670    return res;
10671  }
10672
10673  protected void parseImmunizationImmunizationVaccinationProtocolComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationVaccinationProtocolComponent res) throws IOException, FHIRFormatError {
10674    parseBackboneProperties(json, res);
10675    if (json.has("doseSequence"))
10676      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
10677    if (json.has("_doseSequence"))
10678      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
10679    if (json.has("description"))
10680      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10681    if (json.has("_description"))
10682      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10683    if (json.has("authority"))
10684      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
10685    if (json.has("series"))
10686      res.setSeriesElement(parseString(json.get("series").getAsString()));
10687    if (json.has("_series"))
10688      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
10689    if (json.has("seriesDoses"))
10690      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
10691    if (json.has("_seriesDoses"))
10692      parseElementProperties(json.getAsJsonObject("_seriesDoses"), res.getSeriesDosesElement());
10693    if (json.has("targetDisease")) {
10694      JsonArray array = json.getAsJsonArray("targetDisease");
10695      for (int i = 0; i < array.size(); i++) {
10696        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10697      }
10698    };
10699    if (json.has("doseStatus"))
10700      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
10701    if (json.has("doseStatusReason"))
10702      res.setDoseStatusReason(parseCodeableConcept(json.getAsJsonObject("doseStatusReason")));
10703  }
10704
10705  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
10706    ImmunizationRecommendation res = new ImmunizationRecommendation();
10707    parseImmunizationRecommendationProperties(json, res);
10708    return res;
10709  }
10710
10711  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
10712    parseDomainResourceProperties(json, res);
10713    if (json.has("identifier")) {
10714      JsonArray array = json.getAsJsonArray("identifier");
10715      for (int i = 0; i < array.size(); i++) {
10716        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10717      }
10718    };
10719    if (json.has("patient"))
10720      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10721    if (json.has("recommendation")) {
10722      JsonArray array = json.getAsJsonArray("recommendation");
10723      for (int i = 0; i < array.size(); i++) {
10724        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
10725      }
10726    };
10727  }
10728
10729  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10730    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
10731    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
10732    return res;
10733  }
10734
10735  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
10736    parseBackboneProperties(json, res);
10737    if (json.has("date"))
10738      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10739    if (json.has("_date"))
10740      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10741    if (json.has("vaccineCode"))
10742      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
10743    if (json.has("targetDisease"))
10744      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
10745    if (json.has("doseNumber"))
10746      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
10747    if (json.has("_doseNumber"))
10748      parseElementProperties(json.getAsJsonObject("_doseNumber"), res.getDoseNumberElement());
10749    if (json.has("forecastStatus"))
10750      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
10751    if (json.has("dateCriterion")) {
10752      JsonArray array = json.getAsJsonArray("dateCriterion");
10753      for (int i = 0; i < array.size(); i++) {
10754        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
10755      }
10756    };
10757    if (json.has("protocol"))
10758      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(json.getAsJsonObject("protocol"), owner));
10759    if (json.has("supportingImmunization")) {
10760      JsonArray array = json.getAsJsonArray("supportingImmunization");
10761      for (int i = 0; i < array.size(); i++) {
10762        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
10763      }
10764    };
10765    if (json.has("supportingPatientInformation")) {
10766      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
10767      for (int i = 0; i < array.size(); i++) {
10768        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
10769      }
10770    };
10771  }
10772
10773  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10774    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
10775    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
10776    return res;
10777  }
10778
10779  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
10780    parseBackboneProperties(json, res);
10781    if (json.has("code"))
10782      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10783    if (json.has("value"))
10784      res.setValueElement(parseDateTime(json.get("value").getAsString()));
10785    if (json.has("_value"))
10786      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10787  }
10788
10789  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10790    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
10791    parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(json, owner, res);
10792    return res;
10793  }
10794
10795  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res) throws IOException, FHIRFormatError {
10796    parseBackboneProperties(json, res);
10797    if (json.has("doseSequence"))
10798      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
10799    if (json.has("_doseSequence"))
10800      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
10801    if (json.has("description"))
10802      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10803    if (json.has("_description"))
10804      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10805    if (json.has("authority"))
10806      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
10807    if (json.has("series"))
10808      res.setSeriesElement(parseString(json.get("series").getAsString()));
10809    if (json.has("_series"))
10810      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
10811  }
10812
10813  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
10814    ImplementationGuide res = new ImplementationGuide();
10815    parseImplementationGuideProperties(json, res);
10816    return res;
10817  }
10818
10819  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
10820    parseDomainResourceProperties(json, res);
10821    if (json.has("url"))
10822      res.setUrlElement(parseUri(json.get("url").getAsString()));
10823    if (json.has("_url"))
10824      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10825    if (json.has("version"))
10826      res.setVersionElement(parseString(json.get("version").getAsString()));
10827    if (json.has("_version"))
10828      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10829    if (json.has("name"))
10830      res.setNameElement(parseString(json.get("name").getAsString()));
10831    if (json.has("_name"))
10832      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10833    if (json.has("status"))
10834      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10835    if (json.has("_status"))
10836      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10837    if (json.has("experimental"))
10838      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10839    if (json.has("_experimental"))
10840      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10841    if (json.has("date"))
10842      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10843    if (json.has("_date"))
10844      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10845    if (json.has("publisher"))
10846      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10847    if (json.has("_publisher"))
10848      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10849    if (json.has("contact")) {
10850      JsonArray array = json.getAsJsonArray("contact");
10851      for (int i = 0; i < array.size(); i++) {
10852        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10853      }
10854    };
10855    if (json.has("description"))
10856      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10857    if (json.has("_description"))
10858      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10859    if (json.has("useContext")) {
10860      JsonArray array = json.getAsJsonArray("useContext");
10861      for (int i = 0; i < array.size(); i++) {
10862        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10863      }
10864    };
10865    if (json.has("jurisdiction")) {
10866      JsonArray array = json.getAsJsonArray("jurisdiction");
10867      for (int i = 0; i < array.size(); i++) {
10868        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10869      }
10870    };
10871    if (json.has("copyright"))
10872      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10873    if (json.has("_copyright"))
10874      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10875    if (json.has("fhirVersion"))
10876      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
10877    if (json.has("_fhirVersion"))
10878      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
10879    if (json.has("dependency")) {
10880      JsonArray array = json.getAsJsonArray("dependency");
10881      for (int i = 0; i < array.size(); i++) {
10882        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
10883      }
10884    };
10885    if (json.has("package")) {
10886      JsonArray array = json.getAsJsonArray("package");
10887      for (int i = 0; i < array.size(); i++) {
10888        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
10889      }
10890    };
10891    if (json.has("global")) {
10892      JsonArray array = json.getAsJsonArray("global");
10893      for (int i = 0; i < array.size(); i++) {
10894        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
10895      }
10896    };
10897    if (json.has("binary")) {
10898      JsonArray array = json.getAsJsonArray("binary");
10899      for (int i = 0; i < array.size(); i++) {
10900        res.getBinary().add(parseUri(array.get(i).getAsString()));
10901      }
10902    };
10903    if (json.has("_binary")) {
10904      JsonArray array = json.getAsJsonArray("_binary");
10905      for (int i = 0; i < array.size(); i++) {
10906        if (i == res.getBinary().size())
10907          res.getBinary().add(parseUri(null));
10908        if (array.get(i) instanceof JsonObject) 
10909          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
10910      }
10911    };
10912    if (json.has("page"))
10913      res.setPage(parseImplementationGuideImplementationGuidePageComponent(json.getAsJsonObject("page"), res));
10914  }
10915
10916  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10917    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
10918    parseImplementationGuideImplementationGuideDependencyComponentProperties(json, owner, res);
10919    return res;
10920  }
10921
10922  protected void parseImplementationGuideImplementationGuideDependencyComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependencyComponent res) throws IOException, FHIRFormatError {
10923    parseBackboneProperties(json, res);
10924    if (json.has("type"))
10925      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
10926    if (json.has("_type"))
10927      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10928    if (json.has("uri"))
10929      res.setUriElement(parseUri(json.get("uri").getAsString()));
10930    if (json.has("_uri"))
10931      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
10932  }
10933
10934  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10935    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
10936    parseImplementationGuideImplementationGuidePackageComponentProperties(json, owner, res);
10937    return res;
10938  }
10939
10940  protected void parseImplementationGuideImplementationGuidePackageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageComponent res) throws IOException, FHIRFormatError {
10941    parseBackboneProperties(json, res);
10942    if (json.has("name"))
10943      res.setNameElement(parseString(json.get("name").getAsString()));
10944    if (json.has("_name"))
10945      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10946    if (json.has("description"))
10947      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10948    if (json.has("_description"))
10949      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10950    if (json.has("resource")) {
10951      JsonArray array = json.getAsJsonArray("resource");
10952      for (int i = 0; i < array.size(); i++) {
10953        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
10954      }
10955    };
10956  }
10957
10958  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10959    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
10960    parseImplementationGuideImplementationGuidePackageResourceComponentProperties(json, owner, res);
10961    return res;
10962  }
10963
10964  protected void parseImplementationGuideImplementationGuidePackageResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageResourceComponent res) throws IOException, FHIRFormatError {
10965    parseBackboneProperties(json, res);
10966    if (json.has("example"))
10967      res.setExampleElement(parseBoolean(json.get("example").getAsBoolean()));
10968    if (json.has("_example"))
10969      parseElementProperties(json.getAsJsonObject("_example"), res.getExampleElement());
10970    if (json.has("name"))
10971      res.setNameElement(parseString(json.get("name").getAsString()));
10972    if (json.has("_name"))
10973      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10974    if (json.has("description"))
10975      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10976    if (json.has("_description"))
10977      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10978    if (json.has("acronym"))
10979      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
10980    if (json.has("_acronym"))
10981      parseElementProperties(json.getAsJsonObject("_acronym"), res.getAcronymElement());
10982    Type source = parseType("source", json);
10983    if (source != null)
10984      res.setSource(source);
10985    if (json.has("exampleFor"))
10986      res.setExampleFor(parseReference(json.getAsJsonObject("exampleFor")));
10987  }
10988
10989  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10990    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
10991    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
10992    return res;
10993  }
10994
10995  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
10996    parseBackboneProperties(json, res);
10997    if (json.has("type"))
10998      res.setTypeElement(parseCode(json.get("type").getAsString()));
10999    if (json.has("_type"))
11000      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11001    if (json.has("profile"))
11002      res.setProfile(parseReference(json.getAsJsonObject("profile")));
11003  }
11004
11005  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11006    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
11007    parseImplementationGuideImplementationGuidePageComponentProperties(json, owner, res);
11008    return res;
11009  }
11010
11011  protected void parseImplementationGuideImplementationGuidePageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePageComponent res) throws IOException, FHIRFormatError {
11012    parseBackboneProperties(json, res);
11013    if (json.has("source"))
11014      res.setSourceElement(parseUri(json.get("source").getAsString()));
11015    if (json.has("_source"))
11016      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
11017    if (json.has("title"))
11018      res.setTitleElement(parseString(json.get("title").getAsString()));
11019    if (json.has("_title"))
11020      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11021    if (json.has("kind"))
11022      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
11023    if (json.has("_kind"))
11024      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
11025    if (json.has("type")) {
11026      JsonArray array = json.getAsJsonArray("type");
11027      for (int i = 0; i < array.size(); i++) {
11028        res.getType().add(parseCode(array.get(i).getAsString()));
11029      }
11030    };
11031    if (json.has("_type")) {
11032      JsonArray array = json.getAsJsonArray("_type");
11033      for (int i = 0; i < array.size(); i++) {
11034        if (i == res.getType().size())
11035          res.getType().add(parseCode(null));
11036        if (array.get(i) instanceof JsonObject) 
11037          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
11038      }
11039    };
11040    if (json.has("package")) {
11041      JsonArray array = json.getAsJsonArray("package");
11042      for (int i = 0; i < array.size(); i++) {
11043        res.getPackage().add(parseString(array.get(i).getAsString()));
11044      }
11045    };
11046    if (json.has("_package")) {
11047      JsonArray array = json.getAsJsonArray("_package");
11048      for (int i = 0; i < array.size(); i++) {
11049        if (i == res.getPackage().size())
11050          res.getPackage().add(parseString(null));
11051        if (array.get(i) instanceof JsonObject) 
11052          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
11053      }
11054    };
11055    if (json.has("format"))
11056      res.setFormatElement(parseCode(json.get("format").getAsString()));
11057    if (json.has("_format"))
11058      parseElementProperties(json.getAsJsonObject("_format"), res.getFormatElement());
11059    if (json.has("page")) {
11060      JsonArray array = json.getAsJsonArray("page");
11061      for (int i = 0; i < array.size(); i++) {
11062        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
11063      }
11064    };
11065  }
11066
11067  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
11068    Library res = new Library();
11069    parseLibraryProperties(json, res);
11070    return res;
11071  }
11072
11073  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
11074    parseDomainResourceProperties(json, res);
11075    if (json.has("url"))
11076      res.setUrlElement(parseUri(json.get("url").getAsString()));
11077    if (json.has("_url"))
11078      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11079    if (json.has("identifier")) {
11080      JsonArray array = json.getAsJsonArray("identifier");
11081      for (int i = 0; i < array.size(); i++) {
11082        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11083      }
11084    };
11085    if (json.has("version"))
11086      res.setVersionElement(parseString(json.get("version").getAsString()));
11087    if (json.has("_version"))
11088      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11089    if (json.has("name"))
11090      res.setNameElement(parseString(json.get("name").getAsString()));
11091    if (json.has("_name"))
11092      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11093    if (json.has("title"))
11094      res.setTitleElement(parseString(json.get("title").getAsString()));
11095    if (json.has("_title"))
11096      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11097    if (json.has("status"))
11098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11099    if (json.has("_status"))
11100      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11101    if (json.has("experimental"))
11102      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11103    if (json.has("_experimental"))
11104      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11105    if (json.has("type"))
11106      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11107    if (json.has("date"))
11108      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11109    if (json.has("_date"))
11110      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11111    if (json.has("publisher"))
11112      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11113    if (json.has("_publisher"))
11114      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11115    if (json.has("description"))
11116      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11117    if (json.has("_description"))
11118      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11119    if (json.has("purpose"))
11120      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11121    if (json.has("_purpose"))
11122      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11123    if (json.has("usage"))
11124      res.setUsageElement(parseString(json.get("usage").getAsString()));
11125    if (json.has("_usage"))
11126      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
11127    if (json.has("approvalDate"))
11128      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11129    if (json.has("_approvalDate"))
11130      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11131    if (json.has("lastReviewDate"))
11132      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11133    if (json.has("_lastReviewDate"))
11134      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11135    if (json.has("effectivePeriod"))
11136      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11137    if (json.has("useContext")) {
11138      JsonArray array = json.getAsJsonArray("useContext");
11139      for (int i = 0; i < array.size(); i++) {
11140        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11141      }
11142    };
11143    if (json.has("jurisdiction")) {
11144      JsonArray array = json.getAsJsonArray("jurisdiction");
11145      for (int i = 0; i < array.size(); i++) {
11146        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11147      }
11148    };
11149    if (json.has("topic")) {
11150      JsonArray array = json.getAsJsonArray("topic");
11151      for (int i = 0; i < array.size(); i++) {
11152        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11153      }
11154    };
11155    if (json.has("contributor")) {
11156      JsonArray array = json.getAsJsonArray("contributor");
11157      for (int i = 0; i < array.size(); i++) {
11158        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11159      }
11160    };
11161    if (json.has("contact")) {
11162      JsonArray array = json.getAsJsonArray("contact");
11163      for (int i = 0; i < array.size(); i++) {
11164        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11165      }
11166    };
11167    if (json.has("copyright"))
11168      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11169    if (json.has("_copyright"))
11170      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11171    if (json.has("relatedArtifact")) {
11172      JsonArray array = json.getAsJsonArray("relatedArtifact");
11173      for (int i = 0; i < array.size(); i++) {
11174        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11175      }
11176    };
11177    if (json.has("parameter")) {
11178      JsonArray array = json.getAsJsonArray("parameter");
11179      for (int i = 0; i < array.size(); i++) {
11180        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
11181      }
11182    };
11183    if (json.has("dataRequirement")) {
11184      JsonArray array = json.getAsJsonArray("dataRequirement");
11185      for (int i = 0; i < array.size(); i++) {
11186        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
11187      }
11188    };
11189    if (json.has("content")) {
11190      JsonArray array = json.getAsJsonArray("content");
11191      for (int i = 0; i < array.size(); i++) {
11192        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
11193      }
11194    };
11195  }
11196
11197  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
11198    Linkage res = new Linkage();
11199    parseLinkageProperties(json, res);
11200    return res;
11201  }
11202
11203  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
11204    parseDomainResourceProperties(json, res);
11205    if (json.has("active"))
11206      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11207    if (json.has("_active"))
11208      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11209    if (json.has("author"))
11210      res.setAuthor(parseReference(json.getAsJsonObject("author")));
11211    if (json.has("item")) {
11212      JsonArray array = json.getAsJsonArray("item");
11213      for (int i = 0; i < array.size(); i++) {
11214        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
11215      }
11216    };
11217  }
11218
11219  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
11220    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
11221    parseLinkageLinkageItemComponentProperties(json, owner, res);
11222    return res;
11223  }
11224
11225  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
11226    parseBackboneProperties(json, res);
11227    if (json.has("type"))
11228      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
11229    if (json.has("_type"))
11230      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11231    if (json.has("resource"))
11232      res.setResource(parseReference(json.getAsJsonObject("resource")));
11233  }
11234
11235  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
11236    ListResource res = new ListResource();
11237    parseListResourceProperties(json, res);
11238    return res;
11239  }
11240
11241  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
11242    parseDomainResourceProperties(json, res);
11243    if (json.has("identifier")) {
11244      JsonArray array = json.getAsJsonArray("identifier");
11245      for (int i = 0; i < array.size(); i++) {
11246        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11247      }
11248    };
11249    if (json.has("status"))
11250      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
11251    if (json.has("_status"))
11252      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11253    if (json.has("mode"))
11254      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
11255    if (json.has("_mode"))
11256      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
11257    if (json.has("title"))
11258      res.setTitleElement(parseString(json.get("title").getAsString()));
11259    if (json.has("_title"))
11260      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11261    if (json.has("code"))
11262      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11263    if (json.has("subject"))
11264      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11265    if (json.has("encounter"))
11266      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11267    if (json.has("date"))
11268      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11269    if (json.has("_date"))
11270      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11271    if (json.has("source"))
11272      res.setSource(parseReference(json.getAsJsonObject("source")));
11273    if (json.has("orderedBy"))
11274      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
11275    if (json.has("note")) {
11276      JsonArray array = json.getAsJsonArray("note");
11277      for (int i = 0; i < array.size(); i++) {
11278        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11279      }
11280    };
11281    if (json.has("entry")) {
11282      JsonArray array = json.getAsJsonArray("entry");
11283      for (int i = 0; i < array.size(); i++) {
11284        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
11285      }
11286    };
11287    if (json.has("emptyReason"))
11288      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
11289  }
11290
11291  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
11292    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
11293    parseListResourceListEntryComponentProperties(json, owner, res);
11294    return res;
11295  }
11296
11297  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
11298    parseBackboneProperties(json, res);
11299    if (json.has("flag"))
11300      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
11301    if (json.has("deleted"))
11302      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
11303    if (json.has("_deleted"))
11304      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
11305    if (json.has("date"))
11306      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11307    if (json.has("_date"))
11308      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11309    if (json.has("item"))
11310      res.setItem(parseReference(json.getAsJsonObject("item")));
11311  }
11312
11313  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
11314    Location res = new Location();
11315    parseLocationProperties(json, res);
11316    return res;
11317  }
11318
11319  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
11320    parseDomainResourceProperties(json, res);
11321    if (json.has("identifier")) {
11322      JsonArray array = json.getAsJsonArray("identifier");
11323      for (int i = 0; i < array.size(); i++) {
11324        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11325      }
11326    };
11327    if (json.has("status"))
11328      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
11329    if (json.has("_status"))
11330      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11331    if (json.has("operationalStatus"))
11332      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
11333    if (json.has("name"))
11334      res.setNameElement(parseString(json.get("name").getAsString()));
11335    if (json.has("_name"))
11336      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11337    if (json.has("alias")) {
11338      JsonArray array = json.getAsJsonArray("alias");
11339      for (int i = 0; i < array.size(); i++) {
11340        res.getAlias().add(parseString(array.get(i).getAsString()));
11341      }
11342    };
11343    if (json.has("_alias")) {
11344      JsonArray array = json.getAsJsonArray("_alias");
11345      for (int i = 0; i < array.size(); i++) {
11346        if (i == res.getAlias().size())
11347          res.getAlias().add(parseString(null));
11348        if (array.get(i) instanceof JsonObject) 
11349          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
11350      }
11351    };
11352    if (json.has("description"))
11353      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11354    if (json.has("_description"))
11355      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11356    if (json.has("mode"))
11357      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
11358    if (json.has("_mode"))
11359      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
11360    if (json.has("type"))
11361      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11362    if (json.has("telecom")) {
11363      JsonArray array = json.getAsJsonArray("telecom");
11364      for (int i = 0; i < array.size(); i++) {
11365        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11366      }
11367    };
11368    if (json.has("address"))
11369      res.setAddress(parseAddress(json.getAsJsonObject("address")));
11370    if (json.has("physicalType"))
11371      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
11372    if (json.has("position"))
11373      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
11374    if (json.has("managingOrganization"))
11375      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11376    if (json.has("partOf"))
11377      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
11378    if (json.has("endpoint")) {
11379      JsonArray array = json.getAsJsonArray("endpoint");
11380      for (int i = 0; i < array.size(); i++) {
11381        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11382      }
11383    };
11384  }
11385
11386  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
11387    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
11388    parseLocationLocationPositionComponentProperties(json, owner, res);
11389    return res;
11390  }
11391
11392  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
11393    parseBackboneProperties(json, res);
11394    if (json.has("longitude"))
11395      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
11396    if (json.has("_longitude"))
11397      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
11398    if (json.has("latitude"))
11399      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
11400    if (json.has("_latitude"))
11401      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
11402    if (json.has("altitude"))
11403      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
11404    if (json.has("_altitude"))
11405      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
11406  }
11407
11408  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
11409    Measure res = new Measure();
11410    parseMeasureProperties(json, res);
11411    return res;
11412  }
11413
11414  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
11415    parseDomainResourceProperties(json, res);
11416    if (json.has("url"))
11417      res.setUrlElement(parseUri(json.get("url").getAsString()));
11418    if (json.has("_url"))
11419      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11420    if (json.has("identifier")) {
11421      JsonArray array = json.getAsJsonArray("identifier");
11422      for (int i = 0; i < array.size(); i++) {
11423        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11424      }
11425    };
11426    if (json.has("version"))
11427      res.setVersionElement(parseString(json.get("version").getAsString()));
11428    if (json.has("_version"))
11429      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11430    if (json.has("name"))
11431      res.setNameElement(parseString(json.get("name").getAsString()));
11432    if (json.has("_name"))
11433      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11434    if (json.has("title"))
11435      res.setTitleElement(parseString(json.get("title").getAsString()));
11436    if (json.has("_title"))
11437      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11438    if (json.has("status"))
11439      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11440    if (json.has("_status"))
11441      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11442    if (json.has("experimental"))
11443      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11444    if (json.has("_experimental"))
11445      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11446    if (json.has("date"))
11447      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11448    if (json.has("_date"))
11449      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11450    if (json.has("publisher"))
11451      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11452    if (json.has("_publisher"))
11453      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11454    if (json.has("description"))
11455      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11456    if (json.has("_description"))
11457      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11458    if (json.has("purpose"))
11459      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11460    if (json.has("_purpose"))
11461      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11462    if (json.has("usage"))
11463      res.setUsageElement(parseString(json.get("usage").getAsString()));
11464    if (json.has("_usage"))
11465      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
11466    if (json.has("approvalDate"))
11467      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11468    if (json.has("_approvalDate"))
11469      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11470    if (json.has("lastReviewDate"))
11471      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11472    if (json.has("_lastReviewDate"))
11473      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11474    if (json.has("effectivePeriod"))
11475      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11476    if (json.has("useContext")) {
11477      JsonArray array = json.getAsJsonArray("useContext");
11478      for (int i = 0; i < array.size(); i++) {
11479        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11480      }
11481    };
11482    if (json.has("jurisdiction")) {
11483      JsonArray array = json.getAsJsonArray("jurisdiction");
11484      for (int i = 0; i < array.size(); i++) {
11485        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11486      }
11487    };
11488    if (json.has("topic")) {
11489      JsonArray array = json.getAsJsonArray("topic");
11490      for (int i = 0; i < array.size(); i++) {
11491        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11492      }
11493    };
11494    if (json.has("contributor")) {
11495      JsonArray array = json.getAsJsonArray("contributor");
11496      for (int i = 0; i < array.size(); i++) {
11497        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11498      }
11499    };
11500    if (json.has("contact")) {
11501      JsonArray array = json.getAsJsonArray("contact");
11502      for (int i = 0; i < array.size(); i++) {
11503        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11504      }
11505    };
11506    if (json.has("copyright"))
11507      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11508    if (json.has("_copyright"))
11509      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11510    if (json.has("relatedArtifact")) {
11511      JsonArray array = json.getAsJsonArray("relatedArtifact");
11512      for (int i = 0; i < array.size(); i++) {
11513        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11514      }
11515    };
11516    if (json.has("library")) {
11517      JsonArray array = json.getAsJsonArray("library");
11518      for (int i = 0; i < array.size(); i++) {
11519        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
11520      }
11521    };
11522    if (json.has("disclaimer"))
11523      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
11524    if (json.has("_disclaimer"))
11525      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
11526    if (json.has("scoring"))
11527      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
11528    if (json.has("compositeScoring"))
11529      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
11530    if (json.has("type")) {
11531      JsonArray array = json.getAsJsonArray("type");
11532      for (int i = 0; i < array.size(); i++) {
11533        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11534      }
11535    };
11536    if (json.has("riskAdjustment"))
11537      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
11538    if (json.has("_riskAdjustment"))
11539      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
11540    if (json.has("rateAggregation"))
11541      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
11542    if (json.has("_rateAggregation"))
11543      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
11544    if (json.has("rationale"))
11545      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
11546    if (json.has("_rationale"))
11547      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
11548    if (json.has("clinicalRecommendationStatement"))
11549      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
11550    if (json.has("_clinicalRecommendationStatement"))
11551      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
11552    if (json.has("improvementNotation"))
11553      res.setImprovementNotationElement(parseString(json.get("improvementNotation").getAsString()));
11554    if (json.has("_improvementNotation"))
11555      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
11556    if (json.has("definition")) {
11557      JsonArray array = json.getAsJsonArray("definition");
11558      for (int i = 0; i < array.size(); i++) {
11559        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
11560      }
11561    };
11562    if (json.has("_definition")) {
11563      JsonArray array = json.getAsJsonArray("_definition");
11564      for (int i = 0; i < array.size(); i++) {
11565        if (i == res.getDefinition().size())
11566          res.getDefinition().add(parseMarkdown(null));
11567        if (array.get(i) instanceof JsonObject) 
11568          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
11569      }
11570    };
11571    if (json.has("guidance"))
11572      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
11573    if (json.has("_guidance"))
11574      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
11575    if (json.has("set"))
11576      res.setSetElement(parseString(json.get("set").getAsString()));
11577    if (json.has("_set"))
11578      parseElementProperties(json.getAsJsonObject("_set"), res.getSetElement());
11579    if (json.has("group")) {
11580      JsonArray array = json.getAsJsonArray("group");
11581      for (int i = 0; i < array.size(); i++) {
11582        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
11583      }
11584    };
11585    if (json.has("supplementalData")) {
11586      JsonArray array = json.getAsJsonArray("supplementalData");
11587      for (int i = 0; i < array.size(); i++) {
11588        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
11589      }
11590    };
11591  }
11592
11593  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11594    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
11595    parseMeasureMeasureGroupComponentProperties(json, owner, res);
11596    return res;
11597  }
11598
11599  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
11600    parseBackboneProperties(json, res);
11601    if (json.has("identifier"))
11602      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11603    if (json.has("name"))
11604      res.setNameElement(parseString(json.get("name").getAsString()));
11605    if (json.has("_name"))
11606      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11607    if (json.has("description"))
11608      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11609    if (json.has("_description"))
11610      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11611    if (json.has("population")) {
11612      JsonArray array = json.getAsJsonArray("population");
11613      for (int i = 0; i < array.size(); i++) {
11614        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11615      }
11616    };
11617    if (json.has("stratifier")) {
11618      JsonArray array = json.getAsJsonArray("stratifier");
11619      for (int i = 0; i < array.size(); i++) {
11620        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
11621      }
11622    };
11623  }
11624
11625  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11626    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
11627    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
11628    return res;
11629  }
11630
11631  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
11632    parseBackboneProperties(json, res);
11633    if (json.has("identifier"))
11634      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11635    if (json.has("code"))
11636      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11637    if (json.has("name"))
11638      res.setNameElement(parseString(json.get("name").getAsString()));
11639    if (json.has("_name"))
11640      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11641    if (json.has("description"))
11642      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11643    if (json.has("_description"))
11644      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11645    if (json.has("criteria"))
11646      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11647    if (json.has("_criteria"))
11648      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11649  }
11650
11651  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11652    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
11653    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
11654    return res;
11655  }
11656
11657  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
11658    parseBackboneProperties(json, res);
11659    if (json.has("identifier"))
11660      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11661    if (json.has("criteria"))
11662      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11663    if (json.has("_criteria"))
11664      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11665    if (json.has("path"))
11666      res.setPathElement(parseString(json.get("path").getAsString()));
11667    if (json.has("_path"))
11668      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
11669  }
11670
11671  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11672    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
11673    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
11674    return res;
11675  }
11676
11677  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
11678    parseBackboneProperties(json, res);
11679    if (json.has("identifier"))
11680      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11681    if (json.has("usage")) {
11682      JsonArray array = json.getAsJsonArray("usage");
11683      for (int i = 0; i < array.size(); i++) {
11684        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11685      }
11686    };
11687    if (json.has("criteria"))
11688      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11689    if (json.has("_criteria"))
11690      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11691    if (json.has("path"))
11692      res.setPathElement(parseString(json.get("path").getAsString()));
11693    if (json.has("_path"))
11694      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
11695  }
11696
11697  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
11698    MeasureReport res = new MeasureReport();
11699    parseMeasureReportProperties(json, res);
11700    return res;
11701  }
11702
11703  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
11704    parseDomainResourceProperties(json, res);
11705    if (json.has("identifier"))
11706      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11707    if (json.has("status"))
11708      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
11709    if (json.has("_status"))
11710      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11711    if (json.has("type"))
11712      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
11713    if (json.has("_type"))
11714      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11715    if (json.has("measure"))
11716      res.setMeasure(parseReference(json.getAsJsonObject("measure")));
11717    if (json.has("patient"))
11718      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11719    if (json.has("date"))
11720      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11721    if (json.has("_date"))
11722      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11723    if (json.has("reportingOrganization"))
11724      res.setReportingOrganization(parseReference(json.getAsJsonObject("reportingOrganization")));
11725    if (json.has("period"))
11726      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11727    if (json.has("group")) {
11728      JsonArray array = json.getAsJsonArray("group");
11729      for (int i = 0; i < array.size(); i++) {
11730        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
11731      }
11732    };
11733    if (json.has("evaluatedResources"))
11734      res.setEvaluatedResources(parseReference(json.getAsJsonObject("evaluatedResources")));
11735  }
11736
11737  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11738    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
11739    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
11740    return res;
11741  }
11742
11743  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
11744    parseBackboneProperties(json, res);
11745    if (json.has("identifier"))
11746      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11747    if (json.has("population")) {
11748      JsonArray array = json.getAsJsonArray("population");
11749      for (int i = 0; i < array.size(); i++) {
11750        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11751      }
11752    };
11753    if (json.has("measureScore"))
11754      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
11755    if (json.has("_measureScore"))
11756      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
11757    if (json.has("stratifier")) {
11758      JsonArray array = json.getAsJsonArray("stratifier");
11759      for (int i = 0; i < array.size(); i++) {
11760        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
11761      }
11762    };
11763  }
11764
11765  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11766    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
11767    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
11768    return res;
11769  }
11770
11771  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
11772    parseBackboneProperties(json, res);
11773    if (json.has("identifier"))
11774      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11775    if (json.has("code"))
11776      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11777    if (json.has("count"))
11778      res.setCountElement(parseInteger(json.get("count").getAsLong()));
11779    if (json.has("_count"))
11780      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
11781    if (json.has("patients"))
11782      res.setPatients(parseReference(json.getAsJsonObject("patients")));
11783  }
11784
11785  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11786    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
11787    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
11788    return res;
11789  }
11790
11791  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
11792    parseBackboneProperties(json, res);
11793    if (json.has("identifier"))
11794      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11795    if (json.has("stratum")) {
11796      JsonArray array = json.getAsJsonArray("stratum");
11797      for (int i = 0; i < array.size(); i++) {
11798        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
11799      }
11800    };
11801  }
11802
11803  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11804    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
11805    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
11806    return res;
11807  }
11808
11809  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
11810    parseBackboneProperties(json, res);
11811    if (json.has("value"))
11812      res.setValueElement(parseString(json.get("value").getAsString()));
11813    if (json.has("_value"))
11814      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
11815    if (json.has("population")) {
11816      JsonArray array = json.getAsJsonArray("population");
11817      for (int i = 0; i < array.size(); i++) {
11818        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11819      }
11820    };
11821    if (json.has("measureScore"))
11822      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
11823    if (json.has("_measureScore"))
11824      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
11825  }
11826
11827  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11828    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
11829    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
11830    return res;
11831  }
11832
11833  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
11834    parseBackboneProperties(json, res);
11835    if (json.has("identifier"))
11836      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11837    if (json.has("code"))
11838      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11839    if (json.has("count"))
11840      res.setCountElement(parseInteger(json.get("count").getAsLong()));
11841    if (json.has("_count"))
11842      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
11843    if (json.has("patients"))
11844      res.setPatients(parseReference(json.getAsJsonObject("patients")));
11845  }
11846
11847  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
11848    Media res = new Media();
11849    parseMediaProperties(json, res);
11850    return res;
11851  }
11852
11853  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
11854    parseDomainResourceProperties(json, res);
11855    if (json.has("identifier")) {
11856      JsonArray array = json.getAsJsonArray("identifier");
11857      for (int i = 0; i < array.size(); i++) {
11858        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11859      }
11860    };
11861    if (json.has("basedOn")) {
11862      JsonArray array = json.getAsJsonArray("basedOn");
11863      for (int i = 0; i < array.size(); i++) {
11864        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11865      }
11866    };
11867    if (json.has("type"))
11868      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
11869    if (json.has("_type"))
11870      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11871    if (json.has("subtype"))
11872      res.setSubtype(parseCodeableConcept(json.getAsJsonObject("subtype")));
11873    if (json.has("view"))
11874      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
11875    if (json.has("subject"))
11876      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11877    if (json.has("context"))
11878      res.setContext(parseReference(json.getAsJsonObject("context")));
11879    Type occurrence = parseType("occurrence", json);
11880    if (occurrence != null)
11881      res.setOccurrence(occurrence);
11882    if (json.has("operator"))
11883      res.setOperator(parseReference(json.getAsJsonObject("operator")));
11884    if (json.has("reasonCode")) {
11885      JsonArray array = json.getAsJsonArray("reasonCode");
11886      for (int i = 0; i < array.size(); i++) {
11887        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11888      }
11889    };
11890    if (json.has("bodySite"))
11891      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11892    if (json.has("device"))
11893      res.setDevice(parseReference(json.getAsJsonObject("device")));
11894    if (json.has("height"))
11895      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
11896    if (json.has("_height"))
11897      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
11898    if (json.has("width"))
11899      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
11900    if (json.has("_width"))
11901      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
11902    if (json.has("frames"))
11903      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
11904    if (json.has("_frames"))
11905      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
11906    if (json.has("duration"))
11907      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
11908    if (json.has("_duration"))
11909      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
11910    if (json.has("content"))
11911      res.setContent(parseAttachment(json.getAsJsonObject("content")));
11912    if (json.has("note")) {
11913      JsonArray array = json.getAsJsonArray("note");
11914      for (int i = 0; i < array.size(); i++) {
11915        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11916      }
11917    };
11918  }
11919
11920  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
11921    Medication res = new Medication();
11922    parseMedicationProperties(json, res);
11923    return res;
11924  }
11925
11926  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
11927    parseDomainResourceProperties(json, res);
11928    if (json.has("code"))
11929      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11930    if (json.has("status"))
11931      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
11932    if (json.has("_status"))
11933      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11934    if (json.has("isBrand"))
11935      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
11936    if (json.has("_isBrand"))
11937      parseElementProperties(json.getAsJsonObject("_isBrand"), res.getIsBrandElement());
11938    if (json.has("isOverTheCounter"))
11939      res.setIsOverTheCounterElement(parseBoolean(json.get("isOverTheCounter").getAsBoolean()));
11940    if (json.has("_isOverTheCounter"))
11941      parseElementProperties(json.getAsJsonObject("_isOverTheCounter"), res.getIsOverTheCounterElement());
11942    if (json.has("manufacturer"))
11943      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
11944    if (json.has("form"))
11945      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
11946    if (json.has("ingredient")) {
11947      JsonArray array = json.getAsJsonArray("ingredient");
11948      for (int i = 0; i < array.size(); i++) {
11949        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
11950      }
11951    };
11952    if (json.has("package"))
11953      res.setPackage(parseMedicationMedicationPackageComponent(json.getAsJsonObject("package"), res));
11954    if (json.has("image")) {
11955      JsonArray array = json.getAsJsonArray("image");
11956      for (int i = 0; i < array.size(); i++) {
11957        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
11958      }
11959    };
11960  }
11961
11962  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
11963    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
11964    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
11965    return res;
11966  }
11967
11968  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
11969    parseBackboneProperties(json, res);
11970    Type item = parseType("item", json);
11971    if (item != null)
11972      res.setItem(item);
11973    if (json.has("isActive"))
11974      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
11975    if (json.has("_isActive"))
11976      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
11977    if (json.has("amount"))
11978      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
11979  }
11980
11981  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
11982    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
11983    parseMedicationMedicationPackageComponentProperties(json, owner, res);
11984    return res;
11985  }
11986
11987  protected void parseMedicationMedicationPackageComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageComponent res) throws IOException, FHIRFormatError {
11988    parseBackboneProperties(json, res);
11989    if (json.has("container"))
11990      res.setContainer(parseCodeableConcept(json.getAsJsonObject("container")));
11991    if (json.has("content")) {
11992      JsonArray array = json.getAsJsonArray("content");
11993      for (int i = 0; i < array.size(); i++) {
11994        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
11995      }
11996    };
11997    if (json.has("batch")) {
11998      JsonArray array = json.getAsJsonArray("batch");
11999      for (int i = 0; i < array.size(); i++) {
12000        res.getBatch().add(parseMedicationMedicationPackageBatchComponent(array.get(i).getAsJsonObject(), owner));
12001      }
12002    };
12003  }
12004
12005  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12006    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
12007    parseMedicationMedicationPackageContentComponentProperties(json, owner, res);
12008    return res;
12009  }
12010
12011  protected void parseMedicationMedicationPackageContentComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageContentComponent res) throws IOException, FHIRFormatError {
12012    parseBackboneProperties(json, res);
12013    Type item = parseType("item", json);
12014    if (item != null)
12015      res.setItem(item);
12016    if (json.has("amount"))
12017      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
12018  }
12019
12020  protected Medication.MedicationPackageBatchComponent parseMedicationMedicationPackageBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12021    Medication.MedicationPackageBatchComponent res = new Medication.MedicationPackageBatchComponent();
12022    parseMedicationMedicationPackageBatchComponentProperties(json, owner, res);
12023    return res;
12024  }
12025
12026  protected void parseMedicationMedicationPackageBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageBatchComponent res) throws IOException, FHIRFormatError {
12027    parseBackboneProperties(json, res);
12028    if (json.has("lotNumber"))
12029      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12030    if (json.has("_lotNumber"))
12031      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
12032    if (json.has("expirationDate"))
12033      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
12034    if (json.has("_expirationDate"))
12035      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
12036  }
12037
12038  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
12039    MedicationAdministration res = new MedicationAdministration();
12040    parseMedicationAdministrationProperties(json, res);
12041    return res;
12042  }
12043
12044  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
12045    parseDomainResourceProperties(json, res);
12046    if (json.has("identifier")) {
12047      JsonArray array = json.getAsJsonArray("identifier");
12048      for (int i = 0; i < array.size(); i++) {
12049        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12050      }
12051    };
12052    if (json.has("definition")) {
12053      JsonArray array = json.getAsJsonArray("definition");
12054      for (int i = 0; i < array.size(); i++) {
12055        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12056      }
12057    };
12058    if (json.has("partOf")) {
12059      JsonArray array = json.getAsJsonArray("partOf");
12060      for (int i = 0; i < array.size(); i++) {
12061        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12062      }
12063    };
12064    if (json.has("status"))
12065      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
12066    if (json.has("_status"))
12067      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12068    if (json.has("category"))
12069      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12070    Type medication = parseType("medication", json);
12071    if (medication != null)
12072      res.setMedication(medication);
12073    if (json.has("subject"))
12074      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12075    if (json.has("context"))
12076      res.setContext(parseReference(json.getAsJsonObject("context")));
12077    if (json.has("supportingInformation")) {
12078      JsonArray array = json.getAsJsonArray("supportingInformation");
12079      for (int i = 0; i < array.size(); i++) {
12080        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12081      }
12082    };
12083    Type effective = parseType("effective", json);
12084    if (effective != null)
12085      res.setEffective(effective);
12086    if (json.has("performer")) {
12087      JsonArray array = json.getAsJsonArray("performer");
12088      for (int i = 0; i < array.size(); i++) {
12089        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
12090      }
12091    };
12092    if (json.has("notGiven"))
12093      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
12094    if (json.has("_notGiven"))
12095      parseElementProperties(json.getAsJsonObject("_notGiven"), res.getNotGivenElement());
12096    if (json.has("reasonNotGiven")) {
12097      JsonArray array = json.getAsJsonArray("reasonNotGiven");
12098      for (int i = 0; i < array.size(); i++) {
12099        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12100      }
12101    };
12102    if (json.has("reasonCode")) {
12103      JsonArray array = json.getAsJsonArray("reasonCode");
12104      for (int i = 0; i < array.size(); i++) {
12105        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12106      }
12107    };
12108    if (json.has("reasonReference")) {
12109      JsonArray array = json.getAsJsonArray("reasonReference");
12110      for (int i = 0; i < array.size(); i++) {
12111        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12112      }
12113    };
12114    if (json.has("prescription"))
12115      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
12116    if (json.has("device")) {
12117      JsonArray array = json.getAsJsonArray("device");
12118      for (int i = 0; i < array.size(); i++) {
12119        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
12120      }
12121    };
12122    if (json.has("note")) {
12123      JsonArray array = json.getAsJsonArray("note");
12124      for (int i = 0; i < array.size(); i++) {
12125        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12126      }
12127    };
12128    if (json.has("dosage"))
12129      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
12130    if (json.has("eventHistory")) {
12131      JsonArray array = json.getAsJsonArray("eventHistory");
12132      for (int i = 0; i < array.size(); i++) {
12133        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12134      }
12135    };
12136  }
12137
12138  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12139    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
12140    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
12141    return res;
12142  }
12143
12144  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
12145    parseBackboneProperties(json, res);
12146    if (json.has("actor"))
12147      res.setActor(parseReference(json.getAsJsonObject("actor")));
12148    if (json.has("onBehalfOf"))
12149      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12150  }
12151
12152  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12153    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
12154    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
12155    return res;
12156  }
12157
12158  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
12159    parseBackboneProperties(json, res);
12160    if (json.has("text"))
12161      res.setTextElement(parseString(json.get("text").getAsString()));
12162    if (json.has("_text"))
12163      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12164    if (json.has("site"))
12165      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
12166    if (json.has("route"))
12167      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
12168    if (json.has("method"))
12169      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
12170    if (json.has("dose"))
12171      res.setDose(parseSimpleQuantity(json.getAsJsonObject("dose")));
12172    Type rate = parseType("rate", json);
12173    if (rate != null)
12174      res.setRate(rate);
12175  }
12176
12177  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
12178    MedicationDispense res = new MedicationDispense();
12179    parseMedicationDispenseProperties(json, res);
12180    return res;
12181  }
12182
12183  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
12184    parseDomainResourceProperties(json, res);
12185    if (json.has("identifier")) {
12186      JsonArray array = json.getAsJsonArray("identifier");
12187      for (int i = 0; i < array.size(); i++) {
12188        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12189      }
12190    };
12191    if (json.has("partOf")) {
12192      JsonArray array = json.getAsJsonArray("partOf");
12193      for (int i = 0; i < array.size(); i++) {
12194        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12195      }
12196    };
12197    if (json.has("status"))
12198      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
12199    if (json.has("_status"))
12200      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12201    if (json.has("category"))
12202      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12203    Type medication = parseType("medication", json);
12204    if (medication != null)
12205      res.setMedication(medication);
12206    if (json.has("subject"))
12207      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12208    if (json.has("context"))
12209      res.setContext(parseReference(json.getAsJsonObject("context")));
12210    if (json.has("supportingInformation")) {
12211      JsonArray array = json.getAsJsonArray("supportingInformation");
12212      for (int i = 0; i < array.size(); i++) {
12213        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12214      }
12215    };
12216    if (json.has("performer")) {
12217      JsonArray array = json.getAsJsonArray("performer");
12218      for (int i = 0; i < array.size(); i++) {
12219        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
12220      }
12221    };
12222    if (json.has("authorizingPrescription")) {
12223      JsonArray array = json.getAsJsonArray("authorizingPrescription");
12224      for (int i = 0; i < array.size(); i++) {
12225        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
12226      }
12227    };
12228    if (json.has("type"))
12229      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12230    if (json.has("quantity"))
12231      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
12232    if (json.has("daysSupply"))
12233      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
12234    if (json.has("whenPrepared"))
12235      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
12236    if (json.has("_whenPrepared"))
12237      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
12238    if (json.has("whenHandedOver"))
12239      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
12240    if (json.has("_whenHandedOver"))
12241      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
12242    if (json.has("destination"))
12243      res.setDestination(parseReference(json.getAsJsonObject("destination")));
12244    if (json.has("receiver")) {
12245      JsonArray array = json.getAsJsonArray("receiver");
12246      for (int i = 0; i < array.size(); i++) {
12247        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
12248      }
12249    };
12250    if (json.has("note")) {
12251      JsonArray array = json.getAsJsonArray("note");
12252      for (int i = 0; i < array.size(); i++) {
12253        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12254      }
12255    };
12256    if (json.has("dosageInstruction")) {
12257      JsonArray array = json.getAsJsonArray("dosageInstruction");
12258      for (int i = 0; i < array.size(); i++) {
12259        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12260      }
12261    };
12262    if (json.has("substitution"))
12263      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
12264    if (json.has("detectedIssue")) {
12265      JsonArray array = json.getAsJsonArray("detectedIssue");
12266      for (int i = 0; i < array.size(); i++) {
12267        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12268      }
12269    };
12270    if (json.has("notDone"))
12271      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
12272    if (json.has("_notDone"))
12273      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
12274    Type notDoneReason = parseType("notDoneReason", json);
12275    if (notDoneReason != null)
12276      res.setNotDoneReason(notDoneReason);
12277    if (json.has("eventHistory")) {
12278      JsonArray array = json.getAsJsonArray("eventHistory");
12279      for (int i = 0; i < array.size(); i++) {
12280        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12281      }
12282    };
12283  }
12284
12285  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12286    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
12287    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
12288    return res;
12289  }
12290
12291  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
12292    parseBackboneProperties(json, res);
12293    if (json.has("actor"))
12294      res.setActor(parseReference(json.getAsJsonObject("actor")));
12295    if (json.has("onBehalfOf"))
12296      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12297  }
12298
12299  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12300    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
12301    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
12302    return res;
12303  }
12304
12305  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
12306    parseBackboneProperties(json, res);
12307    if (json.has("wasSubstituted"))
12308      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
12309    if (json.has("_wasSubstituted"))
12310      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
12311    if (json.has("type"))
12312      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12313    if (json.has("reason")) {
12314      JsonArray array = json.getAsJsonArray("reason");
12315      for (int i = 0; i < array.size(); i++) {
12316        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12317      }
12318    };
12319    if (json.has("responsibleParty")) {
12320      JsonArray array = json.getAsJsonArray("responsibleParty");
12321      for (int i = 0; i < array.size(); i++) {
12322        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
12323      }
12324    };
12325  }
12326
12327  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
12328    MedicationRequest res = new MedicationRequest();
12329    parseMedicationRequestProperties(json, res);
12330    return res;
12331  }
12332
12333  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
12334    parseDomainResourceProperties(json, res);
12335    if (json.has("identifier")) {
12336      JsonArray array = json.getAsJsonArray("identifier");
12337      for (int i = 0; i < array.size(); i++) {
12338        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12339      }
12340    };
12341    if (json.has("definition")) {
12342      JsonArray array = json.getAsJsonArray("definition");
12343      for (int i = 0; i < array.size(); i++) {
12344        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12345      }
12346    };
12347    if (json.has("basedOn")) {
12348      JsonArray array = json.getAsJsonArray("basedOn");
12349      for (int i = 0; i < array.size(); i++) {
12350        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12351      }
12352    };
12353    if (json.has("groupIdentifier"))
12354      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
12355    if (json.has("status"))
12356      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
12357    if (json.has("_status"))
12358      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12359    if (json.has("intent"))
12360      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
12361    if (json.has("_intent"))
12362      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
12363    if (json.has("category"))
12364      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12365    if (json.has("priority"))
12366      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
12367    if (json.has("_priority"))
12368      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
12369    Type medication = parseType("medication", json);
12370    if (medication != null)
12371      res.setMedication(medication);
12372    if (json.has("subject"))
12373      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12374    if (json.has("context"))
12375      res.setContext(parseReference(json.getAsJsonObject("context")));
12376    if (json.has("supportingInformation")) {
12377      JsonArray array = json.getAsJsonArray("supportingInformation");
12378      for (int i = 0; i < array.size(); i++) {
12379        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12380      }
12381    };
12382    if (json.has("authoredOn"))
12383      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
12384    if (json.has("_authoredOn"))
12385      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
12386    if (json.has("requester"))
12387      res.setRequester(parseMedicationRequestMedicationRequestRequesterComponent(json.getAsJsonObject("requester"), res));
12388    if (json.has("recorder"))
12389      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
12390    if (json.has("reasonCode")) {
12391      JsonArray array = json.getAsJsonArray("reasonCode");
12392      for (int i = 0; i < array.size(); i++) {
12393        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12394      }
12395    };
12396    if (json.has("reasonReference")) {
12397      JsonArray array = json.getAsJsonArray("reasonReference");
12398      for (int i = 0; i < array.size(); i++) {
12399        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12400      }
12401    };
12402    if (json.has("note")) {
12403      JsonArray array = json.getAsJsonArray("note");
12404      for (int i = 0; i < array.size(); i++) {
12405        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12406      }
12407    };
12408    if (json.has("dosageInstruction")) {
12409      JsonArray array = json.getAsJsonArray("dosageInstruction");
12410      for (int i = 0; i < array.size(); i++) {
12411        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12412      }
12413    };
12414    if (json.has("dispenseRequest"))
12415      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
12416    if (json.has("substitution"))
12417      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
12418    if (json.has("priorPrescription"))
12419      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
12420    if (json.has("detectedIssue")) {
12421      JsonArray array = json.getAsJsonArray("detectedIssue");
12422      for (int i = 0; i < array.size(); i++) {
12423        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12424      }
12425    };
12426    if (json.has("eventHistory")) {
12427      JsonArray array = json.getAsJsonArray("eventHistory");
12428      for (int i = 0; i < array.size(); i++) {
12429        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12430      }
12431    };
12432  }
12433
12434  protected MedicationRequest.MedicationRequestRequesterComponent parseMedicationRequestMedicationRequestRequesterComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12435    MedicationRequest.MedicationRequestRequesterComponent res = new MedicationRequest.MedicationRequestRequesterComponent();
12436    parseMedicationRequestMedicationRequestRequesterComponentProperties(json, owner, res);
12437    return res;
12438  }
12439
12440  protected void parseMedicationRequestMedicationRequestRequesterComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
12441    parseBackboneProperties(json, res);
12442    if (json.has("agent"))
12443      res.setAgent(parseReference(json.getAsJsonObject("agent")));
12444    if (json.has("onBehalfOf"))
12445      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12446  }
12447
12448  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12449    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
12450    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
12451    return res;
12452  }
12453
12454  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
12455    parseBackboneProperties(json, res);
12456    if (json.has("validityPeriod"))
12457      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
12458    if (json.has("numberOfRepeatsAllowed"))
12459      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
12460    if (json.has("_numberOfRepeatsAllowed"))
12461      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
12462    if (json.has("quantity"))
12463      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
12464    if (json.has("expectedSupplyDuration"))
12465      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
12466    if (json.has("performer"))
12467      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
12468  }
12469
12470  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12471    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
12472    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
12473    return res;
12474  }
12475
12476  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
12477    parseBackboneProperties(json, res);
12478    if (json.has("allowed"))
12479      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
12480    if (json.has("_allowed"))
12481      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
12482    if (json.has("reason"))
12483      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12484  }
12485
12486  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
12487    MedicationStatement res = new MedicationStatement();
12488    parseMedicationStatementProperties(json, res);
12489    return res;
12490  }
12491
12492  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
12493    parseDomainResourceProperties(json, res);
12494    if (json.has("identifier")) {
12495      JsonArray array = json.getAsJsonArray("identifier");
12496      for (int i = 0; i < array.size(); i++) {
12497        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12498      }
12499    };
12500    if (json.has("basedOn")) {
12501      JsonArray array = json.getAsJsonArray("basedOn");
12502      for (int i = 0; i < array.size(); i++) {
12503        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12504      }
12505    };
12506    if (json.has("partOf")) {
12507      JsonArray array = json.getAsJsonArray("partOf");
12508      for (int i = 0; i < array.size(); i++) {
12509        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12510      }
12511    };
12512    if (json.has("context"))
12513      res.setContext(parseReference(json.getAsJsonObject("context")));
12514    if (json.has("status"))
12515      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
12516    if (json.has("_status"))
12517      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12518    if (json.has("category"))
12519      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12520    Type medication = parseType("medication", json);
12521    if (medication != null)
12522      res.setMedication(medication);
12523    Type effective = parseType("effective", json);
12524    if (effective != null)
12525      res.setEffective(effective);
12526    if (json.has("dateAsserted"))
12527      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
12528    if (json.has("_dateAsserted"))
12529      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
12530    if (json.has("informationSource"))
12531      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
12532    if (json.has("subject"))
12533      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12534    if (json.has("derivedFrom")) {
12535      JsonArray array = json.getAsJsonArray("derivedFrom");
12536      for (int i = 0; i < array.size(); i++) {
12537        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
12538      }
12539    };
12540    if (json.has("taken"))
12541      res.setTakenElement(parseEnumeration(json.get("taken").getAsString(), MedicationStatement.MedicationStatementTaken.NULL, new MedicationStatement.MedicationStatementTakenEnumFactory()));
12542    if (json.has("_taken"))
12543      parseElementProperties(json.getAsJsonObject("_taken"), res.getTakenElement());
12544    if (json.has("reasonNotTaken")) {
12545      JsonArray array = json.getAsJsonArray("reasonNotTaken");
12546      for (int i = 0; i < array.size(); i++) {
12547        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12548      }
12549    };
12550    if (json.has("reasonCode")) {
12551      JsonArray array = json.getAsJsonArray("reasonCode");
12552      for (int i = 0; i < array.size(); i++) {
12553        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12554      }
12555    };
12556    if (json.has("reasonReference")) {
12557      JsonArray array = json.getAsJsonArray("reasonReference");
12558      for (int i = 0; i < array.size(); i++) {
12559        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12560      }
12561    };
12562    if (json.has("note")) {
12563      JsonArray array = json.getAsJsonArray("note");
12564      for (int i = 0; i < array.size(); i++) {
12565        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12566      }
12567    };
12568    if (json.has("dosage")) {
12569      JsonArray array = json.getAsJsonArray("dosage");
12570      for (int i = 0; i < array.size(); i++) {
12571        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
12572      }
12573    };
12574  }
12575
12576  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
12577    MessageDefinition res = new MessageDefinition();
12578    parseMessageDefinitionProperties(json, res);
12579    return res;
12580  }
12581
12582  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
12583    parseDomainResourceProperties(json, res);
12584    if (json.has("url"))
12585      res.setUrlElement(parseUri(json.get("url").getAsString()));
12586    if (json.has("_url"))
12587      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12588    if (json.has("identifier"))
12589      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12590    if (json.has("version"))
12591      res.setVersionElement(parseString(json.get("version").getAsString()));
12592    if (json.has("_version"))
12593      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12594    if (json.has("name"))
12595      res.setNameElement(parseString(json.get("name").getAsString()));
12596    if (json.has("_name"))
12597      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12598    if (json.has("title"))
12599      res.setTitleElement(parseString(json.get("title").getAsString()));
12600    if (json.has("_title"))
12601      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12602    if (json.has("status"))
12603      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12604    if (json.has("_status"))
12605      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12606    if (json.has("experimental"))
12607      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12608    if (json.has("_experimental"))
12609      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12610    if (json.has("date"))
12611      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12612    if (json.has("_date"))
12613      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12614    if (json.has("publisher"))
12615      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12616    if (json.has("_publisher"))
12617      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12618    if (json.has("contact")) {
12619      JsonArray array = json.getAsJsonArray("contact");
12620      for (int i = 0; i < array.size(); i++) {
12621        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12622      }
12623    };
12624    if (json.has("description"))
12625      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12626    if (json.has("_description"))
12627      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12628    if (json.has("useContext")) {
12629      JsonArray array = json.getAsJsonArray("useContext");
12630      for (int i = 0; i < array.size(); i++) {
12631        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12632      }
12633    };
12634    if (json.has("jurisdiction")) {
12635      JsonArray array = json.getAsJsonArray("jurisdiction");
12636      for (int i = 0; i < array.size(); i++) {
12637        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12638      }
12639    };
12640    if (json.has("purpose"))
12641      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12642    if (json.has("_purpose"))
12643      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12644    if (json.has("copyright"))
12645      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12646    if (json.has("_copyright"))
12647      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12648    if (json.has("base"))
12649      res.setBase(parseReference(json.getAsJsonObject("base")));
12650    if (json.has("parent")) {
12651      JsonArray array = json.getAsJsonArray("parent");
12652      for (int i = 0; i < array.size(); i++) {
12653        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
12654      }
12655    };
12656    if (json.has("replaces")) {
12657      JsonArray array = json.getAsJsonArray("replaces");
12658      for (int i = 0; i < array.size(); i++) {
12659        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
12660      }
12661    };
12662    if (json.has("event"))
12663      res.setEvent(parseCoding(json.getAsJsonObject("event")));
12664    if (json.has("category"))
12665      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
12666    if (json.has("_category"))
12667      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
12668    if (json.has("focus")) {
12669      JsonArray array = json.getAsJsonArray("focus");
12670      for (int i = 0; i < array.size(); i++) {
12671        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
12672      }
12673    };
12674    if (json.has("responseRequired"))
12675      res.setResponseRequiredElement(parseBoolean(json.get("responseRequired").getAsBoolean()));
12676    if (json.has("_responseRequired"))
12677      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
12678    if (json.has("allowedResponse")) {
12679      JsonArray array = json.getAsJsonArray("allowedResponse");
12680      for (int i = 0; i < array.size(); i++) {
12681        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
12682      }
12683    };
12684  }
12685
12686  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12687    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
12688    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
12689    return res;
12690  }
12691
12692  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
12693    parseBackboneProperties(json, res);
12694    if (json.has("code"))
12695      res.setCodeElement(parseCode(json.get("code").getAsString()));
12696    if (json.has("_code"))
12697      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12698    if (json.has("profile"))
12699      res.setProfile(parseReference(json.getAsJsonObject("profile")));
12700    if (json.has("min"))
12701      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
12702    if (json.has("_min"))
12703      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
12704    if (json.has("max"))
12705      res.setMaxElement(parseString(json.get("max").getAsString()));
12706    if (json.has("_max"))
12707      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
12708  }
12709
12710  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12711    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
12712    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
12713    return res;
12714  }
12715
12716  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
12717    parseBackboneProperties(json, res);
12718    if (json.has("message"))
12719      res.setMessage(parseReference(json.getAsJsonObject("message")));
12720    if (json.has("situation"))
12721      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
12722    if (json.has("_situation"))
12723      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
12724  }
12725
12726  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
12727    MessageHeader res = new MessageHeader();
12728    parseMessageHeaderProperties(json, res);
12729    return res;
12730  }
12731
12732  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
12733    parseDomainResourceProperties(json, res);
12734    if (json.has("event"))
12735      res.setEvent(parseCoding(json.getAsJsonObject("event")));
12736    if (json.has("destination")) {
12737      JsonArray array = json.getAsJsonArray("destination");
12738      for (int i = 0; i < array.size(); i++) {
12739        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
12740      }
12741    };
12742    if (json.has("receiver"))
12743      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
12744    if (json.has("sender"))
12745      res.setSender(parseReference(json.getAsJsonObject("sender")));
12746    if (json.has("timestamp"))
12747      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
12748    if (json.has("_timestamp"))
12749      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
12750    if (json.has("enterer"))
12751      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
12752    if (json.has("author"))
12753      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12754    if (json.has("source"))
12755      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
12756    if (json.has("responsible"))
12757      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
12758    if (json.has("reason"))
12759      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12760    if (json.has("response"))
12761      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
12762    if (json.has("focus")) {
12763      JsonArray array = json.getAsJsonArray("focus");
12764      for (int i = 0; i < array.size(); i++) {
12765        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
12766      }
12767    };
12768  }
12769
12770  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12771    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
12772    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
12773    return res;
12774  }
12775
12776  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
12777    parseBackboneProperties(json, res);
12778    if (json.has("name"))
12779      res.setNameElement(parseString(json.get("name").getAsString()));
12780    if (json.has("_name"))
12781      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12782    if (json.has("target"))
12783      res.setTarget(parseReference(json.getAsJsonObject("target")));
12784    if (json.has("endpoint"))
12785      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
12786    if (json.has("_endpoint"))
12787      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
12788  }
12789
12790  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12791    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
12792    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
12793    return res;
12794  }
12795
12796  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
12797    parseBackboneProperties(json, res);
12798    if (json.has("name"))
12799      res.setNameElement(parseString(json.get("name").getAsString()));
12800    if (json.has("_name"))
12801      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12802    if (json.has("software"))
12803      res.setSoftwareElement(parseString(json.get("software").getAsString()));
12804    if (json.has("_software"))
12805      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
12806    if (json.has("version"))
12807      res.setVersionElement(parseString(json.get("version").getAsString()));
12808    if (json.has("_version"))
12809      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12810    if (json.has("contact"))
12811      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
12812    if (json.has("endpoint"))
12813      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
12814    if (json.has("_endpoint"))
12815      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
12816  }
12817
12818  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12819    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
12820    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
12821    return res;
12822  }
12823
12824  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
12825    parseBackboneProperties(json, res);
12826    if (json.has("identifier"))
12827      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
12828    if (json.has("_identifier"))
12829      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
12830    if (json.has("code"))
12831      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
12832    if (json.has("_code"))
12833      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12834    if (json.has("details"))
12835      res.setDetails(parseReference(json.getAsJsonObject("details")));
12836  }
12837
12838  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
12839    NamingSystem res = new NamingSystem();
12840    parseNamingSystemProperties(json, res);
12841    return res;
12842  }
12843
12844  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
12845    parseDomainResourceProperties(json, res);
12846    if (json.has("name"))
12847      res.setNameElement(parseString(json.get("name").getAsString()));
12848    if (json.has("_name"))
12849      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12850    if (json.has("status"))
12851      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12852    if (json.has("_status"))
12853      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12854    if (json.has("kind"))
12855      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
12856    if (json.has("_kind"))
12857      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
12858    if (json.has("date"))
12859      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12860    if (json.has("_date"))
12861      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12862    if (json.has("publisher"))
12863      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12864    if (json.has("_publisher"))
12865      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12866    if (json.has("contact")) {
12867      JsonArray array = json.getAsJsonArray("contact");
12868      for (int i = 0; i < array.size(); i++) {
12869        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12870      }
12871    };
12872    if (json.has("responsible"))
12873      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
12874    if (json.has("_responsible"))
12875      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
12876    if (json.has("type"))
12877      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12878    if (json.has("description"))
12879      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12880    if (json.has("_description"))
12881      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12882    if (json.has("useContext")) {
12883      JsonArray array = json.getAsJsonArray("useContext");
12884      for (int i = 0; i < array.size(); i++) {
12885        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12886      }
12887    };
12888    if (json.has("jurisdiction")) {
12889      JsonArray array = json.getAsJsonArray("jurisdiction");
12890      for (int i = 0; i < array.size(); i++) {
12891        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12892      }
12893    };
12894    if (json.has("usage"))
12895      res.setUsageElement(parseString(json.get("usage").getAsString()));
12896    if (json.has("_usage"))
12897      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
12898    if (json.has("uniqueId")) {
12899      JsonArray array = json.getAsJsonArray("uniqueId");
12900      for (int i = 0; i < array.size(); i++) {
12901        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
12902      }
12903    };
12904    if (json.has("replacedBy"))
12905      res.setReplacedBy(parseReference(json.getAsJsonObject("replacedBy")));
12906  }
12907
12908  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
12909    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
12910    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
12911    return res;
12912  }
12913
12914  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
12915    parseBackboneProperties(json, res);
12916    if (json.has("type"))
12917      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
12918    if (json.has("_type"))
12919      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12920    if (json.has("value"))
12921      res.setValueElement(parseString(json.get("value").getAsString()));
12922    if (json.has("_value"))
12923      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
12924    if (json.has("preferred"))
12925      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
12926    if (json.has("_preferred"))
12927      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
12928    if (json.has("comment"))
12929      res.setCommentElement(parseString(json.get("comment").getAsString()));
12930    if (json.has("_comment"))
12931      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
12932    if (json.has("period"))
12933      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12934  }
12935
12936  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
12937    NutritionOrder res = new NutritionOrder();
12938    parseNutritionOrderProperties(json, res);
12939    return res;
12940  }
12941
12942  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
12943    parseDomainResourceProperties(json, res);
12944    if (json.has("identifier")) {
12945      JsonArray array = json.getAsJsonArray("identifier");
12946      for (int i = 0; i < array.size(); i++) {
12947        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12948      }
12949    };
12950    if (json.has("status"))
12951      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
12952    if (json.has("_status"))
12953      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12954    if (json.has("patient"))
12955      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12956    if (json.has("encounter"))
12957      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12958    if (json.has("dateTime"))
12959      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
12960    if (json.has("_dateTime"))
12961      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
12962    if (json.has("orderer"))
12963      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
12964    if (json.has("allergyIntolerance")) {
12965      JsonArray array = json.getAsJsonArray("allergyIntolerance");
12966      for (int i = 0; i < array.size(); i++) {
12967        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
12968      }
12969    };
12970    if (json.has("foodPreferenceModifier")) {
12971      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
12972      for (int i = 0; i < array.size(); i++) {
12973        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12974      }
12975    };
12976    if (json.has("excludeFoodModifier")) {
12977      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
12978      for (int i = 0; i < array.size(); i++) {
12979        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12980      }
12981    };
12982    if (json.has("oralDiet"))
12983      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
12984    if (json.has("supplement")) {
12985      JsonArray array = json.getAsJsonArray("supplement");
12986      for (int i = 0; i < array.size(); i++) {
12987        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
12988      }
12989    };
12990    if (json.has("enteralFormula"))
12991      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
12992  }
12993
12994  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
12995    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
12996    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
12997    return res;
12998  }
12999
13000  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
13001    parseBackboneProperties(json, res);
13002    if (json.has("type")) {
13003      JsonArray array = json.getAsJsonArray("type");
13004      for (int i = 0; i < array.size(); i++) {
13005        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13006      }
13007    };
13008    if (json.has("schedule")) {
13009      JsonArray array = json.getAsJsonArray("schedule");
13010      for (int i = 0; i < array.size(); i++) {
13011        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13012      }
13013    };
13014    if (json.has("nutrient")) {
13015      JsonArray array = json.getAsJsonArray("nutrient");
13016      for (int i = 0; i < array.size(); i++) {
13017        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
13018      }
13019    };
13020    if (json.has("texture")) {
13021      JsonArray array = json.getAsJsonArray("texture");
13022      for (int i = 0; i < array.size(); i++) {
13023        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
13024      }
13025    };
13026    if (json.has("fluidConsistencyType")) {
13027      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
13028      for (int i = 0; i < array.size(); i++) {
13029        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13030      }
13031    };
13032    if (json.has("instruction"))
13033      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13034    if (json.has("_instruction"))
13035      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
13036  }
13037
13038  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13039    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
13040    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
13041    return res;
13042  }
13043
13044  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
13045    parseBackboneProperties(json, res);
13046    if (json.has("modifier"))
13047      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
13048    if (json.has("amount"))
13049      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
13050  }
13051
13052  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13053    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
13054    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
13055    return res;
13056  }
13057
13058  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
13059    parseBackboneProperties(json, res);
13060    if (json.has("modifier"))
13061      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
13062    if (json.has("foodType"))
13063      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
13064  }
13065
13066  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13067    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
13068    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
13069    return res;
13070  }
13071
13072  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
13073    parseBackboneProperties(json, res);
13074    if (json.has("type"))
13075      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13076    if (json.has("productName"))
13077      res.setProductNameElement(parseString(json.get("productName").getAsString()));
13078    if (json.has("_productName"))
13079      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
13080    if (json.has("schedule")) {
13081      JsonArray array = json.getAsJsonArray("schedule");
13082      for (int i = 0; i < array.size(); i++) {
13083        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13084      }
13085    };
13086    if (json.has("quantity"))
13087      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13088    if (json.has("instruction"))
13089      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13090    if (json.has("_instruction"))
13091      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
13092  }
13093
13094  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13095    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
13096    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
13097    return res;
13098  }
13099
13100  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
13101    parseBackboneProperties(json, res);
13102    if (json.has("baseFormulaType"))
13103      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
13104    if (json.has("baseFormulaProductName"))
13105      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
13106    if (json.has("_baseFormulaProductName"))
13107      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
13108    if (json.has("additiveType"))
13109      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
13110    if (json.has("additiveProductName"))
13111      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
13112    if (json.has("_additiveProductName"))
13113      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
13114    if (json.has("caloricDensity"))
13115      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
13116    if (json.has("routeofAdministration"))
13117      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
13118    if (json.has("administration")) {
13119      JsonArray array = json.getAsJsonArray("administration");
13120      for (int i = 0; i < array.size(); i++) {
13121        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
13122      }
13123    };
13124    if (json.has("maxVolumeToDeliver"))
13125      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
13126    if (json.has("administrationInstruction"))
13127      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
13128    if (json.has("_administrationInstruction"))
13129      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
13130  }
13131
13132  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13133    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
13134    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
13135    return res;
13136  }
13137
13138  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
13139    parseBackboneProperties(json, res);
13140    if (json.has("schedule"))
13141      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
13142    if (json.has("quantity"))
13143      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13144    Type rate = parseType("rate", json);
13145    if (rate != null)
13146      res.setRate(rate);
13147  }
13148
13149  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
13150    Observation res = new Observation();
13151    parseObservationProperties(json, res);
13152    return res;
13153  }
13154
13155  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
13156    parseDomainResourceProperties(json, res);
13157    if (json.has("identifier")) {
13158      JsonArray array = json.getAsJsonArray("identifier");
13159      for (int i = 0; i < array.size(); i++) {
13160        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13161      }
13162    };
13163    if (json.has("basedOn")) {
13164      JsonArray array = json.getAsJsonArray("basedOn");
13165      for (int i = 0; i < array.size(); i++) {
13166        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13167      }
13168    };
13169    if (json.has("status"))
13170      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
13171    if (json.has("_status"))
13172      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13173    if (json.has("category")) {
13174      JsonArray array = json.getAsJsonArray("category");
13175      for (int i = 0; i < array.size(); i++) {
13176        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13177      }
13178    };
13179    if (json.has("code"))
13180      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13181    if (json.has("subject"))
13182      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13183    if (json.has("context"))
13184      res.setContext(parseReference(json.getAsJsonObject("context")));
13185    Type effective = parseType("effective", json);
13186    if (effective != null)
13187      res.setEffective(effective);
13188    if (json.has("issued"))
13189      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
13190    if (json.has("_issued"))
13191      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
13192    if (json.has("performer")) {
13193      JsonArray array = json.getAsJsonArray("performer");
13194      for (int i = 0; i < array.size(); i++) {
13195        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
13196      }
13197    };
13198    Type value = parseType("value", json);
13199    if (value != null)
13200      res.setValue(value);
13201    if (json.has("dataAbsentReason"))
13202      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
13203    if (json.has("interpretation"))
13204      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
13205    if (json.has("comment"))
13206      res.setCommentElement(parseString(json.get("comment").getAsString()));
13207    if (json.has("_comment"))
13208      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13209    if (json.has("bodySite"))
13210      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13211    if (json.has("method"))
13212      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
13213    if (json.has("specimen"))
13214      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
13215    if (json.has("device"))
13216      res.setDevice(parseReference(json.getAsJsonObject("device")));
13217    if (json.has("referenceRange")) {
13218      JsonArray array = json.getAsJsonArray("referenceRange");
13219      for (int i = 0; i < array.size(); i++) {
13220        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
13221      }
13222    };
13223    if (json.has("related")) {
13224      JsonArray array = json.getAsJsonArray("related");
13225      for (int i = 0; i < array.size(); i++) {
13226        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
13227      }
13228    };
13229    if (json.has("component")) {
13230      JsonArray array = json.getAsJsonArray("component");
13231      for (int i = 0; i < array.size(); i++) {
13232        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
13233      }
13234    };
13235  }
13236
13237  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13238    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
13239    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
13240    return res;
13241  }
13242
13243  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
13244    parseBackboneProperties(json, res);
13245    if (json.has("low"))
13246      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
13247    if (json.has("high"))
13248      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
13249    if (json.has("type"))
13250      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13251    if (json.has("appliesTo")) {
13252      JsonArray array = json.getAsJsonArray("appliesTo");
13253      for (int i = 0; i < array.size(); i++) {
13254        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13255      }
13256    };
13257    if (json.has("age"))
13258      res.setAge(parseRange(json.getAsJsonObject("age")));
13259    if (json.has("text"))
13260      res.setTextElement(parseString(json.get("text").getAsString()));
13261    if (json.has("_text"))
13262      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13263  }
13264
13265  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13266    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
13267    parseObservationObservationRelatedComponentProperties(json, owner, res);
13268    return res;
13269  }
13270
13271  protected void parseObservationObservationRelatedComponentProperties(JsonObject json, Observation owner, Observation.ObservationRelatedComponent res) throws IOException, FHIRFormatError {
13272    parseBackboneProperties(json, res);
13273    if (json.has("type"))
13274      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
13275    if (json.has("_type"))
13276      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13277    if (json.has("target"))
13278      res.setTarget(parseReference(json.getAsJsonObject("target")));
13279  }
13280
13281  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13282    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
13283    parseObservationObservationComponentComponentProperties(json, owner, res);
13284    return res;
13285  }
13286
13287  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
13288    parseBackboneProperties(json, res);
13289    if (json.has("code"))
13290      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13291    Type value = parseType("value", json);
13292    if (value != null)
13293      res.setValue(value);
13294    if (json.has("dataAbsentReason"))
13295      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
13296    if (json.has("interpretation"))
13297      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
13298    if (json.has("referenceRange")) {
13299      JsonArray array = json.getAsJsonArray("referenceRange");
13300      for (int i = 0; i < array.size(); i++) {
13301        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
13302      }
13303    };
13304  }
13305
13306  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
13307    OperationDefinition res = new OperationDefinition();
13308    parseOperationDefinitionProperties(json, res);
13309    return res;
13310  }
13311
13312  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
13313    parseDomainResourceProperties(json, res);
13314    if (json.has("url"))
13315      res.setUrlElement(parseUri(json.get("url").getAsString()));
13316    if (json.has("_url"))
13317      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13318    if (json.has("version"))
13319      res.setVersionElement(parseString(json.get("version").getAsString()));
13320    if (json.has("_version"))
13321      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13322    if (json.has("name"))
13323      res.setNameElement(parseString(json.get("name").getAsString()));
13324    if (json.has("_name"))
13325      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13326    if (json.has("status"))
13327      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13328    if (json.has("_status"))
13329      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13330    if (json.has("kind"))
13331      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
13332    if (json.has("_kind"))
13333      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
13334    if (json.has("experimental"))
13335      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13336    if (json.has("_experimental"))
13337      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13338    if (json.has("date"))
13339      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13340    if (json.has("_date"))
13341      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13342    if (json.has("publisher"))
13343      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13344    if (json.has("_publisher"))
13345      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13346    if (json.has("contact")) {
13347      JsonArray array = json.getAsJsonArray("contact");
13348      for (int i = 0; i < array.size(); i++) {
13349        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13350      }
13351    };
13352    if (json.has("description"))
13353      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13354    if (json.has("_description"))
13355      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13356    if (json.has("useContext")) {
13357      JsonArray array = json.getAsJsonArray("useContext");
13358      for (int i = 0; i < array.size(); i++) {
13359        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13360      }
13361    };
13362    if (json.has("jurisdiction")) {
13363      JsonArray array = json.getAsJsonArray("jurisdiction");
13364      for (int i = 0; i < array.size(); i++) {
13365        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13366      }
13367    };
13368    if (json.has("purpose"))
13369      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
13370    if (json.has("_purpose"))
13371      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
13372    if (json.has("idempotent"))
13373      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
13374    if (json.has("_idempotent"))
13375      parseElementProperties(json.getAsJsonObject("_idempotent"), res.getIdempotentElement());
13376    if (json.has("code"))
13377      res.setCodeElement(parseCode(json.get("code").getAsString()));
13378    if (json.has("_code"))
13379      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13380    if (json.has("comment"))
13381      res.setCommentElement(parseString(json.get("comment").getAsString()));
13382    if (json.has("_comment"))
13383      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13384    if (json.has("base"))
13385      res.setBase(parseReference(json.getAsJsonObject("base")));
13386    if (json.has("resource")) {
13387      JsonArray array = json.getAsJsonArray("resource");
13388      for (int i = 0; i < array.size(); i++) {
13389        res.getResource().add(parseCode(array.get(i).getAsString()));
13390      }
13391    };
13392    if (json.has("_resource")) {
13393      JsonArray array = json.getAsJsonArray("_resource");
13394      for (int i = 0; i < array.size(); i++) {
13395        if (i == res.getResource().size())
13396          res.getResource().add(parseCode(null));
13397        if (array.get(i) instanceof JsonObject) 
13398          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
13399      }
13400    };
13401    if (json.has("system"))
13402      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
13403    if (json.has("_system"))
13404      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
13405    if (json.has("type"))
13406      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
13407    if (json.has("_type"))
13408      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13409    if (json.has("instance"))
13410      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
13411    if (json.has("_instance"))
13412      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
13413    if (json.has("parameter")) {
13414      JsonArray array = json.getAsJsonArray("parameter");
13415      for (int i = 0; i < array.size(); i++) {
13416        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
13417      }
13418    };
13419    if (json.has("overload")) {
13420      JsonArray array = json.getAsJsonArray("overload");
13421      for (int i = 0; i < array.size(); i++) {
13422        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
13423      }
13424    };
13425  }
13426
13427  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13428    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
13429    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
13430    return res;
13431  }
13432
13433  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
13434    parseBackboneProperties(json, res);
13435    if (json.has("name"))
13436      res.setNameElement(parseCode(json.get("name").getAsString()));
13437    if (json.has("_name"))
13438      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13439    if (json.has("use"))
13440      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
13441    if (json.has("_use"))
13442      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
13443    if (json.has("min"))
13444      res.setMinElement(parseInteger(json.get("min").getAsLong()));
13445    if (json.has("_min"))
13446      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
13447    if (json.has("max"))
13448      res.setMaxElement(parseString(json.get("max").getAsString()));
13449    if (json.has("_max"))
13450      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
13451    if (json.has("documentation"))
13452      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
13453    if (json.has("_documentation"))
13454      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
13455    if (json.has("type"))
13456      res.setTypeElement(parseCode(json.get("type").getAsString()));
13457    if (json.has("_type"))
13458      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13459    if (json.has("searchType"))
13460      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
13461    if (json.has("_searchType"))
13462      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
13463    if (json.has("profile"))
13464      res.setProfile(parseReference(json.getAsJsonObject("profile")));
13465    if (json.has("binding"))
13466      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
13467    if (json.has("part")) {
13468      JsonArray array = json.getAsJsonArray("part");
13469      for (int i = 0; i < array.size(); i++) {
13470        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
13471      }
13472    };
13473  }
13474
13475  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13476    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
13477    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
13478    return res;
13479  }
13480
13481  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
13482    parseBackboneProperties(json, res);
13483    if (json.has("strength"))
13484      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
13485    if (json.has("_strength"))
13486      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
13487    Type valueSet = parseType("valueSet", json);
13488    if (valueSet != null)
13489      res.setValueSet(valueSet);
13490  }
13491
13492  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13493    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
13494    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
13495    return res;
13496  }
13497
13498  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
13499    parseBackboneProperties(json, res);
13500    if (json.has("parameterName")) {
13501      JsonArray array = json.getAsJsonArray("parameterName");
13502      for (int i = 0; i < array.size(); i++) {
13503        res.getParameterName().add(parseString(array.get(i).getAsString()));
13504      }
13505    };
13506    if (json.has("_parameterName")) {
13507      JsonArray array = json.getAsJsonArray("_parameterName");
13508      for (int i = 0; i < array.size(); i++) {
13509        if (i == res.getParameterName().size())
13510          res.getParameterName().add(parseString(null));
13511        if (array.get(i) instanceof JsonObject) 
13512          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
13513      }
13514    };
13515    if (json.has("comment"))
13516      res.setCommentElement(parseString(json.get("comment").getAsString()));
13517    if (json.has("_comment"))
13518      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13519  }
13520
13521  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
13522    OperationOutcome res = new OperationOutcome();
13523    parseOperationOutcomeProperties(json, res);
13524    return res;
13525  }
13526
13527  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
13528    parseDomainResourceProperties(json, res);
13529    if (json.has("issue")) {
13530      JsonArray array = json.getAsJsonArray("issue");
13531      for (int i = 0; i < array.size(); i++) {
13532        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
13533      }
13534    };
13535  }
13536
13537  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
13538    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
13539    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
13540    return res;
13541  }
13542
13543  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
13544    parseBackboneProperties(json, res);
13545    if (json.has("severity"))
13546      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
13547    if (json.has("_severity"))
13548      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
13549    if (json.has("code"))
13550      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
13551    if (json.has("_code"))
13552      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13553    if (json.has("details"))
13554      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
13555    if (json.has("diagnostics"))
13556      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
13557    if (json.has("_diagnostics"))
13558      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
13559    if (json.has("location")) {
13560      JsonArray array = json.getAsJsonArray("location");
13561      for (int i = 0; i < array.size(); i++) {
13562        res.getLocation().add(parseString(array.get(i).getAsString()));
13563      }
13564    };
13565    if (json.has("_location")) {
13566      JsonArray array = json.getAsJsonArray("_location");
13567      for (int i = 0; i < array.size(); i++) {
13568        if (i == res.getLocation().size())
13569          res.getLocation().add(parseString(null));
13570        if (array.get(i) instanceof JsonObject) 
13571          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
13572      }
13573    };
13574    if (json.has("expression")) {
13575      JsonArray array = json.getAsJsonArray("expression");
13576      for (int i = 0; i < array.size(); i++) {
13577        res.getExpression().add(parseString(array.get(i).getAsString()));
13578      }
13579    };
13580    if (json.has("_expression")) {
13581      JsonArray array = json.getAsJsonArray("_expression");
13582      for (int i = 0; i < array.size(); i++) {
13583        if (i == res.getExpression().size())
13584          res.getExpression().add(parseString(null));
13585        if (array.get(i) instanceof JsonObject) 
13586          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
13587      }
13588    };
13589  }
13590
13591  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
13592    Organization res = new Organization();
13593    parseOrganizationProperties(json, res);
13594    return res;
13595  }
13596
13597  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
13598    parseDomainResourceProperties(json, res);
13599    if (json.has("identifier")) {
13600      JsonArray array = json.getAsJsonArray("identifier");
13601      for (int i = 0; i < array.size(); i++) {
13602        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13603      }
13604    };
13605    if (json.has("active"))
13606      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13607    if (json.has("_active"))
13608      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13609    if (json.has("type")) {
13610      JsonArray array = json.getAsJsonArray("type");
13611      for (int i = 0; i < array.size(); i++) {
13612        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13613      }
13614    };
13615    if (json.has("name"))
13616      res.setNameElement(parseString(json.get("name").getAsString()));
13617    if (json.has("_name"))
13618      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13619    if (json.has("alias")) {
13620      JsonArray array = json.getAsJsonArray("alias");
13621      for (int i = 0; i < array.size(); i++) {
13622        res.getAlias().add(parseString(array.get(i).getAsString()));
13623      }
13624    };
13625    if (json.has("_alias")) {
13626      JsonArray array = json.getAsJsonArray("_alias");
13627      for (int i = 0; i < array.size(); i++) {
13628        if (i == res.getAlias().size())
13629          res.getAlias().add(parseString(null));
13630        if (array.get(i) instanceof JsonObject) 
13631          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
13632      }
13633    };
13634    if (json.has("telecom")) {
13635      JsonArray array = json.getAsJsonArray("telecom");
13636      for (int i = 0; i < array.size(); i++) {
13637        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13638      }
13639    };
13640    if (json.has("address")) {
13641      JsonArray array = json.getAsJsonArray("address");
13642      for (int i = 0; i < array.size(); i++) {
13643        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13644      }
13645    };
13646    if (json.has("partOf"))
13647      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
13648    if (json.has("contact")) {
13649      JsonArray array = json.getAsJsonArray("contact");
13650      for (int i = 0; i < array.size(); i++) {
13651        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
13652      }
13653    };
13654    if (json.has("endpoint")) {
13655      JsonArray array = json.getAsJsonArray("endpoint");
13656      for (int i = 0; i < array.size(); i++) {
13657        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13658      }
13659    };
13660  }
13661
13662  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
13663    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
13664    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
13665    return res;
13666  }
13667
13668  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
13669    parseBackboneProperties(json, res);
13670    if (json.has("purpose"))
13671      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
13672    if (json.has("name"))
13673      res.setName(parseHumanName(json.getAsJsonObject("name")));
13674    if (json.has("telecom")) {
13675      JsonArray array = json.getAsJsonArray("telecom");
13676      for (int i = 0; i < array.size(); i++) {
13677        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13678      }
13679    };
13680    if (json.has("address"))
13681      res.setAddress(parseAddress(json.getAsJsonObject("address")));
13682  }
13683
13684  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
13685    Patient res = new Patient();
13686    parsePatientProperties(json, res);
13687    return res;
13688  }
13689
13690  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
13691    parseDomainResourceProperties(json, res);
13692    if (json.has("identifier")) {
13693      JsonArray array = json.getAsJsonArray("identifier");
13694      for (int i = 0; i < array.size(); i++) {
13695        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13696      }
13697    };
13698    if (json.has("active"))
13699      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13700    if (json.has("_active"))
13701      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13702    if (json.has("name")) {
13703      JsonArray array = json.getAsJsonArray("name");
13704      for (int i = 0; i < array.size(); i++) {
13705        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
13706      }
13707    };
13708    if (json.has("telecom")) {
13709      JsonArray array = json.getAsJsonArray("telecom");
13710      for (int i = 0; i < array.size(); i++) {
13711        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13712      }
13713    };
13714    if (json.has("gender"))
13715      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13716    if (json.has("_gender"))
13717      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
13718    if (json.has("birthDate"))
13719      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
13720    if (json.has("_birthDate"))
13721      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
13722    Type deceased = parseType("deceased", json);
13723    if (deceased != null)
13724      res.setDeceased(deceased);
13725    if (json.has("address")) {
13726      JsonArray array = json.getAsJsonArray("address");
13727      for (int i = 0; i < array.size(); i++) {
13728        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13729      }
13730    };
13731    if (json.has("maritalStatus"))
13732      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
13733    Type multipleBirth = parseType("multipleBirth", json);
13734    if (multipleBirth != null)
13735      res.setMultipleBirth(multipleBirth);
13736    if (json.has("photo")) {
13737      JsonArray array = json.getAsJsonArray("photo");
13738      for (int i = 0; i < array.size(); i++) {
13739        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
13740      }
13741    };
13742    if (json.has("contact")) {
13743      JsonArray array = json.getAsJsonArray("contact");
13744      for (int i = 0; i < array.size(); i++) {
13745        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
13746      }
13747    };
13748    if (json.has("animal"))
13749      res.setAnimal(parsePatientAnimalComponent(json.getAsJsonObject("animal"), res));
13750    if (json.has("communication")) {
13751      JsonArray array = json.getAsJsonArray("communication");
13752      for (int i = 0; i < array.size(); i++) {
13753        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
13754      }
13755    };
13756    if (json.has("generalPractitioner")) {
13757      JsonArray array = json.getAsJsonArray("generalPractitioner");
13758      for (int i = 0; i < array.size(); i++) {
13759        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
13760      }
13761    };
13762    if (json.has("managingOrganization"))
13763      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
13764    if (json.has("link")) {
13765      JsonArray array = json.getAsJsonArray("link");
13766      for (int i = 0; i < array.size(); i++) {
13767        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
13768      }
13769    };
13770  }
13771
13772  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13773    Patient.ContactComponent res = new Patient.ContactComponent();
13774    parsePatientContactComponentProperties(json, owner, res);
13775    return res;
13776  }
13777
13778  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
13779    parseBackboneProperties(json, res);
13780    if (json.has("relationship")) {
13781      JsonArray array = json.getAsJsonArray("relationship");
13782      for (int i = 0; i < array.size(); i++) {
13783        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13784      }
13785    };
13786    if (json.has("name"))
13787      res.setName(parseHumanName(json.getAsJsonObject("name")));
13788    if (json.has("telecom")) {
13789      JsonArray array = json.getAsJsonArray("telecom");
13790      for (int i = 0; i < array.size(); i++) {
13791        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13792      }
13793    };
13794    if (json.has("address"))
13795      res.setAddress(parseAddress(json.getAsJsonObject("address")));
13796    if (json.has("gender"))
13797      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13798    if (json.has("_gender"))
13799      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
13800    if (json.has("organization"))
13801      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13802    if (json.has("period"))
13803      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13804  }
13805
13806  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13807    Patient.AnimalComponent res = new Patient.AnimalComponent();
13808    parsePatientAnimalComponentProperties(json, owner, res);
13809    return res;
13810  }
13811
13812  protected void parsePatientAnimalComponentProperties(JsonObject json, Patient owner, Patient.AnimalComponent res) throws IOException, FHIRFormatError {
13813    parseBackboneProperties(json, res);
13814    if (json.has("species"))
13815      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
13816    if (json.has("breed"))
13817      res.setBreed(parseCodeableConcept(json.getAsJsonObject("breed")));
13818    if (json.has("genderStatus"))
13819      res.setGenderStatus(parseCodeableConcept(json.getAsJsonObject("genderStatus")));
13820  }
13821
13822  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13823    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
13824    parsePatientPatientCommunicationComponentProperties(json, owner, res);
13825    return res;
13826  }
13827
13828  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
13829    parseBackboneProperties(json, res);
13830    if (json.has("language"))
13831      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
13832    if (json.has("preferred"))
13833      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
13834    if (json.has("_preferred"))
13835      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
13836  }
13837
13838  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13839    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
13840    parsePatientPatientLinkComponentProperties(json, owner, res);
13841    return res;
13842  }
13843
13844  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
13845    parseBackboneProperties(json, res);
13846    if (json.has("other"))
13847      res.setOther(parseReference(json.getAsJsonObject("other")));
13848    if (json.has("type"))
13849      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
13850    if (json.has("_type"))
13851      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13852  }
13853
13854  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
13855    PaymentNotice res = new PaymentNotice();
13856    parsePaymentNoticeProperties(json, res);
13857    return res;
13858  }
13859
13860  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
13861    parseDomainResourceProperties(json, res);
13862    if (json.has("identifier")) {
13863      JsonArray array = json.getAsJsonArray("identifier");
13864      for (int i = 0; i < array.size(); i++) {
13865        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13866      }
13867    };
13868    if (json.has("status"))
13869      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
13870    if (json.has("_status"))
13871      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13872    if (json.has("request"))
13873      res.setRequest(parseReference(json.getAsJsonObject("request")));
13874    if (json.has("response"))
13875      res.setResponse(parseReference(json.getAsJsonObject("response")));
13876    if (json.has("statusDate"))
13877      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
13878    if (json.has("_statusDate"))
13879      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
13880    if (json.has("created"))
13881      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13882    if (json.has("_created"))
13883      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
13884    if (json.has("target"))
13885      res.setTarget(parseReference(json.getAsJsonObject("target")));
13886    if (json.has("provider"))
13887      res.setProvider(parseReference(json.getAsJsonObject("provider")));
13888    if (json.has("organization"))
13889      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13890    if (json.has("paymentStatus"))
13891      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
13892  }
13893
13894  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
13895    PaymentReconciliation res = new PaymentReconciliation();
13896    parsePaymentReconciliationProperties(json, res);
13897    return res;
13898  }
13899
13900  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
13901    parseDomainResourceProperties(json, res);
13902    if (json.has("identifier")) {
13903      JsonArray array = json.getAsJsonArray("identifier");
13904      for (int i = 0; i < array.size(); i++) {
13905        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13906      }
13907    };
13908    if (json.has("status"))
13909      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
13910    if (json.has("_status"))
13911      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13912    if (json.has("period"))
13913      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13914    if (json.has("created"))
13915      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13916    if (json.has("_created"))
13917      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
13918    if (json.has("organization"))
13919      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13920    if (json.has("request"))
13921      res.setRequest(parseReference(json.getAsJsonObject("request")));
13922    if (json.has("outcome"))
13923      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
13924    if (json.has("disposition"))
13925      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
13926    if (json.has("_disposition"))
13927      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
13928    if (json.has("requestProvider"))
13929      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
13930    if (json.has("requestOrganization"))
13931      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
13932    if (json.has("detail")) {
13933      JsonArray array = json.getAsJsonArray("detail");
13934      for (int i = 0; i < array.size(); i++) {
13935        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
13936      }
13937    };
13938    if (json.has("form"))
13939      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
13940    if (json.has("total"))
13941      res.setTotal(parseMoney(json.getAsJsonObject("total")));
13942    if (json.has("processNote")) {
13943      JsonArray array = json.getAsJsonArray("processNote");
13944      for (int i = 0; i < array.size(); i++) {
13945        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
13946      }
13947    };
13948  }
13949
13950  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
13951    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
13952    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
13953    return res;
13954  }
13955
13956  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
13957    parseBackboneProperties(json, res);
13958    if (json.has("type"))
13959      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13960    if (json.has("request"))
13961      res.setRequest(parseReference(json.getAsJsonObject("request")));
13962    if (json.has("response"))
13963      res.setResponse(parseReference(json.getAsJsonObject("response")));
13964    if (json.has("submitter"))
13965      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
13966    if (json.has("payee"))
13967      res.setPayee(parseReference(json.getAsJsonObject("payee")));
13968    if (json.has("date"))
13969      res.setDateElement(parseDate(json.get("date").getAsString()));
13970    if (json.has("_date"))
13971      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13972    if (json.has("amount"))
13973      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13974  }
13975
13976  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
13977    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
13978    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
13979    return res;
13980  }
13981
13982  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
13983    parseBackboneProperties(json, res);
13984    if (json.has("type"))
13985      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13986    if (json.has("text"))
13987      res.setTextElement(parseString(json.get("text").getAsString()));
13988    if (json.has("_text"))
13989      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13990  }
13991
13992  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
13993    Person res = new Person();
13994    parsePersonProperties(json, res);
13995    return res;
13996  }
13997
13998  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
13999    parseDomainResourceProperties(json, res);
14000    if (json.has("identifier")) {
14001      JsonArray array = json.getAsJsonArray("identifier");
14002      for (int i = 0; i < array.size(); i++) {
14003        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14004      }
14005    };
14006    if (json.has("name")) {
14007      JsonArray array = json.getAsJsonArray("name");
14008      for (int i = 0; i < array.size(); i++) {
14009        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14010      }
14011    };
14012    if (json.has("telecom")) {
14013      JsonArray array = json.getAsJsonArray("telecom");
14014      for (int i = 0; i < array.size(); i++) {
14015        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14016      }
14017    };
14018    if (json.has("gender"))
14019      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14020    if (json.has("_gender"))
14021      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
14022    if (json.has("birthDate"))
14023      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14024    if (json.has("_birthDate"))
14025      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
14026    if (json.has("address")) {
14027      JsonArray array = json.getAsJsonArray("address");
14028      for (int i = 0; i < array.size(); i++) {
14029        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14030      }
14031    };
14032    if (json.has("photo"))
14033      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
14034    if (json.has("managingOrganization"))
14035      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
14036    if (json.has("active"))
14037      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14038    if (json.has("_active"))
14039      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14040    if (json.has("link")) {
14041      JsonArray array = json.getAsJsonArray("link");
14042      for (int i = 0; i < array.size(); i++) {
14043        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
14044      }
14045    };
14046  }
14047
14048  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
14049    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
14050    parsePersonPersonLinkComponentProperties(json, owner, res);
14051    return res;
14052  }
14053
14054  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
14055    parseBackboneProperties(json, res);
14056    if (json.has("target"))
14057      res.setTarget(parseReference(json.getAsJsonObject("target")));
14058    if (json.has("assurance"))
14059      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
14060    if (json.has("_assurance"))
14061      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
14062  }
14063
14064  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
14065    PlanDefinition res = new PlanDefinition();
14066    parsePlanDefinitionProperties(json, res);
14067    return res;
14068  }
14069
14070  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
14071    parseDomainResourceProperties(json, res);
14072    if (json.has("url"))
14073      res.setUrlElement(parseUri(json.get("url").getAsString()));
14074    if (json.has("_url"))
14075      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14076    if (json.has("identifier")) {
14077      JsonArray array = json.getAsJsonArray("identifier");
14078      for (int i = 0; i < array.size(); i++) {
14079        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14080      }
14081    };
14082    if (json.has("version"))
14083      res.setVersionElement(parseString(json.get("version").getAsString()));
14084    if (json.has("_version"))
14085      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14086    if (json.has("name"))
14087      res.setNameElement(parseString(json.get("name").getAsString()));
14088    if (json.has("_name"))
14089      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14090    if (json.has("title"))
14091      res.setTitleElement(parseString(json.get("title").getAsString()));
14092    if (json.has("_title"))
14093      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14094    if (json.has("type"))
14095      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14096    if (json.has("status"))
14097      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14098    if (json.has("_status"))
14099      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14100    if (json.has("experimental"))
14101      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14102    if (json.has("_experimental"))
14103      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14104    if (json.has("date"))
14105      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14106    if (json.has("_date"))
14107      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14108    if (json.has("publisher"))
14109      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14110    if (json.has("_publisher"))
14111      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14112    if (json.has("description"))
14113      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14114    if (json.has("_description"))
14115      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14116    if (json.has("purpose"))
14117      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14118    if (json.has("_purpose"))
14119      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14120    if (json.has("usage"))
14121      res.setUsageElement(parseString(json.get("usage").getAsString()));
14122    if (json.has("_usage"))
14123      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14124    if (json.has("approvalDate"))
14125      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14126    if (json.has("_approvalDate"))
14127      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14128    if (json.has("lastReviewDate"))
14129      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14130    if (json.has("_lastReviewDate"))
14131      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14132    if (json.has("effectivePeriod"))
14133      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14134    if (json.has("useContext")) {
14135      JsonArray array = json.getAsJsonArray("useContext");
14136      for (int i = 0; i < array.size(); i++) {
14137        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14138      }
14139    };
14140    if (json.has("jurisdiction")) {
14141      JsonArray array = json.getAsJsonArray("jurisdiction");
14142      for (int i = 0; i < array.size(); i++) {
14143        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14144      }
14145    };
14146    if (json.has("topic")) {
14147      JsonArray array = json.getAsJsonArray("topic");
14148      for (int i = 0; i < array.size(); i++) {
14149        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14150      }
14151    };
14152    if (json.has("contributor")) {
14153      JsonArray array = json.getAsJsonArray("contributor");
14154      for (int i = 0; i < array.size(); i++) {
14155        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
14156      }
14157    };
14158    if (json.has("contact")) {
14159      JsonArray array = json.getAsJsonArray("contact");
14160      for (int i = 0; i < array.size(); i++) {
14161        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14162      }
14163    };
14164    if (json.has("copyright"))
14165      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14166    if (json.has("_copyright"))
14167      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14168    if (json.has("relatedArtifact")) {
14169      JsonArray array = json.getAsJsonArray("relatedArtifact");
14170      for (int i = 0; i < array.size(); i++) {
14171        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14172      }
14173    };
14174    if (json.has("library")) {
14175      JsonArray array = json.getAsJsonArray("library");
14176      for (int i = 0; i < array.size(); i++) {
14177        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
14178      }
14179    };
14180    if (json.has("goal")) {
14181      JsonArray array = json.getAsJsonArray("goal");
14182      for (int i = 0; i < array.size(); i++) {
14183        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
14184      }
14185    };
14186    if (json.has("action")) {
14187      JsonArray array = json.getAsJsonArray("action");
14188      for (int i = 0; i < array.size(); i++) {
14189        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
14190      }
14191    };
14192  }
14193
14194  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14195    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
14196    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
14197    return res;
14198  }
14199
14200  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
14201    parseBackboneProperties(json, res);
14202    if (json.has("category"))
14203      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14204    if (json.has("description"))
14205      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
14206    if (json.has("priority"))
14207      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
14208    if (json.has("start"))
14209      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
14210    if (json.has("addresses")) {
14211      JsonArray array = json.getAsJsonArray("addresses");
14212      for (int i = 0; i < array.size(); i++) {
14213        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14214      }
14215    };
14216    if (json.has("documentation")) {
14217      JsonArray array = json.getAsJsonArray("documentation");
14218      for (int i = 0; i < array.size(); i++) {
14219        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14220      }
14221    };
14222    if (json.has("target")) {
14223      JsonArray array = json.getAsJsonArray("target");
14224      for (int i = 0; i < array.size(); i++) {
14225        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
14226      }
14227    };
14228  }
14229
14230  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14231    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
14232    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
14233    return res;
14234  }
14235
14236  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
14237    parseBackboneProperties(json, res);
14238    if (json.has("measure"))
14239      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
14240    Type detail = parseType("detail", json);
14241    if (detail != null)
14242      res.setDetail(detail);
14243    if (json.has("due"))
14244      res.setDue(parseDuration(json.getAsJsonObject("due")));
14245  }
14246
14247  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14248    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
14249    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
14250    return res;
14251  }
14252
14253  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
14254    parseBackboneProperties(json, res);
14255    if (json.has("label"))
14256      res.setLabelElement(parseString(json.get("label").getAsString()));
14257    if (json.has("_label"))
14258      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
14259    if (json.has("title"))
14260      res.setTitleElement(parseString(json.get("title").getAsString()));
14261    if (json.has("_title"))
14262      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14263    if (json.has("description"))
14264      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14265    if (json.has("_description"))
14266      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14267    if (json.has("textEquivalent"))
14268      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
14269    if (json.has("_textEquivalent"))
14270      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
14271    if (json.has("code")) {
14272      JsonArray array = json.getAsJsonArray("code");
14273      for (int i = 0; i < array.size(); i++) {
14274        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14275      }
14276    };
14277    if (json.has("reason")) {
14278      JsonArray array = json.getAsJsonArray("reason");
14279      for (int i = 0; i < array.size(); i++) {
14280        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14281      }
14282    };
14283    if (json.has("documentation")) {
14284      JsonArray array = json.getAsJsonArray("documentation");
14285      for (int i = 0; i < array.size(); i++) {
14286        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14287      }
14288    };
14289    if (json.has("goalId")) {
14290      JsonArray array = json.getAsJsonArray("goalId");
14291      for (int i = 0; i < array.size(); i++) {
14292        res.getGoalId().add(parseId(array.get(i).getAsString()));
14293      }
14294    };
14295    if (json.has("_goalId")) {
14296      JsonArray array = json.getAsJsonArray("_goalId");
14297      for (int i = 0; i < array.size(); i++) {
14298        if (i == res.getGoalId().size())
14299          res.getGoalId().add(parseId(null));
14300        if (array.get(i) instanceof JsonObject) 
14301          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
14302      }
14303    };
14304    if (json.has("triggerDefinition")) {
14305      JsonArray array = json.getAsJsonArray("triggerDefinition");
14306      for (int i = 0; i < array.size(); i++) {
14307        res.getTriggerDefinition().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
14308      }
14309    };
14310    if (json.has("condition")) {
14311      JsonArray array = json.getAsJsonArray("condition");
14312      for (int i = 0; i < array.size(); i++) {
14313        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
14314      }
14315    };
14316    if (json.has("input")) {
14317      JsonArray array = json.getAsJsonArray("input");
14318      for (int i = 0; i < array.size(); i++) {
14319        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14320      }
14321    };
14322    if (json.has("output")) {
14323      JsonArray array = json.getAsJsonArray("output");
14324      for (int i = 0; i < array.size(); i++) {
14325        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14326      }
14327    };
14328    if (json.has("relatedAction")) {
14329      JsonArray array = json.getAsJsonArray("relatedAction");
14330      for (int i = 0; i < array.size(); i++) {
14331        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
14332      }
14333    };
14334    Type timing = parseType("timing", json);
14335    if (timing != null)
14336      res.setTiming(timing);
14337    if (json.has("participant")) {
14338      JsonArray array = json.getAsJsonArray("participant");
14339      for (int i = 0; i < array.size(); i++) {
14340        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
14341      }
14342    };
14343    if (json.has("type"))
14344      res.setType(parseCoding(json.getAsJsonObject("type")));
14345    if (json.has("groupingBehavior"))
14346      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
14347    if (json.has("_groupingBehavior"))
14348      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
14349    if (json.has("selectionBehavior"))
14350      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
14351    if (json.has("_selectionBehavior"))
14352      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
14353    if (json.has("requiredBehavior"))
14354      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
14355    if (json.has("_requiredBehavior"))
14356      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
14357    if (json.has("precheckBehavior"))
14358      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
14359    if (json.has("_precheckBehavior"))
14360      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
14361    if (json.has("cardinalityBehavior"))
14362      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
14363    if (json.has("_cardinalityBehavior"))
14364      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
14365    if (json.has("definition"))
14366      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
14367    if (json.has("transform"))
14368      res.setTransform(parseReference(json.getAsJsonObject("transform")));
14369    if (json.has("dynamicValue")) {
14370      JsonArray array = json.getAsJsonArray("dynamicValue");
14371      for (int i = 0; i < array.size(); i++) {
14372        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
14373      }
14374    };
14375    if (json.has("action")) {
14376      JsonArray array = json.getAsJsonArray("action");
14377      for (int i = 0; i < array.size(); i++) {
14378        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
14379      }
14380    };
14381  }
14382
14383  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14384    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
14385    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
14386    return res;
14387  }
14388
14389  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
14390    parseBackboneProperties(json, res);
14391    if (json.has("kind"))
14392      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
14393    if (json.has("_kind"))
14394      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
14395    if (json.has("description"))
14396      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14397    if (json.has("_description"))
14398      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14399    if (json.has("language"))
14400      res.setLanguageElement(parseString(json.get("language").getAsString()));
14401    if (json.has("_language"))
14402      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
14403    if (json.has("expression"))
14404      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14405    if (json.has("_expression"))
14406      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
14407  }
14408
14409  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14410    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
14411    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
14412    return res;
14413  }
14414
14415  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
14416    parseBackboneProperties(json, res);
14417    if (json.has("actionId"))
14418      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
14419    if (json.has("_actionId"))
14420      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
14421    if (json.has("relationship"))
14422      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
14423    if (json.has("_relationship"))
14424      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
14425    Type offset = parseType("offset", json);
14426    if (offset != null)
14427      res.setOffset(offset);
14428  }
14429
14430  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14431    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
14432    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
14433    return res;
14434  }
14435
14436  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
14437    parseBackboneProperties(json, res);
14438    if (json.has("type"))
14439      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
14440    if (json.has("_type"))
14441      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14442    if (json.has("role"))
14443      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14444  }
14445
14446  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14447    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
14448    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
14449    return res;
14450  }
14451
14452  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
14453    parseBackboneProperties(json, res);
14454    if (json.has("description"))
14455      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14456    if (json.has("_description"))
14457      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14458    if (json.has("path"))
14459      res.setPathElement(parseString(json.get("path").getAsString()));
14460    if (json.has("_path"))
14461      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
14462    if (json.has("language"))
14463      res.setLanguageElement(parseString(json.get("language").getAsString()));
14464    if (json.has("_language"))
14465      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
14466    if (json.has("expression"))
14467      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14468    if (json.has("_expression"))
14469      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
14470  }
14471
14472  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
14473    Practitioner res = new Practitioner();
14474    parsePractitionerProperties(json, res);
14475    return res;
14476  }
14477
14478  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
14479    parseDomainResourceProperties(json, res);
14480    if (json.has("identifier")) {
14481      JsonArray array = json.getAsJsonArray("identifier");
14482      for (int i = 0; i < array.size(); i++) {
14483        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14484      }
14485    };
14486    if (json.has("active"))
14487      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14488    if (json.has("_active"))
14489      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14490    if (json.has("name")) {
14491      JsonArray array = json.getAsJsonArray("name");
14492      for (int i = 0; i < array.size(); i++) {
14493        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14494      }
14495    };
14496    if (json.has("telecom")) {
14497      JsonArray array = json.getAsJsonArray("telecom");
14498      for (int i = 0; i < array.size(); i++) {
14499        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14500      }
14501    };
14502    if (json.has("address")) {
14503      JsonArray array = json.getAsJsonArray("address");
14504      for (int i = 0; i < array.size(); i++) {
14505        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14506      }
14507    };
14508    if (json.has("gender"))
14509      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14510    if (json.has("_gender"))
14511      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
14512    if (json.has("birthDate"))
14513      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14514    if (json.has("_birthDate"))
14515      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
14516    if (json.has("photo")) {
14517      JsonArray array = json.getAsJsonArray("photo");
14518      for (int i = 0; i < array.size(); i++) {
14519        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
14520      }
14521    };
14522    if (json.has("qualification")) {
14523      JsonArray array = json.getAsJsonArray("qualification");
14524      for (int i = 0; i < array.size(); i++) {
14525        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
14526      }
14527    };
14528    if (json.has("communication")) {
14529      JsonArray array = json.getAsJsonArray("communication");
14530      for (int i = 0; i < array.size(); i++) {
14531        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14532      }
14533    };
14534  }
14535
14536  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
14537    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
14538    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
14539    return res;
14540  }
14541
14542  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
14543    parseBackboneProperties(json, res);
14544    if (json.has("identifier")) {
14545      JsonArray array = json.getAsJsonArray("identifier");
14546      for (int i = 0; i < array.size(); i++) {
14547        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14548      }
14549    };
14550    if (json.has("code"))
14551      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14552    if (json.has("period"))
14553      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14554    if (json.has("issuer"))
14555      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
14556  }
14557
14558  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
14559    PractitionerRole res = new PractitionerRole();
14560    parsePractitionerRoleProperties(json, res);
14561    return res;
14562  }
14563
14564  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
14565    parseDomainResourceProperties(json, res);
14566    if (json.has("identifier")) {
14567      JsonArray array = json.getAsJsonArray("identifier");
14568      for (int i = 0; i < array.size(); i++) {
14569        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14570      }
14571    };
14572    if (json.has("active"))
14573      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14574    if (json.has("_active"))
14575      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14576    if (json.has("period"))
14577      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14578    if (json.has("practitioner"))
14579      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
14580    if (json.has("organization"))
14581      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
14582    if (json.has("code")) {
14583      JsonArray array = json.getAsJsonArray("code");
14584      for (int i = 0; i < array.size(); i++) {
14585        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14586      }
14587    };
14588    if (json.has("specialty")) {
14589      JsonArray array = json.getAsJsonArray("specialty");
14590      for (int i = 0; i < array.size(); i++) {
14591        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14592      }
14593    };
14594    if (json.has("location")) {
14595      JsonArray array = json.getAsJsonArray("location");
14596      for (int i = 0; i < array.size(); i++) {
14597        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14598      }
14599    };
14600    if (json.has("healthcareService")) {
14601      JsonArray array = json.getAsJsonArray("healthcareService");
14602      for (int i = 0; i < array.size(); i++) {
14603        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
14604      }
14605    };
14606    if (json.has("telecom")) {
14607      JsonArray array = json.getAsJsonArray("telecom");
14608      for (int i = 0; i < array.size(); i++) {
14609        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14610      }
14611    };
14612    if (json.has("availableTime")) {
14613      JsonArray array = json.getAsJsonArray("availableTime");
14614      for (int i = 0; i < array.size(); i++) {
14615        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
14616      }
14617    };
14618    if (json.has("notAvailable")) {
14619      JsonArray array = json.getAsJsonArray("notAvailable");
14620      for (int i = 0; i < array.size(); i++) {
14621        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
14622      }
14623    };
14624    if (json.has("availabilityExceptions"))
14625      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14626    if (json.has("_availabilityExceptions"))
14627      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14628    if (json.has("endpoint")) {
14629      JsonArray array = json.getAsJsonArray("endpoint");
14630      for (int i = 0; i < array.size(); i++) {
14631        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14632      }
14633    };
14634  }
14635
14636  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14637    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
14638    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
14639    return res;
14640  }
14641
14642  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
14643    parseBackboneProperties(json, res);
14644    if (json.has("daysOfWeek")) {
14645      JsonArray array = json.getAsJsonArray("daysOfWeek");
14646      for (int i = 0; i < array.size(); i++) {
14647        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14648      }
14649    };
14650    if (json.has("_daysOfWeek")) {
14651      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14652      for (int i = 0; i < array.size(); i++) {
14653        if (i == res.getDaysOfWeek().size())
14654          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14655        if (array.get(i) instanceof JsonObject) 
14656          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14657      }
14658    };
14659    if (json.has("allDay"))
14660      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14661    if (json.has("_allDay"))
14662      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
14663    if (json.has("availableStartTime"))
14664      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14665    if (json.has("_availableStartTime"))
14666      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
14667    if (json.has("availableEndTime"))
14668      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14669    if (json.has("_availableEndTime"))
14670      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
14671  }
14672
14673  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14674    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
14675    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
14676    return res;
14677  }
14678
14679  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
14680    parseBackboneProperties(json, res);
14681    if (json.has("description"))
14682      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14683    if (json.has("_description"))
14684      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14685    if (json.has("during"))
14686      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
14687  }
14688
14689  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
14690    Procedure res = new Procedure();
14691    parseProcedureProperties(json, res);
14692    return res;
14693  }
14694
14695  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
14696    parseDomainResourceProperties(json, res);
14697    if (json.has("identifier")) {
14698      JsonArray array = json.getAsJsonArray("identifier");
14699      for (int i = 0; i < array.size(); i++) {
14700        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14701      }
14702    };
14703    if (json.has("definition")) {
14704      JsonArray array = json.getAsJsonArray("definition");
14705      for (int i = 0; i < array.size(); i++) {
14706        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
14707      }
14708    };
14709    if (json.has("basedOn")) {
14710      JsonArray array = json.getAsJsonArray("basedOn");
14711      for (int i = 0; i < array.size(); i++) {
14712        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14713      }
14714    };
14715    if (json.has("partOf")) {
14716      JsonArray array = json.getAsJsonArray("partOf");
14717      for (int i = 0; i < array.size(); i++) {
14718        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
14719      }
14720    };
14721    if (json.has("status"))
14722      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
14723    if (json.has("_status"))
14724      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14725    if (json.has("notDone"))
14726      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
14727    if (json.has("_notDone"))
14728      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
14729    if (json.has("notDoneReason"))
14730      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
14731    if (json.has("category"))
14732      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14733    if (json.has("code"))
14734      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14735    if (json.has("subject"))
14736      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14737    if (json.has("context"))
14738      res.setContext(parseReference(json.getAsJsonObject("context")));
14739    Type performed = parseType("performed", json);
14740    if (performed != null)
14741      res.setPerformed(performed);
14742    if (json.has("performer")) {
14743      JsonArray array = json.getAsJsonArray("performer");
14744      for (int i = 0; i < array.size(); i++) {
14745        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
14746      }
14747    };
14748    if (json.has("location"))
14749      res.setLocation(parseReference(json.getAsJsonObject("location")));
14750    if (json.has("reasonCode")) {
14751      JsonArray array = json.getAsJsonArray("reasonCode");
14752      for (int i = 0; i < array.size(); i++) {
14753        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14754      }
14755    };
14756    if (json.has("reasonReference")) {
14757      JsonArray array = json.getAsJsonArray("reasonReference");
14758      for (int i = 0; i < array.size(); i++) {
14759        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14760      }
14761    };
14762    if (json.has("bodySite")) {
14763      JsonArray array = json.getAsJsonArray("bodySite");
14764      for (int i = 0; i < array.size(); i++) {
14765        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14766      }
14767    };
14768    if (json.has("outcome"))
14769      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
14770    if (json.has("report")) {
14771      JsonArray array = json.getAsJsonArray("report");
14772      for (int i = 0; i < array.size(); i++) {
14773        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
14774      }
14775    };
14776    if (json.has("complication")) {
14777      JsonArray array = json.getAsJsonArray("complication");
14778      for (int i = 0; i < array.size(); i++) {
14779        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14780      }
14781    };
14782    if (json.has("complicationDetail")) {
14783      JsonArray array = json.getAsJsonArray("complicationDetail");
14784      for (int i = 0; i < array.size(); i++) {
14785        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
14786      }
14787    };
14788    if (json.has("followUp")) {
14789      JsonArray array = json.getAsJsonArray("followUp");
14790      for (int i = 0; i < array.size(); i++) {
14791        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14792      }
14793    };
14794    if (json.has("note")) {
14795      JsonArray array = json.getAsJsonArray("note");
14796      for (int i = 0; i < array.size(); i++) {
14797        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14798      }
14799    };
14800    if (json.has("focalDevice")) {
14801      JsonArray array = json.getAsJsonArray("focalDevice");
14802      for (int i = 0; i < array.size(); i++) {
14803        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
14804      }
14805    };
14806    if (json.has("usedReference")) {
14807      JsonArray array = json.getAsJsonArray("usedReference");
14808      for (int i = 0; i < array.size(); i++) {
14809        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
14810      }
14811    };
14812    if (json.has("usedCode")) {
14813      JsonArray array = json.getAsJsonArray("usedCode");
14814      for (int i = 0; i < array.size(); i++) {
14815        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14816      }
14817    };
14818  }
14819
14820  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
14821    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
14822    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
14823    return res;
14824  }
14825
14826  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
14827    parseBackboneProperties(json, res);
14828    if (json.has("role"))
14829      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14830    if (json.has("actor"))
14831      res.setActor(parseReference(json.getAsJsonObject("actor")));
14832    if (json.has("onBehalfOf"))
14833      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
14834  }
14835
14836  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
14837    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
14838    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
14839    return res;
14840  }
14841
14842  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
14843    parseBackboneProperties(json, res);
14844    if (json.has("action"))
14845      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
14846    if (json.has("manipulated"))
14847      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
14848  }
14849
14850  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
14851    ProcedureRequest res = new ProcedureRequest();
14852    parseProcedureRequestProperties(json, res);
14853    return res;
14854  }
14855
14856  protected void parseProcedureRequestProperties(JsonObject json, ProcedureRequest res) throws IOException, FHIRFormatError {
14857    parseDomainResourceProperties(json, res);
14858    if (json.has("identifier")) {
14859      JsonArray array = json.getAsJsonArray("identifier");
14860      for (int i = 0; i < array.size(); i++) {
14861        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14862      }
14863    };
14864    if (json.has("definition")) {
14865      JsonArray array = json.getAsJsonArray("definition");
14866      for (int i = 0; i < array.size(); i++) {
14867        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
14868      }
14869    };
14870    if (json.has("basedOn")) {
14871      JsonArray array = json.getAsJsonArray("basedOn");
14872      for (int i = 0; i < array.size(); i++) {
14873        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14874      }
14875    };
14876    if (json.has("replaces")) {
14877      JsonArray array = json.getAsJsonArray("replaces");
14878      for (int i = 0; i < array.size(); i++) {
14879        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
14880      }
14881    };
14882    if (json.has("requisition"))
14883      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
14884    if (json.has("status"))
14885      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
14886    if (json.has("_status"))
14887      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14888    if (json.has("intent"))
14889      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ProcedureRequest.ProcedureRequestIntent.NULL, new ProcedureRequest.ProcedureRequestIntentEnumFactory()));
14890    if (json.has("_intent"))
14891      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
14892    if (json.has("priority"))
14893      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
14894    if (json.has("_priority"))
14895      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
14896    if (json.has("doNotPerform"))
14897      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
14898    if (json.has("_doNotPerform"))
14899      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
14900    if (json.has("category")) {
14901      JsonArray array = json.getAsJsonArray("category");
14902      for (int i = 0; i < array.size(); i++) {
14903        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14904      }
14905    };
14906    if (json.has("code"))
14907      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14908    if (json.has("subject"))
14909      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14910    if (json.has("context"))
14911      res.setContext(parseReference(json.getAsJsonObject("context")));
14912    Type occurrence = parseType("occurrence", json);
14913    if (occurrence != null)
14914      res.setOccurrence(occurrence);
14915    Type asNeeded = parseType("asNeeded", json);
14916    if (asNeeded != null)
14917      res.setAsNeeded(asNeeded);
14918    if (json.has("authoredOn"))
14919      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
14920    if (json.has("_authoredOn"))
14921      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
14922    if (json.has("requester"))
14923      res.setRequester(parseProcedureRequestProcedureRequestRequesterComponent(json.getAsJsonObject("requester"), res));
14924    if (json.has("performerType"))
14925      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
14926    if (json.has("performer"))
14927      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
14928    if (json.has("reasonCode")) {
14929      JsonArray array = json.getAsJsonArray("reasonCode");
14930      for (int i = 0; i < array.size(); i++) {
14931        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14932      }
14933    };
14934    if (json.has("reasonReference")) {
14935      JsonArray array = json.getAsJsonArray("reasonReference");
14936      for (int i = 0; i < array.size(); i++) {
14937        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14938      }
14939    };
14940    if (json.has("supportingInfo")) {
14941      JsonArray array = json.getAsJsonArray("supportingInfo");
14942      for (int i = 0; i < array.size(); i++) {
14943        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
14944      }
14945    };
14946    if (json.has("specimen")) {
14947      JsonArray array = json.getAsJsonArray("specimen");
14948      for (int i = 0; i < array.size(); i++) {
14949        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
14950      }
14951    };
14952    if (json.has("bodySite")) {
14953      JsonArray array = json.getAsJsonArray("bodySite");
14954      for (int i = 0; i < array.size(); i++) {
14955        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14956      }
14957    };
14958    if (json.has("note")) {
14959      JsonArray array = json.getAsJsonArray("note");
14960      for (int i = 0; i < array.size(); i++) {
14961        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14962      }
14963    };
14964    if (json.has("relevantHistory")) {
14965      JsonArray array = json.getAsJsonArray("relevantHistory");
14966      for (int i = 0; i < array.size(); i++) {
14967        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
14968      }
14969    };
14970  }
14971
14972  protected ProcedureRequest.ProcedureRequestRequesterComponent parseProcedureRequestProcedureRequestRequesterComponent(JsonObject json, ProcedureRequest owner) throws IOException, FHIRFormatError {
14973    ProcedureRequest.ProcedureRequestRequesterComponent res = new ProcedureRequest.ProcedureRequestRequesterComponent();
14974    parseProcedureRequestProcedureRequestRequesterComponentProperties(json, owner, res);
14975    return res;
14976  }
14977
14978  protected void parseProcedureRequestProcedureRequestRequesterComponentProperties(JsonObject json, ProcedureRequest owner, ProcedureRequest.ProcedureRequestRequesterComponent res) throws IOException, FHIRFormatError {
14979    parseBackboneProperties(json, res);
14980    if (json.has("agent"))
14981      res.setAgent(parseReference(json.getAsJsonObject("agent")));
14982    if (json.has("onBehalfOf"))
14983      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
14984  }
14985
14986  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
14987    ProcessRequest res = new ProcessRequest();
14988    parseProcessRequestProperties(json, res);
14989    return res;
14990  }
14991
14992  protected void parseProcessRequestProperties(JsonObject json, ProcessRequest res) throws IOException, FHIRFormatError {
14993    parseDomainResourceProperties(json, res);
14994    if (json.has("identifier")) {
14995      JsonArray array = json.getAsJsonArray("identifier");
14996      for (int i = 0; i < array.size(); i++) {
14997        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14998      }
14999    };
15000    if (json.has("status"))
15001      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
15002    if (json.has("_status"))
15003      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15004    if (json.has("action"))
15005      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
15006    if (json.has("_action"))
15007      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
15008    if (json.has("target"))
15009      res.setTarget(parseReference(json.getAsJsonObject("target")));
15010    if (json.has("created"))
15011      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15012    if (json.has("_created"))
15013      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
15014    if (json.has("provider"))
15015      res.setProvider(parseReference(json.getAsJsonObject("provider")));
15016    if (json.has("organization"))
15017      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
15018    if (json.has("request"))
15019      res.setRequest(parseReference(json.getAsJsonObject("request")));
15020    if (json.has("response"))
15021      res.setResponse(parseReference(json.getAsJsonObject("response")));
15022    if (json.has("nullify"))
15023      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
15024    if (json.has("_nullify"))
15025      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
15026    if (json.has("reference"))
15027      res.setReferenceElement(parseString(json.get("reference").getAsString()));
15028    if (json.has("_reference"))
15029      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
15030    if (json.has("item")) {
15031      JsonArray array = json.getAsJsonArray("item");
15032      for (int i = 0; i < array.size(); i++) {
15033        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
15034      }
15035    };
15036    if (json.has("include")) {
15037      JsonArray array = json.getAsJsonArray("include");
15038      for (int i = 0; i < array.size(); i++) {
15039        res.getInclude().add(parseString(array.get(i).getAsString()));
15040      }
15041    };
15042    if (json.has("_include")) {
15043      JsonArray array = json.getAsJsonArray("_include");
15044      for (int i = 0; i < array.size(); i++) {
15045        if (i == res.getInclude().size())
15046          res.getInclude().add(parseString(null));
15047        if (array.get(i) instanceof JsonObject) 
15048          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
15049      }
15050    };
15051    if (json.has("exclude")) {
15052      JsonArray array = json.getAsJsonArray("exclude");
15053      for (int i = 0; i < array.size(); i++) {
15054        res.getExclude().add(parseString(array.get(i).getAsString()));
15055      }
15056    };
15057    if (json.has("_exclude")) {
15058      JsonArray array = json.getAsJsonArray("_exclude");
15059      for (int i = 0; i < array.size(); i++) {
15060        if (i == res.getExclude().size())
15061          res.getExclude().add(parseString(null));
15062        if (array.get(i) instanceof JsonObject) 
15063          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
15064      }
15065    };
15066    if (json.has("period"))
15067      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15068  }
15069
15070  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
15071    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
15072    parseProcessRequestItemsComponentProperties(json, owner, res);
15073    return res;
15074  }
15075
15076  protected void parseProcessRequestItemsComponentProperties(JsonObject json, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws IOException, FHIRFormatError {
15077    parseBackboneProperties(json, res);
15078    if (json.has("sequenceLinkId"))
15079      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
15080    if (json.has("_sequenceLinkId"))
15081      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
15082  }
15083
15084  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
15085    ProcessResponse res = new ProcessResponse();
15086    parseProcessResponseProperties(json, res);
15087    return res;
15088  }
15089
15090  protected void parseProcessResponseProperties(JsonObject json, ProcessResponse res) throws IOException, FHIRFormatError {
15091    parseDomainResourceProperties(json, res);
15092    if (json.has("identifier")) {
15093      JsonArray array = json.getAsJsonArray("identifier");
15094      for (int i = 0; i < array.size(); i++) {
15095        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15096      }
15097    };
15098    if (json.has("status"))
15099      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
15100    if (json.has("_status"))
15101      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15102    if (json.has("created"))
15103      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15104    if (json.has("_created"))
15105      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
15106    if (json.has("organization"))
15107      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
15108    if (json.has("request"))
15109      res.setRequest(parseReference(json.getAsJsonObject("request")));
15110    if (json.has("outcome"))
15111      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
15112    if (json.has("disposition"))
15113      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
15114    if (json.has("_disposition"))
15115      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
15116    if (json.has("requestProvider"))
15117      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
15118    if (json.has("requestOrganization"))
15119      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
15120    if (json.has("form"))
15121      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
15122    if (json.has("processNote")) {
15123      JsonArray array = json.getAsJsonArray("processNote");
15124      for (int i = 0; i < array.size(); i++) {
15125        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(array.get(i).getAsJsonObject(), res));
15126      }
15127    };
15128    if (json.has("error")) {
15129      JsonArray array = json.getAsJsonArray("error");
15130      for (int i = 0; i < array.size(); i++) {
15131        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15132      }
15133    };
15134    if (json.has("communicationRequest")) {
15135      JsonArray array = json.getAsJsonArray("communicationRequest");
15136      for (int i = 0; i < array.size(); i++) {
15137        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
15138      }
15139    };
15140  }
15141
15142  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
15143    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
15144    parseProcessResponseProcessResponseProcessNoteComponentProperties(json, owner, res);
15145    return res;
15146  }
15147
15148  protected void parseProcessResponseProcessResponseProcessNoteComponentProperties(JsonObject json, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws IOException, FHIRFormatError {
15149    parseBackboneProperties(json, res);
15150    if (json.has("type"))
15151      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15152    if (json.has("text"))
15153      res.setTextElement(parseString(json.get("text").getAsString()));
15154    if (json.has("_text"))
15155      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15156  }
15157
15158  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
15159    Provenance res = new Provenance();
15160    parseProvenanceProperties(json, res);
15161    return res;
15162  }
15163
15164  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
15165    parseDomainResourceProperties(json, res);
15166    if (json.has("target")) {
15167      JsonArray array = json.getAsJsonArray("target");
15168      for (int i = 0; i < array.size(); i++) {
15169        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
15170      }
15171    };
15172    if (json.has("period"))
15173      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15174    if (json.has("recorded"))
15175      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
15176    if (json.has("_recorded"))
15177      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
15178    if (json.has("policy")) {
15179      JsonArray array = json.getAsJsonArray("policy");
15180      for (int i = 0; i < array.size(); i++) {
15181        res.getPolicy().add(parseUri(array.get(i).getAsString()));
15182      }
15183    };
15184    if (json.has("_policy")) {
15185      JsonArray array = json.getAsJsonArray("_policy");
15186      for (int i = 0; i < array.size(); i++) {
15187        if (i == res.getPolicy().size())
15188          res.getPolicy().add(parseUri(null));
15189        if (array.get(i) instanceof JsonObject) 
15190          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
15191      }
15192    };
15193    if (json.has("location"))
15194      res.setLocation(parseReference(json.getAsJsonObject("location")));
15195    if (json.has("reason")) {
15196      JsonArray array = json.getAsJsonArray("reason");
15197      for (int i = 0; i < array.size(); i++) {
15198        res.getReason().add(parseCoding(array.get(i).getAsJsonObject()));
15199      }
15200    };
15201    if (json.has("activity"))
15202      res.setActivity(parseCoding(json.getAsJsonObject("activity")));
15203    if (json.has("agent")) {
15204      JsonArray array = json.getAsJsonArray("agent");
15205      for (int i = 0; i < array.size(); i++) {
15206        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
15207      }
15208    };
15209    if (json.has("entity")) {
15210      JsonArray array = json.getAsJsonArray("entity");
15211      for (int i = 0; i < array.size(); i++) {
15212        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
15213      }
15214    };
15215    if (json.has("signature")) {
15216      JsonArray array = json.getAsJsonArray("signature");
15217      for (int i = 0; i < array.size(); i++) {
15218        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
15219      }
15220    };
15221  }
15222
15223  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15224    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
15225    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
15226    return res;
15227  }
15228
15229  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
15230    parseBackboneProperties(json, res);
15231    if (json.has("role")) {
15232      JsonArray array = json.getAsJsonArray("role");
15233      for (int i = 0; i < array.size(); i++) {
15234        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15235      }
15236    };
15237    Type who = parseType("who", json);
15238    if (who != null)
15239      res.setWho(who);
15240    Type onBehalfOf = parseType("onBehalfOf", json);
15241    if (onBehalfOf != null)
15242      res.setOnBehalfOf(onBehalfOf);
15243    if (json.has("relatedAgentType"))
15244      res.setRelatedAgentType(parseCodeableConcept(json.getAsJsonObject("relatedAgentType")));
15245  }
15246
15247  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15248    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
15249    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
15250    return res;
15251  }
15252
15253  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
15254    parseBackboneProperties(json, res);
15255    if (json.has("role"))
15256      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
15257    if (json.has("_role"))
15258      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
15259    Type what = parseType("what", json);
15260    if (what != null)
15261      res.setWhat(what);
15262    if (json.has("agent")) {
15263      JsonArray array = json.getAsJsonArray("agent");
15264      for (int i = 0; i < array.size(); i++) {
15265        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
15266      }
15267    };
15268  }
15269
15270  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
15271    Questionnaire res = new Questionnaire();
15272    parseQuestionnaireProperties(json, res);
15273    return res;
15274  }
15275
15276  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
15277    parseDomainResourceProperties(json, res);
15278    if (json.has("url"))
15279      res.setUrlElement(parseUri(json.get("url").getAsString()));
15280    if (json.has("_url"))
15281      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15282    if (json.has("identifier")) {
15283      JsonArray array = json.getAsJsonArray("identifier");
15284      for (int i = 0; i < array.size(); i++) {
15285        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15286      }
15287    };
15288    if (json.has("version"))
15289      res.setVersionElement(parseString(json.get("version").getAsString()));
15290    if (json.has("_version"))
15291      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15292    if (json.has("name"))
15293      res.setNameElement(parseString(json.get("name").getAsString()));
15294    if (json.has("_name"))
15295      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15296    if (json.has("title"))
15297      res.setTitleElement(parseString(json.get("title").getAsString()));
15298    if (json.has("_title"))
15299      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15300    if (json.has("status"))
15301      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15302    if (json.has("_status"))
15303      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15304    if (json.has("experimental"))
15305      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15306    if (json.has("_experimental"))
15307      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15308    if (json.has("date"))
15309      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15310    if (json.has("_date"))
15311      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15312    if (json.has("publisher"))
15313      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15314    if (json.has("_publisher"))
15315      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15316    if (json.has("description"))
15317      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15318    if (json.has("_description"))
15319      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15320    if (json.has("purpose"))
15321      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15322    if (json.has("_purpose"))
15323      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15324    if (json.has("approvalDate"))
15325      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15326    if (json.has("_approvalDate"))
15327      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
15328    if (json.has("lastReviewDate"))
15329      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15330    if (json.has("_lastReviewDate"))
15331      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
15332    if (json.has("effectivePeriod"))
15333      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
15334    if (json.has("useContext")) {
15335      JsonArray array = json.getAsJsonArray("useContext");
15336      for (int i = 0; i < array.size(); i++) {
15337        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15338      }
15339    };
15340    if (json.has("jurisdiction")) {
15341      JsonArray array = json.getAsJsonArray("jurisdiction");
15342      for (int i = 0; i < array.size(); i++) {
15343        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15344      }
15345    };
15346    if (json.has("contact")) {
15347      JsonArray array = json.getAsJsonArray("contact");
15348      for (int i = 0; i < array.size(); i++) {
15349        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15350      }
15351    };
15352    if (json.has("copyright"))
15353      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15354    if (json.has("_copyright"))
15355      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15356    if (json.has("code")) {
15357      JsonArray array = json.getAsJsonArray("code");
15358      for (int i = 0; i < array.size(); i++) {
15359        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15360      }
15361    };
15362    if (json.has("subjectType")) {
15363      JsonArray array = json.getAsJsonArray("subjectType");
15364      for (int i = 0; i < array.size(); i++) {
15365        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
15366      }
15367    };
15368    if (json.has("_subjectType")) {
15369      JsonArray array = json.getAsJsonArray("_subjectType");
15370      for (int i = 0; i < array.size(); i++) {
15371        if (i == res.getSubjectType().size())
15372          res.getSubjectType().add(parseCode(null));
15373        if (array.get(i) instanceof JsonObject) 
15374          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
15375      }
15376    };
15377    if (json.has("item")) {
15378      JsonArray array = json.getAsJsonArray("item");
15379      for (int i = 0; i < array.size(); i++) {
15380        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
15381      }
15382    };
15383  }
15384
15385  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15386    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
15387    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
15388    return res;
15389  }
15390
15391  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
15392    parseBackboneProperties(json, res);
15393    if (json.has("linkId"))
15394      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15395    if (json.has("_linkId"))
15396      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
15397    if (json.has("definition"))
15398      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15399    if (json.has("_definition"))
15400      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
15401    if (json.has("code")) {
15402      JsonArray array = json.getAsJsonArray("code");
15403      for (int i = 0; i < array.size(); i++) {
15404        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15405      }
15406    };
15407    if (json.has("prefix"))
15408      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
15409    if (json.has("_prefix"))
15410      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
15411    if (json.has("text"))
15412      res.setTextElement(parseString(json.get("text").getAsString()));
15413    if (json.has("_text"))
15414      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15415    if (json.has("type"))
15416      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
15417    if (json.has("_type"))
15418      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15419    if (json.has("enableWhen")) {
15420      JsonArray array = json.getAsJsonArray("enableWhen");
15421      for (int i = 0; i < array.size(); i++) {
15422        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
15423      }
15424    };
15425    if (json.has("required"))
15426      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
15427    if (json.has("_required"))
15428      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
15429    if (json.has("repeats"))
15430      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
15431    if (json.has("_repeats"))
15432      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
15433    if (json.has("readOnly"))
15434      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
15435    if (json.has("_readOnly"))
15436      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
15437    if (json.has("maxLength"))
15438      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
15439    if (json.has("_maxLength"))
15440      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
15441    if (json.has("options"))
15442      res.setOptions(parseReference(json.getAsJsonObject("options")));
15443    if (json.has("option")) {
15444      JsonArray array = json.getAsJsonArray("option");
15445      for (int i = 0; i < array.size(); i++) {
15446        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(array.get(i).getAsJsonObject(), owner));
15447      }
15448    };
15449    Type initial = parseType("initial", json);
15450    if (initial != null)
15451      res.setInitial(initial);
15452    if (json.has("item")) {
15453      JsonArray array = json.getAsJsonArray("item");
15454      for (int i = 0; i < array.size(); i++) {
15455        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
15456      }
15457    };
15458  }
15459
15460  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15461    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
15462    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
15463    return res;
15464  }
15465
15466  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
15467    parseBackboneProperties(json, res);
15468    if (json.has("question"))
15469      res.setQuestionElement(parseString(json.get("question").getAsString()));
15470    if (json.has("_question"))
15471      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
15472    if (json.has("hasAnswer"))
15473      res.setHasAnswerElement(parseBoolean(json.get("hasAnswer").getAsBoolean()));
15474    if (json.has("_hasAnswer"))
15475      parseElementProperties(json.getAsJsonObject("_hasAnswer"), res.getHasAnswerElement());
15476    Type answer = parseType("answer", json);
15477    if (answer != null)
15478      res.setAnswer(answer);
15479  }
15480
15481  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15482    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
15483    parseQuestionnaireQuestionnaireItemOptionComponentProperties(json, owner, res);
15484    return res;
15485  }
15486
15487  protected void parseQuestionnaireQuestionnaireItemOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemOptionComponent res) throws IOException, FHIRFormatError {
15488    parseBackboneProperties(json, res);
15489    Type value = parseType("value", json);
15490    if (value != null)
15491      res.setValue(value);
15492  }
15493
15494  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
15495    QuestionnaireResponse res = new QuestionnaireResponse();
15496    parseQuestionnaireResponseProperties(json, res);
15497    return res;
15498  }
15499
15500  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
15501    parseDomainResourceProperties(json, res);
15502    if (json.has("identifier"))
15503      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15504    if (json.has("basedOn")) {
15505      JsonArray array = json.getAsJsonArray("basedOn");
15506      for (int i = 0; i < array.size(); i++) {
15507        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15508      }
15509    };
15510    if (json.has("parent")) {
15511      JsonArray array = json.getAsJsonArray("parent");
15512      for (int i = 0; i < array.size(); i++) {
15513        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
15514      }
15515    };
15516    if (json.has("questionnaire"))
15517      res.setQuestionnaire(parseReference(json.getAsJsonObject("questionnaire")));
15518    if (json.has("status"))
15519      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
15520    if (json.has("_status"))
15521      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15522    if (json.has("subject"))
15523      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15524    if (json.has("context"))
15525      res.setContext(parseReference(json.getAsJsonObject("context")));
15526    if (json.has("authored"))
15527      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
15528    if (json.has("_authored"))
15529      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
15530    if (json.has("author"))
15531      res.setAuthor(parseReference(json.getAsJsonObject("author")));
15532    if (json.has("source"))
15533      res.setSource(parseReference(json.getAsJsonObject("source")));
15534    if (json.has("item")) {
15535      JsonArray array = json.getAsJsonArray("item");
15536      for (int i = 0; i < array.size(); i++) {
15537        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
15538      }
15539    };
15540  }
15541
15542  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15543    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
15544    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
15545    return res;
15546  }
15547
15548  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
15549    parseBackboneProperties(json, res);
15550    if (json.has("linkId"))
15551      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15552    if (json.has("_linkId"))
15553      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
15554    if (json.has("definition"))
15555      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15556    if (json.has("_definition"))
15557      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
15558    if (json.has("text"))
15559      res.setTextElement(parseString(json.get("text").getAsString()));
15560    if (json.has("_text"))
15561      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15562    if (json.has("subject"))
15563      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15564    if (json.has("answer")) {
15565      JsonArray array = json.getAsJsonArray("answer");
15566      for (int i = 0; i < array.size(); i++) {
15567        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
15568      }
15569    };
15570    if (json.has("item")) {
15571      JsonArray array = json.getAsJsonArray("item");
15572      for (int i = 0; i < array.size(); i++) {
15573        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15574      }
15575    };
15576  }
15577
15578  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15579    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
15580    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
15581    return res;
15582  }
15583
15584  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
15585    parseBackboneProperties(json, res);
15586    Type value = parseType("value", json);
15587    if (value != null)
15588      res.setValue(value);
15589    if (json.has("item")) {
15590      JsonArray array = json.getAsJsonArray("item");
15591      for (int i = 0; i < array.size(); i++) {
15592        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15593      }
15594    };
15595  }
15596
15597  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
15598    ReferralRequest res = new ReferralRequest();
15599    parseReferralRequestProperties(json, res);
15600    return res;
15601  }
15602
15603  protected void parseReferralRequestProperties(JsonObject json, ReferralRequest res) throws IOException, FHIRFormatError {
15604    parseDomainResourceProperties(json, res);
15605    if (json.has("identifier")) {
15606      JsonArray array = json.getAsJsonArray("identifier");
15607      for (int i = 0; i < array.size(); i++) {
15608        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15609      }
15610    };
15611    if (json.has("definition")) {
15612      JsonArray array = json.getAsJsonArray("definition");
15613      for (int i = 0; i < array.size(); i++) {
15614        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15615      }
15616    };
15617    if (json.has("basedOn")) {
15618      JsonArray array = json.getAsJsonArray("basedOn");
15619      for (int i = 0; i < array.size(); i++) {
15620        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15621      }
15622    };
15623    if (json.has("replaces")) {
15624      JsonArray array = json.getAsJsonArray("replaces");
15625      for (int i = 0; i < array.size(); i++) {
15626        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15627      }
15628    };
15629    if (json.has("groupIdentifier"))
15630      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
15631    if (json.has("status"))
15632      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralRequestStatus.NULL, new ReferralRequest.ReferralRequestStatusEnumFactory()));
15633    if (json.has("_status"))
15634      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15635    if (json.has("intent"))
15636      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ReferralRequest.ReferralCategory.NULL, new ReferralRequest.ReferralCategoryEnumFactory()));
15637    if (json.has("_intent"))
15638      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15639    if (json.has("type"))
15640      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15641    if (json.has("priority"))
15642      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ReferralRequest.ReferralPriority.NULL, new ReferralRequest.ReferralPriorityEnumFactory()));
15643    if (json.has("_priority"))
15644      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
15645    if (json.has("serviceRequested")) {
15646      JsonArray array = json.getAsJsonArray("serviceRequested");
15647      for (int i = 0; i < array.size(); i++) {
15648        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15649      }
15650    };
15651    if (json.has("subject"))
15652      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15653    if (json.has("context"))
15654      res.setContext(parseReference(json.getAsJsonObject("context")));
15655    Type occurrence = parseType("occurrence", json);
15656    if (occurrence != null)
15657      res.setOccurrence(occurrence);
15658    if (json.has("authoredOn"))
15659      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15660    if (json.has("_authoredOn"))
15661      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
15662    if (json.has("requester"))
15663      res.setRequester(parseReferralRequestReferralRequestRequesterComponent(json.getAsJsonObject("requester"), res));
15664    if (json.has("specialty"))
15665      res.setSpecialty(parseCodeableConcept(json.getAsJsonObject("specialty")));
15666    if (json.has("recipient")) {
15667      JsonArray array = json.getAsJsonArray("recipient");
15668      for (int i = 0; i < array.size(); i++) {
15669        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
15670      }
15671    };
15672    if (json.has("reasonCode")) {
15673      JsonArray array = json.getAsJsonArray("reasonCode");
15674      for (int i = 0; i < array.size(); i++) {
15675        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15676      }
15677    };
15678    if (json.has("reasonReference")) {
15679      JsonArray array = json.getAsJsonArray("reasonReference");
15680      for (int i = 0; i < array.size(); i++) {
15681        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15682      }
15683    };
15684    if (json.has("description"))
15685      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15686    if (json.has("_description"))
15687      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15688    if (json.has("supportingInfo")) {
15689      JsonArray array = json.getAsJsonArray("supportingInfo");
15690      for (int i = 0; i < array.size(); i++) {
15691        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
15692      }
15693    };
15694    if (json.has("note")) {
15695      JsonArray array = json.getAsJsonArray("note");
15696      for (int i = 0; i < array.size(); i++) {
15697        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15698      }
15699    };
15700    if (json.has("relevantHistory")) {
15701      JsonArray array = json.getAsJsonArray("relevantHistory");
15702      for (int i = 0; i < array.size(); i++) {
15703        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
15704      }
15705    };
15706  }
15707
15708  protected ReferralRequest.ReferralRequestRequesterComponent parseReferralRequestReferralRequestRequesterComponent(JsonObject json, ReferralRequest owner) throws IOException, FHIRFormatError {
15709    ReferralRequest.ReferralRequestRequesterComponent res = new ReferralRequest.ReferralRequestRequesterComponent();
15710    parseReferralRequestReferralRequestRequesterComponentProperties(json, owner, res);
15711    return res;
15712  }
15713
15714  protected void parseReferralRequestReferralRequestRequesterComponentProperties(JsonObject json, ReferralRequest owner, ReferralRequest.ReferralRequestRequesterComponent res) throws IOException, FHIRFormatError {
15715    parseBackboneProperties(json, res);
15716    if (json.has("agent"))
15717      res.setAgent(parseReference(json.getAsJsonObject("agent")));
15718    if (json.has("onBehalfOf"))
15719      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
15720  }
15721
15722  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
15723    RelatedPerson res = new RelatedPerson();
15724    parseRelatedPersonProperties(json, res);
15725    return res;
15726  }
15727
15728  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
15729    parseDomainResourceProperties(json, res);
15730    if (json.has("identifier")) {
15731      JsonArray array = json.getAsJsonArray("identifier");
15732      for (int i = 0; i < array.size(); i++) {
15733        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15734      }
15735    };
15736    if (json.has("active"))
15737      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
15738    if (json.has("_active"))
15739      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
15740    if (json.has("patient"))
15741      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15742    if (json.has("relationship"))
15743      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
15744    if (json.has("name")) {
15745      JsonArray array = json.getAsJsonArray("name");
15746      for (int i = 0; i < array.size(); i++) {
15747        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
15748      }
15749    };
15750    if (json.has("telecom")) {
15751      JsonArray array = json.getAsJsonArray("telecom");
15752      for (int i = 0; i < array.size(); i++) {
15753        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15754      }
15755    };
15756    if (json.has("gender"))
15757      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
15758    if (json.has("_gender"))
15759      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
15760    if (json.has("birthDate"))
15761      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
15762    if (json.has("_birthDate"))
15763      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
15764    if (json.has("address")) {
15765      JsonArray array = json.getAsJsonArray("address");
15766      for (int i = 0; i < array.size(); i++) {
15767        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
15768      }
15769    };
15770    if (json.has("photo")) {
15771      JsonArray array = json.getAsJsonArray("photo");
15772      for (int i = 0; i < array.size(); i++) {
15773        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
15774      }
15775    };
15776    if (json.has("period"))
15777      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15778  }
15779
15780  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
15781    RequestGroup res = new RequestGroup();
15782    parseRequestGroupProperties(json, res);
15783    return res;
15784  }
15785
15786  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
15787    parseDomainResourceProperties(json, res);
15788    if (json.has("identifier")) {
15789      JsonArray array = json.getAsJsonArray("identifier");
15790      for (int i = 0; i < array.size(); i++) {
15791        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15792      }
15793    };
15794    if (json.has("definition")) {
15795      JsonArray array = json.getAsJsonArray("definition");
15796      for (int i = 0; i < array.size(); i++) {
15797        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15798      }
15799    };
15800    if (json.has("basedOn")) {
15801      JsonArray array = json.getAsJsonArray("basedOn");
15802      for (int i = 0; i < array.size(); i++) {
15803        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15804      }
15805    };
15806    if (json.has("replaces")) {
15807      JsonArray array = json.getAsJsonArray("replaces");
15808      for (int i = 0; i < array.size(); i++) {
15809        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15810      }
15811    };
15812    if (json.has("groupIdentifier"))
15813      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
15814    if (json.has("status"))
15815      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
15816    if (json.has("_status"))
15817      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15818    if (json.has("intent"))
15819      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
15820    if (json.has("_intent"))
15821      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15822    if (json.has("priority"))
15823      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
15824    if (json.has("_priority"))
15825      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
15826    if (json.has("subject"))
15827      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15828    if (json.has("context"))
15829      res.setContext(parseReference(json.getAsJsonObject("context")));
15830    if (json.has("authoredOn"))
15831      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15832    if (json.has("_authoredOn"))
15833      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
15834    if (json.has("author"))
15835      res.setAuthor(parseReference(json.getAsJsonObject("author")));
15836    Type reason = parseType("reason", json);
15837    if (reason != null)
15838      res.setReason(reason);
15839    if (json.has("note")) {
15840      JsonArray array = json.getAsJsonArray("note");
15841      for (int i = 0; i < array.size(); i++) {
15842        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15843      }
15844    };
15845    if (json.has("action")) {
15846      JsonArray array = json.getAsJsonArray("action");
15847      for (int i = 0; i < array.size(); i++) {
15848        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
15849      }
15850    };
15851  }
15852
15853  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15854    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
15855    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
15856    return res;
15857  }
15858
15859  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
15860    parseBackboneProperties(json, res);
15861    if (json.has("label"))
15862      res.setLabelElement(parseString(json.get("label").getAsString()));
15863    if (json.has("_label"))
15864      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
15865    if (json.has("title"))
15866      res.setTitleElement(parseString(json.get("title").getAsString()));
15867    if (json.has("_title"))
15868      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15869    if (json.has("description"))
15870      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15871    if (json.has("_description"))
15872      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15873    if (json.has("textEquivalent"))
15874      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
15875    if (json.has("_textEquivalent"))
15876      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
15877    if (json.has("code")) {
15878      JsonArray array = json.getAsJsonArray("code");
15879      for (int i = 0; i < array.size(); i++) {
15880        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15881      }
15882    };
15883    if (json.has("documentation")) {
15884      JsonArray array = json.getAsJsonArray("documentation");
15885      for (int i = 0; i < array.size(); i++) {
15886        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15887      }
15888    };
15889    if (json.has("condition")) {
15890      JsonArray array = json.getAsJsonArray("condition");
15891      for (int i = 0; i < array.size(); i++) {
15892        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
15893      }
15894    };
15895    if (json.has("relatedAction")) {
15896      JsonArray array = json.getAsJsonArray("relatedAction");
15897      for (int i = 0; i < array.size(); i++) {
15898        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
15899      }
15900    };
15901    Type timing = parseType("timing", json);
15902    if (timing != null)
15903      res.setTiming(timing);
15904    if (json.has("participant")) {
15905      JsonArray array = json.getAsJsonArray("participant");
15906      for (int i = 0; i < array.size(); i++) {
15907        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
15908      }
15909    };
15910    if (json.has("type"))
15911      res.setType(parseCoding(json.getAsJsonObject("type")));
15912    if (json.has("groupingBehavior"))
15913      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
15914    if (json.has("_groupingBehavior"))
15915      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
15916    if (json.has("selectionBehavior"))
15917      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
15918    if (json.has("_selectionBehavior"))
15919      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
15920    if (json.has("requiredBehavior"))
15921      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
15922    if (json.has("_requiredBehavior"))
15923      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
15924    if (json.has("precheckBehavior"))
15925      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
15926    if (json.has("_precheckBehavior"))
15927      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
15928    if (json.has("cardinalityBehavior"))
15929      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
15930    if (json.has("_cardinalityBehavior"))
15931      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
15932    if (json.has("resource"))
15933      res.setResource(parseReference(json.getAsJsonObject("resource")));
15934    if (json.has("action")) {
15935      JsonArray array = json.getAsJsonArray("action");
15936      for (int i = 0; i < array.size(); i++) {
15937        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
15938      }
15939    };
15940  }
15941
15942  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15943    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
15944    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
15945    return res;
15946  }
15947
15948  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
15949    parseBackboneProperties(json, res);
15950    if (json.has("kind"))
15951      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
15952    if (json.has("_kind"))
15953      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
15954    if (json.has("description"))
15955      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15956    if (json.has("_description"))
15957      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15958    if (json.has("language"))
15959      res.setLanguageElement(parseString(json.get("language").getAsString()));
15960    if (json.has("_language"))
15961      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
15962    if (json.has("expression"))
15963      res.setExpressionElement(parseString(json.get("expression").getAsString()));
15964    if (json.has("_expression"))
15965      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
15966  }
15967
15968  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15969    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
15970    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
15971    return res;
15972  }
15973
15974  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
15975    parseBackboneProperties(json, res);
15976    if (json.has("actionId"))
15977      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
15978    if (json.has("_actionId"))
15979      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
15980    if (json.has("relationship"))
15981      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
15982    if (json.has("_relationship"))
15983      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
15984    Type offset = parseType("offset", json);
15985    if (offset != null)
15986      res.setOffset(offset);
15987  }
15988
15989  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
15990    ResearchStudy res = new ResearchStudy();
15991    parseResearchStudyProperties(json, res);
15992    return res;
15993  }
15994
15995  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
15996    parseDomainResourceProperties(json, res);
15997    if (json.has("identifier")) {
15998      JsonArray array = json.getAsJsonArray("identifier");
15999      for (int i = 0; i < array.size(); i++) {
16000        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16001      }
16002    };
16003    if (json.has("title"))
16004      res.setTitleElement(parseString(json.get("title").getAsString()));
16005    if (json.has("_title"))
16006      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16007    if (json.has("protocol")) {
16008      JsonArray array = json.getAsJsonArray("protocol");
16009      for (int i = 0; i < array.size(); i++) {
16010        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
16011      }
16012    };
16013    if (json.has("partOf")) {
16014      JsonArray array = json.getAsJsonArray("partOf");
16015      for (int i = 0; i < array.size(); i++) {
16016        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16017      }
16018    };
16019    if (json.has("status"))
16020      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
16021    if (json.has("_status"))
16022      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16023    if (json.has("category")) {
16024      JsonArray array = json.getAsJsonArray("category");
16025      for (int i = 0; i < array.size(); i++) {
16026        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16027      }
16028    };
16029    if (json.has("focus")) {
16030      JsonArray array = json.getAsJsonArray("focus");
16031      for (int i = 0; i < array.size(); i++) {
16032        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16033      }
16034    };
16035    if (json.has("contact")) {
16036      JsonArray array = json.getAsJsonArray("contact");
16037      for (int i = 0; i < array.size(); i++) {
16038        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16039      }
16040    };
16041    if (json.has("relatedArtifact")) {
16042      JsonArray array = json.getAsJsonArray("relatedArtifact");
16043      for (int i = 0; i < array.size(); i++) {
16044        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16045      }
16046    };
16047    if (json.has("keyword")) {
16048      JsonArray array = json.getAsJsonArray("keyword");
16049      for (int i = 0; i < array.size(); i++) {
16050        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16051      }
16052    };
16053    if (json.has("jurisdiction")) {
16054      JsonArray array = json.getAsJsonArray("jurisdiction");
16055      for (int i = 0; i < array.size(); i++) {
16056        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16057      }
16058    };
16059    if (json.has("description"))
16060      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16061    if (json.has("_description"))
16062      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16063    if (json.has("enrollment")) {
16064      JsonArray array = json.getAsJsonArray("enrollment");
16065      for (int i = 0; i < array.size(); i++) {
16066        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
16067      }
16068    };
16069    if (json.has("period"))
16070      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16071    if (json.has("sponsor"))
16072      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
16073    if (json.has("principalInvestigator"))
16074      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
16075    if (json.has("site")) {
16076      JsonArray array = json.getAsJsonArray("site");
16077      for (int i = 0; i < array.size(); i++) {
16078        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
16079      }
16080    };
16081    if (json.has("reasonStopped"))
16082      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
16083    if (json.has("note")) {
16084      JsonArray array = json.getAsJsonArray("note");
16085      for (int i = 0; i < array.size(); i++) {
16086        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16087      }
16088    };
16089    if (json.has("arm")) {
16090      JsonArray array = json.getAsJsonArray("arm");
16091      for (int i = 0; i < array.size(); i++) {
16092        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
16093      }
16094    };
16095  }
16096
16097  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
16098    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
16099    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
16100    return res;
16101  }
16102
16103  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
16104    parseBackboneProperties(json, res);
16105    if (json.has("name"))
16106      res.setNameElement(parseString(json.get("name").getAsString()));
16107    if (json.has("_name"))
16108      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16109    if (json.has("code"))
16110      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16111    if (json.has("description"))
16112      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16113    if (json.has("_description"))
16114      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16115  }
16116
16117  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
16118    ResearchSubject res = new ResearchSubject();
16119    parseResearchSubjectProperties(json, res);
16120    return res;
16121  }
16122
16123  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
16124    parseDomainResourceProperties(json, res);
16125    if (json.has("identifier"))
16126      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16127    if (json.has("status"))
16128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
16129    if (json.has("_status"))
16130      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16131    if (json.has("period"))
16132      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16133    if (json.has("study"))
16134      res.setStudy(parseReference(json.getAsJsonObject("study")));
16135    if (json.has("individual"))
16136      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
16137    if (json.has("assignedArm"))
16138      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
16139    if (json.has("_assignedArm"))
16140      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
16141    if (json.has("actualArm"))
16142      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
16143    if (json.has("_actualArm"))
16144      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
16145    if (json.has("consent"))
16146      res.setConsent(parseReference(json.getAsJsonObject("consent")));
16147  }
16148
16149  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
16150    RiskAssessment res = new RiskAssessment();
16151    parseRiskAssessmentProperties(json, res);
16152    return res;
16153  }
16154
16155  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
16156    parseDomainResourceProperties(json, res);
16157    if (json.has("identifier"))
16158      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16159    if (json.has("basedOn"))
16160      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
16161    if (json.has("parent"))
16162      res.setParent(parseReference(json.getAsJsonObject("parent")));
16163    if (json.has("status"))
16164      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
16165    if (json.has("_status"))
16166      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16167    if (json.has("method"))
16168      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16169    if (json.has("code"))
16170      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16171    if (json.has("subject"))
16172      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16173    if (json.has("context"))
16174      res.setContext(parseReference(json.getAsJsonObject("context")));
16175    Type occurrence = parseType("occurrence", json);
16176    if (occurrence != null)
16177      res.setOccurrence(occurrence);
16178    if (json.has("condition"))
16179      res.setCondition(parseReference(json.getAsJsonObject("condition")));
16180    if (json.has("performer"))
16181      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16182    Type reason = parseType("reason", json);
16183    if (reason != null)
16184      res.setReason(reason);
16185    if (json.has("basis")) {
16186      JsonArray array = json.getAsJsonArray("basis");
16187      for (int i = 0; i < array.size(); i++) {
16188        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
16189      }
16190    };
16191    if (json.has("prediction")) {
16192      JsonArray array = json.getAsJsonArray("prediction");
16193      for (int i = 0; i < array.size(); i++) {
16194        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
16195      }
16196    };
16197    if (json.has("mitigation"))
16198      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
16199    if (json.has("_mitigation"))
16200      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
16201    if (json.has("comment"))
16202      res.setCommentElement(parseString(json.get("comment").getAsString()));
16203    if (json.has("_comment"))
16204      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16205  }
16206
16207  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
16208    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
16209    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
16210    return res;
16211  }
16212
16213  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
16214    parseBackboneProperties(json, res);
16215    if (json.has("outcome"))
16216      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
16217    Type probability = parseType("probability", json);
16218    if (probability != null)
16219      res.setProbability(probability);
16220    if (json.has("qualitativeRisk"))
16221      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
16222    if (json.has("relativeRisk"))
16223      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
16224    if (json.has("_relativeRisk"))
16225      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
16226    Type when = parseType("when", json);
16227    if (when != null)
16228      res.setWhen(when);
16229    if (json.has("rationale"))
16230      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
16231    if (json.has("_rationale"))
16232      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
16233  }
16234
16235  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
16236    Schedule res = new Schedule();
16237    parseScheduleProperties(json, res);
16238    return res;
16239  }
16240
16241  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
16242    parseDomainResourceProperties(json, res);
16243    if (json.has("identifier")) {
16244      JsonArray array = json.getAsJsonArray("identifier");
16245      for (int i = 0; i < array.size(); i++) {
16246        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16247      }
16248    };
16249    if (json.has("active"))
16250      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16251    if (json.has("_active"))
16252      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16253    if (json.has("serviceCategory"))
16254      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
16255    if (json.has("serviceType")) {
16256      JsonArray array = json.getAsJsonArray("serviceType");
16257      for (int i = 0; i < array.size(); i++) {
16258        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16259      }
16260    };
16261    if (json.has("specialty")) {
16262      JsonArray array = json.getAsJsonArray("specialty");
16263      for (int i = 0; i < array.size(); i++) {
16264        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16265      }
16266    };
16267    if (json.has("actor")) {
16268      JsonArray array = json.getAsJsonArray("actor");
16269      for (int i = 0; i < array.size(); i++) {
16270        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
16271      }
16272    };
16273    if (json.has("planningHorizon"))
16274      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
16275    if (json.has("comment"))
16276      res.setCommentElement(parseString(json.get("comment").getAsString()));
16277    if (json.has("_comment"))
16278      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16279  }
16280
16281  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
16282    SearchParameter res = new SearchParameter();
16283    parseSearchParameterProperties(json, res);
16284    return res;
16285  }
16286
16287  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
16288    parseDomainResourceProperties(json, res);
16289    if (json.has("url"))
16290      res.setUrlElement(parseUri(json.get("url").getAsString()));
16291    if (json.has("_url"))
16292      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16293    if (json.has("version"))
16294      res.setVersionElement(parseString(json.get("version").getAsString()));
16295    if (json.has("_version"))
16296      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16297    if (json.has("name"))
16298      res.setNameElement(parseString(json.get("name").getAsString()));
16299    if (json.has("_name"))
16300      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16301    if (json.has("status"))
16302      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16303    if (json.has("_status"))
16304      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16305    if (json.has("experimental"))
16306      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16307    if (json.has("_experimental"))
16308      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16309    if (json.has("date"))
16310      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16311    if (json.has("_date"))
16312      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16313    if (json.has("publisher"))
16314      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16315    if (json.has("_publisher"))
16316      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16317    if (json.has("contact")) {
16318      JsonArray array = json.getAsJsonArray("contact");
16319      for (int i = 0; i < array.size(); i++) {
16320        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16321      }
16322    };
16323    if (json.has("useContext")) {
16324      JsonArray array = json.getAsJsonArray("useContext");
16325      for (int i = 0; i < array.size(); i++) {
16326        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16327      }
16328    };
16329    if (json.has("jurisdiction")) {
16330      JsonArray array = json.getAsJsonArray("jurisdiction");
16331      for (int i = 0; i < array.size(); i++) {
16332        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16333      }
16334    };
16335    if (json.has("purpose"))
16336      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16337    if (json.has("_purpose"))
16338      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16339    if (json.has("code"))
16340      res.setCodeElement(parseCode(json.get("code").getAsString()));
16341    if (json.has("_code"))
16342      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
16343    if (json.has("base")) {
16344      JsonArray array = json.getAsJsonArray("base");
16345      for (int i = 0; i < array.size(); i++) {
16346        res.getBase().add(parseCode(array.get(i).getAsString()));
16347      }
16348    };
16349    if (json.has("_base")) {
16350      JsonArray array = json.getAsJsonArray("_base");
16351      for (int i = 0; i < array.size(); i++) {
16352        if (i == res.getBase().size())
16353          res.getBase().add(parseCode(null));
16354        if (array.get(i) instanceof JsonObject) 
16355          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
16356      }
16357    };
16358    if (json.has("type"))
16359      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
16360    if (json.has("_type"))
16361      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16362    if (json.has("derivedFrom"))
16363      res.setDerivedFromElement(parseUri(json.get("derivedFrom").getAsString()));
16364    if (json.has("_derivedFrom"))
16365      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
16366    if (json.has("description"))
16367      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16368    if (json.has("_description"))
16369      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16370    if (json.has("expression"))
16371      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16372    if (json.has("_expression"))
16373      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
16374    if (json.has("xpath"))
16375      res.setXpathElement(parseString(json.get("xpath").getAsString()));
16376    if (json.has("_xpath"))
16377      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
16378    if (json.has("xpathUsage"))
16379      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
16380    if (json.has("_xpathUsage"))
16381      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
16382    if (json.has("target")) {
16383      JsonArray array = json.getAsJsonArray("target");
16384      for (int i = 0; i < array.size(); i++) {
16385        res.getTarget().add(parseCode(array.get(i).getAsString()));
16386      }
16387    };
16388    if (json.has("_target")) {
16389      JsonArray array = json.getAsJsonArray("_target");
16390      for (int i = 0; i < array.size(); i++) {
16391        if (i == res.getTarget().size())
16392          res.getTarget().add(parseCode(null));
16393        if (array.get(i) instanceof JsonObject) 
16394          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
16395      }
16396    };
16397    if (json.has("comparator")) {
16398      JsonArray array = json.getAsJsonArray("comparator");
16399      for (int i = 0; i < array.size(); i++) {
16400        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16401      }
16402    };
16403    if (json.has("_comparator")) {
16404      JsonArray array = json.getAsJsonArray("_comparator");
16405      for (int i = 0; i < array.size(); i++) {
16406        if (i == res.getComparator().size())
16407          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16408        if (array.get(i) instanceof JsonObject) 
16409          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
16410      }
16411    };
16412    if (json.has("modifier")) {
16413      JsonArray array = json.getAsJsonArray("modifier");
16414      for (int i = 0; i < array.size(); i++) {
16415        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16416      }
16417    };
16418    if (json.has("_modifier")) {
16419      JsonArray array = json.getAsJsonArray("_modifier");
16420      for (int i = 0; i < array.size(); i++) {
16421        if (i == res.getModifier().size())
16422          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16423        if (array.get(i) instanceof JsonObject) 
16424          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
16425      }
16426    };
16427    if (json.has("chain")) {
16428      JsonArray array = json.getAsJsonArray("chain");
16429      for (int i = 0; i < array.size(); i++) {
16430        res.getChain().add(parseString(array.get(i).getAsString()));
16431      }
16432    };
16433    if (json.has("_chain")) {
16434      JsonArray array = json.getAsJsonArray("_chain");
16435      for (int i = 0; i < array.size(); i++) {
16436        if (i == res.getChain().size())
16437          res.getChain().add(parseString(null));
16438        if (array.get(i) instanceof JsonObject) 
16439          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
16440      }
16441    };
16442    if (json.has("component")) {
16443      JsonArray array = json.getAsJsonArray("component");
16444      for (int i = 0; i < array.size(); i++) {
16445        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
16446      }
16447    };
16448  }
16449
16450  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
16451    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
16452    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
16453    return res;
16454  }
16455
16456  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
16457    parseBackboneProperties(json, res);
16458    if (json.has("definition"))
16459      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
16460    if (json.has("expression"))
16461      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16462    if (json.has("_expression"))
16463      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
16464  }
16465
16466  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
16467    Sequence res = new Sequence();
16468    parseSequenceProperties(json, res);
16469    return res;
16470  }
16471
16472  protected void parseSequenceProperties(JsonObject json, Sequence res) throws IOException, FHIRFormatError {
16473    parseDomainResourceProperties(json, res);
16474    if (json.has("identifier")) {
16475      JsonArray array = json.getAsJsonArray("identifier");
16476      for (int i = 0; i < array.size(); i++) {
16477        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16478      }
16479    };
16480    if (json.has("type"))
16481      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
16482    if (json.has("_type"))
16483      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16484    if (json.has("coordinateSystem"))
16485      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
16486    if (json.has("_coordinateSystem"))
16487      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
16488    if (json.has("patient"))
16489      res.setPatient(parseReference(json.getAsJsonObject("patient")));
16490    if (json.has("specimen"))
16491      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
16492    if (json.has("device"))
16493      res.setDevice(parseReference(json.getAsJsonObject("device")));
16494    if (json.has("performer"))
16495      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16496    if (json.has("quantity"))
16497      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16498    if (json.has("referenceSeq"))
16499      res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
16500    if (json.has("variant")) {
16501      JsonArray array = json.getAsJsonArray("variant");
16502      for (int i = 0; i < array.size(); i++) {
16503        res.getVariant().add(parseSequenceSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
16504      }
16505    };
16506    if (json.has("observedSeq"))
16507      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
16508    if (json.has("_observedSeq"))
16509      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
16510    if (json.has("quality")) {
16511      JsonArray array = json.getAsJsonArray("quality");
16512      for (int i = 0; i < array.size(); i++) {
16513        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
16514      }
16515    };
16516    if (json.has("readCoverage"))
16517      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
16518    if (json.has("_readCoverage"))
16519      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
16520    if (json.has("repository")) {
16521      JsonArray array = json.getAsJsonArray("repository");
16522      for (int i = 0; i < array.size(); i++) {
16523        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
16524      }
16525    };
16526    if (json.has("pointer")) {
16527      JsonArray array = json.getAsJsonArray("pointer");
16528      for (int i = 0; i < array.size(); i++) {
16529        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
16530      }
16531    };
16532  }
16533
16534  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16535    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
16536    parseSequenceSequenceReferenceSeqComponentProperties(json, owner, res);
16537    return res;
16538  }
16539
16540  protected void parseSequenceSequenceReferenceSeqComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
16541    parseBackboneProperties(json, res);
16542    if (json.has("chromosome"))
16543      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
16544    if (json.has("genomeBuild"))
16545      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
16546    if (json.has("_genomeBuild"))
16547      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
16548    if (json.has("referenceSeqId"))
16549      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
16550    if (json.has("referenceSeqPointer"))
16551      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
16552    if (json.has("referenceSeqString"))
16553      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
16554    if (json.has("_referenceSeqString"))
16555      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
16556    if (json.has("strand"))
16557      res.setStrandElement(parseInteger(json.get("strand").getAsLong()));
16558    if (json.has("_strand"))
16559      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
16560    if (json.has("windowStart"))
16561      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
16562    if (json.has("_windowStart"))
16563      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
16564    if (json.has("windowEnd"))
16565      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
16566    if (json.has("_windowEnd"))
16567      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
16568  }
16569
16570  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16571    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
16572    parseSequenceSequenceVariantComponentProperties(json, owner, res);
16573    return res;
16574  }
16575
16576  protected void parseSequenceSequenceVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceVariantComponent res) throws IOException, FHIRFormatError {
16577    parseBackboneProperties(json, res);
16578    if (json.has("start"))
16579      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16580    if (json.has("_start"))
16581      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16582    if (json.has("end"))
16583      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16584    if (json.has("_end"))
16585      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16586    if (json.has("observedAllele"))
16587      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
16588    if (json.has("_observedAllele"))
16589      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
16590    if (json.has("referenceAllele"))
16591      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
16592    if (json.has("_referenceAllele"))
16593      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
16594    if (json.has("cigar"))
16595      res.setCigarElement(parseString(json.get("cigar").getAsString()));
16596    if (json.has("_cigar"))
16597      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
16598    if (json.has("variantPointer"))
16599      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
16600  }
16601
16602  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16603    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
16604    parseSequenceSequenceQualityComponentProperties(json, owner, res);
16605    return res;
16606  }
16607
16608  protected void parseSequenceSequenceQualityComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityComponent res) throws IOException, FHIRFormatError {
16609    parseBackboneProperties(json, res);
16610    if (json.has("type"))
16611      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
16612    if (json.has("_type"))
16613      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16614    if (json.has("standardSequence"))
16615      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
16616    if (json.has("start"))
16617      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16618    if (json.has("_start"))
16619      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16620    if (json.has("end"))
16621      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16622    if (json.has("_end"))
16623      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16624    if (json.has("score"))
16625      res.setScore(parseQuantity(json.getAsJsonObject("score")));
16626    if (json.has("method"))
16627      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16628    if (json.has("truthTP"))
16629      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
16630    if (json.has("_truthTP"))
16631      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
16632    if (json.has("queryTP"))
16633      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
16634    if (json.has("_queryTP"))
16635      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
16636    if (json.has("truthFN"))
16637      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
16638    if (json.has("_truthFN"))
16639      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
16640    if (json.has("queryFP"))
16641      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
16642    if (json.has("_queryFP"))
16643      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
16644    if (json.has("gtFP"))
16645      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
16646    if (json.has("_gtFP"))
16647      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
16648    if (json.has("precision"))
16649      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
16650    if (json.has("_precision"))
16651      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
16652    if (json.has("recall"))
16653      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
16654    if (json.has("_recall"))
16655      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
16656    if (json.has("fScore"))
16657      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
16658    if (json.has("_fScore"))
16659      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
16660  }
16661
16662  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16663    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
16664    parseSequenceSequenceRepositoryComponentProperties(json, owner, res);
16665    return res;
16666  }
16667
16668  protected void parseSequenceSequenceRepositoryComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceRepositoryComponent res) throws IOException, FHIRFormatError {
16669    parseBackboneProperties(json, res);
16670    if (json.has("type"))
16671      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
16672    if (json.has("_type"))
16673      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16674    if (json.has("url"))
16675      res.setUrlElement(parseUri(json.get("url").getAsString()));
16676    if (json.has("_url"))
16677      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16678    if (json.has("name"))
16679      res.setNameElement(parseString(json.get("name").getAsString()));
16680    if (json.has("_name"))
16681      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16682    if (json.has("datasetId"))
16683      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
16684    if (json.has("_datasetId"))
16685      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
16686    if (json.has("variantsetId"))
16687      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
16688    if (json.has("_variantsetId"))
16689      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
16690    if (json.has("readsetId"))
16691      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
16692    if (json.has("_readsetId"))
16693      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
16694  }
16695
16696  protected ServiceDefinition parseServiceDefinition(JsonObject json) throws IOException, FHIRFormatError {
16697    ServiceDefinition res = new ServiceDefinition();
16698    parseServiceDefinitionProperties(json, res);
16699    return res;
16700  }
16701
16702  protected void parseServiceDefinitionProperties(JsonObject json, ServiceDefinition res) throws IOException, FHIRFormatError {
16703    parseDomainResourceProperties(json, res);
16704    if (json.has("url"))
16705      res.setUrlElement(parseUri(json.get("url").getAsString()));
16706    if (json.has("_url"))
16707      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16708    if (json.has("identifier")) {
16709      JsonArray array = json.getAsJsonArray("identifier");
16710      for (int i = 0; i < array.size(); i++) {
16711        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16712      }
16713    };
16714    if (json.has("version"))
16715      res.setVersionElement(parseString(json.get("version").getAsString()));
16716    if (json.has("_version"))
16717      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16718    if (json.has("name"))
16719      res.setNameElement(parseString(json.get("name").getAsString()));
16720    if (json.has("_name"))
16721      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16722    if (json.has("title"))
16723      res.setTitleElement(parseString(json.get("title").getAsString()));
16724    if (json.has("_title"))
16725      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16726    if (json.has("status"))
16727      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16728    if (json.has("_status"))
16729      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16730    if (json.has("experimental"))
16731      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16732    if (json.has("_experimental"))
16733      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16734    if (json.has("date"))
16735      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16736    if (json.has("_date"))
16737      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16738    if (json.has("publisher"))
16739      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16740    if (json.has("_publisher"))
16741      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16742    if (json.has("description"))
16743      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16744    if (json.has("_description"))
16745      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16746    if (json.has("purpose"))
16747      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16748    if (json.has("_purpose"))
16749      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16750    if (json.has("usage"))
16751      res.setUsageElement(parseString(json.get("usage").getAsString()));
16752    if (json.has("_usage"))
16753      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
16754    if (json.has("approvalDate"))
16755      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16756    if (json.has("_approvalDate"))
16757      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
16758    if (json.has("lastReviewDate"))
16759      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16760    if (json.has("_lastReviewDate"))
16761      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16762    if (json.has("effectivePeriod"))
16763      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16764    if (json.has("useContext")) {
16765      JsonArray array = json.getAsJsonArray("useContext");
16766      for (int i = 0; i < array.size(); i++) {
16767        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16768      }
16769    };
16770    if (json.has("jurisdiction")) {
16771      JsonArray array = json.getAsJsonArray("jurisdiction");
16772      for (int i = 0; i < array.size(); i++) {
16773        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16774      }
16775    };
16776    if (json.has("topic")) {
16777      JsonArray array = json.getAsJsonArray("topic");
16778      for (int i = 0; i < array.size(); i++) {
16779        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16780      }
16781    };
16782    if (json.has("contributor")) {
16783      JsonArray array = json.getAsJsonArray("contributor");
16784      for (int i = 0; i < array.size(); i++) {
16785        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
16786      }
16787    };
16788    if (json.has("contact")) {
16789      JsonArray array = json.getAsJsonArray("contact");
16790      for (int i = 0; i < array.size(); i++) {
16791        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16792      }
16793    };
16794    if (json.has("copyright"))
16795      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16796    if (json.has("_copyright"))
16797      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
16798    if (json.has("relatedArtifact")) {
16799      JsonArray array = json.getAsJsonArray("relatedArtifact");
16800      for (int i = 0; i < array.size(); i++) {
16801        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16802      }
16803    };
16804    if (json.has("trigger")) {
16805      JsonArray array = json.getAsJsonArray("trigger");
16806      for (int i = 0; i < array.size(); i++) {
16807        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
16808      }
16809    };
16810    if (json.has("dataRequirement")) {
16811      JsonArray array = json.getAsJsonArray("dataRequirement");
16812      for (int i = 0; i < array.size(); i++) {
16813        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
16814      }
16815    };
16816    if (json.has("operationDefinition"))
16817      res.setOperationDefinition(parseReference(json.getAsJsonObject("operationDefinition")));
16818  }
16819
16820  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
16821    Slot res = new Slot();
16822    parseSlotProperties(json, res);
16823    return res;
16824  }
16825
16826  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
16827    parseDomainResourceProperties(json, res);
16828    if (json.has("identifier")) {
16829      JsonArray array = json.getAsJsonArray("identifier");
16830      for (int i = 0; i < array.size(); i++) {
16831        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16832      }
16833    };
16834    if (json.has("serviceCategory"))
16835      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
16836    if (json.has("serviceType")) {
16837      JsonArray array = json.getAsJsonArray("serviceType");
16838      for (int i = 0; i < array.size(); i++) {
16839        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16840      }
16841    };
16842    if (json.has("specialty")) {
16843      JsonArray array = json.getAsJsonArray("specialty");
16844      for (int i = 0; i < array.size(); i++) {
16845        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16846      }
16847    };
16848    if (json.has("appointmentType"))
16849      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
16850    if (json.has("schedule"))
16851      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
16852    if (json.has("status"))
16853      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
16854    if (json.has("_status"))
16855      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16856    if (json.has("start"))
16857      res.setStartElement(parseInstant(json.get("start").getAsString()));
16858    if (json.has("_start"))
16859      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16860    if (json.has("end"))
16861      res.setEndElement(parseInstant(json.get("end").getAsString()));
16862    if (json.has("_end"))
16863      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16864    if (json.has("overbooked"))
16865      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
16866    if (json.has("_overbooked"))
16867      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
16868    if (json.has("comment"))
16869      res.setCommentElement(parseString(json.get("comment").getAsString()));
16870    if (json.has("_comment"))
16871      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16872  }
16873
16874  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
16875    Specimen res = new Specimen();
16876    parseSpecimenProperties(json, res);
16877    return res;
16878  }
16879
16880  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
16881    parseDomainResourceProperties(json, res);
16882    if (json.has("identifier")) {
16883      JsonArray array = json.getAsJsonArray("identifier");
16884      for (int i = 0; i < array.size(); i++) {
16885        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16886      }
16887    };
16888    if (json.has("accessionIdentifier"))
16889      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
16890    if (json.has("status"))
16891      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
16892    if (json.has("_status"))
16893      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16894    if (json.has("type"))
16895      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16896    if (json.has("subject"))
16897      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16898    if (json.has("receivedTime"))
16899      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
16900    if (json.has("_receivedTime"))
16901      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
16902    if (json.has("parent")) {
16903      JsonArray array = json.getAsJsonArray("parent");
16904      for (int i = 0; i < array.size(); i++) {
16905        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
16906      }
16907    };
16908    if (json.has("request")) {
16909      JsonArray array = json.getAsJsonArray("request");
16910      for (int i = 0; i < array.size(); i++) {
16911        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
16912      }
16913    };
16914    if (json.has("collection"))
16915      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
16916    if (json.has("processing")) {
16917      JsonArray array = json.getAsJsonArray("processing");
16918      for (int i = 0; i < array.size(); i++) {
16919        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
16920      }
16921    };
16922    if (json.has("container")) {
16923      JsonArray array = json.getAsJsonArray("container");
16924      for (int i = 0; i < array.size(); i++) {
16925        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
16926      }
16927    };
16928    if (json.has("note")) {
16929      JsonArray array = json.getAsJsonArray("note");
16930      for (int i = 0; i < array.size(); i++) {
16931        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16932      }
16933    };
16934  }
16935
16936  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16937    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
16938    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
16939    return res;
16940  }
16941
16942  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
16943    parseBackboneProperties(json, res);
16944    if (json.has("collector"))
16945      res.setCollector(parseReference(json.getAsJsonObject("collector")));
16946    Type collected = parseType("collected", json);
16947    if (collected != null)
16948      res.setCollected(collected);
16949    if (json.has("quantity"))
16950      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
16951    if (json.has("method"))
16952      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16953    if (json.has("bodySite"))
16954      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
16955  }
16956
16957  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16958    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
16959    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
16960    return res;
16961  }
16962
16963  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
16964    parseBackboneProperties(json, res);
16965    if (json.has("description"))
16966      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16967    if (json.has("_description"))
16968      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16969    if (json.has("procedure"))
16970      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
16971    if (json.has("additive")) {
16972      JsonArray array = json.getAsJsonArray("additive");
16973      for (int i = 0; i < array.size(); i++) {
16974        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
16975      }
16976    };
16977    Type time = parseType("time", json);
16978    if (time != null)
16979      res.setTime(time);
16980  }
16981
16982  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16983    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
16984    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
16985    return res;
16986  }
16987
16988  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
16989    parseBackboneProperties(json, res);
16990    if (json.has("identifier")) {
16991      JsonArray array = json.getAsJsonArray("identifier");
16992      for (int i = 0; i < array.size(); i++) {
16993        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16994      }
16995    };
16996    if (json.has("description"))
16997      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16998    if (json.has("_description"))
16999      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17000    if (json.has("type"))
17001      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17002    if (json.has("capacity"))
17003      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
17004    if (json.has("specimenQuantity"))
17005      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
17006    Type additive = parseType("additive", json);
17007    if (additive != null)
17008      res.setAdditive(additive);
17009  }
17010
17011  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
17012    StructureDefinition res = new StructureDefinition();
17013    parseStructureDefinitionProperties(json, res);
17014    return res;
17015  }
17016
17017  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
17018    parseDomainResourceProperties(json, res);
17019    if (json.has("url"))
17020      res.setUrlElement(parseUri(json.get("url").getAsString()));
17021    if (json.has("_url"))
17022      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17023    if (json.has("identifier")) {
17024      JsonArray array = json.getAsJsonArray("identifier");
17025      for (int i = 0; i < array.size(); i++) {
17026        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17027      }
17028    };
17029    if (json.has("version"))
17030      res.setVersionElement(parseString(json.get("version").getAsString()));
17031    if (json.has("_version"))
17032      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17033    if (json.has("name"))
17034      res.setNameElement(parseString(json.get("name").getAsString()));
17035    if (json.has("_name"))
17036      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17037    if (json.has("title"))
17038      res.setTitleElement(parseString(json.get("title").getAsString()));
17039    if (json.has("_title"))
17040      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17041    if (json.has("status"))
17042      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17043    if (json.has("_status"))
17044      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17045    if (json.has("experimental"))
17046      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17047    if (json.has("_experimental"))
17048      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17049    if (json.has("date"))
17050      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17051    if (json.has("_date"))
17052      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17053    if (json.has("publisher"))
17054      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17055    if (json.has("_publisher"))
17056      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17057    if (json.has("contact")) {
17058      JsonArray array = json.getAsJsonArray("contact");
17059      for (int i = 0; i < array.size(); i++) {
17060        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17061      }
17062    };
17063    if (json.has("description"))
17064      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17065    if (json.has("_description"))
17066      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17067    if (json.has("useContext")) {
17068      JsonArray array = json.getAsJsonArray("useContext");
17069      for (int i = 0; i < array.size(); i++) {
17070        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17071      }
17072    };
17073    if (json.has("jurisdiction")) {
17074      JsonArray array = json.getAsJsonArray("jurisdiction");
17075      for (int i = 0; i < array.size(); i++) {
17076        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17077      }
17078    };
17079    if (json.has("purpose"))
17080      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17081    if (json.has("_purpose"))
17082      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17083    if (json.has("copyright"))
17084      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17085    if (json.has("_copyright"))
17086      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17087    if (json.has("keyword")) {
17088      JsonArray array = json.getAsJsonArray("keyword");
17089      for (int i = 0; i < array.size(); i++) {
17090        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
17091      }
17092    };
17093    if (json.has("fhirVersion"))
17094      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
17095    if (json.has("_fhirVersion"))
17096      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
17097    if (json.has("mapping")) {
17098      JsonArray array = json.getAsJsonArray("mapping");
17099      for (int i = 0; i < array.size(); i++) {
17100        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
17101      }
17102    };
17103    if (json.has("kind"))
17104      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
17105    if (json.has("_kind"))
17106      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
17107    if (json.has("abstract"))
17108      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
17109    if (json.has("_abstract"))
17110      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
17111    if (json.has("contextType"))
17112      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
17113    if (json.has("_contextType"))
17114      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
17115    if (json.has("context")) {
17116      JsonArray array = json.getAsJsonArray("context");
17117      for (int i = 0; i < array.size(); i++) {
17118        res.getContext().add(parseString(array.get(i).getAsString()));
17119      }
17120    };
17121    if (json.has("_context")) {
17122      JsonArray array = json.getAsJsonArray("_context");
17123      for (int i = 0; i < array.size(); i++) {
17124        if (i == res.getContext().size())
17125          res.getContext().add(parseString(null));
17126        if (array.get(i) instanceof JsonObject) 
17127          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
17128      }
17129    };
17130    if (json.has("contextInvariant")) {
17131      JsonArray array = json.getAsJsonArray("contextInvariant");
17132      for (int i = 0; i < array.size(); i++) {
17133        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
17134      }
17135    };
17136    if (json.has("_contextInvariant")) {
17137      JsonArray array = json.getAsJsonArray("_contextInvariant");
17138      for (int i = 0; i < array.size(); i++) {
17139        if (i == res.getContextInvariant().size())
17140          res.getContextInvariant().add(parseString(null));
17141        if (array.get(i) instanceof JsonObject) 
17142          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
17143      }
17144    };
17145    if (json.has("type"))
17146      res.setTypeElement(parseCode(json.get("type").getAsString()));
17147    if (json.has("_type"))
17148      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17149    if (json.has("baseDefinition"))
17150      res.setBaseDefinitionElement(parseUri(json.get("baseDefinition").getAsString()));
17151    if (json.has("_baseDefinition"))
17152      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
17153    if (json.has("derivation"))
17154      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
17155    if (json.has("_derivation"))
17156      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
17157    if (json.has("snapshot"))
17158      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
17159    if (json.has("differential"))
17160      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
17161  }
17162
17163  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17164    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
17165    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
17166    return res;
17167  }
17168
17169  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
17170    parseBackboneProperties(json, res);
17171    if (json.has("identity"))
17172      res.setIdentityElement(parseId(json.get("identity").getAsString()));
17173    if (json.has("_identity"))
17174      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
17175    if (json.has("uri"))
17176      res.setUriElement(parseUri(json.get("uri").getAsString()));
17177    if (json.has("_uri"))
17178      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
17179    if (json.has("name"))
17180      res.setNameElement(parseString(json.get("name").getAsString()));
17181    if (json.has("_name"))
17182      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17183    if (json.has("comment"))
17184      res.setCommentElement(parseString(json.get("comment").getAsString()));
17185    if (json.has("_comment"))
17186      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
17187  }
17188
17189  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17190    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
17191    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
17192    return res;
17193  }
17194
17195  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
17196    parseBackboneProperties(json, res);
17197    if (json.has("element")) {
17198      JsonArray array = json.getAsJsonArray("element");
17199      for (int i = 0; i < array.size(); i++) {
17200        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17201      }
17202    };
17203  }
17204
17205  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17206    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
17207    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
17208    return res;
17209  }
17210
17211  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
17212    parseBackboneProperties(json, res);
17213    if (json.has("element")) {
17214      JsonArray array = json.getAsJsonArray("element");
17215      for (int i = 0; i < array.size(); i++) {
17216        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17217      }
17218    };
17219  }
17220
17221  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
17222    StructureMap res = new StructureMap();
17223    parseStructureMapProperties(json, res);
17224    return res;
17225  }
17226
17227  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
17228    parseDomainResourceProperties(json, res);
17229    if (json.has("url"))
17230      res.setUrlElement(parseUri(json.get("url").getAsString()));
17231    if (json.has("_url"))
17232      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17233    if (json.has("identifier")) {
17234      JsonArray array = json.getAsJsonArray("identifier");
17235      for (int i = 0; i < array.size(); i++) {
17236        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17237      }
17238    };
17239    if (json.has("version"))
17240      res.setVersionElement(parseString(json.get("version").getAsString()));
17241    if (json.has("_version"))
17242      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17243    if (json.has("name"))
17244      res.setNameElement(parseString(json.get("name").getAsString()));
17245    if (json.has("_name"))
17246      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17247    if (json.has("title"))
17248      res.setTitleElement(parseString(json.get("title").getAsString()));
17249    if (json.has("_title"))
17250      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17251    if (json.has("status"))
17252      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17253    if (json.has("_status"))
17254      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17255    if (json.has("experimental"))
17256      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17257    if (json.has("_experimental"))
17258      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17259    if (json.has("date"))
17260      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17261    if (json.has("_date"))
17262      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17263    if (json.has("publisher"))
17264      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17265    if (json.has("_publisher"))
17266      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17267    if (json.has("contact")) {
17268      JsonArray array = json.getAsJsonArray("contact");
17269      for (int i = 0; i < array.size(); i++) {
17270        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17271      }
17272    };
17273    if (json.has("description"))
17274      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17275    if (json.has("_description"))
17276      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17277    if (json.has("useContext")) {
17278      JsonArray array = json.getAsJsonArray("useContext");
17279      for (int i = 0; i < array.size(); i++) {
17280        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17281      }
17282    };
17283    if (json.has("jurisdiction")) {
17284      JsonArray array = json.getAsJsonArray("jurisdiction");
17285      for (int i = 0; i < array.size(); i++) {
17286        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17287      }
17288    };
17289    if (json.has("purpose"))
17290      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17291    if (json.has("_purpose"))
17292      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17293    if (json.has("copyright"))
17294      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17295    if (json.has("_copyright"))
17296      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17297    if (json.has("structure")) {
17298      JsonArray array = json.getAsJsonArray("structure");
17299      for (int i = 0; i < array.size(); i++) {
17300        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
17301      }
17302    };
17303    if (json.has("import")) {
17304      JsonArray array = json.getAsJsonArray("import");
17305      for (int i = 0; i < array.size(); i++) {
17306        res.getImport().add(parseUri(array.get(i).getAsString()));
17307      }
17308    };
17309    if (json.has("_import")) {
17310      JsonArray array = json.getAsJsonArray("_import");
17311      for (int i = 0; i < array.size(); i++) {
17312        if (i == res.getImport().size())
17313          res.getImport().add(parseUri(null));
17314        if (array.get(i) instanceof JsonObject) 
17315          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
17316      }
17317    };
17318    if (json.has("group")) {
17319      JsonArray array = json.getAsJsonArray("group");
17320      for (int i = 0; i < array.size(); i++) {
17321        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
17322      }
17323    };
17324  }
17325
17326  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17327    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
17328    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
17329    return res;
17330  }
17331
17332  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
17333    parseBackboneProperties(json, res);
17334    if (json.has("url"))
17335      res.setUrlElement(parseUri(json.get("url").getAsString()));
17336    if (json.has("_url"))
17337      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17338    if (json.has("mode"))
17339      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
17340    if (json.has("_mode"))
17341      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
17342    if (json.has("alias"))
17343      res.setAliasElement(parseString(json.get("alias").getAsString()));
17344    if (json.has("_alias"))
17345      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
17346    if (json.has("documentation"))
17347      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17348    if (json.has("_documentation"))
17349      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17350  }
17351
17352  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17353    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
17354    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
17355    return res;
17356  }
17357
17358  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
17359    parseBackboneProperties(json, res);
17360    if (json.has("name"))
17361      res.setNameElement(parseId(json.get("name").getAsString()));
17362    if (json.has("_name"))
17363      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17364    if (json.has("extends"))
17365      res.setExtendsElement(parseId(json.get("extends").getAsString()));
17366    if (json.has("_extends"))
17367      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
17368    if (json.has("typeMode"))
17369      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
17370    if (json.has("_typeMode"))
17371      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
17372    if (json.has("documentation"))
17373      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17374    if (json.has("_documentation"))
17375      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17376    if (json.has("input")) {
17377      JsonArray array = json.getAsJsonArray("input");
17378      for (int i = 0; i < array.size(); i++) {
17379        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
17380      }
17381    };
17382    if (json.has("rule")) {
17383      JsonArray array = json.getAsJsonArray("rule");
17384      for (int i = 0; i < array.size(); i++) {
17385        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17386      }
17387    };
17388  }
17389
17390  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17391    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
17392    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
17393    return res;
17394  }
17395
17396  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
17397    parseBackboneProperties(json, res);
17398    if (json.has("name"))
17399      res.setNameElement(parseId(json.get("name").getAsString()));
17400    if (json.has("_name"))
17401      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17402    if (json.has("type"))
17403      res.setTypeElement(parseString(json.get("type").getAsString()));
17404    if (json.has("_type"))
17405      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17406    if (json.has("mode"))
17407      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
17408    if (json.has("_mode"))
17409      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
17410    if (json.has("documentation"))
17411      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17412    if (json.has("_documentation"))
17413      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17414  }
17415
17416  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17417    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
17418    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
17419    return res;
17420  }
17421
17422  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
17423    parseBackboneProperties(json, res);
17424    if (json.has("name"))
17425      res.setNameElement(parseId(json.get("name").getAsString()));
17426    if (json.has("_name"))
17427      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17428    if (json.has("source")) {
17429      JsonArray array = json.getAsJsonArray("source");
17430      for (int i = 0; i < array.size(); i++) {
17431        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
17432      }
17433    };
17434    if (json.has("target")) {
17435      JsonArray array = json.getAsJsonArray("target");
17436      for (int i = 0; i < array.size(); i++) {
17437        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
17438      }
17439    };
17440    if (json.has("rule")) {
17441      JsonArray array = json.getAsJsonArray("rule");
17442      for (int i = 0; i < array.size(); i++) {
17443        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17444      }
17445    };
17446    if (json.has("dependent")) {
17447      JsonArray array = json.getAsJsonArray("dependent");
17448      for (int i = 0; i < array.size(); i++) {
17449        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
17450      }
17451    };
17452    if (json.has("documentation"))
17453      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17454    if (json.has("_documentation"))
17455      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17456  }
17457
17458  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17459    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
17460    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
17461    return res;
17462  }
17463
17464  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
17465    parseBackboneProperties(json, res);
17466    if (json.has("context"))
17467      res.setContextElement(parseId(json.get("context").getAsString()));
17468    if (json.has("_context"))
17469      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
17470    if (json.has("min"))
17471      res.setMinElement(parseInteger(json.get("min").getAsLong()));
17472    if (json.has("_min"))
17473      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
17474    if (json.has("max"))
17475      res.setMaxElement(parseString(json.get("max").getAsString()));
17476    if (json.has("_max"))
17477      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
17478    if (json.has("type"))
17479      res.setTypeElement(parseString(json.get("type").getAsString()));
17480    if (json.has("_type"))
17481      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17482    Type defaultValue = parseType("defaultValue", json);
17483    if (defaultValue != null)
17484      res.setDefaultValue(defaultValue);
17485    if (json.has("element"))
17486      res.setElementElement(parseString(json.get("element").getAsString()));
17487    if (json.has("_element"))
17488      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
17489    if (json.has("listMode"))
17490      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
17491    if (json.has("_listMode"))
17492      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
17493    if (json.has("variable"))
17494      res.setVariableElement(parseId(json.get("variable").getAsString()));
17495    if (json.has("_variable"))
17496      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
17497    if (json.has("condition"))
17498      res.setConditionElement(parseString(json.get("condition").getAsString()));
17499    if (json.has("_condition"))
17500      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
17501    if (json.has("check"))
17502      res.setCheckElement(parseString(json.get("check").getAsString()));
17503    if (json.has("_check"))
17504      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
17505  }
17506
17507  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17508    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
17509    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
17510    return res;
17511  }
17512
17513  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
17514    parseBackboneProperties(json, res);
17515    if (json.has("context"))
17516      res.setContextElement(parseId(json.get("context").getAsString()));
17517    if (json.has("_context"))
17518      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
17519    if (json.has("contextType"))
17520      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
17521    if (json.has("_contextType"))
17522      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
17523    if (json.has("element"))
17524      res.setElementElement(parseString(json.get("element").getAsString()));
17525    if (json.has("_element"))
17526      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
17527    if (json.has("variable"))
17528      res.setVariableElement(parseId(json.get("variable").getAsString()));
17529    if (json.has("_variable"))
17530      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
17531    if (json.has("listMode")) {
17532      JsonArray array = json.getAsJsonArray("listMode");
17533      for (int i = 0; i < array.size(); i++) {
17534        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17535      }
17536    };
17537    if (json.has("_listMode")) {
17538      JsonArray array = json.getAsJsonArray("_listMode");
17539      for (int i = 0; i < array.size(); i++) {
17540        if (i == res.getListMode().size())
17541          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17542        if (array.get(i) instanceof JsonObject) 
17543          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
17544      }
17545    };
17546    if (json.has("listRuleId"))
17547      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
17548    if (json.has("_listRuleId"))
17549      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
17550    if (json.has("transform"))
17551      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
17552    if (json.has("_transform"))
17553      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
17554    if (json.has("parameter")) {
17555      JsonArray array = json.getAsJsonArray("parameter");
17556      for (int i = 0; i < array.size(); i++) {
17557        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
17558      }
17559    };
17560  }
17561
17562  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17563    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
17564    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
17565    return res;
17566  }
17567
17568  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
17569    parseBackboneProperties(json, res);
17570    Type value = parseType("value", json);
17571    if (value != null)
17572      res.setValue(value);
17573  }
17574
17575  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17576    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
17577    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
17578    return res;
17579  }
17580
17581  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
17582    parseBackboneProperties(json, res);
17583    if (json.has("name"))
17584      res.setNameElement(parseId(json.get("name").getAsString()));
17585    if (json.has("_name"))
17586      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17587    if (json.has("variable")) {
17588      JsonArray array = json.getAsJsonArray("variable");
17589      for (int i = 0; i < array.size(); i++) {
17590        res.getVariable().add(parseString(array.get(i).getAsString()));
17591      }
17592    };
17593    if (json.has("_variable")) {
17594      JsonArray array = json.getAsJsonArray("_variable");
17595      for (int i = 0; i < array.size(); i++) {
17596        if (i == res.getVariable().size())
17597          res.getVariable().add(parseString(null));
17598        if (array.get(i) instanceof JsonObject) 
17599          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
17600      }
17601    };
17602  }
17603
17604  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
17605    Subscription res = new Subscription();
17606    parseSubscriptionProperties(json, res);
17607    return res;
17608  }
17609
17610  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
17611    parseDomainResourceProperties(json, res);
17612    if (json.has("status"))
17613      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
17614    if (json.has("_status"))
17615      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17616    if (json.has("contact")) {
17617      JsonArray array = json.getAsJsonArray("contact");
17618      for (int i = 0; i < array.size(); i++) {
17619        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
17620      }
17621    };
17622    if (json.has("end"))
17623      res.setEndElement(parseInstant(json.get("end").getAsString()));
17624    if (json.has("_end"))
17625      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
17626    if (json.has("reason"))
17627      res.setReasonElement(parseString(json.get("reason").getAsString()));
17628    if (json.has("_reason"))
17629      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
17630    if (json.has("criteria"))
17631      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
17632    if (json.has("_criteria"))
17633      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
17634    if (json.has("error"))
17635      res.setErrorElement(parseString(json.get("error").getAsString()));
17636    if (json.has("_error"))
17637      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
17638    if (json.has("channel"))
17639      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
17640    if (json.has("tag")) {
17641      JsonArray array = json.getAsJsonArray("tag");
17642      for (int i = 0; i < array.size(); i++) {
17643        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
17644      }
17645    };
17646  }
17647
17648  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
17649    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
17650    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
17651    return res;
17652  }
17653
17654  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
17655    parseBackboneProperties(json, res);
17656    if (json.has("type"))
17657      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
17658    if (json.has("_type"))
17659      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17660    if (json.has("endpoint"))
17661      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
17662    if (json.has("_endpoint"))
17663      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
17664    if (json.has("payload"))
17665      res.setPayloadElement(parseString(json.get("payload").getAsString()));
17666    if (json.has("_payload"))
17667      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
17668    if (json.has("header")) {
17669      JsonArray array = json.getAsJsonArray("header");
17670      for (int i = 0; i < array.size(); i++) {
17671        res.getHeader().add(parseString(array.get(i).getAsString()));
17672      }
17673    };
17674    if (json.has("_header")) {
17675      JsonArray array = json.getAsJsonArray("_header");
17676      for (int i = 0; i < array.size(); i++) {
17677        if (i == res.getHeader().size())
17678          res.getHeader().add(parseString(null));
17679        if (array.get(i) instanceof JsonObject) 
17680          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
17681      }
17682    };
17683  }
17684
17685  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
17686    Substance res = new Substance();
17687    parseSubstanceProperties(json, res);
17688    return res;
17689  }
17690
17691  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
17692    parseDomainResourceProperties(json, res);
17693    if (json.has("identifier")) {
17694      JsonArray array = json.getAsJsonArray("identifier");
17695      for (int i = 0; i < array.size(); i++) {
17696        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17697      }
17698    };
17699    if (json.has("status"))
17700      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
17701    if (json.has("_status"))
17702      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17703    if (json.has("category")) {
17704      JsonArray array = json.getAsJsonArray("category");
17705      for (int i = 0; i < array.size(); i++) {
17706        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17707      }
17708    };
17709    if (json.has("code"))
17710      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17711    if (json.has("description"))
17712      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17713    if (json.has("_description"))
17714      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17715    if (json.has("instance")) {
17716      JsonArray array = json.getAsJsonArray("instance");
17717      for (int i = 0; i < array.size(); i++) {
17718        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
17719      }
17720    };
17721    if (json.has("ingredient")) {
17722      JsonArray array = json.getAsJsonArray("ingredient");
17723      for (int i = 0; i < array.size(); i++) {
17724        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
17725      }
17726    };
17727  }
17728
17729  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
17730    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
17731    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
17732    return res;
17733  }
17734
17735  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
17736    parseBackboneProperties(json, res);
17737    if (json.has("identifier"))
17738      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17739    if (json.has("expiry"))
17740      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
17741    if (json.has("_expiry"))
17742      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
17743    if (json.has("quantity"))
17744      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
17745  }
17746
17747  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
17748    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
17749    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
17750    return res;
17751  }
17752
17753  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
17754    parseBackboneProperties(json, res);
17755    if (json.has("quantity"))
17756      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
17757    Type substance = parseType("substance", json);
17758    if (substance != null)
17759      res.setSubstance(substance);
17760  }
17761
17762  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
17763    SupplyDelivery res = new SupplyDelivery();
17764    parseSupplyDeliveryProperties(json, res);
17765    return res;
17766  }
17767
17768  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
17769    parseDomainResourceProperties(json, res);
17770    if (json.has("identifier"))
17771      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17772    if (json.has("basedOn")) {
17773      JsonArray array = json.getAsJsonArray("basedOn");
17774      for (int i = 0; i < array.size(); i++) {
17775        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17776      }
17777    };
17778    if (json.has("partOf")) {
17779      JsonArray array = json.getAsJsonArray("partOf");
17780      for (int i = 0; i < array.size(); i++) {
17781        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17782      }
17783    };
17784    if (json.has("status"))
17785      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
17786    if (json.has("_status"))
17787      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17788    if (json.has("patient"))
17789      res.setPatient(parseReference(json.getAsJsonObject("patient")));
17790    if (json.has("type"))
17791      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17792    if (json.has("suppliedItem"))
17793      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
17794    Type occurrence = parseType("occurrence", json);
17795    if (occurrence != null)
17796      res.setOccurrence(occurrence);
17797    if (json.has("supplier"))
17798      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
17799    if (json.has("destination"))
17800      res.setDestination(parseReference(json.getAsJsonObject("destination")));
17801    if (json.has("receiver")) {
17802      JsonArray array = json.getAsJsonArray("receiver");
17803      for (int i = 0; i < array.size(); i++) {
17804        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
17805      }
17806    };
17807  }
17808
17809  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
17810    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
17811    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
17812    return res;
17813  }
17814
17815  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
17816    parseBackboneProperties(json, res);
17817    if (json.has("quantity"))
17818      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
17819    Type item = parseType("item", json);
17820    if (item != null)
17821      res.setItem(item);
17822  }
17823
17824  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
17825    SupplyRequest res = new SupplyRequest();
17826    parseSupplyRequestProperties(json, res);
17827    return res;
17828  }
17829
17830  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
17831    parseDomainResourceProperties(json, res);
17832    if (json.has("identifier"))
17833      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17834    if (json.has("status"))
17835      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
17836    if (json.has("_status"))
17837      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17838    if (json.has("category"))
17839      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
17840    if (json.has("priority"))
17841      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
17842    if (json.has("_priority"))
17843      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
17844    if (json.has("orderedItem"))
17845      res.setOrderedItem(parseSupplyRequestSupplyRequestOrderedItemComponent(json.getAsJsonObject("orderedItem"), res));
17846    Type occurrence = parseType("occurrence", json);
17847    if (occurrence != null)
17848      res.setOccurrence(occurrence);
17849    if (json.has("authoredOn"))
17850      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17851    if (json.has("_authoredOn"))
17852      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
17853    if (json.has("requester"))
17854      res.setRequester(parseSupplyRequestSupplyRequestRequesterComponent(json.getAsJsonObject("requester"), res));
17855    if (json.has("supplier")) {
17856      JsonArray array = json.getAsJsonArray("supplier");
17857      for (int i = 0; i < array.size(); i++) {
17858        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
17859      }
17860    };
17861    Type reason = parseType("reason", json);
17862    if (reason != null)
17863      res.setReason(reason);
17864    if (json.has("deliverFrom"))
17865      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
17866    if (json.has("deliverTo"))
17867      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
17868  }
17869
17870  protected SupplyRequest.SupplyRequestOrderedItemComponent parseSupplyRequestSupplyRequestOrderedItemComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
17871    SupplyRequest.SupplyRequestOrderedItemComponent res = new SupplyRequest.SupplyRequestOrderedItemComponent();
17872    parseSupplyRequestSupplyRequestOrderedItemComponentProperties(json, owner, res);
17873    return res;
17874  }
17875
17876  protected void parseSupplyRequestSupplyRequestOrderedItemComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestOrderedItemComponent res) throws IOException, FHIRFormatError {
17877    parseBackboneProperties(json, res);
17878    if (json.has("quantity"))
17879      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17880    Type item = parseType("item", json);
17881    if (item != null)
17882      res.setItem(item);
17883  }
17884
17885  protected SupplyRequest.SupplyRequestRequesterComponent parseSupplyRequestSupplyRequestRequesterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
17886    SupplyRequest.SupplyRequestRequesterComponent res = new SupplyRequest.SupplyRequestRequesterComponent();
17887    parseSupplyRequestSupplyRequestRequesterComponentProperties(json, owner, res);
17888    return res;
17889  }
17890
17891  protected void parseSupplyRequestSupplyRequestRequesterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestRequesterComponent res) throws IOException, FHIRFormatError {
17892    parseBackboneProperties(json, res);
17893    if (json.has("agent"))
17894      res.setAgent(parseReference(json.getAsJsonObject("agent")));
17895    if (json.has("onBehalfOf"))
17896      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
17897  }
17898
17899  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
17900    Task res = new Task();
17901    parseTaskProperties(json, res);
17902    return res;
17903  }
17904
17905  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
17906    parseDomainResourceProperties(json, res);
17907    if (json.has("identifier")) {
17908      JsonArray array = json.getAsJsonArray("identifier");
17909      for (int i = 0; i < array.size(); i++) {
17910        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17911      }
17912    };
17913    Type definition = parseType("definition", json);
17914    if (definition != null)
17915      res.setDefinition(definition);
17916    if (json.has("basedOn")) {
17917      JsonArray array = json.getAsJsonArray("basedOn");
17918      for (int i = 0; i < array.size(); i++) {
17919        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17920      }
17921    };
17922    if (json.has("groupIdentifier"))
17923      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
17924    if (json.has("partOf")) {
17925      JsonArray array = json.getAsJsonArray("partOf");
17926      for (int i = 0; i < array.size(); i++) {
17927        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17928      }
17929    };
17930    if (json.has("status"))
17931      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
17932    if (json.has("_status"))
17933      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17934    if (json.has("statusReason"))
17935      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
17936    if (json.has("businessStatus"))
17937      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
17938    if (json.has("intent"))
17939      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
17940    if (json.has("_intent"))
17941      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
17942    if (json.has("priority"))
17943      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
17944    if (json.has("_priority"))
17945      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
17946    if (json.has("code"))
17947      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17948    if (json.has("description"))
17949      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17950    if (json.has("_description"))
17951      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17952    if (json.has("focus"))
17953      res.setFocus(parseReference(json.getAsJsonObject("focus")));
17954    if (json.has("for"))
17955      res.setFor(parseReference(json.getAsJsonObject("for")));
17956    if (json.has("context"))
17957      res.setContext(parseReference(json.getAsJsonObject("context")));
17958    if (json.has("executionPeriod"))
17959      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
17960    if (json.has("authoredOn"))
17961      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17962    if (json.has("_authoredOn"))
17963      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
17964    if (json.has("lastModified"))
17965      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
17966    if (json.has("_lastModified"))
17967      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
17968    if (json.has("requester"))
17969      res.setRequester(parseTaskTaskRequesterComponent(json.getAsJsonObject("requester"), res));
17970    if (json.has("performerType")) {
17971      JsonArray array = json.getAsJsonArray("performerType");
17972      for (int i = 0; i < array.size(); i++) {
17973        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17974      }
17975    };
17976    if (json.has("owner"))
17977      res.setOwner(parseReference(json.getAsJsonObject("owner")));
17978    if (json.has("reason"))
17979      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
17980    if (json.has("note")) {
17981      JsonArray array = json.getAsJsonArray("note");
17982      for (int i = 0; i < array.size(); i++) {
17983        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17984      }
17985    };
17986    if (json.has("relevantHistory")) {
17987      JsonArray array = json.getAsJsonArray("relevantHistory");
17988      for (int i = 0; i < array.size(); i++) {
17989        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
17990      }
17991    };
17992    if (json.has("restriction"))
17993      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
17994    if (json.has("input")) {
17995      JsonArray array = json.getAsJsonArray("input");
17996      for (int i = 0; i < array.size(); i++) {
17997        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
17998      }
17999    };
18000    if (json.has("output")) {
18001      JsonArray array = json.getAsJsonArray("output");
18002      for (int i = 0; i < array.size(); i++) {
18003        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
18004      }
18005    };
18006  }
18007
18008  protected Task.TaskRequesterComponent parseTaskTaskRequesterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18009    Task.TaskRequesterComponent res = new Task.TaskRequesterComponent();
18010    parseTaskTaskRequesterComponentProperties(json, owner, res);
18011    return res;
18012  }
18013
18014  protected void parseTaskTaskRequesterComponentProperties(JsonObject json, Task owner, Task.TaskRequesterComponent res) throws IOException, FHIRFormatError {
18015    parseBackboneProperties(json, res);
18016    if (json.has("agent"))
18017      res.setAgent(parseReference(json.getAsJsonObject("agent")));
18018    if (json.has("onBehalfOf"))
18019      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
18020  }
18021
18022  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18023    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
18024    parseTaskTaskRestrictionComponentProperties(json, owner, res);
18025    return res;
18026  }
18027
18028  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
18029    parseBackboneProperties(json, res);
18030    if (json.has("repetitions"))
18031      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
18032    if (json.has("_repetitions"))
18033      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
18034    if (json.has("period"))
18035      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18036    if (json.has("recipient")) {
18037      JsonArray array = json.getAsJsonArray("recipient");
18038      for (int i = 0; i < array.size(); i++) {
18039        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
18040      }
18041    };
18042  }
18043
18044  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18045    Task.ParameterComponent res = new Task.ParameterComponent();
18046    parseTaskParameterComponentProperties(json, owner, res);
18047    return res;
18048  }
18049
18050  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
18051    parseBackboneProperties(json, res);
18052    if (json.has("type"))
18053      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18054    Type value = parseType("value", json);
18055    if (value != null)
18056      res.setValue(value);
18057  }
18058
18059  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18060    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
18061    parseTaskTaskOutputComponentProperties(json, owner, res);
18062    return res;
18063  }
18064
18065  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
18066    parseBackboneProperties(json, res);
18067    if (json.has("type"))
18068      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18069    Type value = parseType("value", json);
18070    if (value != null)
18071      res.setValue(value);
18072  }
18073
18074  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
18075    TestReport res = new TestReport();
18076    parseTestReportProperties(json, res);
18077    return res;
18078  }
18079
18080  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
18081    parseDomainResourceProperties(json, res);
18082    if (json.has("identifier"))
18083      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
18084    if (json.has("name"))
18085      res.setNameElement(parseString(json.get("name").getAsString()));
18086    if (json.has("_name"))
18087      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18088    if (json.has("status"))
18089      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
18090    if (json.has("_status"))
18091      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18092    if (json.has("testScript"))
18093      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
18094    if (json.has("result"))
18095      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
18096    if (json.has("_result"))
18097      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18098    if (json.has("score"))
18099      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
18100    if (json.has("_score"))
18101      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
18102    if (json.has("tester"))
18103      res.setTesterElement(parseString(json.get("tester").getAsString()));
18104    if (json.has("_tester"))
18105      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
18106    if (json.has("issued"))
18107      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
18108    if (json.has("_issued"))
18109      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
18110    if (json.has("participant")) {
18111      JsonArray array = json.getAsJsonArray("participant");
18112      for (int i = 0; i < array.size(); i++) {
18113        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
18114      }
18115    };
18116    if (json.has("setup"))
18117      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
18118    if (json.has("test")) {
18119      JsonArray array = json.getAsJsonArray("test");
18120      for (int i = 0; i < array.size(); i++) {
18121        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
18122      }
18123    };
18124    if (json.has("teardown"))
18125      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
18126  }
18127
18128  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18129    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
18130    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
18131    return res;
18132  }
18133
18134  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
18135    parseBackboneProperties(json, res);
18136    if (json.has("type"))
18137      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
18138    if (json.has("_type"))
18139      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18140    if (json.has("uri"))
18141      res.setUriElement(parseUri(json.get("uri").getAsString()));
18142    if (json.has("_uri"))
18143      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
18144    if (json.has("display"))
18145      res.setDisplayElement(parseString(json.get("display").getAsString()));
18146    if (json.has("_display"))
18147      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
18148  }
18149
18150  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18151    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
18152    parseTestReportTestReportSetupComponentProperties(json, owner, res);
18153    return res;
18154  }
18155
18156  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
18157    parseBackboneProperties(json, res);
18158    if (json.has("action")) {
18159      JsonArray array = json.getAsJsonArray("action");
18160      for (int i = 0; i < array.size(); i++) {
18161        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
18162      }
18163    };
18164  }
18165
18166  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18167    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
18168    parseTestReportSetupActionComponentProperties(json, owner, res);
18169    return res;
18170  }
18171
18172  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
18173    parseBackboneProperties(json, res);
18174    if (json.has("operation"))
18175      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18176    if (json.has("assert"))
18177      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18178  }
18179
18180  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18181    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
18182    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
18183    return res;
18184  }
18185
18186  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
18187    parseBackboneProperties(json, res);
18188    if (json.has("result"))
18189      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18190    if (json.has("_result"))
18191      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18192    if (json.has("message"))
18193      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18194    if (json.has("_message"))
18195      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18196    if (json.has("detail"))
18197      res.setDetailElement(parseUri(json.get("detail").getAsString()));
18198    if (json.has("_detail"))
18199      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
18200  }
18201
18202  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18203    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
18204    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
18205    return res;
18206  }
18207
18208  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
18209    parseBackboneProperties(json, res);
18210    if (json.has("result"))
18211      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18212    if (json.has("_result"))
18213      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18214    if (json.has("message"))
18215      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18216    if (json.has("_message"))
18217      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18218    if (json.has("detail"))
18219      res.setDetailElement(parseString(json.get("detail").getAsString()));
18220    if (json.has("_detail"))
18221      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
18222  }
18223
18224  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18225    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
18226    parseTestReportTestReportTestComponentProperties(json, owner, res);
18227    return res;
18228  }
18229
18230  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
18231    parseBackboneProperties(json, res);
18232    if (json.has("name"))
18233      res.setNameElement(parseString(json.get("name").getAsString()));
18234    if (json.has("_name"))
18235      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18236    if (json.has("description"))
18237      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18238    if (json.has("_description"))
18239      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18240    if (json.has("action")) {
18241      JsonArray array = json.getAsJsonArray("action");
18242      for (int i = 0; i < array.size(); i++) {
18243        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
18244      }
18245    };
18246  }
18247
18248  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18249    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
18250    parseTestReportTestActionComponentProperties(json, owner, res);
18251    return res;
18252  }
18253
18254  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
18255    parseBackboneProperties(json, res);
18256    if (json.has("operation"))
18257      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18258    if (json.has("assert"))
18259      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18260  }
18261
18262  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18263    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
18264    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
18265    return res;
18266  }
18267
18268  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
18269    parseBackboneProperties(json, res);
18270    if (json.has("action")) {
18271      JsonArray array = json.getAsJsonArray("action");
18272      for (int i = 0; i < array.size(); i++) {
18273        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
18274      }
18275    };
18276  }
18277
18278  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18279    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
18280    parseTestReportTeardownActionComponentProperties(json, owner, res);
18281    return res;
18282  }
18283
18284  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
18285    parseBackboneProperties(json, res);
18286    if (json.has("operation"))
18287      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18288  }
18289
18290  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
18291    TestScript res = new TestScript();
18292    parseTestScriptProperties(json, res);
18293    return res;
18294  }
18295
18296  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
18297    parseDomainResourceProperties(json, res);
18298    if (json.has("url"))
18299      res.setUrlElement(parseUri(json.get("url").getAsString()));
18300    if (json.has("_url"))
18301      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18302    if (json.has("identifier"))
18303      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
18304    if (json.has("version"))
18305      res.setVersionElement(parseString(json.get("version").getAsString()));
18306    if (json.has("_version"))
18307      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18308    if (json.has("name"))
18309      res.setNameElement(parseString(json.get("name").getAsString()));
18310    if (json.has("_name"))
18311      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18312    if (json.has("title"))
18313      res.setTitleElement(parseString(json.get("title").getAsString()));
18314    if (json.has("_title"))
18315      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18316    if (json.has("status"))
18317      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18318    if (json.has("_status"))
18319      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18320    if (json.has("experimental"))
18321      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18322    if (json.has("_experimental"))
18323      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18324    if (json.has("date"))
18325      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18326    if (json.has("_date"))
18327      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18328    if (json.has("publisher"))
18329      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18330    if (json.has("_publisher"))
18331      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18332    if (json.has("contact")) {
18333      JsonArray array = json.getAsJsonArray("contact");
18334      for (int i = 0; i < array.size(); i++) {
18335        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18336      }
18337    };
18338    if (json.has("description"))
18339      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18340    if (json.has("_description"))
18341      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18342    if (json.has("useContext")) {
18343      JsonArray array = json.getAsJsonArray("useContext");
18344      for (int i = 0; i < array.size(); i++) {
18345        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18346      }
18347    };
18348    if (json.has("jurisdiction")) {
18349      JsonArray array = json.getAsJsonArray("jurisdiction");
18350      for (int i = 0; i < array.size(); i++) {
18351        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18352      }
18353    };
18354    if (json.has("purpose"))
18355      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18356    if (json.has("_purpose"))
18357      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18358    if (json.has("copyright"))
18359      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18360    if (json.has("_copyright"))
18361      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
18362    if (json.has("origin")) {
18363      JsonArray array = json.getAsJsonArray("origin");
18364      for (int i = 0; i < array.size(); i++) {
18365        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
18366      }
18367    };
18368    if (json.has("destination")) {
18369      JsonArray array = json.getAsJsonArray("destination");
18370      for (int i = 0; i < array.size(); i++) {
18371        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
18372      }
18373    };
18374    if (json.has("metadata"))
18375      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
18376    if (json.has("fixture")) {
18377      JsonArray array = json.getAsJsonArray("fixture");
18378      for (int i = 0; i < array.size(); i++) {
18379        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
18380      }
18381    };
18382    if (json.has("profile")) {
18383      JsonArray array = json.getAsJsonArray("profile");
18384      for (int i = 0; i < array.size(); i++) {
18385        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
18386      }
18387    };
18388    if (json.has("variable")) {
18389      JsonArray array = json.getAsJsonArray("variable");
18390      for (int i = 0; i < array.size(); i++) {
18391        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
18392      }
18393    };
18394    if (json.has("rule")) {
18395      JsonArray array = json.getAsJsonArray("rule");
18396      for (int i = 0; i < array.size(); i++) {
18397        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
18398      }
18399    };
18400    if (json.has("ruleset")) {
18401      JsonArray array = json.getAsJsonArray("ruleset");
18402      for (int i = 0; i < array.size(); i++) {
18403        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
18404      }
18405    };
18406    if (json.has("setup"))
18407      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
18408    if (json.has("test")) {
18409      JsonArray array = json.getAsJsonArray("test");
18410      for (int i = 0; i < array.size(); i++) {
18411        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
18412      }
18413    };
18414    if (json.has("teardown"))
18415      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
18416  }
18417
18418  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18419    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
18420    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
18421    return res;
18422  }
18423
18424  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
18425    parseBackboneProperties(json, res);
18426    if (json.has("index"))
18427      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18428    if (json.has("_index"))
18429      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
18430    if (json.has("profile"))
18431      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
18432  }
18433
18434  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18435    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
18436    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
18437    return res;
18438  }
18439
18440  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
18441    parseBackboneProperties(json, res);
18442    if (json.has("index"))
18443      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18444    if (json.has("_index"))
18445      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
18446    if (json.has("profile"))
18447      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
18448  }
18449
18450  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18451    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
18452    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
18453    return res;
18454  }
18455
18456  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
18457    parseBackboneProperties(json, res);
18458    if (json.has("link")) {
18459      JsonArray array = json.getAsJsonArray("link");
18460      for (int i = 0; i < array.size(); i++) {
18461        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
18462      }
18463    };
18464    if (json.has("capability")) {
18465      JsonArray array = json.getAsJsonArray("capability");
18466      for (int i = 0; i < array.size(); i++) {
18467        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
18468      }
18469    };
18470  }
18471
18472  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18473    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
18474    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
18475    return res;
18476  }
18477
18478  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
18479    parseBackboneProperties(json, res);
18480    if (json.has("url"))
18481      res.setUrlElement(parseUri(json.get("url").getAsString()));
18482    if (json.has("_url"))
18483      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18484    if (json.has("description"))
18485      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18486    if (json.has("_description"))
18487      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18488  }
18489
18490  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18491    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
18492    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
18493    return res;
18494  }
18495
18496  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
18497    parseBackboneProperties(json, res);
18498    if (json.has("required"))
18499      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
18500    if (json.has("_required"))
18501      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
18502    if (json.has("validated"))
18503      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
18504    if (json.has("_validated"))
18505      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
18506    if (json.has("description"))
18507      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18508    if (json.has("_description"))
18509      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18510    if (json.has("origin")) {
18511      JsonArray array = json.getAsJsonArray("origin");
18512      for (int i = 0; i < array.size(); i++) {
18513        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
18514      }
18515    };
18516    if (json.has("_origin")) {
18517      JsonArray array = json.getAsJsonArray("_origin");
18518      for (int i = 0; i < array.size(); i++) {
18519        if (i == res.getOrigin().size())
18520          res.getOrigin().add(parseInteger(null));
18521        if (array.get(i) instanceof JsonObject) 
18522          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
18523      }
18524    };
18525    if (json.has("destination"))
18526      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
18527    if (json.has("_destination"))
18528      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
18529    if (json.has("link")) {
18530      JsonArray array = json.getAsJsonArray("link");
18531      for (int i = 0; i < array.size(); i++) {
18532        res.getLink().add(parseUri(array.get(i).getAsString()));
18533      }
18534    };
18535    if (json.has("_link")) {
18536      JsonArray array = json.getAsJsonArray("_link");
18537      for (int i = 0; i < array.size(); i++) {
18538        if (i == res.getLink().size())
18539          res.getLink().add(parseUri(null));
18540        if (array.get(i) instanceof JsonObject) 
18541          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
18542      }
18543    };
18544    if (json.has("capabilities"))
18545      res.setCapabilities(parseReference(json.getAsJsonObject("capabilities")));
18546  }
18547
18548  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18549    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
18550    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
18551    return res;
18552  }
18553
18554  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
18555    parseBackboneProperties(json, res);
18556    if (json.has("autocreate"))
18557      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
18558    if (json.has("_autocreate"))
18559      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
18560    if (json.has("autodelete"))
18561      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
18562    if (json.has("_autodelete"))
18563      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
18564    if (json.has("resource"))
18565      res.setResource(parseReference(json.getAsJsonObject("resource")));
18566  }
18567
18568  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18569    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
18570    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
18571    return res;
18572  }
18573
18574  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
18575    parseBackboneProperties(json, res);
18576    if (json.has("name"))
18577      res.setNameElement(parseString(json.get("name").getAsString()));
18578    if (json.has("_name"))
18579      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18580    if (json.has("defaultValue"))
18581      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
18582    if (json.has("_defaultValue"))
18583      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
18584    if (json.has("description"))
18585      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18586    if (json.has("_description"))
18587      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18588    if (json.has("expression"))
18589      res.setExpressionElement(parseString(json.get("expression").getAsString()));
18590    if (json.has("_expression"))
18591      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
18592    if (json.has("headerField"))
18593      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
18594    if (json.has("_headerField"))
18595      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
18596    if (json.has("hint"))
18597      res.setHintElement(parseString(json.get("hint").getAsString()));
18598    if (json.has("_hint"))
18599      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
18600    if (json.has("path"))
18601      res.setPathElement(parseString(json.get("path").getAsString()));
18602    if (json.has("_path"))
18603      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
18604    if (json.has("sourceId"))
18605      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18606    if (json.has("_sourceId"))
18607      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18608  }
18609
18610  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18611    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
18612    parseTestScriptTestScriptRuleComponentProperties(json, owner, res);
18613    return res;
18614  }
18615
18616  protected void parseTestScriptTestScriptRuleComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRuleComponent res) throws IOException, FHIRFormatError {
18617    parseBackboneProperties(json, res);
18618    if (json.has("resource"))
18619      res.setResource(parseReference(json.getAsJsonObject("resource")));
18620    if (json.has("param")) {
18621      JsonArray array = json.getAsJsonArray("param");
18622      for (int i = 0; i < array.size(); i++) {
18623        res.getParam().add(parseTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18624      }
18625    };
18626  }
18627
18628  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18629    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
18630    parseTestScriptRuleParamComponentProperties(json, owner, res);
18631    return res;
18632  }
18633
18634  protected void parseTestScriptRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RuleParamComponent res) throws IOException, FHIRFormatError {
18635    parseBackboneProperties(json, res);
18636    if (json.has("name"))
18637      res.setNameElement(parseString(json.get("name").getAsString()));
18638    if (json.has("_name"))
18639      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18640    if (json.has("value"))
18641      res.setValueElement(parseString(json.get("value").getAsString()));
18642    if (json.has("_value"))
18643      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18644  }
18645
18646  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18647    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
18648    parseTestScriptTestScriptRulesetComponentProperties(json, owner, res);
18649    return res;
18650  }
18651
18652  protected void parseTestScriptTestScriptRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRulesetComponent res) throws IOException, FHIRFormatError {
18653    parseBackboneProperties(json, res);
18654    if (json.has("resource"))
18655      res.setResource(parseReference(json.getAsJsonObject("resource")));
18656    if (json.has("rule")) {
18657      JsonArray array = json.getAsJsonArray("rule");
18658      for (int i = 0; i < array.size(); i++) {
18659        res.getRule().add(parseTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
18660      }
18661    };
18662  }
18663
18664  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18665    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
18666    parseTestScriptRulesetRuleComponentProperties(json, owner, res);
18667    return res;
18668  }
18669
18670  protected void parseTestScriptRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleComponent res) throws IOException, FHIRFormatError {
18671    parseBackboneProperties(json, res);
18672    if (json.has("ruleId"))
18673      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
18674    if (json.has("_ruleId"))
18675      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
18676    if (json.has("param")) {
18677      JsonArray array = json.getAsJsonArray("param");
18678      for (int i = 0; i < array.size(); i++) {
18679        res.getParam().add(parseTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18680      }
18681    };
18682  }
18683
18684  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18685    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
18686    parseTestScriptRulesetRuleParamComponentProperties(json, owner, res);
18687    return res;
18688  }
18689
18690  protected void parseTestScriptRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleParamComponent res) throws IOException, FHIRFormatError {
18691    parseBackboneProperties(json, res);
18692    if (json.has("name"))
18693      res.setNameElement(parseString(json.get("name").getAsString()));
18694    if (json.has("_name"))
18695      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18696    if (json.has("value"))
18697      res.setValueElement(parseString(json.get("value").getAsString()));
18698    if (json.has("_value"))
18699      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18700  }
18701
18702  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18703    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
18704    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
18705    return res;
18706  }
18707
18708  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
18709    parseBackboneProperties(json, res);
18710    if (json.has("action")) {
18711      JsonArray array = json.getAsJsonArray("action");
18712      for (int i = 0; i < array.size(); i++) {
18713        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
18714      }
18715    };
18716  }
18717
18718  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18719    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
18720    parseTestScriptSetupActionComponentProperties(json, owner, res);
18721    return res;
18722  }
18723
18724  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
18725    parseBackboneProperties(json, res);
18726    if (json.has("operation"))
18727      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18728    if (json.has("assert"))
18729      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18730  }
18731
18732  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18733    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
18734    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
18735    return res;
18736  }
18737
18738  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
18739    parseBackboneProperties(json, res);
18740    if (json.has("type"))
18741      res.setType(parseCoding(json.getAsJsonObject("type")));
18742    if (json.has("resource"))
18743      res.setResourceElement(parseCode(json.get("resource").getAsString()));
18744    if (json.has("_resource"))
18745      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
18746    if (json.has("label"))
18747      res.setLabelElement(parseString(json.get("label").getAsString()));
18748    if (json.has("_label"))
18749      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
18750    if (json.has("description"))
18751      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18752    if (json.has("_description"))
18753      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18754    if (json.has("accept"))
18755      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18756    if (json.has("_accept"))
18757      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
18758    if (json.has("contentType"))
18759      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18760    if (json.has("_contentType"))
18761      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
18762    if (json.has("destination"))
18763      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
18764    if (json.has("_destination"))
18765      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
18766    if (json.has("encodeRequestUrl"))
18767      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
18768    if (json.has("_encodeRequestUrl"))
18769      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
18770    if (json.has("origin"))
18771      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
18772    if (json.has("_origin"))
18773      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
18774    if (json.has("params"))
18775      res.setParamsElement(parseString(json.get("params").getAsString()));
18776    if (json.has("_params"))
18777      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
18778    if (json.has("requestHeader")) {
18779      JsonArray array = json.getAsJsonArray("requestHeader");
18780      for (int i = 0; i < array.size(); i++) {
18781        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
18782      }
18783    };
18784    if (json.has("requestId"))
18785      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
18786    if (json.has("_requestId"))
18787      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
18788    if (json.has("responseId"))
18789      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
18790    if (json.has("_responseId"))
18791      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
18792    if (json.has("sourceId"))
18793      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18794    if (json.has("_sourceId"))
18795      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18796    if (json.has("targetId"))
18797      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
18798    if (json.has("_targetId"))
18799      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
18800    if (json.has("url"))
18801      res.setUrlElement(parseString(json.get("url").getAsString()));
18802    if (json.has("_url"))
18803      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18804  }
18805
18806  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18807    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
18808    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
18809    return res;
18810  }
18811
18812  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
18813    parseBackboneProperties(json, res);
18814    if (json.has("field"))
18815      res.setFieldElement(parseString(json.get("field").getAsString()));
18816    if (json.has("_field"))
18817      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
18818    if (json.has("value"))
18819      res.setValueElement(parseString(json.get("value").getAsString()));
18820    if (json.has("_value"))
18821      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18822  }
18823
18824  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18825    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
18826    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
18827    return res;
18828  }
18829
18830  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
18831    parseBackboneProperties(json, res);
18832    if (json.has("label"))
18833      res.setLabelElement(parseString(json.get("label").getAsString()));
18834    if (json.has("_label"))
18835      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
18836    if (json.has("description"))
18837      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18838    if (json.has("_description"))
18839      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18840    if (json.has("direction"))
18841      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
18842    if (json.has("_direction"))
18843      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
18844    if (json.has("compareToSourceId"))
18845      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
18846    if (json.has("_compareToSourceId"))
18847      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
18848    if (json.has("compareToSourceExpression"))
18849      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
18850    if (json.has("_compareToSourceExpression"))
18851      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
18852    if (json.has("compareToSourcePath"))
18853      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
18854    if (json.has("_compareToSourcePath"))
18855      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
18856    if (json.has("contentType"))
18857      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18858    if (json.has("_contentType"))
18859      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
18860    if (json.has("expression"))
18861      res.setExpressionElement(parseString(json.get("expression").getAsString()));
18862    if (json.has("_expression"))
18863      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
18864    if (json.has("headerField"))
18865      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
18866    if (json.has("_headerField"))
18867      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
18868    if (json.has("minimumId"))
18869      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
18870    if (json.has("_minimumId"))
18871      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
18872    if (json.has("navigationLinks"))
18873      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
18874    if (json.has("_navigationLinks"))
18875      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
18876    if (json.has("operator"))
18877      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
18878    if (json.has("_operator"))
18879      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
18880    if (json.has("path"))
18881      res.setPathElement(parseString(json.get("path").getAsString()));
18882    if (json.has("_path"))
18883      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
18884    if (json.has("requestMethod"))
18885      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
18886    if (json.has("_requestMethod"))
18887      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
18888    if (json.has("requestURL"))
18889      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
18890    if (json.has("_requestURL"))
18891      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
18892    if (json.has("resource"))
18893      res.setResourceElement(parseCode(json.get("resource").getAsString()));
18894    if (json.has("_resource"))
18895      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
18896    if (json.has("response"))
18897      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
18898    if (json.has("_response"))
18899      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
18900    if (json.has("responseCode"))
18901      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
18902    if (json.has("_responseCode"))
18903      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
18904    if (json.has("rule"))
18905      res.setRule(parseTestScriptActionAssertRuleComponent(json.getAsJsonObject("rule"), owner));
18906    if (json.has("ruleset"))
18907      res.setRuleset(parseTestScriptActionAssertRulesetComponent(json.getAsJsonObject("ruleset"), owner));
18908    if (json.has("sourceId"))
18909      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18910    if (json.has("_sourceId"))
18911      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18912    if (json.has("validateProfileId"))
18913      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
18914    if (json.has("_validateProfileId"))
18915      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
18916    if (json.has("value"))
18917      res.setValueElement(parseString(json.get("value").getAsString()));
18918    if (json.has("_value"))
18919      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18920    if (json.has("warningOnly"))
18921      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
18922    if (json.has("_warningOnly"))
18923      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
18924  }
18925
18926  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18927    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
18928    parseTestScriptActionAssertRuleComponentProperties(json, owner, res);
18929    return res;
18930  }
18931
18932  protected void parseTestScriptActionAssertRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleComponent res) throws IOException, FHIRFormatError {
18933    parseBackboneProperties(json, res);
18934    if (json.has("ruleId"))
18935      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
18936    if (json.has("_ruleId"))
18937      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
18938    if (json.has("param")) {
18939      JsonArray array = json.getAsJsonArray("param");
18940      for (int i = 0; i < array.size(); i++) {
18941        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18942      }
18943    };
18944  }
18945
18946  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18947    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
18948    parseTestScriptActionAssertRuleParamComponentProperties(json, owner, res);
18949    return res;
18950  }
18951
18952  protected void parseTestScriptActionAssertRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws IOException, FHIRFormatError {
18953    parseBackboneProperties(json, res);
18954    if (json.has("name"))
18955      res.setNameElement(parseString(json.get("name").getAsString()));
18956    if (json.has("_name"))
18957      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18958    if (json.has("value"))
18959      res.setValueElement(parseString(json.get("value").getAsString()));
18960    if (json.has("_value"))
18961      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18962  }
18963
18964  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18965    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
18966    parseTestScriptActionAssertRulesetComponentProperties(json, owner, res);
18967    return res;
18968  }
18969
18970  protected void parseTestScriptActionAssertRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws IOException, FHIRFormatError {
18971    parseBackboneProperties(json, res);
18972    if (json.has("rulesetId"))
18973      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
18974    if (json.has("_rulesetId"))
18975      parseElementProperties(json.getAsJsonObject("_rulesetId"), res.getRulesetIdElement());
18976    if (json.has("rule")) {
18977      JsonArray array = json.getAsJsonArray("rule");
18978      for (int i = 0; i < array.size(); i++) {
18979        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
18980      }
18981    };
18982  }
18983
18984  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18985    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
18986    parseTestScriptActionAssertRulesetRuleComponentProperties(json, owner, res);
18987    return res;
18988  }
18989
18990  protected void parseTestScriptActionAssertRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws IOException, FHIRFormatError {
18991    parseBackboneProperties(json, res);
18992    if (json.has("ruleId"))
18993      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
18994    if (json.has("_ruleId"))
18995      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
18996    if (json.has("param")) {
18997      JsonArray array = json.getAsJsonArray("param");
18998      for (int i = 0; i < array.size(); i++) {
18999        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
19000      }
19001    };
19002  }
19003
19004  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19005    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
19006    parseTestScriptActionAssertRulesetRuleParamComponentProperties(json, owner, res);
19007    return res;
19008  }
19009
19010  protected void parseTestScriptActionAssertRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws IOException, FHIRFormatError {
19011    parseBackboneProperties(json, res);
19012    if (json.has("name"))
19013      res.setNameElement(parseString(json.get("name").getAsString()));
19014    if (json.has("_name"))
19015      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19016    if (json.has("value"))
19017      res.setValueElement(parseString(json.get("value").getAsString()));
19018    if (json.has("_value"))
19019      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19020  }
19021
19022  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19023    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
19024    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
19025    return res;
19026  }
19027
19028  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
19029    parseBackboneProperties(json, res);
19030    if (json.has("name"))
19031      res.setNameElement(parseString(json.get("name").getAsString()));
19032    if (json.has("_name"))
19033      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19034    if (json.has("description"))
19035      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19036    if (json.has("_description"))
19037      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19038    if (json.has("action")) {
19039      JsonArray array = json.getAsJsonArray("action");
19040      for (int i = 0; i < array.size(); i++) {
19041        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
19042      }
19043    };
19044  }
19045
19046  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19047    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
19048    parseTestScriptTestActionComponentProperties(json, owner, res);
19049    return res;
19050  }
19051
19052  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
19053    parseBackboneProperties(json, res);
19054    if (json.has("operation"))
19055      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
19056    if (json.has("assert"))
19057      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
19058  }
19059
19060  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19061    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
19062    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
19063    return res;
19064  }
19065
19066  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
19067    parseBackboneProperties(json, res);
19068    if (json.has("action")) {
19069      JsonArray array = json.getAsJsonArray("action");
19070      for (int i = 0; i < array.size(); i++) {
19071        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
19072      }
19073    };
19074  }
19075
19076  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19077    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
19078    parseTestScriptTeardownActionComponentProperties(json, owner, res);
19079    return res;
19080  }
19081
19082  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
19083    parseBackboneProperties(json, res);
19084    if (json.has("operation"))
19085      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
19086  }
19087
19088  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
19089    ValueSet res = new ValueSet();
19090    parseValueSetProperties(json, res);
19091    return res;
19092  }
19093
19094  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
19095    parseDomainResourceProperties(json, res);
19096    if (json.has("url"))
19097      res.setUrlElement(parseUri(json.get("url").getAsString()));
19098    if (json.has("_url"))
19099      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19100    if (json.has("identifier")) {
19101      JsonArray array = json.getAsJsonArray("identifier");
19102      for (int i = 0; i < array.size(); i++) {
19103        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19104      }
19105    };
19106    if (json.has("version"))
19107      res.setVersionElement(parseString(json.get("version").getAsString()));
19108    if (json.has("_version"))
19109      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19110    if (json.has("name"))
19111      res.setNameElement(parseString(json.get("name").getAsString()));
19112    if (json.has("_name"))
19113      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19114    if (json.has("title"))
19115      res.setTitleElement(parseString(json.get("title").getAsString()));
19116    if (json.has("_title"))
19117      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19118    if (json.has("status"))
19119      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19120    if (json.has("_status"))
19121      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19122    if (json.has("experimental"))
19123      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19124    if (json.has("_experimental"))
19125      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19126    if (json.has("date"))
19127      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19128    if (json.has("_date"))
19129      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19130    if (json.has("publisher"))
19131      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19132    if (json.has("_publisher"))
19133      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19134    if (json.has("contact")) {
19135      JsonArray array = json.getAsJsonArray("contact");
19136      for (int i = 0; i < array.size(); i++) {
19137        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19138      }
19139    };
19140    if (json.has("description"))
19141      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19142    if (json.has("_description"))
19143      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19144    if (json.has("useContext")) {
19145      JsonArray array = json.getAsJsonArray("useContext");
19146      for (int i = 0; i < array.size(); i++) {
19147        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19148      }
19149    };
19150    if (json.has("jurisdiction")) {
19151      JsonArray array = json.getAsJsonArray("jurisdiction");
19152      for (int i = 0; i < array.size(); i++) {
19153        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19154      }
19155    };
19156    if (json.has("immutable"))
19157      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
19158    if (json.has("_immutable"))
19159      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
19160    if (json.has("purpose"))
19161      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19162    if (json.has("_purpose"))
19163      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19164    if (json.has("copyright"))
19165      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19166    if (json.has("_copyright"))
19167      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
19168    if (json.has("extensible"))
19169      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
19170    if (json.has("_extensible"))
19171      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
19172    if (json.has("compose"))
19173      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
19174    if (json.has("expansion"))
19175      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
19176  }
19177
19178  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19179    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
19180    parseValueSetValueSetComposeComponentProperties(json, owner, res);
19181    return res;
19182  }
19183
19184  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
19185    parseBackboneProperties(json, res);
19186    if (json.has("lockedDate"))
19187      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
19188    if (json.has("_lockedDate"))
19189      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
19190    if (json.has("inactive"))
19191      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19192    if (json.has("_inactive"))
19193      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
19194    if (json.has("include")) {
19195      JsonArray array = json.getAsJsonArray("include");
19196      for (int i = 0; i < array.size(); i++) {
19197        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19198      }
19199    };
19200    if (json.has("exclude")) {
19201      JsonArray array = json.getAsJsonArray("exclude");
19202      for (int i = 0; i < array.size(); i++) {
19203        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19204      }
19205    };
19206  }
19207
19208  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19209    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
19210    parseValueSetConceptSetComponentProperties(json, owner, res);
19211    return res;
19212  }
19213
19214  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
19215    parseBackboneProperties(json, res);
19216    if (json.has("system"))
19217      res.setSystemElement(parseUri(json.get("system").getAsString()));
19218    if (json.has("_system"))
19219      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19220    if (json.has("version"))
19221      res.setVersionElement(parseString(json.get("version").getAsString()));
19222    if (json.has("_version"))
19223      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19224    if (json.has("concept")) {
19225      JsonArray array = json.getAsJsonArray("concept");
19226      for (int i = 0; i < array.size(); i++) {
19227        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
19228      }
19229    };
19230    if (json.has("filter")) {
19231      JsonArray array = json.getAsJsonArray("filter");
19232      for (int i = 0; i < array.size(); i++) {
19233        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
19234      }
19235    };
19236    if (json.has("valueSet")) {
19237      JsonArray array = json.getAsJsonArray("valueSet");
19238      for (int i = 0; i < array.size(); i++) {
19239        res.getValueSet().add(parseUri(array.get(i).getAsString()));
19240      }
19241    };
19242    if (json.has("_valueSet")) {
19243      JsonArray array = json.getAsJsonArray("_valueSet");
19244      for (int i = 0; i < array.size(); i++) {
19245        if (i == res.getValueSet().size())
19246          res.getValueSet().add(parseUri(null));
19247        if (array.get(i) instanceof JsonObject) 
19248          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
19249      }
19250    };
19251  }
19252
19253  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19254    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
19255    parseValueSetConceptReferenceComponentProperties(json, owner, res);
19256    return res;
19257  }
19258
19259  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
19260    parseBackboneProperties(json, res);
19261    if (json.has("code"))
19262      res.setCodeElement(parseCode(json.get("code").getAsString()));
19263    if (json.has("_code"))
19264      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19265    if (json.has("display"))
19266      res.setDisplayElement(parseString(json.get("display").getAsString()));
19267    if (json.has("_display"))
19268      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
19269    if (json.has("designation")) {
19270      JsonArray array = json.getAsJsonArray("designation");
19271      for (int i = 0; i < array.size(); i++) {
19272        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19273      }
19274    };
19275  }
19276
19277  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19278    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
19279    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
19280    return res;
19281  }
19282
19283  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
19284    parseBackboneProperties(json, res);
19285    if (json.has("language"))
19286      res.setLanguageElement(parseCode(json.get("language").getAsString()));
19287    if (json.has("_language"))
19288      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
19289    if (json.has("use"))
19290      res.setUse(parseCoding(json.getAsJsonObject("use")));
19291    if (json.has("value"))
19292      res.setValueElement(parseString(json.get("value").getAsString()));
19293    if (json.has("_value"))
19294      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19295  }
19296
19297  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19298    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
19299    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
19300    return res;
19301  }
19302
19303  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
19304    parseBackboneProperties(json, res);
19305    if (json.has("property"))
19306      res.setPropertyElement(parseCode(json.get("property").getAsString()));
19307    if (json.has("_property"))
19308      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
19309    if (json.has("op"))
19310      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
19311    if (json.has("_op"))
19312      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
19313    if (json.has("value"))
19314      res.setValueElement(parseCode(json.get("value").getAsString()));
19315    if (json.has("_value"))
19316      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19317  }
19318
19319  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19320    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
19321    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
19322    return res;
19323  }
19324
19325  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
19326    parseBackboneProperties(json, res);
19327    if (json.has("identifier"))
19328      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
19329    if (json.has("_identifier"))
19330      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
19331    if (json.has("timestamp"))
19332      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
19333    if (json.has("_timestamp"))
19334      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
19335    if (json.has("total"))
19336      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
19337    if (json.has("_total"))
19338      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
19339    if (json.has("offset"))
19340      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
19341    if (json.has("_offset"))
19342      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
19343    if (json.has("parameter")) {
19344      JsonArray array = json.getAsJsonArray("parameter");
19345      for (int i = 0; i < array.size(); i++) {
19346        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
19347      }
19348    };
19349    if (json.has("contains")) {
19350      JsonArray array = json.getAsJsonArray("contains");
19351      for (int i = 0; i < array.size(); i++) {
19352        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19353      }
19354    };
19355  }
19356
19357  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19358    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
19359    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
19360    return res;
19361  }
19362
19363  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
19364    parseBackboneProperties(json, res);
19365    if (json.has("name"))
19366      res.setNameElement(parseString(json.get("name").getAsString()));
19367    if (json.has("_name"))
19368      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19369    Type value = parseType("value", json);
19370    if (value != null)
19371      res.setValue(value);
19372  }
19373
19374  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19375    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
19376    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
19377    return res;
19378  }
19379
19380  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
19381    parseBackboneProperties(json, res);
19382    if (json.has("system"))
19383      res.setSystemElement(parseUri(json.get("system").getAsString()));
19384    if (json.has("_system"))
19385      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19386    if (json.has("abstract"))
19387      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
19388    if (json.has("_abstract"))
19389      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
19390    if (json.has("inactive"))
19391      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19392    if (json.has("_inactive"))
19393      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
19394    if (json.has("version"))
19395      res.setVersionElement(parseString(json.get("version").getAsString()));
19396    if (json.has("_version"))
19397      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19398    if (json.has("code"))
19399      res.setCodeElement(parseCode(json.get("code").getAsString()));
19400    if (json.has("_code"))
19401      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19402    if (json.has("display"))
19403      res.setDisplayElement(parseString(json.get("display").getAsString()));
19404    if (json.has("_display"))
19405      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
19406    if (json.has("designation")) {
19407      JsonArray array = json.getAsJsonArray("designation");
19408      for (int i = 0; i < array.size(); i++) {
19409        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19410      }
19411    };
19412    if (json.has("contains")) {
19413      JsonArray array = json.getAsJsonArray("contains");
19414      for (int i = 0; i < array.size(); i++) {
19415        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19416      }
19417    };
19418  }
19419
19420  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
19421    VisionPrescription res = new VisionPrescription();
19422    parseVisionPrescriptionProperties(json, res);
19423    return res;
19424  }
19425
19426  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
19427    parseDomainResourceProperties(json, res);
19428    if (json.has("identifier")) {
19429      JsonArray array = json.getAsJsonArray("identifier");
19430      for (int i = 0; i < array.size(); i++) {
19431        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19432      }
19433    };
19434    if (json.has("status"))
19435      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
19436    if (json.has("_status"))
19437      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19438    if (json.has("patient"))
19439      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19440    if (json.has("encounter"))
19441      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19442    if (json.has("dateWritten"))
19443      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
19444    if (json.has("_dateWritten"))
19445      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
19446    if (json.has("prescriber"))
19447      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
19448    Type reason = parseType("reason", json);
19449    if (reason != null)
19450      res.setReason(reason);
19451    if (json.has("dispense")) {
19452      JsonArray array = json.getAsJsonArray("dispense");
19453      for (int i = 0; i < array.size(); i++) {
19454        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
19455      }
19456    };
19457  }
19458
19459  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
19460    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
19461    parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(json, owner, res);
19462    return res;
19463  }
19464
19465  protected void parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws IOException, FHIRFormatError {
19466    parseBackboneProperties(json, res);
19467    if (json.has("product"))
19468      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
19469    if (json.has("eye"))
19470      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
19471    if (json.has("_eye"))
19472      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
19473    if (json.has("sphere"))
19474      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
19475    if (json.has("_sphere"))
19476      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
19477    if (json.has("cylinder"))
19478      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
19479    if (json.has("_cylinder"))
19480      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
19481    if (json.has("axis"))
19482      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
19483    if (json.has("_axis"))
19484      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
19485    if (json.has("prism"))
19486      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
19487    if (json.has("_prism"))
19488      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
19489    if (json.has("base"))
19490      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
19491    if (json.has("_base"))
19492      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
19493    if (json.has("add"))
19494      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
19495    if (json.has("_add"))
19496      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
19497    if (json.has("power"))
19498      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
19499    if (json.has("_power"))
19500      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
19501    if (json.has("backCurve"))
19502      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
19503    if (json.has("_backCurve"))
19504      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
19505    if (json.has("diameter"))
19506      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
19507    if (json.has("_diameter"))
19508      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
19509    if (json.has("duration"))
19510      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
19511    if (json.has("color"))
19512      res.setColorElement(parseString(json.get("color").getAsString()));
19513    if (json.has("_color"))
19514      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
19515    if (json.has("brand"))
19516      res.setBrandElement(parseString(json.get("brand").getAsString()));
19517    if (json.has("_brand"))
19518      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
19519    if (json.has("note")) {
19520      JsonArray array = json.getAsJsonArray("note");
19521      for (int i = 0; i < array.size(); i++) {
19522        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19523      }
19524    };
19525  }
19526
19527  @Override
19528  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
19529    String t = json.get("resourceType").getAsString();
19530    if (Utilities.noString(t))
19531      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
19532    if (t.equals("Parameters"))
19533      return parseParameters(json);
19534    else if (t.equals("Account"))
19535      return parseAccount(json);
19536    else if (t.equals("ActivityDefinition"))
19537      return parseActivityDefinition(json);
19538    else if (t.equals("AdverseEvent"))
19539      return parseAdverseEvent(json);
19540    else if (t.equals("AllergyIntolerance"))
19541      return parseAllergyIntolerance(json);
19542    else if (t.equals("Appointment"))
19543      return parseAppointment(json);
19544    else if (t.equals("AppointmentResponse"))
19545      return parseAppointmentResponse(json);
19546    else if (t.equals("AuditEvent"))
19547      return parseAuditEvent(json);
19548    else if (t.equals("Basic"))
19549      return parseBasic(json);
19550    else if (t.equals("Binary"))
19551      return parseBinary(json);
19552    else if (t.equals("BodySite"))
19553      return parseBodySite(json);
19554    else if (t.equals("Bundle"))
19555      return parseBundle(json);
19556    else if (t.equals("CapabilityStatement"))
19557      return parseCapabilityStatement(json);
19558    else if (t.equals("CarePlan"))
19559      return parseCarePlan(json);
19560    else if (t.equals("CareTeam"))
19561      return parseCareTeam(json);
19562    else if (t.equals("ChargeItem"))
19563      return parseChargeItem(json);
19564    else if (t.equals("Claim"))
19565      return parseClaim(json);
19566    else if (t.equals("ClaimResponse"))
19567      return parseClaimResponse(json);
19568    else if (t.equals("ClinicalImpression"))
19569      return parseClinicalImpression(json);
19570    else if (t.equals("CodeSystem"))
19571      return parseCodeSystem(json);
19572    else if (t.equals("Communication"))
19573      return parseCommunication(json);
19574    else if (t.equals("CommunicationRequest"))
19575      return parseCommunicationRequest(json);
19576    else if (t.equals("CompartmentDefinition"))
19577      return parseCompartmentDefinition(json);
19578    else if (t.equals("Composition"))
19579      return parseComposition(json);
19580    else if (t.equals("ConceptMap"))
19581      return parseConceptMap(json);
19582    else if (t.equals("Condition"))
19583      return parseCondition(json);
19584    else if (t.equals("Consent"))
19585      return parseConsent(json);
19586    else if (t.equals("Contract"))
19587      return parseContract(json);
19588    else if (t.equals("Coverage"))
19589      return parseCoverage(json);
19590    else if (t.equals("DataElement"))
19591      return parseDataElement(json);
19592    else if (t.equals("DetectedIssue"))
19593      return parseDetectedIssue(json);
19594    else if (t.equals("Device"))
19595      return parseDevice(json);
19596    else if (t.equals("DeviceComponent"))
19597      return parseDeviceComponent(json);
19598    else if (t.equals("DeviceMetric"))
19599      return parseDeviceMetric(json);
19600    else if (t.equals("DeviceRequest"))
19601      return parseDeviceRequest(json);
19602    else if (t.equals("DeviceUseStatement"))
19603      return parseDeviceUseStatement(json);
19604    else if (t.equals("DiagnosticReport"))
19605      return parseDiagnosticReport(json);
19606    else if (t.equals("DocumentManifest"))
19607      return parseDocumentManifest(json);
19608    else if (t.equals("DocumentReference"))
19609      return parseDocumentReference(json);
19610    else if (t.equals("EligibilityRequest"))
19611      return parseEligibilityRequest(json);
19612    else if (t.equals("EligibilityResponse"))
19613      return parseEligibilityResponse(json);
19614    else if (t.equals("Encounter"))
19615      return parseEncounter(json);
19616    else if (t.equals("Endpoint"))
19617      return parseEndpoint(json);
19618    else if (t.equals("EnrollmentRequest"))
19619      return parseEnrollmentRequest(json);
19620    else if (t.equals("EnrollmentResponse"))
19621      return parseEnrollmentResponse(json);
19622    else if (t.equals("EpisodeOfCare"))
19623      return parseEpisodeOfCare(json);
19624    else if (t.equals("ExpansionProfile"))
19625      return parseExpansionProfile(json);
19626    else if (t.equals("ExplanationOfBenefit"))
19627      return parseExplanationOfBenefit(json);
19628    else if (t.equals("FamilyMemberHistory"))
19629      return parseFamilyMemberHistory(json);
19630    else if (t.equals("Flag"))
19631      return parseFlag(json);
19632    else if (t.equals("Goal"))
19633      return parseGoal(json);
19634    else if (t.equals("GraphDefinition"))
19635      return parseGraphDefinition(json);
19636    else if (t.equals("Group"))
19637      return parseGroup(json);
19638    else if (t.equals("GuidanceResponse"))
19639      return parseGuidanceResponse(json);
19640    else if (t.equals("HealthcareService"))
19641      return parseHealthcareService(json);
19642    else if (t.equals("ImagingManifest"))
19643      return parseImagingManifest(json);
19644    else if (t.equals("ImagingStudy"))
19645      return parseImagingStudy(json);
19646    else if (t.equals("Immunization"))
19647      return parseImmunization(json);
19648    else if (t.equals("ImmunizationRecommendation"))
19649      return parseImmunizationRecommendation(json);
19650    else if (t.equals("ImplementationGuide"))
19651      return parseImplementationGuide(json);
19652    else if (t.equals("Library"))
19653      return parseLibrary(json);
19654    else if (t.equals("Linkage"))
19655      return parseLinkage(json);
19656    else if (t.equals("List"))
19657      return parseListResource(json);
19658    else if (t.equals("Location"))
19659      return parseLocation(json);
19660    else if (t.equals("Measure"))
19661      return parseMeasure(json);
19662    else if (t.equals("MeasureReport"))
19663      return parseMeasureReport(json);
19664    else if (t.equals("Media"))
19665      return parseMedia(json);
19666    else if (t.equals("Medication"))
19667      return parseMedication(json);
19668    else if (t.equals("MedicationAdministration"))
19669      return parseMedicationAdministration(json);
19670    else if (t.equals("MedicationDispense"))
19671      return parseMedicationDispense(json);
19672    else if (t.equals("MedicationRequest"))
19673      return parseMedicationRequest(json);
19674    else if (t.equals("MedicationStatement"))
19675      return parseMedicationStatement(json);
19676    else if (t.equals("MessageDefinition"))
19677      return parseMessageDefinition(json);
19678    else if (t.equals("MessageHeader"))
19679      return parseMessageHeader(json);
19680    else if (t.equals("NamingSystem"))
19681      return parseNamingSystem(json);
19682    else if (t.equals("NutritionOrder"))
19683      return parseNutritionOrder(json);
19684    else if (t.equals("Observation"))
19685      return parseObservation(json);
19686    else if (t.equals("OperationDefinition"))
19687      return parseOperationDefinition(json);
19688    else if (t.equals("OperationOutcome"))
19689      return parseOperationOutcome(json);
19690    else if (t.equals("Organization"))
19691      return parseOrganization(json);
19692    else if (t.equals("Patient"))
19693      return parsePatient(json);
19694    else if (t.equals("PaymentNotice"))
19695      return parsePaymentNotice(json);
19696    else if (t.equals("PaymentReconciliation"))
19697      return parsePaymentReconciliation(json);
19698    else if (t.equals("Person"))
19699      return parsePerson(json);
19700    else if (t.equals("PlanDefinition"))
19701      return parsePlanDefinition(json);
19702    else if (t.equals("Practitioner"))
19703      return parsePractitioner(json);
19704    else if (t.equals("PractitionerRole"))
19705      return parsePractitionerRole(json);
19706    else if (t.equals("Procedure"))
19707      return parseProcedure(json);
19708    else if (t.equals("ProcedureRequest"))
19709      return parseProcedureRequest(json);
19710    else if (t.equals("ProcessRequest"))
19711      return parseProcessRequest(json);
19712    else if (t.equals("ProcessResponse"))
19713      return parseProcessResponse(json);
19714    else if (t.equals("Provenance"))
19715      return parseProvenance(json);
19716    else if (t.equals("Questionnaire"))
19717      return parseQuestionnaire(json);
19718    else if (t.equals("QuestionnaireResponse"))
19719      return parseQuestionnaireResponse(json);
19720    else if (t.equals("ReferralRequest"))
19721      return parseReferralRequest(json);
19722    else if (t.equals("RelatedPerson"))
19723      return parseRelatedPerson(json);
19724    else if (t.equals("RequestGroup"))
19725      return parseRequestGroup(json);
19726    else if (t.equals("ResearchStudy"))
19727      return parseResearchStudy(json);
19728    else if (t.equals("ResearchSubject"))
19729      return parseResearchSubject(json);
19730    else if (t.equals("RiskAssessment"))
19731      return parseRiskAssessment(json);
19732    else if (t.equals("Schedule"))
19733      return parseSchedule(json);
19734    else if (t.equals("SearchParameter"))
19735      return parseSearchParameter(json);
19736    else if (t.equals("Sequence"))
19737      return parseSequence(json);
19738    else if (t.equals("ServiceDefinition"))
19739      return parseServiceDefinition(json);
19740    else if (t.equals("Slot"))
19741      return parseSlot(json);
19742    else if (t.equals("Specimen"))
19743      return parseSpecimen(json);
19744    else if (t.equals("StructureDefinition"))
19745      return parseStructureDefinition(json);
19746    else if (t.equals("StructureMap"))
19747      return parseStructureMap(json);
19748    else if (t.equals("Subscription"))
19749      return parseSubscription(json);
19750    else if (t.equals("Substance"))
19751      return parseSubstance(json);
19752    else if (t.equals("SupplyDelivery"))
19753      return parseSupplyDelivery(json);
19754    else if (t.equals("SupplyRequest"))
19755      return parseSupplyRequest(json);
19756    else if (t.equals("Task"))
19757      return parseTask(json);
19758    else if (t.equals("TestReport"))
19759      return parseTestReport(json);
19760    else if (t.equals("TestScript"))
19761      return parseTestScript(json);
19762    else if (t.equals("ValueSet"))
19763      return parseValueSet(json);
19764    else if (t.equals("VisionPrescription"))
19765      return parseVisionPrescription(json);
19766    else if (t.equals("Binary"))
19767      return parseBinary(json);
19768    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
19769  }
19770
19771  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
19772    if (json.has(prefix+"Reference"))
19773      return parseReference(json.getAsJsonObject(prefix+"Reference"));
19774    else if (json.has(prefix+"Quantity"))
19775      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
19776    else if (json.has(prefix+"Period"))
19777      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
19778    else if (json.has(prefix+"Attachment"))
19779      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
19780    else if (json.has(prefix+"Duration"))
19781      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
19782    else if (json.has(prefix+"Count"))
19783      return parseCount(json.getAsJsonObject(prefix+"Count"));
19784    else if (json.has(prefix+"Range"))
19785      return parseRange(json.getAsJsonObject(prefix+"Range"));
19786    else if (json.has(prefix+"Annotation"))
19787      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
19788    else if (json.has(prefix+"Money"))
19789      return parseMoney(json.getAsJsonObject(prefix+"Money"));
19790    else if (json.has(prefix+"Identifier"))
19791      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
19792    else if (json.has(prefix+"Coding"))
19793      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
19794    else if (json.has(prefix+"Signature"))
19795      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
19796    else if (json.has(prefix+"SampledData"))
19797      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
19798    else if (json.has(prefix+"Ratio"))
19799      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
19800    else if (json.has(prefix+"Distance"))
19801      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
19802    else if (json.has(prefix+"Age"))
19803      return parseAge(json.getAsJsonObject(prefix+"Age"));
19804    else if (json.has(prefix+"CodeableConcept"))
19805      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
19806    else if (json.has(prefix+"SimpleQuantity"))
19807      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
19808    else if (json.has(prefix+"Meta"))
19809      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
19810    else if (json.has(prefix+"Address"))
19811      return parseAddress(json.getAsJsonObject(prefix+"Address"));
19812    else if (json.has(prefix+"TriggerDefinition"))
19813      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
19814    else if (json.has(prefix+"Contributor"))
19815      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
19816    else if (json.has(prefix+"DataRequirement"))
19817      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
19818    else if (json.has(prefix+"Dosage"))
19819      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
19820    else if (json.has(prefix+"RelatedArtifact"))
19821      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
19822    else if (json.has(prefix+"ContactDetail"))
19823      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
19824    else if (json.has(prefix+"HumanName"))
19825      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
19826    else if (json.has(prefix+"ContactPoint"))
19827      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
19828    else if (json.has(prefix+"UsageContext"))
19829      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
19830    else if (json.has(prefix+"Timing"))
19831      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
19832    else if (json.has(prefix+"ElementDefinition"))
19833      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
19834    else if (json.has(prefix+"ParameterDefinition"))
19835      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
19836    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
19837      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
19838      if (json.has("_"+prefix+"Date"))
19839        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
19840      return t;
19841    }
19842    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
19843      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
19844      if (json.has("_"+prefix+"DateTime"))
19845        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
19846      return t;
19847    }
19848    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
19849      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
19850      if (json.has("_"+prefix+"Code"))
19851        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
19852      return t;
19853    }
19854    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
19855      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
19856      if (json.has("_"+prefix+"String"))
19857        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
19858      return t;
19859    }
19860    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
19861      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
19862      if (json.has("_"+prefix+"Integer"))
19863        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
19864      return t;
19865    }
19866    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
19867      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
19868      if (json.has("_"+prefix+"Oid"))
19869        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
19870      return t;
19871    }
19872    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
19873      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
19874      if (json.has("_"+prefix+"Uri"))
19875        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
19876      return t;
19877    }
19878    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
19879      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
19880      if (json.has("_"+prefix+"Uuid"))
19881        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
19882      return t;
19883    }
19884    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
19885      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
19886      if (json.has("_"+prefix+"Instant"))
19887        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
19888      return t;
19889    }
19890    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
19891      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
19892      if (json.has("_"+prefix+"Boolean"))
19893        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
19894      return t;
19895    }
19896    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
19897      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
19898      if (json.has("_"+prefix+"Base64Binary"))
19899        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
19900      return t;
19901    }
19902    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
19903      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
19904      if (json.has("_"+prefix+"UnsignedInt"))
19905        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
19906      return t;
19907    }
19908    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
19909      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
19910      if (json.has("_"+prefix+"Markdown"))
19911        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
19912      return t;
19913    }
19914    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
19915      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
19916      if (json.has("_"+prefix+"Time"))
19917        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
19918      return t;
19919    }
19920    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
19921      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
19922      if (json.has("_"+prefix+"Id"))
19923        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
19924      return t;
19925    }
19926    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
19927      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
19928      if (json.has("_"+prefix+"PositiveInt"))
19929        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
19930      return t;
19931    }
19932    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
19933      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
19934      if (json.has("_"+prefix+"Decimal"))
19935        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
19936      return t;
19937    }
19938    return null;
19939  }
19940
19941  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
19942    if (type.equals("Reference"))
19943      return parseReference(json);
19944    else if (type.equals("Quantity"))
19945      return parseQuantity(json);
19946    else if (type.equals("Period"))
19947      return parsePeriod(json);
19948    else if (type.equals("Attachment"))
19949      return parseAttachment(json);
19950    else if (type.equals("Duration"))
19951      return parseDuration(json);
19952    else if (type.equals("Count"))
19953      return parseCount(json);
19954    else if (type.equals("Range"))
19955      return parseRange(json);
19956    else if (type.equals("Annotation"))
19957      return parseAnnotation(json);
19958    else if (type.equals("Money"))
19959      return parseMoney(json);
19960    else if (type.equals("Identifier"))
19961      return parseIdentifier(json);
19962    else if (type.equals("Coding"))
19963      return parseCoding(json);
19964    else if (type.equals("Signature"))
19965      return parseSignature(json);
19966    else if (type.equals("SampledData"))
19967      return parseSampledData(json);
19968    else if (type.equals("Ratio"))
19969      return parseRatio(json);
19970    else if (type.equals("Distance"))
19971      return parseDistance(json);
19972    else if (type.equals("Age"))
19973      return parseAge(json);
19974    else if (type.equals("CodeableConcept"))
19975      return parseCodeableConcept(json);
19976    else if (type.equals("SimpleQuantity"))
19977      return parseSimpleQuantity(json);
19978    else if (type.equals("Meta"))
19979      return parseMeta(json);
19980    else if (type.equals("Address"))
19981      return parseAddress(json);
19982    else if (type.equals("TriggerDefinition"))
19983      return parseTriggerDefinition(json);
19984    else if (type.equals("Contributor"))
19985      return parseContributor(json);
19986    else if (type.equals("DataRequirement"))
19987      return parseDataRequirement(json);
19988    else if (type.equals("Dosage"))
19989      return parseDosage(json);
19990    else if (type.equals("RelatedArtifact"))
19991      return parseRelatedArtifact(json);
19992    else if (type.equals("ContactDetail"))
19993      return parseContactDetail(json);
19994    else if (type.equals("HumanName"))
19995      return parseHumanName(json);
19996    else if (type.equals("ContactPoint"))
19997      return parseContactPoint(json);
19998    else if (type.equals("UsageContext"))
19999      return parseUsageContext(json);
20000    else if (type.equals("Timing"))
20001      return parseTiming(json);
20002    else if (type.equals("ElementDefinition"))
20003      return parseElementDefinition(json);
20004    else if (type.equals("ParameterDefinition"))
20005      return parseParameterDefinition(json);
20006    throw new FHIRFormatError("Unknown Type "+type);
20007  }
20008
20009  protected boolean hasTypeName(JsonObject json, String prefix) {
20010        if (json.has(prefix+"Reference"))
20011      return true;
20012    if (json.has(prefix+"Quantity"))
20013      return true;
20014    if (json.has(prefix+"Period"))
20015      return true;
20016    if (json.has(prefix+"Attachment"))
20017      return true;
20018    if (json.has(prefix+"Duration"))
20019      return true;
20020    if (json.has(prefix+"Count"))
20021      return true;
20022    if (json.has(prefix+"Range"))
20023      return true;
20024    if (json.has(prefix+"Annotation"))
20025      return true;
20026    if (json.has(prefix+"Money"))
20027      return true;
20028    if (json.has(prefix+"Identifier"))
20029      return true;
20030    if (json.has(prefix+"Coding"))
20031      return true;
20032    if (json.has(prefix+"Signature"))
20033      return true;
20034    if (json.has(prefix+"SampledData"))
20035      return true;
20036    if (json.has(prefix+"Ratio"))
20037      return true;
20038    if (json.has(prefix+"Distance"))
20039      return true;
20040    if (json.has(prefix+"Age"))
20041      return true;
20042    if (json.has(prefix+"CodeableConcept"))
20043      return true;
20044    if (json.has(prefix+"SimpleQuantity"))
20045      return true;
20046    if (json.has(prefix+"Meta"))
20047      return true;
20048    if (json.has(prefix+"Address"))
20049      return true;
20050    if (json.has(prefix+"TriggerDefinition"))
20051      return true;
20052    if (json.has(prefix+"Contributor"))
20053      return true;
20054    if (json.has(prefix+"DataRequirement"))
20055      return true;
20056    if (json.has(prefix+"Dosage"))
20057      return true;
20058    if (json.has(prefix+"RelatedArtifact"))
20059      return true;
20060    if (json.has(prefix+"ContactDetail"))
20061      return true;
20062    if (json.has(prefix+"HumanName"))
20063      return true;
20064    if (json.has(prefix+"ContactPoint"))
20065      return true;
20066    if (json.has(prefix+"UsageContext"))
20067      return true;
20068    if (json.has(prefix+"Timing"))
20069      return true;
20070    if (json.has(prefix+"ElementDefinition"))
20071      return true;
20072    if (json.has(prefix+"ParameterDefinition"))
20073      return true;
20074    if (json.has(prefix+"Parameters"))
20075      return true;
20076    if (json.has(prefix+"Account"))
20077      return true;
20078    if (json.has(prefix+"ActivityDefinition"))
20079      return true;
20080    if (json.has(prefix+"AdverseEvent"))
20081      return true;
20082    if (json.has(prefix+"AllergyIntolerance"))
20083      return true;
20084    if (json.has(prefix+"Appointment"))
20085      return true;
20086    if (json.has(prefix+"AppointmentResponse"))
20087      return true;
20088    if (json.has(prefix+"AuditEvent"))
20089      return true;
20090    if (json.has(prefix+"Basic"))
20091      return true;
20092    if (json.has(prefix+"Binary"))
20093      return true;
20094    if (json.has(prefix+"BodySite"))
20095      return true;
20096    if (json.has(prefix+"Bundle"))
20097      return true;
20098    if (json.has(prefix+"CapabilityStatement"))
20099      return true;
20100    if (json.has(prefix+"CarePlan"))
20101      return true;
20102    if (json.has(prefix+"CareTeam"))
20103      return true;
20104    if (json.has(prefix+"ChargeItem"))
20105      return true;
20106    if (json.has(prefix+"Claim"))
20107      return true;
20108    if (json.has(prefix+"ClaimResponse"))
20109      return true;
20110    if (json.has(prefix+"ClinicalImpression"))
20111      return true;
20112    if (json.has(prefix+"CodeSystem"))
20113      return true;
20114    if (json.has(prefix+"Communication"))
20115      return true;
20116    if (json.has(prefix+"CommunicationRequest"))
20117      return true;
20118    if (json.has(prefix+"CompartmentDefinition"))
20119      return true;
20120    if (json.has(prefix+"Composition"))
20121      return true;
20122    if (json.has(prefix+"ConceptMap"))
20123      return true;
20124    if (json.has(prefix+"Condition"))
20125      return true;
20126    if (json.has(prefix+"Consent"))
20127      return true;
20128    if (json.has(prefix+"Contract"))
20129      return true;
20130    if (json.has(prefix+"Coverage"))
20131      return true;
20132    if (json.has(prefix+"DataElement"))
20133      return true;
20134    if (json.has(prefix+"DetectedIssue"))
20135      return true;
20136    if (json.has(prefix+"Device"))
20137      return true;
20138    if (json.has(prefix+"DeviceComponent"))
20139      return true;
20140    if (json.has(prefix+"DeviceMetric"))
20141      return true;
20142    if (json.has(prefix+"DeviceRequest"))
20143      return true;
20144    if (json.has(prefix+"DeviceUseStatement"))
20145      return true;
20146    if (json.has(prefix+"DiagnosticReport"))
20147      return true;
20148    if (json.has(prefix+"DocumentManifest"))
20149      return true;
20150    if (json.has(prefix+"DocumentReference"))
20151      return true;
20152    if (json.has(prefix+"EligibilityRequest"))
20153      return true;
20154    if (json.has(prefix+"EligibilityResponse"))
20155      return true;
20156    if (json.has(prefix+"Encounter"))
20157      return true;
20158    if (json.has(prefix+"Endpoint"))
20159      return true;
20160    if (json.has(prefix+"EnrollmentRequest"))
20161      return true;
20162    if (json.has(prefix+"EnrollmentResponse"))
20163      return true;
20164    if (json.has(prefix+"EpisodeOfCare"))
20165      return true;
20166    if (json.has(prefix+"ExpansionProfile"))
20167      return true;
20168    if (json.has(prefix+"ExplanationOfBenefit"))
20169      return true;
20170    if (json.has(prefix+"FamilyMemberHistory"))
20171      return true;
20172    if (json.has(prefix+"Flag"))
20173      return true;
20174    if (json.has(prefix+"Goal"))
20175      return true;
20176    if (json.has(prefix+"GraphDefinition"))
20177      return true;
20178    if (json.has(prefix+"Group"))
20179      return true;
20180    if (json.has(prefix+"GuidanceResponse"))
20181      return true;
20182    if (json.has(prefix+"HealthcareService"))
20183      return true;
20184    if (json.has(prefix+"ImagingManifest"))
20185      return true;
20186    if (json.has(prefix+"ImagingStudy"))
20187      return true;
20188    if (json.has(prefix+"Immunization"))
20189      return true;
20190    if (json.has(prefix+"ImmunizationRecommendation"))
20191      return true;
20192    if (json.has(prefix+"ImplementationGuide"))
20193      return true;
20194    if (json.has(prefix+"Library"))
20195      return true;
20196    if (json.has(prefix+"Linkage"))
20197      return true;
20198    if (json.has(prefix+"List"))
20199      return true;
20200    if (json.has(prefix+"Location"))
20201      return true;
20202    if (json.has(prefix+"Measure"))
20203      return true;
20204    if (json.has(prefix+"MeasureReport"))
20205      return true;
20206    if (json.has(prefix+"Media"))
20207      return true;
20208    if (json.has(prefix+"Medication"))
20209      return true;
20210    if (json.has(prefix+"MedicationAdministration"))
20211      return true;
20212    if (json.has(prefix+"MedicationDispense"))
20213      return true;
20214    if (json.has(prefix+"MedicationRequest"))
20215      return true;
20216    if (json.has(prefix+"MedicationStatement"))
20217      return true;
20218    if (json.has(prefix+"MessageDefinition"))
20219      return true;
20220    if (json.has(prefix+"MessageHeader"))
20221      return true;
20222    if (json.has(prefix+"NamingSystem"))
20223      return true;
20224    if (json.has(prefix+"NutritionOrder"))
20225      return true;
20226    if (json.has(prefix+"Observation"))
20227      return true;
20228    if (json.has(prefix+"OperationDefinition"))
20229      return true;
20230    if (json.has(prefix+"OperationOutcome"))
20231      return true;
20232    if (json.has(prefix+"Organization"))
20233      return true;
20234    if (json.has(prefix+"Patient"))
20235      return true;
20236    if (json.has(prefix+"PaymentNotice"))
20237      return true;
20238    if (json.has(prefix+"PaymentReconciliation"))
20239      return true;
20240    if (json.has(prefix+"Person"))
20241      return true;
20242    if (json.has(prefix+"PlanDefinition"))
20243      return true;
20244    if (json.has(prefix+"Practitioner"))
20245      return true;
20246    if (json.has(prefix+"PractitionerRole"))
20247      return true;
20248    if (json.has(prefix+"Procedure"))
20249      return true;
20250    if (json.has(prefix+"ProcedureRequest"))
20251      return true;
20252    if (json.has(prefix+"ProcessRequest"))
20253      return true;
20254    if (json.has(prefix+"ProcessResponse"))
20255      return true;
20256    if (json.has(prefix+"Provenance"))
20257      return true;
20258    if (json.has(prefix+"Questionnaire"))
20259      return true;
20260    if (json.has(prefix+"QuestionnaireResponse"))
20261      return true;
20262    if (json.has(prefix+"ReferralRequest"))
20263      return true;
20264    if (json.has(prefix+"RelatedPerson"))
20265      return true;
20266    if (json.has(prefix+"RequestGroup"))
20267      return true;
20268    if (json.has(prefix+"ResearchStudy"))
20269      return true;
20270    if (json.has(prefix+"ResearchSubject"))
20271      return true;
20272    if (json.has(prefix+"RiskAssessment"))
20273      return true;
20274    if (json.has(prefix+"Schedule"))
20275      return true;
20276    if (json.has(prefix+"SearchParameter"))
20277      return true;
20278    if (json.has(prefix+"Sequence"))
20279      return true;
20280    if (json.has(prefix+"ServiceDefinition"))
20281      return true;
20282    if (json.has(prefix+"Slot"))
20283      return true;
20284    if (json.has(prefix+"Specimen"))
20285      return true;
20286    if (json.has(prefix+"StructureDefinition"))
20287      return true;
20288    if (json.has(prefix+"StructureMap"))
20289      return true;
20290    if (json.has(prefix+"Subscription"))
20291      return true;
20292    if (json.has(prefix+"Substance"))
20293      return true;
20294    if (json.has(prefix+"SupplyDelivery"))
20295      return true;
20296    if (json.has(prefix+"SupplyRequest"))
20297      return true;
20298    if (json.has(prefix+"Task"))
20299      return true;
20300    if (json.has(prefix+"TestReport"))
20301      return true;
20302    if (json.has(prefix+"TestScript"))
20303      return true;
20304    if (json.has(prefix+"ValueSet"))
20305      return true;
20306    if (json.has(prefix+"VisionPrescription"))
20307      return true;
20308    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
20309      return true;
20310    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
20311      return true;
20312    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
20313      return true;
20314    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
20315      return true;
20316    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
20317      return true;
20318    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
20319      return true;
20320    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
20321      return true;
20322    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
20323      return true;
20324    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
20325      return true;
20326    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
20327      return true;
20328    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
20329      return true;
20330    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
20331      return true;
20332    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
20333      return true;
20334    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
20335      return true;
20336    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
20337      return true;
20338    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
20339      return true;
20340    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
20341      return true;
20342    return false;
20343  }
20344  protected void composeElement(Element element) throws IOException {
20345    if (element.hasId())
20346      prop("id", element.getId());
20347      if (makeComments(element)) {
20348        openArray("fhir_comments");
20349        for (String s : element.getFormatCommentsPre())
20350          prop(null,  s);
20351        for (String s : element.getFormatCommentsPost())
20352          prop(null,  s);
20353         closeArray();
20354      }
20355    if (element.hasExtension()) {
20356      openArray("extension");
20357      for (Extension e : element.getExtension())
20358        composeExtension(null, e);
20359      closeArray();
20360    }
20361  }
20362
20363  protected void composeBackbone(BackboneElement element) throws IOException {
20364    composeElement(element);
20365    if (element.hasModifierExtension()) {
20366      openArray("modifierExtension");
20367      for (Extension e : element.getModifierExtension())
20368        composeExtension(null, e);
20369      closeArray();
20370    }
20371  }
20372
20373  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20374    if (value != null && value.getValue() != null) {
20375      prop(name, e.toCode(value.getValue()));
20376    } else if (inArray)   
20377      writeNull(name);
20378  }    
20379
20380  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20381    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20382      open(inArray ? null : "_"+name);
20383      composeElement(value);
20384      close();
20385    } else if (inArray)   
20386      writeNull(name);
20387  }    
20388
20389  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
20390    if (value != null && value.hasValue()) {
20391        prop(name, value.asStringValue());
20392    }    
20393    else if (inArray) 
20394      writeNull(name); 
20395  }    
20396
20397  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
20398    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20399      open(inArray ? null : "_"+name);
20400      composeElement(value);
20401      close();
20402    }
20403    else if (inArray) 
20404      writeNull(name); 
20405  }
20406
20407  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
20408    if (value != null && value.hasValue()) {
20409        prop(name, value.asStringValue());
20410    }    
20411    else if (inArray) 
20412      writeNull(name); 
20413  }    
20414
20415  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
20416    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20417      open(inArray ? null : "_"+name);
20418      composeElement(value);
20419      close();
20420    }
20421    else if (inArray) 
20422      writeNull(name); 
20423  }
20424
20425  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
20426    if (value != null && value.hasValue()) {
20427        prop(name, toString(value.getValue()));
20428    }    
20429    else if (inArray) 
20430      writeNull(name); 
20431  }    
20432
20433  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
20434    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20435      open(inArray ? null : "_"+name);
20436      composeElement(value);
20437      close();
20438    }
20439    else if (inArray) 
20440      writeNull(name); 
20441  }
20442
20443  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
20444    if (value != null && value.hasValue()) {
20445        prop(name, toString(value.getValue()));
20446    }    
20447    else if (inArray) 
20448      writeNull(name); 
20449  }    
20450
20451  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
20452    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20453      open(inArray ? null : "_"+name);
20454      composeElement(value);
20455      close();
20456    }
20457    else if (inArray) 
20458      writeNull(name); 
20459  }
20460
20461  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
20462    if (value != null && value.hasValue()) {
20463        prop(name, Integer.valueOf(value.getValue()));
20464    }    
20465    else if (inArray) 
20466      writeNull(name); 
20467  }    
20468
20469  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
20470    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20471      open(inArray ? null : "_"+name);
20472      composeElement(value);
20473      close();
20474    }
20475    else if (inArray) 
20476      writeNull(name); 
20477  }
20478
20479  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
20480    if (value != null && value.hasValue()) {
20481        prop(name, toString(value.getValue()));
20482    }    
20483    else if (inArray) 
20484      writeNull(name); 
20485  }    
20486
20487  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
20488    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20489      open(inArray ? null : "_"+name);
20490      composeElement(value);
20491      close();
20492    }
20493    else if (inArray) 
20494      writeNull(name); 
20495  }
20496
20497  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
20498    if (value != null && value.hasValue()) {
20499        prop(name, toString(value.getValue()));
20500    }    
20501    else if (inArray) 
20502      writeNull(name); 
20503  }    
20504
20505  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
20506    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20507      open(inArray ? null : "_"+name);
20508      composeElement(value);
20509      close();
20510    }
20511    else if (inArray) 
20512      writeNull(name); 
20513  }
20514
20515  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
20516    if (value != null && value.hasValue()) {
20517        prop(name, toString(value.getValue()));
20518    }    
20519    else if (inArray) 
20520      writeNull(name); 
20521  }    
20522
20523  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
20524    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20525      open(inArray ? null : "_"+name);
20526      composeElement(value);
20527      close();
20528    }
20529    else if (inArray) 
20530      writeNull(name); 
20531  }
20532
20533  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
20534    if (value != null && value.hasValue()) {
20535        prop(name, value.asStringValue());
20536    }    
20537    else if (inArray) 
20538      writeNull(name); 
20539  }    
20540
20541  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
20542    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20543      open(inArray ? null : "_"+name);
20544      composeElement(value);
20545      close();
20546    }
20547    else if (inArray) 
20548      writeNull(name); 
20549  }
20550
20551  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
20552    if (value != null && value.hasValue()) {
20553        prop(name, value.getValue());
20554    }    
20555    else if (inArray) 
20556      writeNull(name); 
20557  }    
20558
20559  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
20560    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20561      open(inArray ? null : "_"+name);
20562      composeElement(value);
20563      close();
20564    }
20565    else if (inArray) 
20566      writeNull(name); 
20567  }
20568
20569  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
20570    if (value != null && value.hasValue()) {
20571        prop(name, toString(value.getValue()));
20572    }    
20573    else if (inArray) 
20574      writeNull(name); 
20575  }    
20576
20577  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
20578    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20579      open(inArray ? null : "_"+name);
20580      composeElement(value);
20581      close();
20582    }
20583    else if (inArray) 
20584      writeNull(name); 
20585  }
20586
20587  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
20588    if (value != null && value.hasValue()) {
20589        prop(name, Integer.valueOf(value.getValue()));
20590    }    
20591    else if (inArray) 
20592      writeNull(name); 
20593  }    
20594
20595  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
20596    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20597      open(inArray ? null : "_"+name);
20598      composeElement(value);
20599      close();
20600    }
20601    else if (inArray) 
20602      writeNull(name); 
20603  }
20604
20605  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
20606    if (value != null && value.hasValue()) {
20607        prop(name, toString(value.getValue()));
20608    }    
20609    else if (inArray) 
20610      writeNull(name); 
20611  }    
20612
20613  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
20614    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20615      open(inArray ? null : "_"+name);
20616      composeElement(value);
20617      close();
20618    }
20619    else if (inArray) 
20620      writeNull(name); 
20621  }
20622
20623  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
20624    if (value != null && value.hasValue()) {
20625        prop(name, value.asStringValue());
20626    }    
20627    else if (inArray) 
20628      writeNull(name); 
20629  }    
20630
20631  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
20632    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20633      open(inArray ? null : "_"+name);
20634      composeElement(value);
20635      close();
20636    }
20637    else if (inArray) 
20638      writeNull(name); 
20639  }
20640
20641  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
20642    if (value != null && value.hasValue()) {
20643        prop(name, toString(value.getValue()));
20644    }    
20645    else if (inArray) 
20646      writeNull(name); 
20647  }    
20648
20649  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
20650    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20651      open(inArray ? null : "_"+name);
20652      composeElement(value);
20653      close();
20654    }
20655    else if (inArray) 
20656      writeNull(name); 
20657  }
20658
20659  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
20660    if (value != null && value.hasValue()) {
20661        prop(name, Integer.valueOf(value.getValue()));
20662    }    
20663    else if (inArray) 
20664      writeNull(name); 
20665  }    
20666
20667  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
20668    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20669      open(inArray ? null : "_"+name);
20670      composeElement(value);
20671      close();
20672    }
20673    else if (inArray) 
20674      writeNull(name); 
20675  }
20676
20677  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
20678    if (value != null && value.hasValue()) {
20679        prop(name, value.getValue());
20680    }    
20681    else if (inArray) 
20682      writeNull(name); 
20683  }    
20684
20685  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
20686    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20687      open(inArray ? null : "_"+name);
20688      composeElement(value);
20689      close();
20690    }
20691    else if (inArray) 
20692      writeNull(name); 
20693  }
20694
20695  protected void composeExtension(String name, Extension element) throws IOException {
20696    if (element != null) {
20697      open(name);
20698      composeExtensionInner(element);
20699      close();
20700    }
20701  }
20702
20703  protected void composeExtensionInner(Extension element) throws IOException {
20704      composeElement(element);
20705      if (element.hasUrlElement()) {
20706        composeUriCore("url", element.getUrlElement(), false);
20707        composeUriExtras("url", element.getUrlElement(), false);
20708      }
20709      if (element.hasValue()) {
20710        composeType("value", element.getValue());
20711      }
20712  }
20713
20714  protected void composeNarrative(String name, Narrative element) throws IOException {
20715    if (element != null) {
20716      open(name);
20717      composeNarrativeInner(element);
20718      close();
20719    }
20720  }
20721
20722  protected void composeNarrativeInner(Narrative element) throws IOException {
20723      composeElement(element);
20724      if (element.hasStatusElement()) {
20725        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
20726        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
20727      }
20728      if (element.hasDiv()) {
20729        XhtmlNode node = element.getDiv();
20730        if (node.getNsDecl() == null) {
20731          node.attribute("xmlns", XHTML_NS);
20732        }
20733        composeXhtml("div", node);
20734      }
20735  }
20736
20737  protected void composeDuration(String name, Duration element) throws IOException {
20738    if (element != null) {
20739      open(name);
20740      composeDurationInner(element);
20741      close();
20742    }
20743  }
20744
20745  protected void composeDurationInner(Duration element) throws IOException {
20746      composeQuantityInner(element);
20747  }
20748
20749  protected void composeCount(String name, Count element) throws IOException {
20750    if (element != null) {
20751      open(name);
20752      composeCountInner(element);
20753      close();
20754    }
20755  }
20756
20757  protected void composeCountInner(Count element) throws IOException {
20758      composeQuantityInner(element);
20759  }
20760
20761  protected void composeMoney(String name, Money element) throws IOException {
20762    if (element != null) {
20763      open(name);
20764      composeMoneyInner(element);
20765      close();
20766    }
20767  }
20768
20769  protected void composeMoneyInner(Money element) throws IOException {
20770      composeQuantityInner(element);
20771  }
20772
20773  protected void composeDistance(String name, Distance element) throws IOException {
20774    if (element != null) {
20775      open(name);
20776      composeDistanceInner(element);
20777      close();
20778    }
20779  }
20780
20781  protected void composeDistanceInner(Distance element) throws IOException {
20782      composeQuantityInner(element);
20783  }
20784
20785  protected void composeAge(String name, Age element) throws IOException {
20786    if (element != null) {
20787      open(name);
20788      composeAgeInner(element);
20789      close();
20790    }
20791  }
20792
20793  protected void composeAgeInner(Age element) throws IOException {
20794      composeQuantityInner(element);
20795  }
20796
20797  protected void composeReference(String name, Reference element) throws IOException {
20798    if (element != null) {
20799      open(name);
20800      composeReferenceInner(element);
20801      close();
20802    }
20803  }
20804
20805  protected void composeReferenceInner(Reference element) throws IOException {
20806      composeElement(element);
20807      if (element.hasReferenceElement()) {
20808        composeStringCore("reference", element.getReferenceElement(), false);
20809        composeStringExtras("reference", element.getReferenceElement(), false);
20810      }
20811      if (element.hasIdentifier()) {
20812        composeIdentifier("identifier", element.getIdentifier());
20813      }
20814      if (element.hasDisplayElement()) {
20815        composeStringCore("display", element.getDisplayElement(), false);
20816        composeStringExtras("display", element.getDisplayElement(), false);
20817      }
20818  }
20819
20820  protected void composeQuantity(String name, Quantity element) throws IOException {
20821    if (element != null) {
20822      open(name);
20823      composeQuantityInner(element);
20824      close();
20825    }
20826  }
20827
20828  protected void composeQuantityInner(Quantity element) throws IOException {
20829      composeElement(element);
20830      if (element.hasValueElement()) {
20831        composeDecimalCore("value", element.getValueElement(), false);
20832        composeDecimalExtras("value", element.getValueElement(), false);
20833      }
20834      if (element.hasComparatorElement()) {
20835        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
20836        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
20837      }
20838      if (element.hasUnitElement()) {
20839        composeStringCore("unit", element.getUnitElement(), false);
20840        composeStringExtras("unit", element.getUnitElement(), false);
20841      }
20842      if (element.hasSystemElement()) {
20843        composeUriCore("system", element.getSystemElement(), false);
20844        composeUriExtras("system", element.getSystemElement(), false);
20845      }
20846      if (element.hasCodeElement()) {
20847        composeCodeCore("code", element.getCodeElement(), false);
20848        composeCodeExtras("code", element.getCodeElement(), false);
20849      }
20850  }
20851
20852  protected void composePeriod(String name, Period element) throws IOException {
20853    if (element != null) {
20854      open(name);
20855      composePeriodInner(element);
20856      close();
20857    }
20858  }
20859
20860  protected void composePeriodInner(Period element) throws IOException {
20861      composeElement(element);
20862      if (element.hasStartElement()) {
20863        composeDateTimeCore("start", element.getStartElement(), false);
20864        composeDateTimeExtras("start", element.getStartElement(), false);
20865      }
20866      if (element.hasEndElement()) {
20867        composeDateTimeCore("end", element.getEndElement(), false);
20868        composeDateTimeExtras("end", element.getEndElement(), false);
20869      }
20870  }
20871
20872  protected void composeAttachment(String name, Attachment element) throws IOException {
20873    if (element != null) {
20874      open(name);
20875      composeAttachmentInner(element);
20876      close();
20877    }
20878  }
20879
20880  protected void composeAttachmentInner(Attachment element) throws IOException {
20881      composeElement(element);
20882      if (element.hasContentTypeElement()) {
20883        composeCodeCore("contentType", element.getContentTypeElement(), false);
20884        composeCodeExtras("contentType", element.getContentTypeElement(), false);
20885      }
20886      if (element.hasLanguageElement()) {
20887        composeCodeCore("language", element.getLanguageElement(), false);
20888        composeCodeExtras("language", element.getLanguageElement(), false);
20889      }
20890      if (element.hasDataElement()) {
20891        composeBase64BinaryCore("data", element.getDataElement(), false);
20892        composeBase64BinaryExtras("data", element.getDataElement(), false);
20893      }
20894      if (element.hasUrlElement()) {
20895        composeUriCore("url", element.getUrlElement(), false);
20896        composeUriExtras("url", element.getUrlElement(), false);
20897      }
20898      if (element.hasSizeElement()) {
20899        composeUnsignedIntCore("size", element.getSizeElement(), false);
20900        composeUnsignedIntExtras("size", element.getSizeElement(), false);
20901      }
20902      if (element.hasHashElement()) {
20903        composeBase64BinaryCore("hash", element.getHashElement(), false);
20904        composeBase64BinaryExtras("hash", element.getHashElement(), false);
20905      }
20906      if (element.hasTitleElement()) {
20907        composeStringCore("title", element.getTitleElement(), false);
20908        composeStringExtras("title", element.getTitleElement(), false);
20909      }
20910      if (element.hasCreationElement()) {
20911        composeDateTimeCore("creation", element.getCreationElement(), false);
20912        composeDateTimeExtras("creation", element.getCreationElement(), false);
20913      }
20914  }
20915
20916  protected void composeRange(String name, Range element) throws IOException {
20917    if (element != null) {
20918      open(name);
20919      composeRangeInner(element);
20920      close();
20921    }
20922  }
20923
20924  protected void composeRangeInner(Range element) throws IOException {
20925      composeElement(element);
20926      if (element.hasLow()) {
20927        composeSimpleQuantity("low", element.getLow());
20928      }
20929      if (element.hasHigh()) {
20930        composeSimpleQuantity("high", element.getHigh());
20931      }
20932  }
20933
20934  protected void composeAnnotation(String name, Annotation element) throws IOException {
20935    if (element != null) {
20936      open(name);
20937      composeAnnotationInner(element);
20938      close();
20939    }
20940  }
20941
20942  protected void composeAnnotationInner(Annotation element) throws IOException {
20943      composeElement(element);
20944      if (element.hasAuthor()) {
20945        composeType("author", element.getAuthor());
20946      }
20947      if (element.hasTimeElement()) {
20948        composeDateTimeCore("time", element.getTimeElement(), false);
20949        composeDateTimeExtras("time", element.getTimeElement(), false);
20950      }
20951      if (element.hasTextElement()) {
20952        composeStringCore("text", element.getTextElement(), false);
20953        composeStringExtras("text", element.getTextElement(), false);
20954      }
20955  }
20956
20957  protected void composeIdentifier(String name, Identifier element) throws IOException {
20958    if (element != null) {
20959      open(name);
20960      composeIdentifierInner(element);
20961      close();
20962    }
20963  }
20964
20965  protected void composeIdentifierInner(Identifier element) throws IOException {
20966      composeElement(element);
20967      if (element.hasUseElement()) {
20968        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
20969        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
20970      }
20971      if (element.hasType()) {
20972        composeCodeableConcept("type", element.getType());
20973      }
20974      if (element.hasSystemElement()) {
20975        composeUriCore("system", element.getSystemElement(), false);
20976        composeUriExtras("system", element.getSystemElement(), false);
20977      }
20978      if (element.hasValueElement()) {
20979        composeStringCore("value", element.getValueElement(), false);
20980        composeStringExtras("value", element.getValueElement(), false);
20981      }
20982      if (element.hasPeriod()) {
20983        composePeriod("period", element.getPeriod());
20984      }
20985      if (element.hasAssigner()) {
20986        composeReference("assigner", element.getAssigner());
20987      }
20988  }
20989
20990  protected void composeCoding(String name, Coding element) throws IOException {
20991    if (element != null) {
20992      open(name);
20993      composeCodingInner(element);
20994      close();
20995    }
20996  }
20997
20998  protected void composeCodingInner(Coding element) throws IOException {
20999      composeElement(element);
21000      if (element.hasSystemElement()) {
21001        composeUriCore("system", element.getSystemElement(), false);
21002        composeUriExtras("system", element.getSystemElement(), false);
21003      }
21004      if (element.hasVersionElement()) {
21005        composeStringCore("version", element.getVersionElement(), false);
21006        composeStringExtras("version", element.getVersionElement(), false);
21007      }
21008      if (element.hasCodeElement()) {
21009        composeCodeCore("code", element.getCodeElement(), false);
21010        composeCodeExtras("code", element.getCodeElement(), false);
21011      }
21012      if (element.hasDisplayElement()) {
21013        composeStringCore("display", element.getDisplayElement(), false);
21014        composeStringExtras("display", element.getDisplayElement(), false);
21015      }
21016      if (element.hasUserSelectedElement()) {
21017        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
21018        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
21019      }
21020  }
21021
21022  protected void composeSignature(String name, Signature element) throws IOException {
21023    if (element != null) {
21024      open(name);
21025      composeSignatureInner(element);
21026      close();
21027    }
21028  }
21029
21030  protected void composeSignatureInner(Signature element) throws IOException {
21031      composeElement(element);
21032      if (element.hasType()) {
21033        openArray("type");
21034        for (Coding e : element.getType()) 
21035          composeCoding(null, e);
21036        closeArray();
21037      };
21038      if (element.hasWhenElement()) {
21039        composeInstantCore("when", element.getWhenElement(), false);
21040        composeInstantExtras("when", element.getWhenElement(), false);
21041      }
21042      if (element.hasWho()) {
21043        composeType("who", element.getWho());
21044      }
21045      if (element.hasOnBehalfOf()) {
21046        composeType("onBehalfOf", element.getOnBehalfOf());
21047      }
21048      if (element.hasContentTypeElement()) {
21049        composeCodeCore("contentType", element.getContentTypeElement(), false);
21050        composeCodeExtras("contentType", element.getContentTypeElement(), false);
21051      }
21052      if (element.hasBlobElement()) {
21053        composeBase64BinaryCore("blob", element.getBlobElement(), false);
21054        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
21055      }
21056  }
21057
21058  protected void composeSampledData(String name, SampledData element) throws IOException {
21059    if (element != null) {
21060      open(name);
21061      composeSampledDataInner(element);
21062      close();
21063    }
21064  }
21065
21066  protected void composeSampledDataInner(SampledData element) throws IOException {
21067      composeElement(element);
21068      if (element.hasOrigin()) {
21069        composeSimpleQuantity("origin", element.getOrigin());
21070      }
21071      if (element.hasPeriodElement()) {
21072        composeDecimalCore("period", element.getPeriodElement(), false);
21073        composeDecimalExtras("period", element.getPeriodElement(), false);
21074      }
21075      if (element.hasFactorElement()) {
21076        composeDecimalCore("factor", element.getFactorElement(), false);
21077        composeDecimalExtras("factor", element.getFactorElement(), false);
21078      }
21079      if (element.hasLowerLimitElement()) {
21080        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
21081        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
21082      }
21083      if (element.hasUpperLimitElement()) {
21084        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
21085        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
21086      }
21087      if (element.hasDimensionsElement()) {
21088        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
21089        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
21090      }
21091      if (element.hasDataElement()) {
21092        composeStringCore("data", element.getDataElement(), false);
21093        composeStringExtras("data", element.getDataElement(), false);
21094      }
21095  }
21096
21097  protected void composeRatio(String name, Ratio element) throws IOException {
21098    if (element != null) {
21099      open(name);
21100      composeRatioInner(element);
21101      close();
21102    }
21103  }
21104
21105  protected void composeRatioInner(Ratio element) throws IOException {
21106      composeElement(element);
21107      if (element.hasNumerator()) {
21108        composeQuantity("numerator", element.getNumerator());
21109      }
21110      if (element.hasDenominator()) {
21111        composeQuantity("denominator", element.getDenominator());
21112      }
21113  }
21114
21115  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
21116    if (element != null) {
21117      open(name);
21118      composeCodeableConceptInner(element);
21119      close();
21120    }
21121  }
21122
21123  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
21124      composeElement(element);
21125      if (element.hasCoding()) {
21126        openArray("coding");
21127        for (Coding e : element.getCoding()) 
21128          composeCoding(null, e);
21129        closeArray();
21130      };
21131      if (element.hasTextElement()) {
21132        composeStringCore("text", element.getTextElement(), false);
21133        composeStringExtras("text", element.getTextElement(), false);
21134      }
21135  }
21136
21137  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
21138    if (element != null) {
21139      open(name);
21140      composeSimpleQuantityInner(element);
21141      close();
21142    }
21143  }
21144
21145  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
21146      composeElement(element);
21147      if (element.hasValueElement()) {
21148        composeDecimalCore("value", element.getValueElement(), false);
21149        composeDecimalExtras("value", element.getValueElement(), false);
21150      }
21151      if (element.hasComparatorElement()) {
21152        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21153        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21154      }
21155      if (element.hasUnitElement()) {
21156        composeStringCore("unit", element.getUnitElement(), false);
21157        composeStringExtras("unit", element.getUnitElement(), false);
21158      }
21159      if (element.hasSystemElement()) {
21160        composeUriCore("system", element.getSystemElement(), false);
21161        composeUriExtras("system", element.getSystemElement(), false);
21162      }
21163      if (element.hasCodeElement()) {
21164        composeCodeCore("code", element.getCodeElement(), false);
21165        composeCodeExtras("code", element.getCodeElement(), false);
21166      }
21167  }
21168
21169  protected void composeMeta(String name, Meta element) throws IOException {
21170    if (element != null) {
21171      open(name);
21172      composeMetaInner(element);
21173      close();
21174    }
21175  }
21176
21177  protected void composeMetaInner(Meta element) throws IOException {
21178      composeElement(element);
21179      if (element.hasVersionIdElement()) {
21180        composeIdCore("versionId", element.getVersionIdElement(), false);
21181        composeIdExtras("versionId", element.getVersionIdElement(), false);
21182      }
21183      if (element.hasLastUpdatedElement()) {
21184        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
21185        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
21186      }
21187      if (element.hasProfile()) {
21188        openArray("profile");
21189        for (UriType e : element.getProfile()) 
21190          composeUriCore(null, e, true);
21191        closeArray();
21192        if (anyHasExtras(element.getProfile())) {
21193          openArray("_profile");
21194          for (UriType e : element.getProfile()) 
21195            composeUriExtras(null, e, true);
21196          closeArray();
21197        }
21198      };
21199      if (element.hasSecurity()) {
21200        openArray("security");
21201        for (Coding e : element.getSecurity()) 
21202          composeCoding(null, e);
21203        closeArray();
21204      };
21205      if (element.hasTag()) {
21206        openArray("tag");
21207        for (Coding e : element.getTag()) 
21208          composeCoding(null, e);
21209        closeArray();
21210      };
21211  }
21212
21213  protected void composeAddress(String name, Address element) throws IOException {
21214    if (element != null) {
21215      open(name);
21216      composeAddressInner(element);
21217      close();
21218    }
21219  }
21220
21221  protected void composeAddressInner(Address element) throws IOException {
21222      composeElement(element);
21223      if (element.hasUseElement()) {
21224        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21225        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21226      }
21227      if (element.hasTypeElement()) {
21228        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21229        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21230      }
21231      if (element.hasTextElement()) {
21232        composeStringCore("text", element.getTextElement(), false);
21233        composeStringExtras("text", element.getTextElement(), false);
21234      }
21235      if (element.hasLine()) {
21236        openArray("line");
21237        for (StringType e : element.getLine()) 
21238          composeStringCore(null, e, true);
21239        closeArray();
21240        if (anyHasExtras(element.getLine())) {
21241          openArray("_line");
21242          for (StringType e : element.getLine()) 
21243            composeStringExtras(null, e, true);
21244          closeArray();
21245        }
21246      };
21247      if (element.hasCityElement()) {
21248        composeStringCore("city", element.getCityElement(), false);
21249        composeStringExtras("city", element.getCityElement(), false);
21250      }
21251      if (element.hasDistrictElement()) {
21252        composeStringCore("district", element.getDistrictElement(), false);
21253        composeStringExtras("district", element.getDistrictElement(), false);
21254      }
21255      if (element.hasStateElement()) {
21256        composeStringCore("state", element.getStateElement(), false);
21257        composeStringExtras("state", element.getStateElement(), false);
21258      }
21259      if (element.hasPostalCodeElement()) {
21260        composeStringCore("postalCode", element.getPostalCodeElement(), false);
21261        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
21262      }
21263      if (element.hasCountryElement()) {
21264        composeStringCore("country", element.getCountryElement(), false);
21265        composeStringExtras("country", element.getCountryElement(), false);
21266      }
21267      if (element.hasPeriod()) {
21268        composePeriod("period", element.getPeriod());
21269      }
21270  }
21271
21272  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
21273    if (element != null) {
21274      open(name);
21275      composeTriggerDefinitionInner(element);
21276      close();
21277    }
21278  }
21279
21280  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
21281      composeElement(element);
21282      if (element.hasTypeElement()) {
21283        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21284        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21285      }
21286      if (element.hasEventNameElement()) {
21287        composeStringCore("eventName", element.getEventNameElement(), false);
21288        composeStringExtras("eventName", element.getEventNameElement(), false);
21289      }
21290      if (element.hasEventTiming()) {
21291        composeType("eventTiming", element.getEventTiming());
21292      }
21293      if (element.hasEventData()) {
21294        composeDataRequirement("eventData", element.getEventData());
21295      }
21296  }
21297
21298  protected void composeContributor(String name, Contributor element) throws IOException {
21299    if (element != null) {
21300      open(name);
21301      composeContributorInner(element);
21302      close();
21303    }
21304  }
21305
21306  protected void composeContributorInner(Contributor element) throws IOException {
21307      composeElement(element);
21308      if (element.hasTypeElement()) {
21309        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21310        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21311      }
21312      if (element.hasNameElement()) {
21313        composeStringCore("name", element.getNameElement(), false);
21314        composeStringExtras("name", element.getNameElement(), false);
21315      }
21316      if (element.hasContact()) {
21317        openArray("contact");
21318        for (ContactDetail e : element.getContact()) 
21319          composeContactDetail(null, e);
21320        closeArray();
21321      };
21322  }
21323
21324  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
21325    if (element != null) {
21326      open(name);
21327      composeDataRequirementInner(element);
21328      close();
21329    }
21330  }
21331
21332  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
21333      composeElement(element);
21334      if (element.hasTypeElement()) {
21335        composeCodeCore("type", element.getTypeElement(), false);
21336        composeCodeExtras("type", element.getTypeElement(), false);
21337      }
21338      if (element.hasProfile()) {
21339        openArray("profile");
21340        for (UriType e : element.getProfile()) 
21341          composeUriCore(null, e, true);
21342        closeArray();
21343        if (anyHasExtras(element.getProfile())) {
21344          openArray("_profile");
21345          for (UriType e : element.getProfile()) 
21346            composeUriExtras(null, e, true);
21347          closeArray();
21348        }
21349      };
21350      if (element.hasMustSupport()) {
21351        openArray("mustSupport");
21352        for (StringType e : element.getMustSupport()) 
21353          composeStringCore(null, e, true);
21354        closeArray();
21355        if (anyHasExtras(element.getMustSupport())) {
21356          openArray("_mustSupport");
21357          for (StringType e : element.getMustSupport()) 
21358            composeStringExtras(null, e, true);
21359          closeArray();
21360        }
21361      };
21362      if (element.hasCodeFilter()) {
21363        openArray("codeFilter");
21364        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
21365          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
21366        closeArray();
21367      };
21368      if (element.hasDateFilter()) {
21369        openArray("dateFilter");
21370        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
21371          composeDataRequirementDataRequirementDateFilterComponent(null, e);
21372        closeArray();
21373      };
21374  }
21375
21376  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21377    if (element != null) {
21378      open(name);
21379      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
21380      close();
21381    }
21382  }
21383
21384  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21385      composeElement(element);
21386      if (element.hasPathElement()) {
21387        composeStringCore("path", element.getPathElement(), false);
21388        composeStringExtras("path", element.getPathElement(), false);
21389      }
21390      if (element.hasValueSet()) {
21391        composeType("valueSet", element.getValueSet());
21392      }
21393      if (element.hasValueCode()) {
21394        openArray("valueCode");
21395        for (CodeType e : element.getValueCode()) 
21396          composeCodeCore(null, e, true);
21397        closeArray();
21398        if (anyHasExtras(element.getValueCode())) {
21399          openArray("_valueCode");
21400          for (CodeType e : element.getValueCode()) 
21401            composeCodeExtras(null, e, true);
21402          closeArray();
21403        }
21404      };
21405      if (element.hasValueCoding()) {
21406        openArray("valueCoding");
21407        for (Coding e : element.getValueCoding()) 
21408          composeCoding(null, e);
21409        closeArray();
21410      };
21411      if (element.hasValueCodeableConcept()) {
21412        openArray("valueCodeableConcept");
21413        for (CodeableConcept e : element.getValueCodeableConcept()) 
21414          composeCodeableConcept(null, e);
21415        closeArray();
21416      };
21417  }
21418
21419  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21420    if (element != null) {
21421      open(name);
21422      composeDataRequirementDataRequirementDateFilterComponentInner(element);
21423      close();
21424    }
21425  }
21426
21427  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21428      composeElement(element);
21429      if (element.hasPathElement()) {
21430        composeStringCore("path", element.getPathElement(), false);
21431        composeStringExtras("path", element.getPathElement(), false);
21432      }
21433      if (element.hasValue()) {
21434        composeType("value", element.getValue());
21435      }
21436  }
21437
21438  protected void composeDosage(String name, Dosage element) throws IOException {
21439    if (element != null) {
21440      open(name);
21441      composeDosageInner(element);
21442      close();
21443    }
21444  }
21445
21446  protected void composeDosageInner(Dosage element) throws IOException {
21447      composeElement(element);
21448      if (element.hasSequenceElement()) {
21449        composeIntegerCore("sequence", element.getSequenceElement(), false);
21450        composeIntegerExtras("sequence", element.getSequenceElement(), false);
21451      }
21452      if (element.hasTextElement()) {
21453        composeStringCore("text", element.getTextElement(), false);
21454        composeStringExtras("text", element.getTextElement(), false);
21455      }
21456      if (element.hasAdditionalInstruction()) {
21457        openArray("additionalInstruction");
21458        for (CodeableConcept e : element.getAdditionalInstruction()) 
21459          composeCodeableConcept(null, e);
21460        closeArray();
21461      };
21462      if (element.hasPatientInstructionElement()) {
21463        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
21464        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
21465      }
21466      if (element.hasTiming()) {
21467        composeTiming("timing", element.getTiming());
21468      }
21469      if (element.hasAsNeeded()) {
21470        composeType("asNeeded", element.getAsNeeded());
21471      }
21472      if (element.hasSite()) {
21473        composeCodeableConcept("site", element.getSite());
21474      }
21475      if (element.hasRoute()) {
21476        composeCodeableConcept("route", element.getRoute());
21477      }
21478      if (element.hasMethod()) {
21479        composeCodeableConcept("method", element.getMethod());
21480      }
21481      if (element.hasDose()) {
21482        composeType("dose", element.getDose());
21483      }
21484      if (element.hasMaxDosePerPeriod()) {
21485        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21486      }
21487      if (element.hasMaxDosePerAdministration()) {
21488        composeSimpleQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
21489      }
21490      if (element.hasMaxDosePerLifetime()) {
21491        composeSimpleQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
21492      }
21493      if (element.hasRate()) {
21494        composeType("rate", element.getRate());
21495      }
21496  }
21497
21498  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
21499    if (element != null) {
21500      open(name);
21501      composeRelatedArtifactInner(element);
21502      close();
21503    }
21504  }
21505
21506  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
21507      composeElement(element);
21508      if (element.hasTypeElement()) {
21509        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21510        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21511      }
21512      if (element.hasDisplayElement()) {
21513        composeStringCore("display", element.getDisplayElement(), false);
21514        composeStringExtras("display", element.getDisplayElement(), false);
21515      }
21516      if (element.hasCitationElement()) {
21517        composeStringCore("citation", element.getCitationElement(), false);
21518        composeStringExtras("citation", element.getCitationElement(), false);
21519      }
21520      if (element.hasUrlElement()) {
21521        composeUriCore("url", element.getUrlElement(), false);
21522        composeUriExtras("url", element.getUrlElement(), false);
21523      }
21524      if (element.hasDocument()) {
21525        composeAttachment("document", element.getDocument());
21526      }
21527      if (element.hasResource()) {
21528        composeReference("resource", element.getResource());
21529      }
21530  }
21531
21532  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
21533    if (element != null) {
21534      open(name);
21535      composeContactDetailInner(element);
21536      close();
21537    }
21538  }
21539
21540  protected void composeContactDetailInner(ContactDetail element) throws IOException {
21541      composeElement(element);
21542      if (element.hasNameElement()) {
21543        composeStringCore("name", element.getNameElement(), false);
21544        composeStringExtras("name", element.getNameElement(), false);
21545      }
21546      if (element.hasTelecom()) {
21547        openArray("telecom");
21548        for (ContactPoint e : element.getTelecom()) 
21549          composeContactPoint(null, e);
21550        closeArray();
21551      };
21552  }
21553
21554  protected void composeHumanName(String name, HumanName element) throws IOException {
21555    if (element != null) {
21556      open(name);
21557      composeHumanNameInner(element);
21558      close();
21559    }
21560  }
21561
21562  protected void composeHumanNameInner(HumanName element) throws IOException {
21563      composeElement(element);
21564      if (element.hasUseElement()) {
21565        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21566        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21567      }
21568      if (element.hasTextElement()) {
21569        composeStringCore("text", element.getTextElement(), false);
21570        composeStringExtras("text", element.getTextElement(), false);
21571      }
21572      if (element.hasFamilyElement()) {
21573        composeStringCore("family", element.getFamilyElement(), false);
21574        composeStringExtras("family", element.getFamilyElement(), false);
21575      }
21576      if (element.hasGiven()) {
21577        openArray("given");
21578        for (StringType e : element.getGiven()) 
21579          composeStringCore(null, e, true);
21580        closeArray();
21581        if (anyHasExtras(element.getGiven())) {
21582          openArray("_given");
21583          for (StringType e : element.getGiven()) 
21584            composeStringExtras(null, e, true);
21585          closeArray();
21586        }
21587      };
21588      if (element.hasPrefix()) {
21589        openArray("prefix");
21590        for (StringType e : element.getPrefix()) 
21591          composeStringCore(null, e, true);
21592        closeArray();
21593        if (anyHasExtras(element.getPrefix())) {
21594          openArray("_prefix");
21595          for (StringType e : element.getPrefix()) 
21596            composeStringExtras(null, e, true);
21597          closeArray();
21598        }
21599      };
21600      if (element.hasSuffix()) {
21601        openArray("suffix");
21602        for (StringType e : element.getSuffix()) 
21603          composeStringCore(null, e, true);
21604        closeArray();
21605        if (anyHasExtras(element.getSuffix())) {
21606          openArray("_suffix");
21607          for (StringType e : element.getSuffix()) 
21608            composeStringExtras(null, e, true);
21609          closeArray();
21610        }
21611      };
21612      if (element.hasPeriod()) {
21613        composePeriod("period", element.getPeriod());
21614      }
21615  }
21616
21617  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
21618    if (element != null) {
21619      open(name);
21620      composeContactPointInner(element);
21621      close();
21622    }
21623  }
21624
21625  protected void composeContactPointInner(ContactPoint element) throws IOException {
21626      composeElement(element);
21627      if (element.hasSystemElement()) {
21628        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21629        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21630      }
21631      if (element.hasValueElement()) {
21632        composeStringCore("value", element.getValueElement(), false);
21633        composeStringExtras("value", element.getValueElement(), false);
21634      }
21635      if (element.hasUseElement()) {
21636        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21637        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21638      }
21639      if (element.hasRankElement()) {
21640        composePositiveIntCore("rank", element.getRankElement(), false);
21641        composePositiveIntExtras("rank", element.getRankElement(), false);
21642      }
21643      if (element.hasPeriod()) {
21644        composePeriod("period", element.getPeriod());
21645      }
21646  }
21647
21648  protected void composeUsageContext(String name, UsageContext element) throws IOException {
21649    if (element != null) {
21650      open(name);
21651      composeUsageContextInner(element);
21652      close();
21653    }
21654  }
21655
21656  protected void composeUsageContextInner(UsageContext element) throws IOException {
21657      composeElement(element);
21658      if (element.hasCode()) {
21659        composeCoding("code", element.getCode());
21660      }
21661      if (element.hasValue()) {
21662        composeType("value", element.getValue());
21663      }
21664  }
21665
21666  protected void composeTiming(String name, Timing element) throws IOException {
21667    if (element != null) {
21668      open(name);
21669      composeTimingInner(element);
21670      close();
21671    }
21672  }
21673
21674  protected void composeTimingInner(Timing element) throws IOException {
21675      composeElement(element);
21676      if (element.hasEvent()) {
21677        openArray("event");
21678        for (DateTimeType e : element.getEvent()) 
21679          composeDateTimeCore(null, e, true);
21680        closeArray();
21681        if (anyHasExtras(element.getEvent())) {
21682          openArray("_event");
21683          for (DateTimeType e : element.getEvent()) 
21684            composeDateTimeExtras(null, e, true);
21685          closeArray();
21686        }
21687      };
21688      if (element.hasRepeat()) {
21689        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
21690      }
21691      if (element.hasCode()) {
21692        composeCodeableConcept("code", element.getCode());
21693      }
21694  }
21695
21696  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
21697    if (element != null) {
21698      open(name);
21699      composeTimingTimingRepeatComponentInner(element);
21700      close();
21701    }
21702  }
21703
21704  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
21705      composeElement(element);
21706      if (element.hasBounds()) {
21707        composeType("bounds", element.getBounds());
21708      }
21709      if (element.hasCountElement()) {
21710        composeIntegerCore("count", element.getCountElement(), false);
21711        composeIntegerExtras("count", element.getCountElement(), false);
21712      }
21713      if (element.hasCountMaxElement()) {
21714        composeIntegerCore("countMax", element.getCountMaxElement(), false);
21715        composeIntegerExtras("countMax", element.getCountMaxElement(), false);
21716      }
21717      if (element.hasDurationElement()) {
21718        composeDecimalCore("duration", element.getDurationElement(), false);
21719        composeDecimalExtras("duration", element.getDurationElement(), false);
21720      }
21721      if (element.hasDurationMaxElement()) {
21722        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
21723        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
21724      }
21725      if (element.hasDurationUnitElement()) {
21726        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21727        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21728      }
21729      if (element.hasFrequencyElement()) {
21730        composeIntegerCore("frequency", element.getFrequencyElement(), false);
21731        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
21732      }
21733      if (element.hasFrequencyMaxElement()) {
21734        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
21735        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
21736      }
21737      if (element.hasPeriodElement()) {
21738        composeDecimalCore("period", element.getPeriodElement(), false);
21739        composeDecimalExtras("period", element.getPeriodElement(), false);
21740      }
21741      if (element.hasPeriodMaxElement()) {
21742        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
21743        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
21744      }
21745      if (element.hasPeriodUnitElement()) {
21746        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21747        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21748      }
21749      if (element.hasDayOfWeek()) {
21750        openArray("dayOfWeek");
21751        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
21752          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
21753        closeArray();
21754        if (anyHasExtras(element.getDayOfWeek())) {
21755          openArray("_dayOfWeek");
21756          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
21757            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
21758          closeArray();
21759        }
21760      };
21761      if (element.hasTimeOfDay()) {
21762        openArray("timeOfDay");
21763        for (TimeType e : element.getTimeOfDay()) 
21764          composeTimeCore(null, e, true);
21765        closeArray();
21766        if (anyHasExtras(element.getTimeOfDay())) {
21767          openArray("_timeOfDay");
21768          for (TimeType e : element.getTimeOfDay()) 
21769            composeTimeExtras(null, e, true);
21770          closeArray();
21771        }
21772      };
21773      if (element.hasWhen()) {
21774        openArray("when");
21775        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
21776          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
21777        closeArray();
21778        if (anyHasExtras(element.getWhen())) {
21779          openArray("_when");
21780          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
21781            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
21782          closeArray();
21783        }
21784      };
21785      if (element.hasOffsetElement()) {
21786        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
21787        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
21788      }
21789  }
21790
21791  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
21792    if (element != null) {
21793      open(name);
21794      composeElementDefinitionInner(element);
21795      close();
21796    }
21797  }
21798
21799  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
21800      composeElement(element);
21801      if (element.hasPathElement()) {
21802        composeStringCore("path", element.getPathElement(), false);
21803        composeStringExtras("path", element.getPathElement(), false);
21804      }
21805      if (element.hasRepresentation()) {
21806        openArray("representation");
21807        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
21808          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
21809        closeArray();
21810        if (anyHasExtras(element.getRepresentation())) {
21811          openArray("_representation");
21812          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
21813            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
21814          closeArray();
21815        }
21816      };
21817      if (element.hasSliceNameElement()) {
21818        composeStringCore("sliceName", element.getSliceNameElement(), false);
21819        composeStringExtras("sliceName", element.getSliceNameElement(), false);
21820      }
21821      if (element.hasLabelElement()) {
21822        composeStringCore("label", element.getLabelElement(), false);
21823        composeStringExtras("label", element.getLabelElement(), false);
21824      }
21825      if (element.hasCode()) {
21826        openArray("code");
21827        for (Coding e : element.getCode()) 
21828          composeCoding(null, e);
21829        closeArray();
21830      };
21831      if (element.hasSlicing()) {
21832        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
21833      }
21834      if (element.hasShortElement()) {
21835        composeStringCore("short", element.getShortElement(), false);
21836        composeStringExtras("short", element.getShortElement(), false);
21837      }
21838      if (element.hasDefinitionElement()) {
21839        composeMarkdownCore("definition", element.getDefinitionElement(), false);
21840        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
21841      }
21842      if (element.hasCommentElement()) {
21843        composeMarkdownCore("comment", element.getCommentElement(), false);
21844        composeMarkdownExtras("comment", element.getCommentElement(), false);
21845      }
21846      if (element.hasRequirementsElement()) {
21847        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
21848        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
21849      }
21850      if (element.hasAlias()) {
21851        openArray("alias");
21852        for (StringType e : element.getAlias()) 
21853          composeStringCore(null, e, true);
21854        closeArray();
21855        if (anyHasExtras(element.getAlias())) {
21856          openArray("_alias");
21857          for (StringType e : element.getAlias()) 
21858            composeStringExtras(null, e, true);
21859          closeArray();
21860        }
21861      };
21862      if (element.hasMinElement()) {
21863        composeUnsignedIntCore("min", element.getMinElement(), false);
21864        composeUnsignedIntExtras("min", element.getMinElement(), false);
21865      }
21866      if (element.hasMaxElement()) {
21867        composeStringCore("max", element.getMaxElement(), false);
21868        composeStringExtras("max", element.getMaxElement(), false);
21869      }
21870      if (element.hasBase()) {
21871        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
21872      }
21873      if (element.hasContentReferenceElement()) {
21874        composeUriCore("contentReference", element.getContentReferenceElement(), false);
21875        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
21876      }
21877      if (element.hasType()) {
21878        openArray("type");
21879        for (ElementDefinition.TypeRefComponent e : element.getType()) 
21880          composeElementDefinitionTypeRefComponent(null, e);
21881        closeArray();
21882      };
21883      if (element.hasDefaultValue()) {
21884        composeType("defaultValue", element.getDefaultValue());
21885      }
21886      if (element.hasMeaningWhenMissingElement()) {
21887        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
21888        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
21889      }
21890      if (element.hasOrderMeaningElement()) {
21891        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
21892        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
21893      }
21894      if (element.hasFixed()) {
21895        composeType("fixed", element.getFixed());
21896      }
21897      if (element.hasPattern()) {
21898        composeType("pattern", element.getPattern());
21899      }
21900      if (element.hasExample()) {
21901        openArray("example");
21902        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
21903          composeElementDefinitionElementDefinitionExampleComponent(null, e);
21904        closeArray();
21905      };
21906      if (element.hasMinValue()) {
21907        composeType("minValue", element.getMinValue());
21908      }
21909      if (element.hasMaxValue()) {
21910        composeType("maxValue", element.getMaxValue());
21911      }
21912      if (element.hasMaxLengthElement()) {
21913        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
21914        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
21915      }
21916      if (element.hasCondition()) {
21917        openArray("condition");
21918        for (IdType e : element.getCondition()) 
21919          composeIdCore(null, e, true);
21920        closeArray();
21921        if (anyHasExtras(element.getCondition())) {
21922          openArray("_condition");
21923          for (IdType e : element.getCondition()) 
21924            composeIdExtras(null, e, true);
21925          closeArray();
21926        }
21927      };
21928      if (element.hasConstraint()) {
21929        openArray("constraint");
21930        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
21931          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
21932        closeArray();
21933      };
21934      if (element.hasMustSupportElement()) {
21935        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
21936        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
21937      }
21938      if (element.hasIsModifierElement()) {
21939        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
21940        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
21941      }
21942      if (element.hasIsSummaryElement()) {
21943        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
21944        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
21945      }
21946      if (element.hasBinding()) {
21947        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
21948      }
21949      if (element.hasMapping()) {
21950        openArray("mapping");
21951        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
21952          composeElementDefinitionElementDefinitionMappingComponent(null, e);
21953        closeArray();
21954      };
21955  }
21956
21957  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
21958    if (element != null) {
21959      open(name);
21960      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
21961      close();
21962    }
21963  }
21964
21965  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
21966      composeElement(element);
21967      if (element.hasDiscriminator()) {
21968        openArray("discriminator");
21969        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
21970          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
21971        closeArray();
21972      };
21973      if (element.hasDescriptionElement()) {
21974        composeStringCore("description", element.getDescriptionElement(), false);
21975        composeStringExtras("description", element.getDescriptionElement(), false);
21976      }
21977      if (element.hasOrderedElement()) {
21978        composeBooleanCore("ordered", element.getOrderedElement(), false);
21979        composeBooleanExtras("ordered", element.getOrderedElement(), false);
21980      }
21981      if (element.hasRulesElement()) {
21982        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
21983        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
21984      }
21985  }
21986
21987  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
21988    if (element != null) {
21989      open(name);
21990      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
21991      close();
21992    }
21993  }
21994
21995  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
21996      composeElement(element);
21997      if (element.hasTypeElement()) {
21998        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
21999        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
22000      }
22001      if (element.hasPathElement()) {
22002        composeStringCore("path", element.getPathElement(), false);
22003        composeStringExtras("path", element.getPathElement(), false);
22004      }
22005  }
22006
22007  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22008    if (element != null) {
22009      open(name);
22010      composeElementDefinitionElementDefinitionBaseComponentInner(element);
22011      close();
22012    }
22013  }
22014
22015  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22016      composeElement(element);
22017      if (element.hasPathElement()) {
22018        composeStringCore("path", element.getPathElement(), false);
22019        composeStringExtras("path", element.getPathElement(), false);
22020      }
22021      if (element.hasMinElement()) {
22022        composeUnsignedIntCore("min", element.getMinElement(), false);
22023        composeUnsignedIntExtras("min", element.getMinElement(), false);
22024      }
22025      if (element.hasMaxElement()) {
22026        composeStringCore("max", element.getMaxElement(), false);
22027        composeStringExtras("max", element.getMaxElement(), false);
22028      }
22029  }
22030
22031  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
22032    if (element != null) {
22033      open(name);
22034      composeElementDefinitionTypeRefComponentInner(element);
22035      close();
22036    }
22037  }
22038
22039  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
22040      composeElement(element);
22041      if (element.hasCodeElement()) {
22042        composeUriCore("code", element.getCodeElement(), false);
22043        composeUriExtras("code", element.getCodeElement(), false);
22044      }
22045      if (element.hasProfileElement()) {
22046        composeUriCore("profile", element.getProfileElement(), false);
22047        composeUriExtras("profile", element.getProfileElement(), false);
22048      }
22049      if (element.hasTargetProfileElement()) {
22050        composeUriCore("targetProfile", element.getTargetProfileElement(), false);
22051        composeUriExtras("targetProfile", element.getTargetProfileElement(), false);
22052      }
22053      if (element.hasAggregation()) {
22054        openArray("aggregation");
22055        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22056          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22057        closeArray();
22058        if (anyHasExtras(element.getAggregation())) {
22059          openArray("_aggregation");
22060          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22061            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22062          closeArray();
22063        }
22064      };
22065      if (element.hasVersioningElement()) {
22066        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22067        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22068      }
22069  }
22070
22071  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22072    if (element != null) {
22073      open(name);
22074      composeElementDefinitionElementDefinitionExampleComponentInner(element);
22075      close();
22076    }
22077  }
22078
22079  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22080      composeElement(element);
22081      if (element.hasLabelElement()) {
22082        composeStringCore("label", element.getLabelElement(), false);
22083        composeStringExtras("label", element.getLabelElement(), false);
22084      }
22085      if (element.hasValue()) {
22086        composeType("value", element.getValue());
22087      }
22088  }
22089
22090  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22091    if (element != null) {
22092      open(name);
22093      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
22094      close();
22095    }
22096  }
22097
22098  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22099      composeElement(element);
22100      if (element.hasKeyElement()) {
22101        composeIdCore("key", element.getKeyElement(), false);
22102        composeIdExtras("key", element.getKeyElement(), false);
22103      }
22104      if (element.hasRequirementsElement()) {
22105        composeStringCore("requirements", element.getRequirementsElement(), false);
22106        composeStringExtras("requirements", element.getRequirementsElement(), false);
22107      }
22108      if (element.hasSeverityElement()) {
22109        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22110        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22111      }
22112      if (element.hasHumanElement()) {
22113        composeStringCore("human", element.getHumanElement(), false);
22114        composeStringExtras("human", element.getHumanElement(), false);
22115      }
22116      if (element.hasExpressionElement()) {
22117        composeStringCore("expression", element.getExpressionElement(), false);
22118        composeStringExtras("expression", element.getExpressionElement(), false);
22119      }
22120      if (element.hasXpathElement()) {
22121        composeStringCore("xpath", element.getXpathElement(), false);
22122        composeStringExtras("xpath", element.getXpathElement(), false);
22123      }
22124      if (element.hasSourceElement()) {
22125        composeUriCore("source", element.getSourceElement(), false);
22126        composeUriExtras("source", element.getSourceElement(), false);
22127      }
22128  }
22129
22130  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22131    if (element != null) {
22132      open(name);
22133      composeElementDefinitionElementDefinitionBindingComponentInner(element);
22134      close();
22135    }
22136  }
22137
22138  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22139      composeElement(element);
22140      if (element.hasStrengthElement()) {
22141        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22142        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22143      }
22144      if (element.hasDescriptionElement()) {
22145        composeStringCore("description", element.getDescriptionElement(), false);
22146        composeStringExtras("description", element.getDescriptionElement(), false);
22147      }
22148      if (element.hasValueSet()) {
22149        composeType("valueSet", element.getValueSet());
22150      }
22151  }
22152
22153  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22154    if (element != null) {
22155      open(name);
22156      composeElementDefinitionElementDefinitionMappingComponentInner(element);
22157      close();
22158    }
22159  }
22160
22161  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22162      composeElement(element);
22163      if (element.hasIdentityElement()) {
22164        composeIdCore("identity", element.getIdentityElement(), false);
22165        composeIdExtras("identity", element.getIdentityElement(), false);
22166      }
22167      if (element.hasLanguageElement()) {
22168        composeCodeCore("language", element.getLanguageElement(), false);
22169        composeCodeExtras("language", element.getLanguageElement(), false);
22170      }
22171      if (element.hasMapElement()) {
22172        composeStringCore("map", element.getMapElement(), false);
22173        composeStringExtras("map", element.getMapElement(), false);
22174      }
22175      if (element.hasCommentElement()) {
22176        composeStringCore("comment", element.getCommentElement(), false);
22177        composeStringExtras("comment", element.getCommentElement(), false);
22178      }
22179  }
22180
22181  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
22182    if (element != null) {
22183      open(name);
22184      composeParameterDefinitionInner(element);
22185      close();
22186    }
22187  }
22188
22189  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
22190      composeElement(element);
22191      if (element.hasNameElement()) {
22192        composeCodeCore("name", element.getNameElement(), false);
22193        composeCodeExtras("name", element.getNameElement(), false);
22194      }
22195      if (element.hasUseElement()) {
22196        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22197        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22198      }
22199      if (element.hasMinElement()) {
22200        composeIntegerCore("min", element.getMinElement(), false);
22201        composeIntegerExtras("min", element.getMinElement(), false);
22202      }
22203      if (element.hasMaxElement()) {
22204        composeStringCore("max", element.getMaxElement(), false);
22205        composeStringExtras("max", element.getMaxElement(), false);
22206      }
22207      if (element.hasDocumentationElement()) {
22208        composeStringCore("documentation", element.getDocumentationElement(), false);
22209        composeStringExtras("documentation", element.getDocumentationElement(), false);
22210      }
22211      if (element.hasTypeElement()) {
22212        composeCodeCore("type", element.getTypeElement(), false);
22213        composeCodeExtras("type", element.getTypeElement(), false);
22214      }
22215      if (element.hasProfile()) {
22216        composeReference("profile", element.getProfile());
22217      }
22218  }
22219
22220  protected void composeDomainResourceElements(DomainResource element) throws IOException {
22221      composeResourceElements(element);
22222      if (element.hasText()) {
22223        composeNarrative("text", element.getText());
22224      }
22225      if (element.hasContained()) {
22226        openArray("contained");
22227        for (Resource e : element.getContained()) {
22228          open(null);
22229          composeResource(e);
22230          close();
22231        }
22232        closeArray();
22233      };
22234      if (element.hasExtension()) {
22235        openArray("extension");
22236        for (Extension e : element.getExtension()) 
22237          composeExtension(null, e);
22238        closeArray();
22239      };
22240      if (element.hasModifierExtension()) {
22241        openArray("modifierExtension");
22242        for (Extension e : element.getModifierExtension()) 
22243          composeExtension(null, e);
22244        closeArray();
22245      };
22246  }
22247
22248  protected void composeParameters(String name, Parameters element) throws IOException {
22249    if (element != null) {
22250      prop("resourceType", name);
22251      composeParametersInner(element);
22252    }
22253  }
22254
22255  protected void composeParametersInner(Parameters element) throws IOException {
22256      composeResourceElements(element);
22257      if (element.hasParameter()) {
22258        openArray("parameter");
22259        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
22260          composeParametersParametersParameterComponent(null, e);
22261        closeArray();
22262      };
22263  }
22264
22265  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
22266    if (element != null) {
22267      open(name);
22268      composeParametersParametersParameterComponentInner(element);
22269      close();
22270    }
22271  }
22272
22273  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
22274      composeBackbone(element);
22275      if (element.hasNameElement()) {
22276        composeStringCore("name", element.getNameElement(), false);
22277        composeStringExtras("name", element.getNameElement(), false);
22278      }
22279      if (element.hasValue()) {
22280        composeType("value", element.getValue());
22281      }
22282        if (element.hasResource()) {
22283          open("resource");
22284          composeResource(element.getResource());
22285          close();
22286        }
22287      if (element.hasPart()) {
22288        openArray("part");
22289        for (Parameters.ParametersParameterComponent e : element.getPart()) 
22290          composeParametersParametersParameterComponent(null, e);
22291        closeArray();
22292      };
22293  }
22294
22295  protected void composeResourceElements(Resource element) throws IOException {
22296      if (element.hasIdElement()) {
22297        composeIdCore("id", element.getIdElement(), false);
22298        composeIdExtras("id", element.getIdElement(), false);
22299      }
22300      if (element.hasMeta()) {
22301        composeMeta("meta", element.getMeta());
22302      }
22303      if (element.hasImplicitRulesElement()) {
22304        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
22305        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
22306      }
22307      if (element.hasLanguageElement()) {
22308        composeCodeCore("language", element.getLanguageElement(), false);
22309        composeCodeExtras("language", element.getLanguageElement(), false);
22310      }
22311  }
22312
22313  protected void composeAccount(String name, Account element) throws IOException {
22314    if (element != null) {
22315      prop("resourceType", name);
22316      composeAccountInner(element);
22317    }
22318  }
22319
22320  protected void composeAccountInner(Account element) throws IOException {
22321      composeDomainResourceElements(element);
22322      if (element.hasIdentifier()) {
22323        openArray("identifier");
22324        for (Identifier e : element.getIdentifier()) 
22325          composeIdentifier(null, e);
22326        closeArray();
22327      };
22328      if (element.hasStatusElement()) {
22329        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22330        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22331      }
22332      if (element.hasType()) {
22333        composeCodeableConcept("type", element.getType());
22334      }
22335      if (element.hasNameElement()) {
22336        composeStringCore("name", element.getNameElement(), false);
22337        composeStringExtras("name", element.getNameElement(), false);
22338      }
22339      if (element.hasSubject()) {
22340        composeReference("subject", element.getSubject());
22341      }
22342      if (element.hasPeriod()) {
22343        composePeriod("period", element.getPeriod());
22344      }
22345      if (element.hasActive()) {
22346        composePeriod("active", element.getActive());
22347      }
22348      if (element.hasBalance()) {
22349        composeMoney("balance", element.getBalance());
22350      }
22351      if (element.hasCoverage()) {
22352        openArray("coverage");
22353        for (Account.CoverageComponent e : element.getCoverage()) 
22354          composeAccountCoverageComponent(null, e);
22355        closeArray();
22356      };
22357      if (element.hasOwner()) {
22358        composeReference("owner", element.getOwner());
22359      }
22360      if (element.hasDescriptionElement()) {
22361        composeStringCore("description", element.getDescriptionElement(), false);
22362        composeStringExtras("description", element.getDescriptionElement(), false);
22363      }
22364      if (element.hasGuarantor()) {
22365        openArray("guarantor");
22366        for (Account.GuarantorComponent e : element.getGuarantor()) 
22367          composeAccountGuarantorComponent(null, e);
22368        closeArray();
22369      };
22370  }
22371
22372  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
22373    if (element != null) {
22374      open(name);
22375      composeAccountCoverageComponentInner(element);
22376      close();
22377    }
22378  }
22379
22380  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
22381      composeBackbone(element);
22382      if (element.hasCoverage()) {
22383        composeReference("coverage", element.getCoverage());
22384      }
22385      if (element.hasPriorityElement()) {
22386        composePositiveIntCore("priority", element.getPriorityElement(), false);
22387        composePositiveIntExtras("priority", element.getPriorityElement(), false);
22388      }
22389  }
22390
22391  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
22392    if (element != null) {
22393      open(name);
22394      composeAccountGuarantorComponentInner(element);
22395      close();
22396    }
22397  }
22398
22399  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
22400      composeBackbone(element);
22401      if (element.hasParty()) {
22402        composeReference("party", element.getParty());
22403      }
22404      if (element.hasOnHoldElement()) {
22405        composeBooleanCore("onHold", element.getOnHoldElement(), false);
22406        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
22407      }
22408      if (element.hasPeriod()) {
22409        composePeriod("period", element.getPeriod());
22410      }
22411  }
22412
22413  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
22414    if (element != null) {
22415      prop("resourceType", name);
22416      composeActivityDefinitionInner(element);
22417    }
22418  }
22419
22420  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
22421      composeDomainResourceElements(element);
22422      if (element.hasUrlElement()) {
22423        composeUriCore("url", element.getUrlElement(), false);
22424        composeUriExtras("url", element.getUrlElement(), false);
22425      }
22426      if (element.hasIdentifier()) {
22427        openArray("identifier");
22428        for (Identifier e : element.getIdentifier()) 
22429          composeIdentifier(null, e);
22430        closeArray();
22431      };
22432      if (element.hasVersionElement()) {
22433        composeStringCore("version", element.getVersionElement(), false);
22434        composeStringExtras("version", element.getVersionElement(), false);
22435      }
22436      if (element.hasNameElement()) {
22437        composeStringCore("name", element.getNameElement(), false);
22438        composeStringExtras("name", element.getNameElement(), false);
22439      }
22440      if (element.hasTitleElement()) {
22441        composeStringCore("title", element.getTitleElement(), false);
22442        composeStringExtras("title", element.getTitleElement(), false);
22443      }
22444      if (element.hasStatusElement()) {
22445        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22446        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22447      }
22448      if (element.hasExperimentalElement()) {
22449        composeBooleanCore("experimental", element.getExperimentalElement(), false);
22450        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
22451      }
22452      if (element.hasDateElement()) {
22453        composeDateTimeCore("date", element.getDateElement(), false);
22454        composeDateTimeExtras("date", element.getDateElement(), false);
22455      }
22456      if (element.hasPublisherElement()) {
22457        composeStringCore("publisher", element.getPublisherElement(), false);
22458        composeStringExtras("publisher", element.getPublisherElement(), false);
22459      }
22460      if (element.hasDescriptionElement()) {
22461        composeMarkdownCore("description", element.getDescriptionElement(), false);
22462        composeMarkdownExtras("description", element.getDescriptionElement(), false);
22463      }
22464      if (element.hasPurposeElement()) {
22465        composeMarkdownCore("purpose", element.getPurposeElement(), false);
22466        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
22467      }
22468      if (element.hasUsageElement()) {
22469        composeStringCore("usage", element.getUsageElement(), false);
22470        composeStringExtras("usage", element.getUsageElement(), false);
22471      }
22472      if (element.hasApprovalDateElement()) {
22473        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
22474        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
22475      }
22476      if (element.hasLastReviewDateElement()) {
22477        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
22478        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
22479      }
22480      if (element.hasEffectivePeriod()) {
22481        composePeriod("effectivePeriod", element.getEffectivePeriod());
22482      }
22483      if (element.hasUseContext()) {
22484        openArray("useContext");
22485        for (UsageContext e : element.getUseContext()) 
22486          composeUsageContext(null, e);
22487        closeArray();
22488      };
22489      if (element.hasJurisdiction()) {
22490        openArray("jurisdiction");
22491        for (CodeableConcept e : element.getJurisdiction()) 
22492          composeCodeableConcept(null, e);
22493        closeArray();
22494      };
22495      if (element.hasTopic()) {
22496        openArray("topic");
22497        for (CodeableConcept e : element.getTopic()) 
22498          composeCodeableConcept(null, e);
22499        closeArray();
22500      };
22501      if (element.hasContributor()) {
22502        openArray("contributor");
22503        for (Contributor e : element.getContributor()) 
22504          composeContributor(null, e);
22505        closeArray();
22506      };
22507      if (element.hasContact()) {
22508        openArray("contact");
22509        for (ContactDetail e : element.getContact()) 
22510          composeContactDetail(null, e);
22511        closeArray();
22512      };
22513      if (element.hasCopyrightElement()) {
22514        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
22515        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
22516      }
22517      if (element.hasRelatedArtifact()) {
22518        openArray("relatedArtifact");
22519        for (RelatedArtifact e : element.getRelatedArtifact()) 
22520          composeRelatedArtifact(null, e);
22521        closeArray();
22522      };
22523      if (element.hasLibrary()) {
22524        openArray("library");
22525        for (Reference e : element.getLibrary()) 
22526          composeReference(null, e);
22527        closeArray();
22528      };
22529      if (element.hasKindElement()) {
22530        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22531        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22532      }
22533      if (element.hasCode()) {
22534        composeCodeableConcept("code", element.getCode());
22535      }
22536      if (element.hasTiming()) {
22537        composeType("timing", element.getTiming());
22538      }
22539      if (element.hasLocation()) {
22540        composeReference("location", element.getLocation());
22541      }
22542      if (element.hasParticipant()) {
22543        openArray("participant");
22544        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
22545          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
22546        closeArray();
22547      };
22548      if (element.hasProduct()) {
22549        composeType("product", element.getProduct());
22550      }
22551      if (element.hasQuantity()) {
22552        composeSimpleQuantity("quantity", element.getQuantity());
22553      }
22554      if (element.hasDosage()) {
22555        openArray("dosage");
22556        for (Dosage e : element.getDosage()) 
22557          composeDosage(null, e);
22558        closeArray();
22559      };
22560      if (element.hasBodySite()) {
22561        openArray("bodySite");
22562        for (CodeableConcept e : element.getBodySite()) 
22563          composeCodeableConcept(null, e);
22564        closeArray();
22565      };
22566      if (element.hasTransform()) {
22567        composeReference("transform", element.getTransform());
22568      }
22569      if (element.hasDynamicValue()) {
22570        openArray("dynamicValue");
22571        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
22572          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
22573        closeArray();
22574      };
22575  }
22576
22577  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22578    if (element != null) {
22579      open(name);
22580      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
22581      close();
22582    }
22583  }
22584
22585  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22586      composeBackbone(element);
22587      if (element.hasTypeElement()) {
22588        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22589        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22590      }
22591      if (element.hasRole()) {
22592        composeCodeableConcept("role", element.getRole());
22593      }
22594  }
22595
22596  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22597    if (element != null) {
22598      open(name);
22599      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
22600      close();
22601    }
22602  }
22603
22604  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22605      composeBackbone(element);
22606      if (element.hasDescriptionElement()) {
22607        composeStringCore("description", element.getDescriptionElement(), false);
22608        composeStringExtras("description", element.getDescriptionElement(), false);
22609      }
22610      if (element.hasPathElement()) {
22611        composeStringCore("path", element.getPathElement(), false);
22612        composeStringExtras("path", element.getPathElement(), false);
22613      }
22614      if (element.hasLanguageElement()) {
22615        composeStringCore("language", element.getLanguageElement(), false);
22616        composeStringExtras("language", element.getLanguageElement(), false);
22617      }
22618      if (element.hasExpressionElement()) {
22619        composeStringCore("expression", element.getExpressionElement(), false);
22620        composeStringExtras("expression", element.getExpressionElement(), false);
22621      }
22622  }
22623
22624  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
22625    if (element != null) {
22626      prop("resourceType", name);
22627      composeAdverseEventInner(element);
22628    }
22629  }
22630
22631  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
22632      composeDomainResourceElements(element);
22633      if (element.hasIdentifier()) {
22634        composeIdentifier("identifier", element.getIdentifier());
22635      }
22636      if (element.hasCategoryElement()) {
22637        composeEnumerationCore("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22638        composeEnumerationExtras("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22639      }
22640      if (element.hasType()) {
22641        composeCodeableConcept("type", element.getType());
22642      }
22643      if (element.hasSubject()) {
22644        composeReference("subject", element.getSubject());
22645      }
22646      if (element.hasDateElement()) {
22647        composeDateTimeCore("date", element.getDateElement(), false);
22648        composeDateTimeExtras("date", element.getDateElement(), false);
22649      }
22650      if (element.hasReaction()) {
22651        openArray("reaction");
22652        for (Reference e : element.getReaction()) 
22653          composeReference(null, e);
22654        closeArray();
22655      };
22656      if (element.hasLocation()) {
22657        composeReference("location", element.getLocation());
22658      }
22659      if (element.hasSeriousness()) {
22660        composeCodeableConcept("seriousness", element.getSeriousness());
22661      }
22662      if (element.hasOutcome()) {
22663        composeCodeableConcept("outcome", element.getOutcome());
22664      }
22665      if (element.hasRecorder()) {
22666        composeReference("recorder", element.getRecorder());
22667      }
22668      if (element.hasEventParticipant()) {
22669        composeReference("eventParticipant", element.getEventParticipant());
22670      }
22671      if (element.hasDescriptionElement()) {
22672        composeStringCore("description", element.getDescriptionElement(), false);
22673        composeStringExtras("description", element.getDescriptionElement(), false);
22674      }
22675      if (element.hasSuspectEntity()) {
22676        openArray("suspectEntity");
22677        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
22678          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
22679        closeArray();
22680      };
22681      if (element.hasSubjectMedicalHistory()) {
22682        openArray("subjectMedicalHistory");
22683        for (Reference e : element.getSubjectMedicalHistory()) 
22684          composeReference(null, e);
22685        closeArray();
22686      };
22687      if (element.hasReferenceDocument()) {
22688        openArray("referenceDocument");
22689        for (Reference e : element.getReferenceDocument()) 
22690          composeReference(null, e);
22691        closeArray();
22692      };
22693      if (element.hasStudy()) {
22694        openArray("study");
22695        for (Reference e : element.getStudy()) 
22696          composeReference(null, e);
22697        closeArray();
22698      };
22699  }
22700
22701  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
22702    if (element != null) {
22703      open(name);
22704      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
22705      close();
22706    }
22707  }
22708
22709  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
22710      composeBackbone(element);
22711      if (element.hasInstance()) {
22712        composeReference("instance", element.getInstance());
22713      }
22714      if (element.hasCausalityElement()) {
22715        composeEnumerationCore("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
22716        composeEnumerationExtras("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
22717      }
22718      if (element.hasCausalityAssessment()) {
22719        composeCodeableConcept("causalityAssessment", element.getCausalityAssessment());
22720      }
22721      if (element.hasCausalityProductRelatednessElement()) {
22722        composeStringCore("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
22723        composeStringExtras("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
22724      }
22725      if (element.hasCausalityMethod()) {
22726        composeCodeableConcept("causalityMethod", element.getCausalityMethod());
22727      }
22728      if (element.hasCausalityAuthor()) {
22729        composeReference("causalityAuthor", element.getCausalityAuthor());
22730      }
22731      if (element.hasCausalityResult()) {
22732        composeCodeableConcept("causalityResult", element.getCausalityResult());
22733      }
22734  }
22735
22736  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
22737    if (element != null) {
22738      prop("resourceType", name);
22739      composeAllergyIntoleranceInner(element);
22740    }
22741  }
22742
22743  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
22744      composeDomainResourceElements(element);
22745      if (element.hasIdentifier()) {
22746        openArray("identifier");
22747        for (Identifier e : element.getIdentifier()) 
22748          composeIdentifier(null, e);
22749        closeArray();
22750      };
22751      if (element.hasClinicalStatusElement()) {
22752        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
22753        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
22754      }
22755      if (element.hasVerificationStatusElement()) {
22756        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
22757        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
22758      }
22759      if (element.hasTypeElement()) {
22760        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
22761        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
22762      }
22763      if (element.hasCategory()) {
22764        openArray("category");
22765        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
22766          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
22767        closeArray();
22768        if (anyHasExtras(element.getCategory())) {
22769          openArray("_category");
22770          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
22771            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
22772          closeArray();
22773        }
22774      };
22775      if (element.hasCriticalityElement()) {
22776        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
22777        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
22778      }
22779      if (element.hasCode()) {
22780        composeCodeableConcept("code", element.getCode());
22781      }
22782      if (element.hasPatient()) {
22783        composeReference("patient", element.getPatient());
22784      }
22785      if (element.hasOnset()) {
22786        composeType("onset", element.getOnset());
22787      }
22788      if (element.hasAssertedDateElement()) {
22789        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
22790        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
22791      }
22792      if (element.hasRecorder()) {
22793        composeReference("recorder", element.getRecorder());
22794      }
22795      if (element.hasAsserter()) {
22796        composeReference("asserter", element.getAsserter());
22797      }
22798      if (element.hasLastOccurrenceElement()) {
22799        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
22800        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
22801      }
22802      if (element.hasNote()) {
22803        openArray("note");
22804        for (Annotation e : element.getNote()) 
22805          composeAnnotation(null, e);
22806        closeArray();
22807      };
22808      if (element.hasReaction()) {
22809        openArray("reaction");
22810        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
22811          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
22812        closeArray();
22813      };
22814  }
22815
22816  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
22817    if (element != null) {
22818      open(name);
22819      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
22820      close();
22821    }
22822  }
22823
22824  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
22825      composeBackbone(element);
22826      if (element.hasSubstance()) {
22827        composeCodeableConcept("substance", element.getSubstance());
22828      }
22829      if (element.hasManifestation()) {
22830        openArray("manifestation");
22831        for (CodeableConcept e : element.getManifestation()) 
22832          composeCodeableConcept(null, e);
22833        closeArray();
22834      };
22835      if (element.hasDescriptionElement()) {
22836        composeStringCore("description", element.getDescriptionElement(), false);
22837        composeStringExtras("description", element.getDescriptionElement(), false);
22838      }
22839      if (element.hasOnsetElement()) {
22840        composeDateTimeCore("onset", element.getOnsetElement(), false);
22841        composeDateTimeExtras("onset", element.getOnsetElement(), false);
22842      }
22843      if (element.hasSeverityElement()) {
22844        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
22845        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
22846      }
22847      if (element.hasExposureRoute()) {
22848        composeCodeableConcept("exposureRoute", element.getExposureRoute());
22849      }
22850      if (element.hasNote()) {
22851        openArray("note");
22852        for (Annotation e : element.getNote()) 
22853          composeAnnotation(null, e);
22854        closeArray();
22855      };
22856  }
22857
22858  protected void composeAppointment(String name, Appointment element) throws IOException {
22859    if (element != null) {
22860      prop("resourceType", name);
22861      composeAppointmentInner(element);
22862    }
22863  }
22864
22865  protected void composeAppointmentInner(Appointment element) throws IOException {
22866      composeDomainResourceElements(element);
22867      if (element.hasIdentifier()) {
22868        openArray("identifier");
22869        for (Identifier e : element.getIdentifier()) 
22870          composeIdentifier(null, e);
22871        closeArray();
22872      };
22873      if (element.hasStatusElement()) {
22874        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
22875        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
22876      }
22877      if (element.hasServiceCategory()) {
22878        composeCodeableConcept("serviceCategory", element.getServiceCategory());
22879      }
22880      if (element.hasServiceType()) {
22881        openArray("serviceType");
22882        for (CodeableConcept e : element.getServiceType()) 
22883          composeCodeableConcept(null, e);
22884        closeArray();
22885      };
22886      if (element.hasSpecialty()) {
22887        openArray("specialty");
22888        for (CodeableConcept e : element.getSpecialty()) 
22889          composeCodeableConcept(null, e);
22890        closeArray();
22891      };
22892      if (element.hasAppointmentType()) {
22893        composeCodeableConcept("appointmentType", element.getAppointmentType());
22894      }
22895      if (element.hasReason()) {
22896        openArray("reason");
22897        for (CodeableConcept e : element.getReason()) 
22898          composeCodeableConcept(null, e);
22899        closeArray();
22900      };
22901      if (element.hasIndication()) {
22902        openArray("indication");
22903        for (Reference e : element.getIndication()) 
22904          composeReference(null, e);
22905        closeArray();
22906      };
22907      if (element.hasPriorityElement()) {
22908        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
22909        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
22910      }
22911      if (element.hasDescriptionElement()) {
22912        composeStringCore("description", element.getDescriptionElement(), false);
22913        composeStringExtras("description", element.getDescriptionElement(), false);
22914      }
22915      if (element.hasSupportingInformation()) {
22916        openArray("supportingInformation");
22917        for (Reference e : element.getSupportingInformation()) 
22918          composeReference(null, e);
22919        closeArray();
22920      };
22921      if (element.hasStartElement()) {
22922        composeInstantCore("start", element.getStartElement(), false);
22923        composeInstantExtras("start", element.getStartElement(), false);
22924      }
22925      if (element.hasEndElement()) {
22926        composeInstantCore("end", element.getEndElement(), false);
22927        composeInstantExtras("end", element.getEndElement(), false);
22928      }
22929      if (element.hasMinutesDurationElement()) {
22930        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
22931        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
22932      }
22933      if (element.hasSlot()) {
22934        openArray("slot");
22935        for (Reference e : element.getSlot()) 
22936          composeReference(null, e);
22937        closeArray();
22938      };
22939      if (element.hasCreatedElement()) {
22940        composeDateTimeCore("created", element.getCreatedElement(), false);
22941        composeDateTimeExtras("created", element.getCreatedElement(), false);
22942      }
22943      if (element.hasCommentElement()) {
22944        composeStringCore("comment", element.getCommentElement(), false);
22945        composeStringExtras("comment", element.getCommentElement(), false);
22946      }
22947      if (element.hasIncomingReferral()) {
22948        openArray("incomingReferral");
22949        for (Reference e : element.getIncomingReferral()) 
22950          composeReference(null, e);
22951        closeArray();
22952      };
22953      if (element.hasParticipant()) {
22954        openArray("participant");
22955        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
22956          composeAppointmentAppointmentParticipantComponent(null, e);
22957        closeArray();
22958      };
22959      if (element.hasRequestedPeriod()) {
22960        openArray("requestedPeriod");
22961        for (Period e : element.getRequestedPeriod()) 
22962          composePeriod(null, e);
22963        closeArray();
22964      };
22965  }
22966
22967  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
22968    if (element != null) {
22969      open(name);
22970      composeAppointmentAppointmentParticipantComponentInner(element);
22971      close();
22972    }
22973  }
22974
22975  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
22976      composeBackbone(element);
22977      if (element.hasType()) {
22978        openArray("type");
22979        for (CodeableConcept e : element.getType()) 
22980          composeCodeableConcept(null, e);
22981        closeArray();
22982      };
22983      if (element.hasActor()) {
22984        composeReference("actor", element.getActor());
22985      }
22986      if (element.hasRequiredElement()) {
22987        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
22988        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
22989      }
22990      if (element.hasStatusElement()) {
22991        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
22992        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
22993      }
22994  }
22995
22996  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
22997    if (element != null) {
22998      prop("resourceType", name);
22999      composeAppointmentResponseInner(element);
23000    }
23001  }
23002
23003  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
23004      composeDomainResourceElements(element);
23005      if (element.hasIdentifier()) {
23006        openArray("identifier");
23007        for (Identifier e : element.getIdentifier()) 
23008          composeIdentifier(null, e);
23009        closeArray();
23010      };
23011      if (element.hasAppointment()) {
23012        composeReference("appointment", element.getAppointment());
23013      }
23014      if (element.hasStartElement()) {
23015        composeInstantCore("start", element.getStartElement(), false);
23016        composeInstantExtras("start", element.getStartElement(), false);
23017      }
23018      if (element.hasEndElement()) {
23019        composeInstantCore("end", element.getEndElement(), false);
23020        composeInstantExtras("end", element.getEndElement(), false);
23021      }
23022      if (element.hasParticipantType()) {
23023        openArray("participantType");
23024        for (CodeableConcept e : element.getParticipantType()) 
23025          composeCodeableConcept(null, e);
23026        closeArray();
23027      };
23028      if (element.hasActor()) {
23029        composeReference("actor", element.getActor());
23030      }
23031      if (element.hasParticipantStatusElement()) {
23032        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23033        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23034      }
23035      if (element.hasCommentElement()) {
23036        composeStringCore("comment", element.getCommentElement(), false);
23037        composeStringExtras("comment", element.getCommentElement(), false);
23038      }
23039  }
23040
23041  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
23042    if (element != null) {
23043      prop("resourceType", name);
23044      composeAuditEventInner(element);
23045    }
23046  }
23047
23048  protected void composeAuditEventInner(AuditEvent element) throws IOException {
23049      composeDomainResourceElements(element);
23050      if (element.hasType()) {
23051        composeCoding("type", element.getType());
23052      }
23053      if (element.hasSubtype()) {
23054        openArray("subtype");
23055        for (Coding e : element.getSubtype()) 
23056          composeCoding(null, e);
23057        closeArray();
23058      };
23059      if (element.hasActionElement()) {
23060        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23061        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23062      }
23063      if (element.hasRecordedElement()) {
23064        composeInstantCore("recorded", element.getRecordedElement(), false);
23065        composeInstantExtras("recorded", element.getRecordedElement(), false);
23066      }
23067      if (element.hasOutcomeElement()) {
23068        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23069        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23070      }
23071      if (element.hasOutcomeDescElement()) {
23072        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
23073        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
23074      }
23075      if (element.hasPurposeOfEvent()) {
23076        openArray("purposeOfEvent");
23077        for (CodeableConcept e : element.getPurposeOfEvent()) 
23078          composeCodeableConcept(null, e);
23079        closeArray();
23080      };
23081      if (element.hasAgent()) {
23082        openArray("agent");
23083        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
23084          composeAuditEventAuditEventAgentComponent(null, e);
23085        closeArray();
23086      };
23087      if (element.hasSource()) {
23088        composeAuditEventAuditEventSourceComponent("source", element.getSource());
23089      }
23090      if (element.hasEntity()) {
23091        openArray("entity");
23092        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
23093          composeAuditEventAuditEventEntityComponent(null, e);
23094        closeArray();
23095      };
23096  }
23097
23098  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
23099    if (element != null) {
23100      open(name);
23101      composeAuditEventAuditEventAgentComponentInner(element);
23102      close();
23103    }
23104  }
23105
23106  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
23107      composeBackbone(element);
23108      if (element.hasRole()) {
23109        openArray("role");
23110        for (CodeableConcept e : element.getRole()) 
23111          composeCodeableConcept(null, e);
23112        closeArray();
23113      };
23114      if (element.hasReference()) {
23115        composeReference("reference", element.getReference());
23116      }
23117      if (element.hasUserId()) {
23118        composeIdentifier("userId", element.getUserId());
23119      }
23120      if (element.hasAltIdElement()) {
23121        composeStringCore("altId", element.getAltIdElement(), false);
23122        composeStringExtras("altId", element.getAltIdElement(), false);
23123      }
23124      if (element.hasNameElement()) {
23125        composeStringCore("name", element.getNameElement(), false);
23126        composeStringExtras("name", element.getNameElement(), false);
23127      }
23128      if (element.hasRequestorElement()) {
23129        composeBooleanCore("requestor", element.getRequestorElement(), false);
23130        composeBooleanExtras("requestor", element.getRequestorElement(), false);
23131      }
23132      if (element.hasLocation()) {
23133        composeReference("location", element.getLocation());
23134      }
23135      if (element.hasPolicy()) {
23136        openArray("policy");
23137        for (UriType e : element.getPolicy()) 
23138          composeUriCore(null, e, true);
23139        closeArray();
23140        if (anyHasExtras(element.getPolicy())) {
23141          openArray("_policy");
23142          for (UriType e : element.getPolicy()) 
23143            composeUriExtras(null, e, true);
23144          closeArray();
23145        }
23146      };
23147      if (element.hasMedia()) {
23148        composeCoding("media", element.getMedia());
23149      }
23150      if (element.hasNetwork()) {
23151        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
23152      }
23153      if (element.hasPurposeOfUse()) {
23154        openArray("purposeOfUse");
23155        for (CodeableConcept e : element.getPurposeOfUse()) 
23156          composeCodeableConcept(null, e);
23157        closeArray();
23158      };
23159  }
23160
23161  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23162    if (element != null) {
23163      open(name);
23164      composeAuditEventAuditEventAgentNetworkComponentInner(element);
23165      close();
23166    }
23167  }
23168
23169  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23170      composeBackbone(element);
23171      if (element.hasAddressElement()) {
23172        composeStringCore("address", element.getAddressElement(), false);
23173        composeStringExtras("address", element.getAddressElement(), false);
23174      }
23175      if (element.hasTypeElement()) {
23176        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23177        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23178      }
23179  }
23180
23181  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
23182    if (element != null) {
23183      open(name);
23184      composeAuditEventAuditEventSourceComponentInner(element);
23185      close();
23186    }
23187  }
23188
23189  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
23190      composeBackbone(element);
23191      if (element.hasSiteElement()) {
23192        composeStringCore("site", element.getSiteElement(), false);
23193        composeStringExtras("site", element.getSiteElement(), false);
23194      }
23195      if (element.hasIdentifier()) {
23196        composeIdentifier("identifier", element.getIdentifier());
23197      }
23198      if (element.hasType()) {
23199        openArray("type");
23200        for (Coding e : element.getType()) 
23201          composeCoding(null, e);
23202        closeArray();
23203      };
23204  }
23205
23206  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
23207    if (element != null) {
23208      open(name);
23209      composeAuditEventAuditEventEntityComponentInner(element);
23210      close();
23211    }
23212  }
23213
23214  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
23215      composeBackbone(element);
23216      if (element.hasIdentifier()) {
23217        composeIdentifier("identifier", element.getIdentifier());
23218      }
23219      if (element.hasReference()) {
23220        composeReference("reference", element.getReference());
23221      }
23222      if (element.hasType()) {
23223        composeCoding("type", element.getType());
23224      }
23225      if (element.hasRole()) {
23226        composeCoding("role", element.getRole());
23227      }
23228      if (element.hasLifecycle()) {
23229        composeCoding("lifecycle", element.getLifecycle());
23230      }
23231      if (element.hasSecurityLabel()) {
23232        openArray("securityLabel");
23233        for (Coding e : element.getSecurityLabel()) 
23234          composeCoding(null, e);
23235        closeArray();
23236      };
23237      if (element.hasNameElement()) {
23238        composeStringCore("name", element.getNameElement(), false);
23239        composeStringExtras("name", element.getNameElement(), false);
23240      }
23241      if (element.hasDescriptionElement()) {
23242        composeStringCore("description", element.getDescriptionElement(), false);
23243        composeStringExtras("description", element.getDescriptionElement(), false);
23244      }
23245      if (element.hasQueryElement()) {
23246        composeBase64BinaryCore("query", element.getQueryElement(), false);
23247        composeBase64BinaryExtras("query", element.getQueryElement(), false);
23248      }
23249      if (element.hasDetail()) {
23250        openArray("detail");
23251        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
23252          composeAuditEventAuditEventEntityDetailComponent(null, e);
23253        closeArray();
23254      };
23255  }
23256
23257  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23258    if (element != null) {
23259      open(name);
23260      composeAuditEventAuditEventEntityDetailComponentInner(element);
23261      close();
23262    }
23263  }
23264
23265  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23266      composeBackbone(element);
23267      if (element.hasTypeElement()) {
23268        composeStringCore("type", element.getTypeElement(), false);
23269        composeStringExtras("type", element.getTypeElement(), false);
23270      }
23271      if (element.hasValueElement()) {
23272        composeBase64BinaryCore("value", element.getValueElement(), false);
23273        composeBase64BinaryExtras("value", element.getValueElement(), false);
23274      }
23275  }
23276
23277  protected void composeBasic(String name, Basic element) throws IOException {
23278    if (element != null) {
23279      prop("resourceType", name);
23280      composeBasicInner(element);
23281    }
23282  }
23283
23284  protected void composeBasicInner(Basic element) throws IOException {
23285      composeDomainResourceElements(element);
23286      if (element.hasIdentifier()) {
23287        openArray("identifier");
23288        for (Identifier e : element.getIdentifier()) 
23289          composeIdentifier(null, e);
23290        closeArray();
23291      };
23292      if (element.hasCode()) {
23293        composeCodeableConcept("code", element.getCode());
23294      }
23295      if (element.hasSubject()) {
23296        composeReference("subject", element.getSubject());
23297      }
23298      if (element.hasCreatedElement()) {
23299        composeDateCore("created", element.getCreatedElement(), false);
23300        composeDateExtras("created", element.getCreatedElement(), false);
23301      }
23302      if (element.hasAuthor()) {
23303        composeReference("author", element.getAuthor());
23304      }
23305  }
23306
23307  protected void composeBinary(String name, Binary element) throws IOException {
23308    if (element != null) {
23309      prop("resourceType", name);
23310      composeBinaryInner(element);
23311    }
23312  }
23313
23314  protected void composeBinaryInner(Binary element) throws IOException {
23315      composeResourceElements(element);
23316      if (element.hasContentTypeElement()) {
23317        composeCodeCore("contentType", element.getContentTypeElement(), false);
23318        composeCodeExtras("contentType", element.getContentTypeElement(), false);
23319      }
23320      if (element.hasSecurityContext()) {
23321        composeReference("securityContext", element.getSecurityContext());
23322      }
23323      if (element.hasContentElement()) {
23324        composeBase64BinaryCore("content", element.getContentElement(), false);
23325        composeBase64BinaryExtras("content", element.getContentElement(), false);
23326      }
23327  }
23328
23329  protected void composeBodySite(String name, BodySite element) throws IOException {
23330    if (element != null) {
23331      prop("resourceType", name);
23332      composeBodySiteInner(element);
23333    }
23334  }
23335
23336  protected void composeBodySiteInner(BodySite element) throws IOException {
23337      composeDomainResourceElements(element);
23338      if (element.hasIdentifier()) {
23339        openArray("identifier");
23340        for (Identifier e : element.getIdentifier()) 
23341          composeIdentifier(null, e);
23342        closeArray();
23343      };
23344      if (element.hasActiveElement()) {
23345        composeBooleanCore("active", element.getActiveElement(), false);
23346        composeBooleanExtras("active", element.getActiveElement(), false);
23347      }
23348      if (element.hasCode()) {
23349        composeCodeableConcept("code", element.getCode());
23350      }
23351      if (element.hasQualifier()) {
23352        openArray("qualifier");
23353        for (CodeableConcept e : element.getQualifier()) 
23354          composeCodeableConcept(null, e);
23355        closeArray();
23356      };
23357      if (element.hasDescriptionElement()) {
23358        composeStringCore("description", element.getDescriptionElement(), false);
23359        composeStringExtras("description", element.getDescriptionElement(), false);
23360      }
23361      if (element.hasImage()) {
23362        openArray("image");
23363        for (Attachment e : element.getImage()) 
23364          composeAttachment(null, e);
23365        closeArray();
23366      };
23367      if (element.hasPatient()) {
23368        composeReference("patient", element.getPatient());
23369      }
23370  }
23371
23372  protected void composeBundle(String name, Bundle element) throws IOException {
23373    if (element != null) {
23374      prop("resourceType", name);
23375      composeBundleInner(element);
23376    }
23377  }
23378
23379  protected void composeBundleInner(Bundle element) throws IOException {
23380      composeResourceElements(element);
23381      if (element.hasIdentifier()) {
23382        composeIdentifier("identifier", element.getIdentifier());
23383      }
23384      if (element.hasTypeElement()) {
23385        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23386        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23387      }
23388      if (element.hasTotalElement()) {
23389        composeUnsignedIntCore("total", element.getTotalElement(), false);
23390        composeUnsignedIntExtras("total", element.getTotalElement(), false);
23391      }
23392      if (element.hasLink()) {
23393        openArray("link");
23394        for (Bundle.BundleLinkComponent e : element.getLink()) 
23395          composeBundleBundleLinkComponent(null, e);
23396        closeArray();
23397      };
23398      if (element.hasEntry()) {
23399        openArray("entry");
23400        for (Bundle.BundleEntryComponent e : element.getEntry()) 
23401          composeBundleBundleEntryComponent(null, e);
23402        closeArray();
23403      };
23404      if (element.hasSignature()) {
23405        composeSignature("signature", element.getSignature());
23406      }
23407  }
23408
23409  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
23410    if (element != null) {
23411      open(name);
23412      composeBundleBundleLinkComponentInner(element);
23413      close();
23414    }
23415  }
23416
23417  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
23418      composeBackbone(element);
23419      if (element.hasRelationElement()) {
23420        composeStringCore("relation", element.getRelationElement(), false);
23421        composeStringExtras("relation", element.getRelationElement(), false);
23422      }
23423      if (element.hasUrlElement()) {
23424        composeUriCore("url", element.getUrlElement(), false);
23425        composeUriExtras("url", element.getUrlElement(), false);
23426      }
23427  }
23428
23429  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
23430    if (element != null) {
23431      open(name);
23432      composeBundleBundleEntryComponentInner(element);
23433      close();
23434    }
23435  }
23436
23437  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
23438      composeBackbone(element);
23439      if (element.hasLink()) {
23440        openArray("link");
23441        for (Bundle.BundleLinkComponent e : element.getLink()) 
23442          composeBundleBundleLinkComponent(null, e);
23443        closeArray();
23444      };
23445      if (element.hasFullUrlElement()) {
23446        composeUriCore("fullUrl", element.getFullUrlElement(), false);
23447        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
23448      }
23449        if (element.hasResource()) {
23450          open("resource");
23451          composeResource(element.getResource());
23452          close();
23453        }
23454      if (element.hasSearch()) {
23455        composeBundleBundleEntrySearchComponent("search", element.getSearch());
23456      }
23457      if (element.hasRequest()) {
23458        composeBundleBundleEntryRequestComponent("request", element.getRequest());
23459      }
23460      if (element.hasResponse()) {
23461        composeBundleBundleEntryResponseComponent("response", element.getResponse());
23462      }
23463  }
23464
23465  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
23466    if (element != null) {
23467      open(name);
23468      composeBundleBundleEntrySearchComponentInner(element);
23469      close();
23470    }
23471  }
23472
23473  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
23474      composeBackbone(element);
23475      if (element.hasModeElement()) {
23476        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23477        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23478      }
23479      if (element.hasScoreElement()) {
23480        composeDecimalCore("score", element.getScoreElement(), false);
23481        composeDecimalExtras("score", element.getScoreElement(), false);
23482      }
23483  }
23484
23485  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
23486    if (element != null) {
23487      open(name);
23488      composeBundleBundleEntryRequestComponentInner(element);
23489      close();
23490    }
23491  }
23492
23493  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
23494      composeBackbone(element);
23495      if (element.hasMethodElement()) {
23496        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23497        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23498      }
23499      if (element.hasUrlElement()) {
23500        composeUriCore("url", element.getUrlElement(), false);
23501        composeUriExtras("url", element.getUrlElement(), false);
23502      }
23503      if (element.hasIfNoneMatchElement()) {
23504        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
23505        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
23506      }
23507      if (element.hasIfModifiedSinceElement()) {
23508        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23509        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23510      }
23511      if (element.hasIfMatchElement()) {
23512        composeStringCore("ifMatch", element.getIfMatchElement(), false);
23513        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
23514      }
23515      if (element.hasIfNoneExistElement()) {
23516        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
23517        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
23518      }
23519  }
23520
23521  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
23522    if (element != null) {
23523      open(name);
23524      composeBundleBundleEntryResponseComponentInner(element);
23525      close();
23526    }
23527  }
23528
23529  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
23530      composeBackbone(element);
23531      if (element.hasStatusElement()) {
23532        composeStringCore("status", element.getStatusElement(), false);
23533        composeStringExtras("status", element.getStatusElement(), false);
23534      }
23535      if (element.hasLocationElement()) {
23536        composeUriCore("location", element.getLocationElement(), false);
23537        composeUriExtras("location", element.getLocationElement(), false);
23538      }
23539      if (element.hasEtagElement()) {
23540        composeStringCore("etag", element.getEtagElement(), false);
23541        composeStringExtras("etag", element.getEtagElement(), false);
23542      }
23543      if (element.hasLastModifiedElement()) {
23544        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
23545        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
23546      }
23547        if (element.hasOutcome()) {
23548          open("outcome");
23549          composeResource(element.getOutcome());
23550          close();
23551        }
23552  }
23553
23554  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
23555    if (element != null) {
23556      prop("resourceType", name);
23557      composeCapabilityStatementInner(element);
23558    }
23559  }
23560
23561  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
23562      composeDomainResourceElements(element);
23563      if (element.hasUrlElement()) {
23564        composeUriCore("url", element.getUrlElement(), false);
23565        composeUriExtras("url", element.getUrlElement(), false);
23566      }
23567      if (element.hasVersionElement()) {
23568        composeStringCore("version", element.getVersionElement(), false);
23569        composeStringExtras("version", element.getVersionElement(), false);
23570      }
23571      if (element.hasNameElement()) {
23572        composeStringCore("name", element.getNameElement(), false);
23573        composeStringExtras("name", element.getNameElement(), false);
23574      }
23575      if (element.hasTitleElement()) {
23576        composeStringCore("title", element.getTitleElement(), false);
23577        composeStringExtras("title", element.getTitleElement(), false);
23578      }
23579      if (element.hasStatusElement()) {
23580        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23581        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23582      }
23583      if (element.hasExperimentalElement()) {
23584        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23585        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23586      }
23587      if (element.hasDateElement()) {
23588        composeDateTimeCore("date", element.getDateElement(), false);
23589        composeDateTimeExtras("date", element.getDateElement(), false);
23590      }
23591      if (element.hasPublisherElement()) {
23592        composeStringCore("publisher", element.getPublisherElement(), false);
23593        composeStringExtras("publisher", element.getPublisherElement(), false);
23594      }
23595      if (element.hasContact()) {
23596        openArray("contact");
23597        for (ContactDetail e : element.getContact()) 
23598          composeContactDetail(null, e);
23599        closeArray();
23600      };
23601      if (element.hasDescriptionElement()) {
23602        composeMarkdownCore("description", element.getDescriptionElement(), false);
23603        composeMarkdownExtras("description", element.getDescriptionElement(), false);
23604      }
23605      if (element.hasUseContext()) {
23606        openArray("useContext");
23607        for (UsageContext e : element.getUseContext()) 
23608          composeUsageContext(null, e);
23609        closeArray();
23610      };
23611      if (element.hasJurisdiction()) {
23612        openArray("jurisdiction");
23613        for (CodeableConcept e : element.getJurisdiction()) 
23614          composeCodeableConcept(null, e);
23615        closeArray();
23616      };
23617      if (element.hasPurposeElement()) {
23618        composeMarkdownCore("purpose", element.getPurposeElement(), false);
23619        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
23620      }
23621      if (element.hasCopyrightElement()) {
23622        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
23623        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
23624      }
23625      if (element.hasKindElement()) {
23626        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23627        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23628      }
23629      if (element.hasInstantiates()) {
23630        openArray("instantiates");
23631        for (UriType e : element.getInstantiates()) 
23632          composeUriCore(null, e, true);
23633        closeArray();
23634        if (anyHasExtras(element.getInstantiates())) {
23635          openArray("_instantiates");
23636          for (UriType e : element.getInstantiates()) 
23637            composeUriExtras(null, e, true);
23638          closeArray();
23639        }
23640      };
23641      if (element.hasSoftware()) {
23642        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
23643      }
23644      if (element.hasImplementation()) {
23645        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
23646      }
23647      if (element.hasFhirVersionElement()) {
23648        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
23649        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
23650      }
23651      if (element.hasAcceptUnknownElement()) {
23652        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
23653        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
23654      }
23655      if (element.hasFormat()) {
23656        openArray("format");
23657        for (CodeType e : element.getFormat()) 
23658          composeCodeCore(null, e, true);
23659        closeArray();
23660        if (anyHasExtras(element.getFormat())) {
23661          openArray("_format");
23662          for (CodeType e : element.getFormat()) 
23663            composeCodeExtras(null, e, true);
23664          closeArray();
23665        }
23666      };
23667      if (element.hasPatchFormat()) {
23668        openArray("patchFormat");
23669        for (CodeType e : element.getPatchFormat()) 
23670          composeCodeCore(null, e, true);
23671        closeArray();
23672        if (anyHasExtras(element.getPatchFormat())) {
23673          openArray("_patchFormat");
23674          for (CodeType e : element.getPatchFormat()) 
23675            composeCodeExtras(null, e, true);
23676          closeArray();
23677        }
23678      };
23679      if (element.hasImplementationGuide()) {
23680        openArray("implementationGuide");
23681        for (UriType e : element.getImplementationGuide()) 
23682          composeUriCore(null, e, true);
23683        closeArray();
23684        if (anyHasExtras(element.getImplementationGuide())) {
23685          openArray("_implementationGuide");
23686          for (UriType e : element.getImplementationGuide()) 
23687            composeUriExtras(null, e, true);
23688          closeArray();
23689        }
23690      };
23691      if (element.hasProfile()) {
23692        openArray("profile");
23693        for (Reference e : element.getProfile()) 
23694          composeReference(null, e);
23695        closeArray();
23696      };
23697      if (element.hasRest()) {
23698        openArray("rest");
23699        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
23700          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
23701        closeArray();
23702      };
23703      if (element.hasMessaging()) {
23704        openArray("messaging");
23705        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
23706          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
23707        closeArray();
23708      };
23709      if (element.hasDocument()) {
23710        openArray("document");
23711        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
23712          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
23713        closeArray();
23714      };
23715  }
23716
23717  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
23718    if (element != null) {
23719      open(name);
23720      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
23721      close();
23722    }
23723  }
23724
23725  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
23726      composeBackbone(element);
23727      if (element.hasNameElement()) {
23728        composeStringCore("name", element.getNameElement(), false);
23729        composeStringExtras("name", element.getNameElement(), false);
23730      }
23731      if (element.hasVersionElement()) {
23732        composeStringCore("version", element.getVersionElement(), false);
23733        composeStringExtras("version", element.getVersionElement(), false);
23734      }
23735      if (element.hasReleaseDateElement()) {
23736        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
23737        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
23738      }
23739  }
23740
23741  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
23742    if (element != null) {
23743      open(name);
23744      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
23745      close();
23746    }
23747  }
23748
23749  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
23750      composeBackbone(element);
23751      if (element.hasDescriptionElement()) {
23752        composeStringCore("description", element.getDescriptionElement(), false);
23753        composeStringExtras("description", element.getDescriptionElement(), false);
23754      }
23755      if (element.hasUrlElement()) {
23756        composeUriCore("url", element.getUrlElement(), false);
23757        composeUriExtras("url", element.getUrlElement(), false);
23758      }
23759  }
23760
23761  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
23762    if (element != null) {
23763      open(name);
23764      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
23765      close();
23766    }
23767  }
23768
23769  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
23770      composeBackbone(element);
23771      if (element.hasModeElement()) {
23772        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
23773        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
23774      }
23775      if (element.hasDocumentationElement()) {
23776        composeStringCore("documentation", element.getDocumentationElement(), false);
23777        composeStringExtras("documentation", element.getDocumentationElement(), false);
23778      }
23779      if (element.hasSecurity()) {
23780        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
23781      }
23782      if (element.hasResource()) {
23783        openArray("resource");
23784        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
23785          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
23786        closeArray();
23787      };
23788      if (element.hasInteraction()) {
23789        openArray("interaction");
23790        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
23791          composeCapabilityStatementSystemInteractionComponent(null, e);
23792        closeArray();
23793      };
23794      if (element.hasSearchParam()) {
23795        openArray("searchParam");
23796        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
23797          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
23798        closeArray();
23799      };
23800      if (element.hasOperation()) {
23801        openArray("operation");
23802        for (CapabilityStatement.CapabilityStatementRestOperationComponent e : element.getOperation()) 
23803          composeCapabilityStatementCapabilityStatementRestOperationComponent(null, e);
23804        closeArray();
23805      };
23806      if (element.hasCompartment()) {
23807        openArray("compartment");
23808        for (UriType e : element.getCompartment()) 
23809          composeUriCore(null, e, true);
23810        closeArray();
23811        if (anyHasExtras(element.getCompartment())) {
23812          openArray("_compartment");
23813          for (UriType e : element.getCompartment()) 
23814            composeUriExtras(null, e, true);
23815          closeArray();
23816        }
23817      };
23818  }
23819
23820  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
23821    if (element != null) {
23822      open(name);
23823      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
23824      close();
23825    }
23826  }
23827
23828  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
23829      composeBackbone(element);
23830      if (element.hasCorsElement()) {
23831        composeBooleanCore("cors", element.getCorsElement(), false);
23832        composeBooleanExtras("cors", element.getCorsElement(), false);
23833      }
23834      if (element.hasService()) {
23835        openArray("service");
23836        for (CodeableConcept e : element.getService()) 
23837          composeCodeableConcept(null, e);
23838        closeArray();
23839      };
23840      if (element.hasDescriptionElement()) {
23841        composeStringCore("description", element.getDescriptionElement(), false);
23842        composeStringExtras("description", element.getDescriptionElement(), false);
23843      }
23844      if (element.hasCertificate()) {
23845        openArray("certificate");
23846        for (CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent e : element.getCertificate()) 
23847          composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(null, e);
23848        closeArray();
23849      };
23850  }
23851
23852  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
23853    if (element != null) {
23854      open(name);
23855      composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(element);
23856      close();
23857    }
23858  }
23859
23860  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
23861      composeBackbone(element);
23862      if (element.hasTypeElement()) {
23863        composeCodeCore("type", element.getTypeElement(), false);
23864        composeCodeExtras("type", element.getTypeElement(), false);
23865      }
23866      if (element.hasBlobElement()) {
23867        composeBase64BinaryCore("blob", element.getBlobElement(), false);
23868        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
23869      }
23870  }
23871
23872  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
23873    if (element != null) {
23874      open(name);
23875      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
23876      close();
23877    }
23878  }
23879
23880  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
23881      composeBackbone(element);
23882      if (element.hasTypeElement()) {
23883        composeCodeCore("type", element.getTypeElement(), false);
23884        composeCodeExtras("type", element.getTypeElement(), false);
23885      }
23886      if (element.hasProfile()) {
23887        composeReference("profile", element.getProfile());
23888      }
23889      if (element.hasDocumentationElement()) {
23890        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
23891        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
23892      }
23893      if (element.hasInteraction()) {
23894        openArray("interaction");
23895        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
23896          composeCapabilityStatementResourceInteractionComponent(null, e);
23897        closeArray();
23898      };
23899      if (element.hasVersioningElement()) {
23900        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
23901        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
23902      }
23903      if (element.hasReadHistoryElement()) {
23904        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
23905        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
23906      }
23907      if (element.hasUpdateCreateElement()) {
23908        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
23909        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
23910      }
23911      if (element.hasConditionalCreateElement()) {
23912        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
23913        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
23914      }
23915      if (element.hasConditionalReadElement()) {
23916        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
23917        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
23918      }
23919      if (element.hasConditionalUpdateElement()) {
23920        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
23921        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
23922      }
23923      if (element.hasConditionalDeleteElement()) {
23924        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
23925        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
23926      }
23927      if (element.hasReferencePolicy()) {
23928        openArray("referencePolicy");
23929        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
23930          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
23931        closeArray();
23932        if (anyHasExtras(element.getReferencePolicy())) {
23933          openArray("_referencePolicy");
23934          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
23935            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
23936          closeArray();
23937        }
23938      };
23939      if (element.hasSearchInclude()) {
23940        openArray("searchInclude");
23941        for (StringType e : element.getSearchInclude()) 
23942          composeStringCore(null, e, true);
23943        closeArray();
23944        if (anyHasExtras(element.getSearchInclude())) {
23945          openArray("_searchInclude");
23946          for (StringType e : element.getSearchInclude()) 
23947            composeStringExtras(null, e, true);
23948          closeArray();
23949        }
23950      };
23951      if (element.hasSearchRevInclude()) {
23952        openArray("searchRevInclude");
23953        for (StringType e : element.getSearchRevInclude()) 
23954          composeStringCore(null, e, true);
23955        closeArray();
23956        if (anyHasExtras(element.getSearchRevInclude())) {
23957          openArray("_searchRevInclude");
23958          for (StringType e : element.getSearchRevInclude()) 
23959            composeStringExtras(null, e, true);
23960          closeArray();
23961        }
23962      };
23963      if (element.hasSearchParam()) {
23964        openArray("searchParam");
23965        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
23966          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
23967        closeArray();
23968      };
23969  }
23970
23971  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
23972    if (element != null) {
23973      open(name);
23974      composeCapabilityStatementResourceInteractionComponentInner(element);
23975      close();
23976    }
23977  }
23978
23979  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
23980      composeBackbone(element);
23981      if (element.hasCodeElement()) {
23982        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
23983        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
23984      }
23985      if (element.hasDocumentationElement()) {
23986        composeStringCore("documentation", element.getDocumentationElement(), false);
23987        composeStringExtras("documentation", element.getDocumentationElement(), false);
23988      }
23989  }
23990
23991  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
23992    if (element != null) {
23993      open(name);
23994      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
23995      close();
23996    }
23997  }
23998
23999  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
24000      composeBackbone(element);
24001      if (element.hasNameElement()) {
24002        composeStringCore("name", element.getNameElement(), false);
24003        composeStringExtras("name", element.getNameElement(), false);
24004      }
24005      if (element.hasDefinitionElement()) {
24006        composeUriCore("definition", element.getDefinitionElement(), false);
24007        composeUriExtras("definition", element.getDefinitionElement(), false);
24008      }
24009      if (element.hasTypeElement()) {
24010        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24011        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24012      }
24013      if (element.hasDocumentationElement()) {
24014        composeStringCore("documentation", element.getDocumentationElement(), false);
24015        composeStringExtras("documentation", element.getDocumentationElement(), false);
24016      }
24017  }
24018
24019  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
24020    if (element != null) {
24021      open(name);
24022      composeCapabilityStatementSystemInteractionComponentInner(element);
24023      close();
24024    }
24025  }
24026
24027  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
24028      composeBackbone(element);
24029      if (element.hasCodeElement()) {
24030        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24031        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24032      }
24033      if (element.hasDocumentationElement()) {
24034        composeStringCore("documentation", element.getDocumentationElement(), false);
24035        composeStringExtras("documentation", element.getDocumentationElement(), false);
24036      }
24037  }
24038
24039  protected void composeCapabilityStatementCapabilityStatementRestOperationComponent(String name, CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24040    if (element != null) {
24041      open(name);
24042      composeCapabilityStatementCapabilityStatementRestOperationComponentInner(element);
24043      close();
24044    }
24045  }
24046
24047  protected void composeCapabilityStatementCapabilityStatementRestOperationComponentInner(CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24048      composeBackbone(element);
24049      if (element.hasNameElement()) {
24050        composeStringCore("name", element.getNameElement(), false);
24051        composeStringExtras("name", element.getNameElement(), false);
24052      }
24053      if (element.hasDefinition()) {
24054        composeReference("definition", element.getDefinition());
24055      }
24056  }
24057
24058  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24059    if (element != null) {
24060      open(name);
24061      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
24062      close();
24063    }
24064  }
24065
24066  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24067      composeBackbone(element);
24068      if (element.hasEndpoint()) {
24069        openArray("endpoint");
24070        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
24071          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
24072        closeArray();
24073      };
24074      if (element.hasReliableCacheElement()) {
24075        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
24076        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
24077      }
24078      if (element.hasDocumentationElement()) {
24079        composeStringCore("documentation", element.getDocumentationElement(), false);
24080        composeStringExtras("documentation", element.getDocumentationElement(), false);
24081      }
24082      if (element.hasSupportedMessage()) {
24083        openArray("supportedMessage");
24084        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
24085          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
24086        closeArray();
24087      };
24088      if (element.hasEvent()) {
24089        openArray("event");
24090        for (CapabilityStatement.CapabilityStatementMessagingEventComponent e : element.getEvent()) 
24091          composeCapabilityStatementCapabilityStatementMessagingEventComponent(null, e);
24092        closeArray();
24093      };
24094  }
24095
24096  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24097    if (element != null) {
24098      open(name);
24099      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
24100      close();
24101    }
24102  }
24103
24104  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24105      composeBackbone(element);
24106      if (element.hasProtocol()) {
24107        composeCoding("protocol", element.getProtocol());
24108      }
24109      if (element.hasAddressElement()) {
24110        composeUriCore("address", element.getAddressElement(), false);
24111        composeUriExtras("address", element.getAddressElement(), false);
24112      }
24113  }
24114
24115  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24116    if (element != null) {
24117      open(name);
24118      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
24119      close();
24120    }
24121  }
24122
24123  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24124      composeBackbone(element);
24125      if (element.hasModeElement()) {
24126        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24127        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24128      }
24129      if (element.hasDefinition()) {
24130        composeReference("definition", element.getDefinition());
24131      }
24132  }
24133
24134  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponent(String name, CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24135    if (element != null) {
24136      open(name);
24137      composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(element);
24138      close();
24139    }
24140  }
24141
24142  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24143      composeBackbone(element);
24144      if (element.hasCode()) {
24145        composeCoding("code", element.getCode());
24146      }
24147      if (element.hasCategoryElement()) {
24148        composeEnumerationCore("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24149        composeEnumerationExtras("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24150      }
24151      if (element.hasModeElement()) {
24152        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24153        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24154      }
24155      if (element.hasFocusElement()) {
24156        composeCodeCore("focus", element.getFocusElement(), false);
24157        composeCodeExtras("focus", element.getFocusElement(), false);
24158      }
24159      if (element.hasRequest()) {
24160        composeReference("request", element.getRequest());
24161      }
24162      if (element.hasResponse()) {
24163        composeReference("response", element.getResponse());
24164      }
24165      if (element.hasDocumentationElement()) {
24166        composeStringCore("documentation", element.getDocumentationElement(), false);
24167        composeStringExtras("documentation", element.getDocumentationElement(), false);
24168      }
24169  }
24170
24171  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24172    if (element != null) {
24173      open(name);
24174      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
24175      close();
24176    }
24177  }
24178
24179  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24180      composeBackbone(element);
24181      if (element.hasModeElement()) {
24182        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24183        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24184      }
24185      if (element.hasDocumentationElement()) {
24186        composeStringCore("documentation", element.getDocumentationElement(), false);
24187        composeStringExtras("documentation", element.getDocumentationElement(), false);
24188      }
24189      if (element.hasProfile()) {
24190        composeReference("profile", element.getProfile());
24191      }
24192  }
24193
24194  protected void composeCarePlan(String name, CarePlan element) throws IOException {
24195    if (element != null) {
24196      prop("resourceType", name);
24197      composeCarePlanInner(element);
24198    }
24199  }
24200
24201  protected void composeCarePlanInner(CarePlan element) throws IOException {
24202      composeDomainResourceElements(element);
24203      if (element.hasIdentifier()) {
24204        openArray("identifier");
24205        for (Identifier e : element.getIdentifier()) 
24206          composeIdentifier(null, e);
24207        closeArray();
24208      };
24209      if (element.hasDefinition()) {
24210        openArray("definition");
24211        for (Reference e : element.getDefinition()) 
24212          composeReference(null, e);
24213        closeArray();
24214      };
24215      if (element.hasBasedOn()) {
24216        openArray("basedOn");
24217        for (Reference e : element.getBasedOn()) 
24218          composeReference(null, e);
24219        closeArray();
24220      };
24221      if (element.hasReplaces()) {
24222        openArray("replaces");
24223        for (Reference e : element.getReplaces()) 
24224          composeReference(null, e);
24225        closeArray();
24226      };
24227      if (element.hasPartOf()) {
24228        openArray("partOf");
24229        for (Reference e : element.getPartOf()) 
24230          composeReference(null, e);
24231        closeArray();
24232      };
24233      if (element.hasStatusElement()) {
24234        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24235        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24236      }
24237      if (element.hasIntentElement()) {
24238        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24239        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24240      }
24241      if (element.hasCategory()) {
24242        openArray("category");
24243        for (CodeableConcept e : element.getCategory()) 
24244          composeCodeableConcept(null, e);
24245        closeArray();
24246      };
24247      if (element.hasTitleElement()) {
24248        composeStringCore("title", element.getTitleElement(), false);
24249        composeStringExtras("title", element.getTitleElement(), false);
24250      }
24251      if (element.hasDescriptionElement()) {
24252        composeStringCore("description", element.getDescriptionElement(), false);
24253        composeStringExtras("description", element.getDescriptionElement(), false);
24254      }
24255      if (element.hasSubject()) {
24256        composeReference("subject", element.getSubject());
24257      }
24258      if (element.hasContext()) {
24259        composeReference("context", element.getContext());
24260      }
24261      if (element.hasPeriod()) {
24262        composePeriod("period", element.getPeriod());
24263      }
24264      if (element.hasAuthor()) {
24265        openArray("author");
24266        for (Reference e : element.getAuthor()) 
24267          composeReference(null, e);
24268        closeArray();
24269      };
24270      if (element.hasCareTeam()) {
24271        openArray("careTeam");
24272        for (Reference e : element.getCareTeam()) 
24273          composeReference(null, e);
24274        closeArray();
24275      };
24276      if (element.hasAddresses()) {
24277        openArray("addresses");
24278        for (Reference e : element.getAddresses()) 
24279          composeReference(null, e);
24280        closeArray();
24281      };
24282      if (element.hasSupportingInfo()) {
24283        openArray("supportingInfo");
24284        for (Reference e : element.getSupportingInfo()) 
24285          composeReference(null, e);
24286        closeArray();
24287      };
24288      if (element.hasGoal()) {
24289        openArray("goal");
24290        for (Reference e : element.getGoal()) 
24291          composeReference(null, e);
24292        closeArray();
24293      };
24294      if (element.hasActivity()) {
24295        openArray("activity");
24296        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
24297          composeCarePlanCarePlanActivityComponent(null, e);
24298        closeArray();
24299      };
24300      if (element.hasNote()) {
24301        openArray("note");
24302        for (Annotation e : element.getNote()) 
24303          composeAnnotation(null, e);
24304        closeArray();
24305      };
24306  }
24307
24308  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
24309    if (element != null) {
24310      open(name);
24311      composeCarePlanCarePlanActivityComponentInner(element);
24312      close();
24313    }
24314  }
24315
24316  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
24317      composeBackbone(element);
24318      if (element.hasOutcomeCodeableConcept()) {
24319        openArray("outcomeCodeableConcept");
24320        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
24321          composeCodeableConcept(null, e);
24322        closeArray();
24323      };
24324      if (element.hasOutcomeReference()) {
24325        openArray("outcomeReference");
24326        for (Reference e : element.getOutcomeReference()) 
24327          composeReference(null, e);
24328        closeArray();
24329      };
24330      if (element.hasProgress()) {
24331        openArray("progress");
24332        for (Annotation e : element.getProgress()) 
24333          composeAnnotation(null, e);
24334        closeArray();
24335      };
24336      if (element.hasReference()) {
24337        composeReference("reference", element.getReference());
24338      }
24339      if (element.hasDetail()) {
24340        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
24341      }
24342  }
24343
24344  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24345    if (element != null) {
24346      open(name);
24347      composeCarePlanCarePlanActivityDetailComponentInner(element);
24348      close();
24349    }
24350  }
24351
24352  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24353      composeBackbone(element);
24354      if (element.hasCategory()) {
24355        composeCodeableConcept("category", element.getCategory());
24356      }
24357      if (element.hasDefinition()) {
24358        composeReference("definition", element.getDefinition());
24359      }
24360      if (element.hasCode()) {
24361        composeCodeableConcept("code", element.getCode());
24362      }
24363      if (element.hasReasonCode()) {
24364        openArray("reasonCode");
24365        for (CodeableConcept e : element.getReasonCode()) 
24366          composeCodeableConcept(null, e);
24367        closeArray();
24368      };
24369      if (element.hasReasonReference()) {
24370        openArray("reasonReference");
24371        for (Reference e : element.getReasonReference()) 
24372          composeReference(null, e);
24373        closeArray();
24374      };
24375      if (element.hasGoal()) {
24376        openArray("goal");
24377        for (Reference e : element.getGoal()) 
24378          composeReference(null, e);
24379        closeArray();
24380      };
24381      if (element.hasStatusElement()) {
24382        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24383        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24384      }
24385      if (element.hasStatusReasonElement()) {
24386        composeStringCore("statusReason", element.getStatusReasonElement(), false);
24387        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
24388      }
24389      if (element.hasProhibitedElement()) {
24390        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
24391        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
24392      }
24393      if (element.hasScheduled()) {
24394        composeType("scheduled", element.getScheduled());
24395      }
24396      if (element.hasLocation()) {
24397        composeReference("location", element.getLocation());
24398      }
24399      if (element.hasPerformer()) {
24400        openArray("performer");
24401        for (Reference e : element.getPerformer()) 
24402          composeReference(null, e);
24403        closeArray();
24404      };
24405      if (element.hasProduct()) {
24406        composeType("product", element.getProduct());
24407      }
24408      if (element.hasDailyAmount()) {
24409        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
24410      }
24411      if (element.hasQuantity()) {
24412        composeSimpleQuantity("quantity", element.getQuantity());
24413      }
24414      if (element.hasDescriptionElement()) {
24415        composeStringCore("description", element.getDescriptionElement(), false);
24416        composeStringExtras("description", element.getDescriptionElement(), false);
24417      }
24418  }
24419
24420  protected void composeCareTeam(String name, CareTeam element) throws IOException {
24421    if (element != null) {
24422      prop("resourceType", name);
24423      composeCareTeamInner(element);
24424    }
24425  }
24426
24427  protected void composeCareTeamInner(CareTeam element) throws IOException {
24428      composeDomainResourceElements(element);
24429      if (element.hasIdentifier()) {
24430        openArray("identifier");
24431        for (Identifier e : element.getIdentifier()) 
24432          composeIdentifier(null, e);
24433        closeArray();
24434      };
24435      if (element.hasStatusElement()) {
24436        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24437        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24438      }
24439      if (element.hasCategory()) {
24440        openArray("category");
24441        for (CodeableConcept e : element.getCategory()) 
24442          composeCodeableConcept(null, e);
24443        closeArray();
24444      };
24445      if (element.hasNameElement()) {
24446        composeStringCore("name", element.getNameElement(), false);
24447        composeStringExtras("name", element.getNameElement(), false);
24448      }
24449      if (element.hasSubject()) {
24450        composeReference("subject", element.getSubject());
24451      }
24452      if (element.hasContext()) {
24453        composeReference("context", element.getContext());
24454      }
24455      if (element.hasPeriod()) {
24456        composePeriod("period", element.getPeriod());
24457      }
24458      if (element.hasParticipant()) {
24459        openArray("participant");
24460        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
24461          composeCareTeamCareTeamParticipantComponent(null, e);
24462        closeArray();
24463      };
24464      if (element.hasReasonCode()) {
24465        openArray("reasonCode");
24466        for (CodeableConcept e : element.getReasonCode()) 
24467          composeCodeableConcept(null, e);
24468        closeArray();
24469      };
24470      if (element.hasReasonReference()) {
24471        openArray("reasonReference");
24472        for (Reference e : element.getReasonReference()) 
24473          composeReference(null, e);
24474        closeArray();
24475      };
24476      if (element.hasManagingOrganization()) {
24477        openArray("managingOrganization");
24478        for (Reference e : element.getManagingOrganization()) 
24479          composeReference(null, e);
24480        closeArray();
24481      };
24482      if (element.hasNote()) {
24483        openArray("note");
24484        for (Annotation e : element.getNote()) 
24485          composeAnnotation(null, e);
24486        closeArray();
24487      };
24488  }
24489
24490  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
24491    if (element != null) {
24492      open(name);
24493      composeCareTeamCareTeamParticipantComponentInner(element);
24494      close();
24495    }
24496  }
24497
24498  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
24499      composeBackbone(element);
24500      if (element.hasRole()) {
24501        composeCodeableConcept("role", element.getRole());
24502      }
24503      if (element.hasMember()) {
24504        composeReference("member", element.getMember());
24505      }
24506      if (element.hasOnBehalfOf()) {
24507        composeReference("onBehalfOf", element.getOnBehalfOf());
24508      }
24509      if (element.hasPeriod()) {
24510        composePeriod("period", element.getPeriod());
24511      }
24512  }
24513
24514  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
24515    if (element != null) {
24516      prop("resourceType", name);
24517      composeChargeItemInner(element);
24518    }
24519  }
24520
24521  protected void composeChargeItemInner(ChargeItem element) throws IOException {
24522      composeDomainResourceElements(element);
24523      if (element.hasIdentifier()) {
24524        composeIdentifier("identifier", element.getIdentifier());
24525      }
24526      if (element.hasDefinition()) {
24527        openArray("definition");
24528        for (UriType e : element.getDefinition()) 
24529          composeUriCore(null, e, true);
24530        closeArray();
24531        if (anyHasExtras(element.getDefinition())) {
24532          openArray("_definition");
24533          for (UriType e : element.getDefinition()) 
24534            composeUriExtras(null, e, true);
24535          closeArray();
24536        }
24537      };
24538      if (element.hasStatusElement()) {
24539        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24540        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24541      }
24542      if (element.hasPartOf()) {
24543        openArray("partOf");
24544        for (Reference e : element.getPartOf()) 
24545          composeReference(null, e);
24546        closeArray();
24547      };
24548      if (element.hasCode()) {
24549        composeCodeableConcept("code", element.getCode());
24550      }
24551      if (element.hasSubject()) {
24552        composeReference("subject", element.getSubject());
24553      }
24554      if (element.hasContext()) {
24555        composeReference("context", element.getContext());
24556      }
24557      if (element.hasOccurrence()) {
24558        composeType("occurrence", element.getOccurrence());
24559      }
24560      if (element.hasParticipant()) {
24561        openArray("participant");
24562        for (ChargeItem.ChargeItemParticipantComponent e : element.getParticipant()) 
24563          composeChargeItemChargeItemParticipantComponent(null, e);
24564        closeArray();
24565      };
24566      if (element.hasPerformingOrganization()) {
24567        composeReference("performingOrganization", element.getPerformingOrganization());
24568      }
24569      if (element.hasRequestingOrganization()) {
24570        composeReference("requestingOrganization", element.getRequestingOrganization());
24571      }
24572      if (element.hasQuantity()) {
24573        composeQuantity("quantity", element.getQuantity());
24574      }
24575      if (element.hasBodysite()) {
24576        openArray("bodysite");
24577        for (CodeableConcept e : element.getBodysite()) 
24578          composeCodeableConcept(null, e);
24579        closeArray();
24580      };
24581      if (element.hasFactorOverrideElement()) {
24582        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
24583        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
24584      }
24585      if (element.hasPriceOverride()) {
24586        composeMoney("priceOverride", element.getPriceOverride());
24587      }
24588      if (element.hasOverrideReasonElement()) {
24589        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
24590        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
24591      }
24592      if (element.hasEnterer()) {
24593        composeReference("enterer", element.getEnterer());
24594      }
24595      if (element.hasEnteredDateElement()) {
24596        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
24597        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
24598      }
24599      if (element.hasReason()) {
24600        openArray("reason");
24601        for (CodeableConcept e : element.getReason()) 
24602          composeCodeableConcept(null, e);
24603        closeArray();
24604      };
24605      if (element.hasService()) {
24606        openArray("service");
24607        for (Reference e : element.getService()) 
24608          composeReference(null, e);
24609        closeArray();
24610      };
24611      if (element.hasAccount()) {
24612        openArray("account");
24613        for (Reference e : element.getAccount()) 
24614          composeReference(null, e);
24615        closeArray();
24616      };
24617      if (element.hasNote()) {
24618        openArray("note");
24619        for (Annotation e : element.getNote()) 
24620          composeAnnotation(null, e);
24621        closeArray();
24622      };
24623      if (element.hasSupportingInformation()) {
24624        openArray("supportingInformation");
24625        for (Reference e : element.getSupportingInformation()) 
24626          composeReference(null, e);
24627        closeArray();
24628      };
24629  }
24630
24631  protected void composeChargeItemChargeItemParticipantComponent(String name, ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24632    if (element != null) {
24633      open(name);
24634      composeChargeItemChargeItemParticipantComponentInner(element);
24635      close();
24636    }
24637  }
24638
24639  protected void composeChargeItemChargeItemParticipantComponentInner(ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24640      composeBackbone(element);
24641      if (element.hasRole()) {
24642        composeCodeableConcept("role", element.getRole());
24643      }
24644      if (element.hasActor()) {
24645        composeReference("actor", element.getActor());
24646      }
24647  }
24648
24649  protected void composeClaim(String name, Claim element) throws IOException {
24650    if (element != null) {
24651      prop("resourceType", name);
24652      composeClaimInner(element);
24653    }
24654  }
24655
24656  protected void composeClaimInner(Claim element) throws IOException {
24657      composeDomainResourceElements(element);
24658      if (element.hasIdentifier()) {
24659        openArray("identifier");
24660        for (Identifier e : element.getIdentifier()) 
24661          composeIdentifier(null, e);
24662        closeArray();
24663      };
24664      if (element.hasStatusElement()) {
24665        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
24666        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
24667      }
24668      if (element.hasType()) {
24669        composeCodeableConcept("type", element.getType());
24670      }
24671      if (element.hasSubType()) {
24672        openArray("subType");
24673        for (CodeableConcept e : element.getSubType()) 
24674          composeCodeableConcept(null, e);
24675        closeArray();
24676      };
24677      if (element.hasUseElement()) {
24678        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
24679        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
24680      }
24681      if (element.hasPatient()) {
24682        composeReference("patient", element.getPatient());
24683      }
24684      if (element.hasBillablePeriod()) {
24685        composePeriod("billablePeriod", element.getBillablePeriod());
24686      }
24687      if (element.hasCreatedElement()) {
24688        composeDateTimeCore("created", element.getCreatedElement(), false);
24689        composeDateTimeExtras("created", element.getCreatedElement(), false);
24690      }
24691      if (element.hasEnterer()) {
24692        composeReference("enterer", element.getEnterer());
24693      }
24694      if (element.hasInsurer()) {
24695        composeReference("insurer", element.getInsurer());
24696      }
24697      if (element.hasProvider()) {
24698        composeReference("provider", element.getProvider());
24699      }
24700      if (element.hasOrganization()) {
24701        composeReference("organization", element.getOrganization());
24702      }
24703      if (element.hasPriority()) {
24704        composeCodeableConcept("priority", element.getPriority());
24705      }
24706      if (element.hasFundsReserve()) {
24707        composeCodeableConcept("fundsReserve", element.getFundsReserve());
24708      }
24709      if (element.hasRelated()) {
24710        openArray("related");
24711        for (Claim.RelatedClaimComponent e : element.getRelated()) 
24712          composeClaimRelatedClaimComponent(null, e);
24713        closeArray();
24714      };
24715      if (element.hasPrescription()) {
24716        composeReference("prescription", element.getPrescription());
24717      }
24718      if (element.hasOriginalPrescription()) {
24719        composeReference("originalPrescription", element.getOriginalPrescription());
24720      }
24721      if (element.hasPayee()) {
24722        composeClaimPayeeComponent("payee", element.getPayee());
24723      }
24724      if (element.hasReferral()) {
24725        composeReference("referral", element.getReferral());
24726      }
24727      if (element.hasFacility()) {
24728        composeReference("facility", element.getFacility());
24729      }
24730      if (element.hasCareTeam()) {
24731        openArray("careTeam");
24732        for (Claim.CareTeamComponent e : element.getCareTeam()) 
24733          composeClaimCareTeamComponent(null, e);
24734        closeArray();
24735      };
24736      if (element.hasInformation()) {
24737        openArray("information");
24738        for (Claim.SpecialConditionComponent e : element.getInformation()) 
24739          composeClaimSpecialConditionComponent(null, e);
24740        closeArray();
24741      };
24742      if (element.hasDiagnosis()) {
24743        openArray("diagnosis");
24744        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
24745          composeClaimDiagnosisComponent(null, e);
24746        closeArray();
24747      };
24748      if (element.hasProcedure()) {
24749        openArray("procedure");
24750        for (Claim.ProcedureComponent e : element.getProcedure()) 
24751          composeClaimProcedureComponent(null, e);
24752        closeArray();
24753      };
24754      if (element.hasInsurance()) {
24755        openArray("insurance");
24756        for (Claim.InsuranceComponent e : element.getInsurance()) 
24757          composeClaimInsuranceComponent(null, e);
24758        closeArray();
24759      };
24760      if (element.hasAccident()) {
24761        composeClaimAccidentComponent("accident", element.getAccident());
24762      }
24763      if (element.hasEmploymentImpacted()) {
24764        composePeriod("employmentImpacted", element.getEmploymentImpacted());
24765      }
24766      if (element.hasHospitalization()) {
24767        composePeriod("hospitalization", element.getHospitalization());
24768      }
24769      if (element.hasItem()) {
24770        openArray("item");
24771        for (Claim.ItemComponent e : element.getItem()) 
24772          composeClaimItemComponent(null, e);
24773        closeArray();
24774      };
24775      if (element.hasTotal()) {
24776        composeMoney("total", element.getTotal());
24777      }
24778  }
24779
24780  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
24781    if (element != null) {
24782      open(name);
24783      composeClaimRelatedClaimComponentInner(element);
24784      close();
24785    }
24786  }
24787
24788  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
24789      composeBackbone(element);
24790      if (element.hasClaim()) {
24791        composeReference("claim", element.getClaim());
24792      }
24793      if (element.hasRelationship()) {
24794        composeCodeableConcept("relationship", element.getRelationship());
24795      }
24796      if (element.hasReference()) {
24797        composeIdentifier("reference", element.getReference());
24798      }
24799  }
24800
24801  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
24802    if (element != null) {
24803      open(name);
24804      composeClaimPayeeComponentInner(element);
24805      close();
24806    }
24807  }
24808
24809  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
24810      composeBackbone(element);
24811      if (element.hasType()) {
24812        composeCodeableConcept("type", element.getType());
24813      }
24814      if (element.hasResourceType()) {
24815        composeCoding("resourceType", element.getResourceType());
24816      }
24817      if (element.hasParty()) {
24818        composeReference("party", element.getParty());
24819      }
24820  }
24821
24822  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
24823    if (element != null) {
24824      open(name);
24825      composeClaimCareTeamComponentInner(element);
24826      close();
24827    }
24828  }
24829
24830  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
24831      composeBackbone(element);
24832      if (element.hasSequenceElement()) {
24833        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24834        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24835      }
24836      if (element.hasProvider()) {
24837        composeReference("provider", element.getProvider());
24838      }
24839      if (element.hasResponsibleElement()) {
24840        composeBooleanCore("responsible", element.getResponsibleElement(), false);
24841        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
24842      }
24843      if (element.hasRole()) {
24844        composeCodeableConcept("role", element.getRole());
24845      }
24846      if (element.hasQualification()) {
24847        composeCodeableConcept("qualification", element.getQualification());
24848      }
24849  }
24850
24851  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
24852    if (element != null) {
24853      open(name);
24854      composeClaimSpecialConditionComponentInner(element);
24855      close();
24856    }
24857  }
24858
24859  protected void composeClaimSpecialConditionComponentInner(Claim.SpecialConditionComponent element) throws IOException {
24860      composeBackbone(element);
24861      if (element.hasSequenceElement()) {
24862        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24863        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24864      }
24865      if (element.hasCategory()) {
24866        composeCodeableConcept("category", element.getCategory());
24867      }
24868      if (element.hasCode()) {
24869        composeCodeableConcept("code", element.getCode());
24870      }
24871      if (element.hasTiming()) {
24872        composeType("timing", element.getTiming());
24873      }
24874      if (element.hasValue()) {
24875        composeType("value", element.getValue());
24876      }
24877      if (element.hasReason()) {
24878        composeCodeableConcept("reason", element.getReason());
24879      }
24880  }
24881
24882  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
24883    if (element != null) {
24884      open(name);
24885      composeClaimDiagnosisComponentInner(element);
24886      close();
24887    }
24888  }
24889
24890  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
24891      composeBackbone(element);
24892      if (element.hasSequenceElement()) {
24893        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24894        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24895      }
24896      if (element.hasDiagnosis()) {
24897        composeType("diagnosis", element.getDiagnosis());
24898      }
24899      if (element.hasType()) {
24900        openArray("type");
24901        for (CodeableConcept e : element.getType()) 
24902          composeCodeableConcept(null, e);
24903        closeArray();
24904      };
24905      if (element.hasPackageCode()) {
24906        composeCodeableConcept("packageCode", element.getPackageCode());
24907      }
24908  }
24909
24910  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
24911    if (element != null) {
24912      open(name);
24913      composeClaimProcedureComponentInner(element);
24914      close();
24915    }
24916  }
24917
24918  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
24919      composeBackbone(element);
24920      if (element.hasSequenceElement()) {
24921        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24922        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24923      }
24924      if (element.hasDateElement()) {
24925        composeDateTimeCore("date", element.getDateElement(), false);
24926        composeDateTimeExtras("date", element.getDateElement(), false);
24927      }
24928      if (element.hasProcedure()) {
24929        composeType("procedure", element.getProcedure());
24930      }
24931  }
24932
24933  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
24934    if (element != null) {
24935      open(name);
24936      composeClaimInsuranceComponentInner(element);
24937      close();
24938    }
24939  }
24940
24941  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
24942      composeBackbone(element);
24943      if (element.hasSequenceElement()) {
24944        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24945        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24946      }
24947      if (element.hasFocalElement()) {
24948        composeBooleanCore("focal", element.getFocalElement(), false);
24949        composeBooleanExtras("focal", element.getFocalElement(), false);
24950      }
24951      if (element.hasCoverage()) {
24952        composeReference("coverage", element.getCoverage());
24953      }
24954      if (element.hasBusinessArrangementElement()) {
24955        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
24956        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
24957      }
24958      if (element.hasPreAuthRef()) {
24959        openArray("preAuthRef");
24960        for (StringType e : element.getPreAuthRef()) 
24961          composeStringCore(null, e, true);
24962        closeArray();
24963        if (anyHasExtras(element.getPreAuthRef())) {
24964          openArray("_preAuthRef");
24965          for (StringType e : element.getPreAuthRef()) 
24966            composeStringExtras(null, e, true);
24967          closeArray();
24968        }
24969      };
24970      if (element.hasClaimResponse()) {
24971        composeReference("claimResponse", element.getClaimResponse());
24972      }
24973  }
24974
24975  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
24976    if (element != null) {
24977      open(name);
24978      composeClaimAccidentComponentInner(element);
24979      close();
24980    }
24981  }
24982
24983  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
24984      composeBackbone(element);
24985      if (element.hasDateElement()) {
24986        composeDateCore("date", element.getDateElement(), false);
24987        composeDateExtras("date", element.getDateElement(), false);
24988      }
24989      if (element.hasType()) {
24990        composeCodeableConcept("type", element.getType());
24991      }
24992      if (element.hasLocation()) {
24993        composeType("location", element.getLocation());
24994      }
24995  }
24996
24997  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
24998    if (element != null) {
24999      open(name);
25000      composeClaimItemComponentInner(element);
25001      close();
25002    }
25003  }
25004
25005  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
25006      composeBackbone(element);
25007      if (element.hasSequenceElement()) {
25008        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25009        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25010      }
25011      if (element.hasCareTeamLinkId()) {
25012        openArray("careTeamLinkId");
25013        for (PositiveIntType e : element.getCareTeamLinkId()) 
25014          composePositiveIntCore(null, e, true);
25015        closeArray();
25016        if (anyHasExtras(element.getCareTeamLinkId())) {
25017          openArray("_careTeamLinkId");
25018          for (PositiveIntType e : element.getCareTeamLinkId()) 
25019            composePositiveIntExtras(null, e, true);
25020          closeArray();
25021        }
25022      };
25023      if (element.hasDiagnosisLinkId()) {
25024        openArray("diagnosisLinkId");
25025        for (PositiveIntType e : element.getDiagnosisLinkId()) 
25026          composePositiveIntCore(null, e, true);
25027        closeArray();
25028        if (anyHasExtras(element.getDiagnosisLinkId())) {
25029          openArray("_diagnosisLinkId");
25030          for (PositiveIntType e : element.getDiagnosisLinkId()) 
25031            composePositiveIntExtras(null, e, true);
25032          closeArray();
25033        }
25034      };
25035      if (element.hasProcedureLinkId()) {
25036        openArray("procedureLinkId");
25037        for (PositiveIntType e : element.getProcedureLinkId()) 
25038          composePositiveIntCore(null, e, true);
25039        closeArray();
25040        if (anyHasExtras(element.getProcedureLinkId())) {
25041          openArray("_procedureLinkId");
25042          for (PositiveIntType e : element.getProcedureLinkId()) 
25043            composePositiveIntExtras(null, e, true);
25044          closeArray();
25045        }
25046      };
25047      if (element.hasInformationLinkId()) {
25048        openArray("informationLinkId");
25049        for (PositiveIntType e : element.getInformationLinkId()) 
25050          composePositiveIntCore(null, e, true);
25051        closeArray();
25052        if (anyHasExtras(element.getInformationLinkId())) {
25053          openArray("_informationLinkId");
25054          for (PositiveIntType e : element.getInformationLinkId()) 
25055            composePositiveIntExtras(null, e, true);
25056          closeArray();
25057        }
25058      };
25059      if (element.hasRevenue()) {
25060        composeCodeableConcept("revenue", element.getRevenue());
25061      }
25062      if (element.hasCategory()) {
25063        composeCodeableConcept("category", element.getCategory());
25064      }
25065      if (element.hasService()) {
25066        composeCodeableConcept("service", element.getService());
25067      }
25068      if (element.hasModifier()) {
25069        openArray("modifier");
25070        for (CodeableConcept e : element.getModifier()) 
25071          composeCodeableConcept(null, e);
25072        closeArray();
25073      };
25074      if (element.hasProgramCode()) {
25075        openArray("programCode");
25076        for (CodeableConcept e : element.getProgramCode()) 
25077          composeCodeableConcept(null, e);
25078        closeArray();
25079      };
25080      if (element.hasServiced()) {
25081        composeType("serviced", element.getServiced());
25082      }
25083      if (element.hasLocation()) {
25084        composeType("location", element.getLocation());
25085      }
25086      if (element.hasQuantity()) {
25087        composeSimpleQuantity("quantity", element.getQuantity());
25088      }
25089      if (element.hasUnitPrice()) {
25090        composeMoney("unitPrice", element.getUnitPrice());
25091      }
25092      if (element.hasFactorElement()) {
25093        composeDecimalCore("factor", element.getFactorElement(), false);
25094        composeDecimalExtras("factor", element.getFactorElement(), false);
25095      }
25096      if (element.hasNet()) {
25097        composeMoney("net", element.getNet());
25098      }
25099      if (element.hasUdi()) {
25100        openArray("udi");
25101        for (Reference e : element.getUdi()) 
25102          composeReference(null, e);
25103        closeArray();
25104      };
25105      if (element.hasBodySite()) {
25106        composeCodeableConcept("bodySite", element.getBodySite());
25107      }
25108      if (element.hasSubSite()) {
25109        openArray("subSite");
25110        for (CodeableConcept e : element.getSubSite()) 
25111          composeCodeableConcept(null, e);
25112        closeArray();
25113      };
25114      if (element.hasEncounter()) {
25115        openArray("encounter");
25116        for (Reference e : element.getEncounter()) 
25117          composeReference(null, e);
25118        closeArray();
25119      };
25120      if (element.hasDetail()) {
25121        openArray("detail");
25122        for (Claim.DetailComponent e : element.getDetail()) 
25123          composeClaimDetailComponent(null, e);
25124        closeArray();
25125      };
25126  }
25127
25128  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
25129    if (element != null) {
25130      open(name);
25131      composeClaimDetailComponentInner(element);
25132      close();
25133    }
25134  }
25135
25136  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
25137      composeBackbone(element);
25138      if (element.hasSequenceElement()) {
25139        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25140        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25141      }
25142      if (element.hasRevenue()) {
25143        composeCodeableConcept("revenue", element.getRevenue());
25144      }
25145      if (element.hasCategory()) {
25146        composeCodeableConcept("category", element.getCategory());
25147      }
25148      if (element.hasService()) {
25149        composeCodeableConcept("service", element.getService());
25150      }
25151      if (element.hasModifier()) {
25152        openArray("modifier");
25153        for (CodeableConcept e : element.getModifier()) 
25154          composeCodeableConcept(null, e);
25155        closeArray();
25156      };
25157      if (element.hasProgramCode()) {
25158        openArray("programCode");
25159        for (CodeableConcept e : element.getProgramCode()) 
25160          composeCodeableConcept(null, e);
25161        closeArray();
25162      };
25163      if (element.hasQuantity()) {
25164        composeSimpleQuantity("quantity", element.getQuantity());
25165      }
25166      if (element.hasUnitPrice()) {
25167        composeMoney("unitPrice", element.getUnitPrice());
25168      }
25169      if (element.hasFactorElement()) {
25170        composeDecimalCore("factor", element.getFactorElement(), false);
25171        composeDecimalExtras("factor", element.getFactorElement(), false);
25172      }
25173      if (element.hasNet()) {
25174        composeMoney("net", element.getNet());
25175      }
25176      if (element.hasUdi()) {
25177        openArray("udi");
25178        for (Reference e : element.getUdi()) 
25179          composeReference(null, e);
25180        closeArray();
25181      };
25182      if (element.hasSubDetail()) {
25183        openArray("subDetail");
25184        for (Claim.SubDetailComponent e : element.getSubDetail()) 
25185          composeClaimSubDetailComponent(null, e);
25186        closeArray();
25187      };
25188  }
25189
25190  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
25191    if (element != null) {
25192      open(name);
25193      composeClaimSubDetailComponentInner(element);
25194      close();
25195    }
25196  }
25197
25198  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
25199      composeBackbone(element);
25200      if (element.hasSequenceElement()) {
25201        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25202        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25203      }
25204      if (element.hasRevenue()) {
25205        composeCodeableConcept("revenue", element.getRevenue());
25206      }
25207      if (element.hasCategory()) {
25208        composeCodeableConcept("category", element.getCategory());
25209      }
25210      if (element.hasService()) {
25211        composeCodeableConcept("service", element.getService());
25212      }
25213      if (element.hasModifier()) {
25214        openArray("modifier");
25215        for (CodeableConcept e : element.getModifier()) 
25216          composeCodeableConcept(null, e);
25217        closeArray();
25218      };
25219      if (element.hasProgramCode()) {
25220        openArray("programCode");
25221        for (CodeableConcept e : element.getProgramCode()) 
25222          composeCodeableConcept(null, e);
25223        closeArray();
25224      };
25225      if (element.hasQuantity()) {
25226        composeSimpleQuantity("quantity", element.getQuantity());
25227      }
25228      if (element.hasUnitPrice()) {
25229        composeMoney("unitPrice", element.getUnitPrice());
25230      }
25231      if (element.hasFactorElement()) {
25232        composeDecimalCore("factor", element.getFactorElement(), false);
25233        composeDecimalExtras("factor", element.getFactorElement(), false);
25234      }
25235      if (element.hasNet()) {
25236        composeMoney("net", element.getNet());
25237      }
25238      if (element.hasUdi()) {
25239        openArray("udi");
25240        for (Reference e : element.getUdi()) 
25241          composeReference(null, e);
25242        closeArray();
25243      };
25244  }
25245
25246  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
25247    if (element != null) {
25248      prop("resourceType", name);
25249      composeClaimResponseInner(element);
25250    }
25251  }
25252
25253  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
25254      composeDomainResourceElements(element);
25255      if (element.hasIdentifier()) {
25256        openArray("identifier");
25257        for (Identifier e : element.getIdentifier()) 
25258          composeIdentifier(null, e);
25259        closeArray();
25260      };
25261      if (element.hasStatusElement()) {
25262        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25263        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25264      }
25265      if (element.hasPatient()) {
25266        composeReference("patient", element.getPatient());
25267      }
25268      if (element.hasCreatedElement()) {
25269        composeDateTimeCore("created", element.getCreatedElement(), false);
25270        composeDateTimeExtras("created", element.getCreatedElement(), false);
25271      }
25272      if (element.hasInsurer()) {
25273        composeReference("insurer", element.getInsurer());
25274      }
25275      if (element.hasRequestProvider()) {
25276        composeReference("requestProvider", element.getRequestProvider());
25277      }
25278      if (element.hasRequestOrganization()) {
25279        composeReference("requestOrganization", element.getRequestOrganization());
25280      }
25281      if (element.hasRequest()) {
25282        composeReference("request", element.getRequest());
25283      }
25284      if (element.hasOutcome()) {
25285        composeCodeableConcept("outcome", element.getOutcome());
25286      }
25287      if (element.hasDispositionElement()) {
25288        composeStringCore("disposition", element.getDispositionElement(), false);
25289        composeStringExtras("disposition", element.getDispositionElement(), false);
25290      }
25291      if (element.hasPayeeType()) {
25292        composeCodeableConcept("payeeType", element.getPayeeType());
25293      }
25294      if (element.hasItem()) {
25295        openArray("item");
25296        for (ClaimResponse.ItemComponent e : element.getItem()) 
25297          composeClaimResponseItemComponent(null, e);
25298        closeArray();
25299      };
25300      if (element.hasAddItem()) {
25301        openArray("addItem");
25302        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
25303          composeClaimResponseAddedItemComponent(null, e);
25304        closeArray();
25305      };
25306      if (element.hasError()) {
25307        openArray("error");
25308        for (ClaimResponse.ErrorComponent e : element.getError()) 
25309          composeClaimResponseErrorComponent(null, e);
25310        closeArray();
25311      };
25312      if (element.hasTotalCost()) {
25313        composeMoney("totalCost", element.getTotalCost());
25314      }
25315      if (element.hasUnallocDeductable()) {
25316        composeMoney("unallocDeductable", element.getUnallocDeductable());
25317      }
25318      if (element.hasTotalBenefit()) {
25319        composeMoney("totalBenefit", element.getTotalBenefit());
25320      }
25321      if (element.hasPayment()) {
25322        composeClaimResponsePaymentComponent("payment", element.getPayment());
25323      }
25324      if (element.hasReserved()) {
25325        composeCoding("reserved", element.getReserved());
25326      }
25327      if (element.hasForm()) {
25328        composeCodeableConcept("form", element.getForm());
25329      }
25330      if (element.hasProcessNote()) {
25331        openArray("processNote");
25332        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
25333          composeClaimResponseNoteComponent(null, e);
25334        closeArray();
25335      };
25336      if (element.hasCommunicationRequest()) {
25337        openArray("communicationRequest");
25338        for (Reference e : element.getCommunicationRequest()) 
25339          composeReference(null, e);
25340        closeArray();
25341      };
25342      if (element.hasInsurance()) {
25343        openArray("insurance");
25344        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
25345          composeClaimResponseInsuranceComponent(null, e);
25346        closeArray();
25347      };
25348  }
25349
25350  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
25351    if (element != null) {
25352      open(name);
25353      composeClaimResponseItemComponentInner(element);
25354      close();
25355    }
25356  }
25357
25358  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
25359      composeBackbone(element);
25360      if (element.hasSequenceLinkIdElement()) {
25361        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25362        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25363      }
25364      if (element.hasNoteNumber()) {
25365        openArray("noteNumber");
25366        for (PositiveIntType e : element.getNoteNumber()) 
25367          composePositiveIntCore(null, e, true);
25368        closeArray();
25369        if (anyHasExtras(element.getNoteNumber())) {
25370          openArray("_noteNumber");
25371          for (PositiveIntType e : element.getNoteNumber()) 
25372            composePositiveIntExtras(null, e, true);
25373          closeArray();
25374        }
25375      };
25376      if (element.hasAdjudication()) {
25377        openArray("adjudication");
25378        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25379          composeClaimResponseAdjudicationComponent(null, e);
25380        closeArray();
25381      };
25382      if (element.hasDetail()) {
25383        openArray("detail");
25384        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
25385          composeClaimResponseItemDetailComponent(null, e);
25386        closeArray();
25387      };
25388  }
25389
25390  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
25391    if (element != null) {
25392      open(name);
25393      composeClaimResponseAdjudicationComponentInner(element);
25394      close();
25395    }
25396  }
25397
25398  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
25399      composeBackbone(element);
25400      if (element.hasCategory()) {
25401        composeCodeableConcept("category", element.getCategory());
25402      }
25403      if (element.hasReason()) {
25404        composeCodeableConcept("reason", element.getReason());
25405      }
25406      if (element.hasAmount()) {
25407        composeMoney("amount", element.getAmount());
25408      }
25409      if (element.hasValueElement()) {
25410        composeDecimalCore("value", element.getValueElement(), false);
25411        composeDecimalExtras("value", element.getValueElement(), false);
25412      }
25413  }
25414
25415  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
25416    if (element != null) {
25417      open(name);
25418      composeClaimResponseItemDetailComponentInner(element);
25419      close();
25420    }
25421  }
25422
25423  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
25424      composeBackbone(element);
25425      if (element.hasSequenceLinkIdElement()) {
25426        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25427        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25428      }
25429      if (element.hasNoteNumber()) {
25430        openArray("noteNumber");
25431        for (PositiveIntType e : element.getNoteNumber()) 
25432          composePositiveIntCore(null, e, true);
25433        closeArray();
25434        if (anyHasExtras(element.getNoteNumber())) {
25435          openArray("_noteNumber");
25436          for (PositiveIntType e : element.getNoteNumber()) 
25437            composePositiveIntExtras(null, e, true);
25438          closeArray();
25439        }
25440      };
25441      if (element.hasAdjudication()) {
25442        openArray("adjudication");
25443        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25444          composeClaimResponseAdjudicationComponent(null, e);
25445        closeArray();
25446      };
25447      if (element.hasSubDetail()) {
25448        openArray("subDetail");
25449        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
25450          composeClaimResponseSubDetailComponent(null, e);
25451        closeArray();
25452      };
25453  }
25454
25455  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
25456    if (element != null) {
25457      open(name);
25458      composeClaimResponseSubDetailComponentInner(element);
25459      close();
25460    }
25461  }
25462
25463  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
25464      composeBackbone(element);
25465      if (element.hasSequenceLinkIdElement()) {
25466        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25467        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25468      }
25469      if (element.hasNoteNumber()) {
25470        openArray("noteNumber");
25471        for (PositiveIntType e : element.getNoteNumber()) 
25472          composePositiveIntCore(null, e, true);
25473        closeArray();
25474        if (anyHasExtras(element.getNoteNumber())) {
25475          openArray("_noteNumber");
25476          for (PositiveIntType e : element.getNoteNumber()) 
25477            composePositiveIntExtras(null, e, true);
25478          closeArray();
25479        }
25480      };
25481      if (element.hasAdjudication()) {
25482        openArray("adjudication");
25483        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25484          composeClaimResponseAdjudicationComponent(null, e);
25485        closeArray();
25486      };
25487  }
25488
25489  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
25490    if (element != null) {
25491      open(name);
25492      composeClaimResponseAddedItemComponentInner(element);
25493      close();
25494    }
25495  }
25496
25497  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
25498      composeBackbone(element);
25499      if (element.hasSequenceLinkId()) {
25500        openArray("sequenceLinkId");
25501        for (PositiveIntType e : element.getSequenceLinkId()) 
25502          composePositiveIntCore(null, e, true);
25503        closeArray();
25504        if (anyHasExtras(element.getSequenceLinkId())) {
25505          openArray("_sequenceLinkId");
25506          for (PositiveIntType e : element.getSequenceLinkId()) 
25507            composePositiveIntExtras(null, e, true);
25508          closeArray();
25509        }
25510      };
25511      if (element.hasRevenue()) {
25512        composeCodeableConcept("revenue", element.getRevenue());
25513      }
25514      if (element.hasCategory()) {
25515        composeCodeableConcept("category", element.getCategory());
25516      }
25517      if (element.hasService()) {
25518        composeCodeableConcept("service", element.getService());
25519      }
25520      if (element.hasModifier()) {
25521        openArray("modifier");
25522        for (CodeableConcept e : element.getModifier()) 
25523          composeCodeableConcept(null, e);
25524        closeArray();
25525      };
25526      if (element.hasFee()) {
25527        composeMoney("fee", element.getFee());
25528      }
25529      if (element.hasNoteNumber()) {
25530        openArray("noteNumber");
25531        for (PositiveIntType e : element.getNoteNumber()) 
25532          composePositiveIntCore(null, e, true);
25533        closeArray();
25534        if (anyHasExtras(element.getNoteNumber())) {
25535          openArray("_noteNumber");
25536          for (PositiveIntType e : element.getNoteNumber()) 
25537            composePositiveIntExtras(null, e, true);
25538          closeArray();
25539        }
25540      };
25541      if (element.hasAdjudication()) {
25542        openArray("adjudication");
25543        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25544          composeClaimResponseAdjudicationComponent(null, e);
25545        closeArray();
25546      };
25547      if (element.hasDetail()) {
25548        openArray("detail");
25549        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
25550          composeClaimResponseAddedItemsDetailComponent(null, e);
25551        closeArray();
25552      };
25553  }
25554
25555  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25556    if (element != null) {
25557      open(name);
25558      composeClaimResponseAddedItemsDetailComponentInner(element);
25559      close();
25560    }
25561  }
25562
25563  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25564      composeBackbone(element);
25565      if (element.hasRevenue()) {
25566        composeCodeableConcept("revenue", element.getRevenue());
25567      }
25568      if (element.hasCategory()) {
25569        composeCodeableConcept("category", element.getCategory());
25570      }
25571      if (element.hasService()) {
25572        composeCodeableConcept("service", element.getService());
25573      }
25574      if (element.hasModifier()) {
25575        openArray("modifier");
25576        for (CodeableConcept e : element.getModifier()) 
25577          composeCodeableConcept(null, e);
25578        closeArray();
25579      };
25580      if (element.hasFee()) {
25581        composeMoney("fee", element.getFee());
25582      }
25583      if (element.hasNoteNumber()) {
25584        openArray("noteNumber");
25585        for (PositiveIntType e : element.getNoteNumber()) 
25586          composePositiveIntCore(null, e, true);
25587        closeArray();
25588        if (anyHasExtras(element.getNoteNumber())) {
25589          openArray("_noteNumber");
25590          for (PositiveIntType e : element.getNoteNumber()) 
25591            composePositiveIntExtras(null, e, true);
25592          closeArray();
25593        }
25594      };
25595      if (element.hasAdjudication()) {
25596        openArray("adjudication");
25597        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25598          composeClaimResponseAdjudicationComponent(null, e);
25599        closeArray();
25600      };
25601  }
25602
25603  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
25604    if (element != null) {
25605      open(name);
25606      composeClaimResponseErrorComponentInner(element);
25607      close();
25608    }
25609  }
25610
25611  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
25612      composeBackbone(element);
25613      if (element.hasSequenceLinkIdElement()) {
25614        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25615        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25616      }
25617      if (element.hasDetailSequenceLinkIdElement()) {
25618        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25619        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25620      }
25621      if (element.hasSubdetailSequenceLinkIdElement()) {
25622        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25623        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25624      }
25625      if (element.hasCode()) {
25626        composeCodeableConcept("code", element.getCode());
25627      }
25628  }
25629
25630  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
25631    if (element != null) {
25632      open(name);
25633      composeClaimResponsePaymentComponentInner(element);
25634      close();
25635    }
25636  }
25637
25638  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
25639      composeBackbone(element);
25640      if (element.hasType()) {
25641        composeCodeableConcept("type", element.getType());
25642      }
25643      if (element.hasAdjustment()) {
25644        composeMoney("adjustment", element.getAdjustment());
25645      }
25646      if (element.hasAdjustmentReason()) {
25647        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
25648      }
25649      if (element.hasDateElement()) {
25650        composeDateCore("date", element.getDateElement(), false);
25651        composeDateExtras("date", element.getDateElement(), false);
25652      }
25653      if (element.hasAmount()) {
25654        composeMoney("amount", element.getAmount());
25655      }
25656      if (element.hasIdentifier()) {
25657        composeIdentifier("identifier", element.getIdentifier());
25658      }
25659  }
25660
25661  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
25662    if (element != null) {
25663      open(name);
25664      composeClaimResponseNoteComponentInner(element);
25665      close();
25666    }
25667  }
25668
25669  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
25670      composeBackbone(element);
25671      if (element.hasNumberElement()) {
25672        composePositiveIntCore("number", element.getNumberElement(), false);
25673        composePositiveIntExtras("number", element.getNumberElement(), false);
25674      }
25675      if (element.hasType()) {
25676        composeCodeableConcept("type", element.getType());
25677      }
25678      if (element.hasTextElement()) {
25679        composeStringCore("text", element.getTextElement(), false);
25680        composeStringExtras("text", element.getTextElement(), false);
25681      }
25682      if (element.hasLanguage()) {
25683        composeCodeableConcept("language", element.getLanguage());
25684      }
25685  }
25686
25687  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
25688    if (element != null) {
25689      open(name);
25690      composeClaimResponseInsuranceComponentInner(element);
25691      close();
25692    }
25693  }
25694
25695  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
25696      composeBackbone(element);
25697      if (element.hasSequenceElement()) {
25698        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25699        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25700      }
25701      if (element.hasFocalElement()) {
25702        composeBooleanCore("focal", element.getFocalElement(), false);
25703        composeBooleanExtras("focal", element.getFocalElement(), false);
25704      }
25705      if (element.hasCoverage()) {
25706        composeReference("coverage", element.getCoverage());
25707      }
25708      if (element.hasBusinessArrangementElement()) {
25709        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
25710        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
25711      }
25712      if (element.hasPreAuthRef()) {
25713        openArray("preAuthRef");
25714        for (StringType e : element.getPreAuthRef()) 
25715          composeStringCore(null, e, true);
25716        closeArray();
25717        if (anyHasExtras(element.getPreAuthRef())) {
25718          openArray("_preAuthRef");
25719          for (StringType e : element.getPreAuthRef()) 
25720            composeStringExtras(null, e, true);
25721          closeArray();
25722        }
25723      };
25724      if (element.hasClaimResponse()) {
25725        composeReference("claimResponse", element.getClaimResponse());
25726      }
25727  }
25728
25729  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
25730    if (element != null) {
25731      prop("resourceType", name);
25732      composeClinicalImpressionInner(element);
25733    }
25734  }
25735
25736  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
25737      composeDomainResourceElements(element);
25738      if (element.hasIdentifier()) {
25739        openArray("identifier");
25740        for (Identifier e : element.getIdentifier()) 
25741          composeIdentifier(null, e);
25742        closeArray();
25743      };
25744      if (element.hasStatusElement()) {
25745        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
25746        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
25747      }
25748      if (element.hasCode()) {
25749        composeCodeableConcept("code", element.getCode());
25750      }
25751      if (element.hasDescriptionElement()) {
25752        composeStringCore("description", element.getDescriptionElement(), false);
25753        composeStringExtras("description", element.getDescriptionElement(), false);
25754      }
25755      if (element.hasSubject()) {
25756        composeReference("subject", element.getSubject());
25757      }
25758      if (element.hasContext()) {
25759        composeReference("context", element.getContext());
25760      }
25761      if (element.hasEffective()) {
25762        composeType("effective", element.getEffective());
25763      }
25764      if (element.hasDateElement()) {
25765        composeDateTimeCore("date", element.getDateElement(), false);
25766        composeDateTimeExtras("date", element.getDateElement(), false);
25767      }
25768      if (element.hasAssessor()) {
25769        composeReference("assessor", element.getAssessor());
25770      }
25771      if (element.hasPrevious()) {
25772        composeReference("previous", element.getPrevious());
25773      }
25774      if (element.hasProblem()) {
25775        openArray("problem");
25776        for (Reference e : element.getProblem()) 
25777          composeReference(null, e);
25778        closeArray();
25779      };
25780      if (element.hasInvestigation()) {
25781        openArray("investigation");
25782        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
25783          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
25784        closeArray();
25785      };
25786      if (element.hasProtocol()) {
25787        openArray("protocol");
25788        for (UriType e : element.getProtocol()) 
25789          composeUriCore(null, e, true);
25790        closeArray();
25791        if (anyHasExtras(element.getProtocol())) {
25792          openArray("_protocol");
25793          for (UriType e : element.getProtocol()) 
25794            composeUriExtras(null, e, true);
25795          closeArray();
25796        }
25797      };
25798      if (element.hasSummaryElement()) {
25799        composeStringCore("summary", element.getSummaryElement(), false);
25800        composeStringExtras("summary", element.getSummaryElement(), false);
25801      }
25802      if (element.hasFinding()) {
25803        openArray("finding");
25804        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
25805          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
25806        closeArray();
25807      };
25808      if (element.hasPrognosisCodeableConcept()) {
25809        openArray("prognosisCodeableConcept");
25810        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
25811          composeCodeableConcept(null, e);
25812        closeArray();
25813      };
25814      if (element.hasPrognosisReference()) {
25815        openArray("prognosisReference");
25816        for (Reference e : element.getPrognosisReference()) 
25817          composeReference(null, e);
25818        closeArray();
25819      };
25820      if (element.hasAction()) {
25821        openArray("action");
25822        for (Reference e : element.getAction()) 
25823          composeReference(null, e);
25824        closeArray();
25825      };
25826      if (element.hasNote()) {
25827        openArray("note");
25828        for (Annotation e : element.getNote()) 
25829          composeAnnotation(null, e);
25830        closeArray();
25831      };
25832  }
25833
25834  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
25835    if (element != null) {
25836      open(name);
25837      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
25838      close();
25839    }
25840  }
25841
25842  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
25843      composeBackbone(element);
25844      if (element.hasCode()) {
25845        composeCodeableConcept("code", element.getCode());
25846      }
25847      if (element.hasItem()) {
25848        openArray("item");
25849        for (Reference e : element.getItem()) 
25850          composeReference(null, e);
25851        closeArray();
25852      };
25853  }
25854
25855  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
25856    if (element != null) {
25857      open(name);
25858      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
25859      close();
25860    }
25861  }
25862
25863  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
25864      composeBackbone(element);
25865      if (element.hasItem()) {
25866        composeType("item", element.getItem());
25867      }
25868      if (element.hasBasisElement()) {
25869        composeStringCore("basis", element.getBasisElement(), false);
25870        composeStringExtras("basis", element.getBasisElement(), false);
25871      }
25872  }
25873
25874  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
25875    if (element != null) {
25876      prop("resourceType", name);
25877      composeCodeSystemInner(element);
25878    }
25879  }
25880
25881  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
25882      composeDomainResourceElements(element);
25883      if (element.hasUrlElement()) {
25884        composeUriCore("url", element.getUrlElement(), false);
25885        composeUriExtras("url", element.getUrlElement(), false);
25886      }
25887      if (element.hasIdentifier()) {
25888        composeIdentifier("identifier", element.getIdentifier());
25889      }
25890      if (element.hasVersionElement()) {
25891        composeStringCore("version", element.getVersionElement(), false);
25892        composeStringExtras("version", element.getVersionElement(), false);
25893      }
25894      if (element.hasNameElement()) {
25895        composeStringCore("name", element.getNameElement(), false);
25896        composeStringExtras("name", element.getNameElement(), false);
25897      }
25898      if (element.hasTitleElement()) {
25899        composeStringCore("title", element.getTitleElement(), false);
25900        composeStringExtras("title", element.getTitleElement(), false);
25901      }
25902      if (element.hasStatusElement()) {
25903        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
25904        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
25905      }
25906      if (element.hasExperimentalElement()) {
25907        composeBooleanCore("experimental", element.getExperimentalElement(), false);
25908        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
25909      }
25910      if (element.hasDateElement()) {
25911        composeDateTimeCore("date", element.getDateElement(), false);
25912        composeDateTimeExtras("date", element.getDateElement(), false);
25913      }
25914      if (element.hasPublisherElement()) {
25915        composeStringCore("publisher", element.getPublisherElement(), false);
25916        composeStringExtras("publisher", element.getPublisherElement(), false);
25917      }
25918      if (element.hasContact()) {
25919        openArray("contact");
25920        for (ContactDetail e : element.getContact()) 
25921          composeContactDetail(null, e);
25922        closeArray();
25923      };
25924      if (element.hasDescriptionElement()) {
25925        composeMarkdownCore("description", element.getDescriptionElement(), false);
25926        composeMarkdownExtras("description", element.getDescriptionElement(), false);
25927      }
25928      if (element.hasUseContext()) {
25929        openArray("useContext");
25930        for (UsageContext e : element.getUseContext()) 
25931          composeUsageContext(null, e);
25932        closeArray();
25933      };
25934      if (element.hasJurisdiction()) {
25935        openArray("jurisdiction");
25936        for (CodeableConcept e : element.getJurisdiction()) 
25937          composeCodeableConcept(null, e);
25938        closeArray();
25939      };
25940      if (element.hasPurposeElement()) {
25941        composeMarkdownCore("purpose", element.getPurposeElement(), false);
25942        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
25943      }
25944      if (element.hasCopyrightElement()) {
25945        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
25946        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
25947      }
25948      if (element.hasCaseSensitiveElement()) {
25949        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
25950        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
25951      }
25952      if (element.hasValueSetElement()) {
25953        composeUriCore("valueSet", element.getValueSetElement(), false);
25954        composeUriExtras("valueSet", element.getValueSetElement(), false);
25955      }
25956      if (element.hasHierarchyMeaningElement()) {
25957        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
25958        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
25959      }
25960      if (element.hasCompositionalElement()) {
25961        composeBooleanCore("compositional", element.getCompositionalElement(), false);
25962        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
25963      }
25964      if (element.hasVersionNeededElement()) {
25965        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
25966        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
25967      }
25968      if (element.hasContentElement()) {
25969        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
25970        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
25971      }
25972      if (element.hasCountElement()) {
25973        composeUnsignedIntCore("count", element.getCountElement(), false);
25974        composeUnsignedIntExtras("count", element.getCountElement(), false);
25975      }
25976      if (element.hasFilter()) {
25977        openArray("filter");
25978        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
25979          composeCodeSystemCodeSystemFilterComponent(null, e);
25980        closeArray();
25981      };
25982      if (element.hasProperty()) {
25983        openArray("property");
25984        for (CodeSystem.PropertyComponent e : element.getProperty()) 
25985          composeCodeSystemPropertyComponent(null, e);
25986        closeArray();
25987      };
25988      if (element.hasConcept()) {
25989        openArray("concept");
25990        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
25991          composeCodeSystemConceptDefinitionComponent(null, e);
25992        closeArray();
25993      };
25994  }
25995
25996  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
25997    if (element != null) {
25998      open(name);
25999      composeCodeSystemCodeSystemFilterComponentInner(element);
26000      close();
26001    }
26002  }
26003
26004  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
26005      composeBackbone(element);
26006      if (element.hasCodeElement()) {
26007        composeCodeCore("code", element.getCodeElement(), false);
26008        composeCodeExtras("code", element.getCodeElement(), false);
26009      }
26010      if (element.hasDescriptionElement()) {
26011        composeStringCore("description", element.getDescriptionElement(), false);
26012        composeStringExtras("description", element.getDescriptionElement(), false);
26013      }
26014      if (element.hasOperator()) {
26015        openArray("operator");
26016        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26017          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26018        closeArray();
26019        if (anyHasExtras(element.getOperator())) {
26020          openArray("_operator");
26021          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26022            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26023          closeArray();
26024        }
26025      };
26026      if (element.hasValueElement()) {
26027        composeStringCore("value", element.getValueElement(), false);
26028        composeStringExtras("value", element.getValueElement(), false);
26029      }
26030  }
26031
26032  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
26033    if (element != null) {
26034      open(name);
26035      composeCodeSystemPropertyComponentInner(element);
26036      close();
26037    }
26038  }
26039
26040  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
26041      composeBackbone(element);
26042      if (element.hasCodeElement()) {
26043        composeCodeCore("code", element.getCodeElement(), false);
26044        composeCodeExtras("code", element.getCodeElement(), false);
26045      }
26046      if (element.hasUriElement()) {
26047        composeUriCore("uri", element.getUriElement(), false);
26048        composeUriExtras("uri", element.getUriElement(), false);
26049      }
26050      if (element.hasDescriptionElement()) {
26051        composeStringCore("description", element.getDescriptionElement(), false);
26052        composeStringExtras("description", element.getDescriptionElement(), false);
26053      }
26054      if (element.hasTypeElement()) {
26055        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26056        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26057      }
26058  }
26059
26060  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
26061    if (element != null) {
26062      open(name);
26063      composeCodeSystemConceptDefinitionComponentInner(element);
26064      close();
26065    }
26066  }
26067
26068  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
26069      composeBackbone(element);
26070      if (element.hasCodeElement()) {
26071        composeCodeCore("code", element.getCodeElement(), false);
26072        composeCodeExtras("code", element.getCodeElement(), false);
26073      }
26074      if (element.hasDisplayElement()) {
26075        composeStringCore("display", element.getDisplayElement(), false);
26076        composeStringExtras("display", element.getDisplayElement(), false);
26077      }
26078      if (element.hasDefinitionElement()) {
26079        composeStringCore("definition", element.getDefinitionElement(), false);
26080        composeStringExtras("definition", element.getDefinitionElement(), false);
26081      }
26082      if (element.hasDesignation()) {
26083        openArray("designation");
26084        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
26085          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
26086        closeArray();
26087      };
26088      if (element.hasProperty()) {
26089        openArray("property");
26090        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
26091          composeCodeSystemConceptPropertyComponent(null, e);
26092        closeArray();
26093      };
26094      if (element.hasConcept()) {
26095        openArray("concept");
26096        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
26097          composeCodeSystemConceptDefinitionComponent(null, e);
26098        closeArray();
26099      };
26100  }
26101
26102  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26103    if (element != null) {
26104      open(name);
26105      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
26106      close();
26107    }
26108  }
26109
26110  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26111      composeBackbone(element);
26112      if (element.hasLanguageElement()) {
26113        composeCodeCore("language", element.getLanguageElement(), false);
26114        composeCodeExtras("language", element.getLanguageElement(), false);
26115      }
26116      if (element.hasUse()) {
26117        composeCoding("use", element.getUse());
26118      }
26119      if (element.hasValueElement()) {
26120        composeStringCore("value", element.getValueElement(), false);
26121        composeStringExtras("value", element.getValueElement(), false);
26122      }
26123  }
26124
26125  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
26126    if (element != null) {
26127      open(name);
26128      composeCodeSystemConceptPropertyComponentInner(element);
26129      close();
26130    }
26131  }
26132
26133  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
26134      composeBackbone(element);
26135      if (element.hasCodeElement()) {
26136        composeCodeCore("code", element.getCodeElement(), false);
26137        composeCodeExtras("code", element.getCodeElement(), false);
26138      }
26139      if (element.hasValue()) {
26140        composeType("value", element.getValue());
26141      }
26142  }
26143
26144  protected void composeCommunication(String name, Communication element) throws IOException {
26145    if (element != null) {
26146      prop("resourceType", name);
26147      composeCommunicationInner(element);
26148    }
26149  }
26150
26151  protected void composeCommunicationInner(Communication element) throws IOException {
26152      composeDomainResourceElements(element);
26153      if (element.hasIdentifier()) {
26154        openArray("identifier");
26155        for (Identifier e : element.getIdentifier()) 
26156          composeIdentifier(null, e);
26157        closeArray();
26158      };
26159      if (element.hasDefinition()) {
26160        openArray("definition");
26161        for (Reference e : element.getDefinition()) 
26162          composeReference(null, e);
26163        closeArray();
26164      };
26165      if (element.hasBasedOn()) {
26166        openArray("basedOn");
26167        for (Reference e : element.getBasedOn()) 
26168          composeReference(null, e);
26169        closeArray();
26170      };
26171      if (element.hasPartOf()) {
26172        openArray("partOf");
26173        for (Reference e : element.getPartOf()) 
26174          composeReference(null, e);
26175        closeArray();
26176      };
26177      if (element.hasStatusElement()) {
26178        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26179        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26180      }
26181      if (element.hasNotDoneElement()) {
26182        composeBooleanCore("notDone", element.getNotDoneElement(), false);
26183        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
26184      }
26185      if (element.hasNotDoneReason()) {
26186        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
26187      }
26188      if (element.hasCategory()) {
26189        openArray("category");
26190        for (CodeableConcept e : element.getCategory()) 
26191          composeCodeableConcept(null, e);
26192        closeArray();
26193      };
26194      if (element.hasMedium()) {
26195        openArray("medium");
26196        for (CodeableConcept e : element.getMedium()) 
26197          composeCodeableConcept(null, e);
26198        closeArray();
26199      };
26200      if (element.hasSubject()) {
26201        composeReference("subject", element.getSubject());
26202      }
26203      if (element.hasRecipient()) {
26204        openArray("recipient");
26205        for (Reference e : element.getRecipient()) 
26206          composeReference(null, e);
26207        closeArray();
26208      };
26209      if (element.hasTopic()) {
26210        openArray("topic");
26211        for (Reference e : element.getTopic()) 
26212          composeReference(null, e);
26213        closeArray();
26214      };
26215      if (element.hasContext()) {
26216        composeReference("context", element.getContext());
26217      }
26218      if (element.hasSentElement()) {
26219        composeDateTimeCore("sent", element.getSentElement(), false);
26220        composeDateTimeExtras("sent", element.getSentElement(), false);
26221      }
26222      if (element.hasReceivedElement()) {
26223        composeDateTimeCore("received", element.getReceivedElement(), false);
26224        composeDateTimeExtras("received", element.getReceivedElement(), false);
26225      }
26226      if (element.hasSender()) {
26227        composeReference("sender", element.getSender());
26228      }
26229      if (element.hasReasonCode()) {
26230        openArray("reasonCode");
26231        for (CodeableConcept e : element.getReasonCode()) 
26232          composeCodeableConcept(null, e);
26233        closeArray();
26234      };
26235      if (element.hasReasonReference()) {
26236        openArray("reasonReference");
26237        for (Reference e : element.getReasonReference()) 
26238          composeReference(null, e);
26239        closeArray();
26240      };
26241      if (element.hasPayload()) {
26242        openArray("payload");
26243        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
26244          composeCommunicationCommunicationPayloadComponent(null, e);
26245        closeArray();
26246      };
26247      if (element.hasNote()) {
26248        openArray("note");
26249        for (Annotation e : element.getNote()) 
26250          composeAnnotation(null, e);
26251        closeArray();
26252      };
26253  }
26254
26255  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
26256    if (element != null) {
26257      open(name);
26258      composeCommunicationCommunicationPayloadComponentInner(element);
26259      close();
26260    }
26261  }
26262
26263  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
26264      composeBackbone(element);
26265      if (element.hasContent()) {
26266        composeType("content", element.getContent());
26267      }
26268  }
26269
26270  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
26271    if (element != null) {
26272      prop("resourceType", name);
26273      composeCommunicationRequestInner(element);
26274    }
26275  }
26276
26277  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
26278      composeDomainResourceElements(element);
26279      if (element.hasIdentifier()) {
26280        openArray("identifier");
26281        for (Identifier e : element.getIdentifier()) 
26282          composeIdentifier(null, e);
26283        closeArray();
26284      };
26285      if (element.hasBasedOn()) {
26286        openArray("basedOn");
26287        for (Reference e : element.getBasedOn()) 
26288          composeReference(null, e);
26289        closeArray();
26290      };
26291      if (element.hasReplaces()) {
26292        openArray("replaces");
26293        for (Reference e : element.getReplaces()) 
26294          composeReference(null, e);
26295        closeArray();
26296      };
26297      if (element.hasGroupIdentifier()) {
26298        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
26299      }
26300      if (element.hasStatusElement()) {
26301        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26302        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26303      }
26304      if (element.hasCategory()) {
26305        openArray("category");
26306        for (CodeableConcept e : element.getCategory()) 
26307          composeCodeableConcept(null, e);
26308        closeArray();
26309      };
26310      if (element.hasPriorityElement()) {
26311        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26312        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26313      }
26314      if (element.hasMedium()) {
26315        openArray("medium");
26316        for (CodeableConcept e : element.getMedium()) 
26317          composeCodeableConcept(null, e);
26318        closeArray();
26319      };
26320      if (element.hasSubject()) {
26321        composeReference("subject", element.getSubject());
26322      }
26323      if (element.hasRecipient()) {
26324        openArray("recipient");
26325        for (Reference e : element.getRecipient()) 
26326          composeReference(null, e);
26327        closeArray();
26328      };
26329      if (element.hasTopic()) {
26330        openArray("topic");
26331        for (Reference e : element.getTopic()) 
26332          composeReference(null, e);
26333        closeArray();
26334      };
26335      if (element.hasContext()) {
26336        composeReference("context", element.getContext());
26337      }
26338      if (element.hasPayload()) {
26339        openArray("payload");
26340        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
26341          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
26342        closeArray();
26343      };
26344      if (element.hasOccurrence()) {
26345        composeType("occurrence", element.getOccurrence());
26346      }
26347      if (element.hasAuthoredOnElement()) {
26348        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
26349        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
26350      }
26351      if (element.hasSender()) {
26352        composeReference("sender", element.getSender());
26353      }
26354      if (element.hasRequester()) {
26355        composeCommunicationRequestCommunicationRequestRequesterComponent("requester", element.getRequester());
26356      }
26357      if (element.hasReasonCode()) {
26358        openArray("reasonCode");
26359        for (CodeableConcept e : element.getReasonCode()) 
26360          composeCodeableConcept(null, e);
26361        closeArray();
26362      };
26363      if (element.hasReasonReference()) {
26364        openArray("reasonReference");
26365        for (Reference e : element.getReasonReference()) 
26366          composeReference(null, e);
26367        closeArray();
26368      };
26369      if (element.hasNote()) {
26370        openArray("note");
26371        for (Annotation e : element.getNote()) 
26372          composeAnnotation(null, e);
26373        closeArray();
26374      };
26375  }
26376
26377  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26378    if (element != null) {
26379      open(name);
26380      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
26381      close();
26382    }
26383  }
26384
26385  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26386      composeBackbone(element);
26387      if (element.hasContent()) {
26388        composeType("content", element.getContent());
26389      }
26390  }
26391
26392  protected void composeCommunicationRequestCommunicationRequestRequesterComponent(String name, CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26393    if (element != null) {
26394      open(name);
26395      composeCommunicationRequestCommunicationRequestRequesterComponentInner(element);
26396      close();
26397    }
26398  }
26399
26400  protected void composeCommunicationRequestCommunicationRequestRequesterComponentInner(CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26401      composeBackbone(element);
26402      if (element.hasAgent()) {
26403        composeReference("agent", element.getAgent());
26404      }
26405      if (element.hasOnBehalfOf()) {
26406        composeReference("onBehalfOf", element.getOnBehalfOf());
26407      }
26408  }
26409
26410  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
26411    if (element != null) {
26412      prop("resourceType", name);
26413      composeCompartmentDefinitionInner(element);
26414    }
26415  }
26416
26417  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
26418      composeDomainResourceElements(element);
26419      if (element.hasUrlElement()) {
26420        composeUriCore("url", element.getUrlElement(), false);
26421        composeUriExtras("url", element.getUrlElement(), false);
26422      }
26423      if (element.hasNameElement()) {
26424        composeStringCore("name", element.getNameElement(), false);
26425        composeStringExtras("name", element.getNameElement(), false);
26426      }
26427      if (element.hasTitleElement()) {
26428        composeStringCore("title", element.getTitleElement(), false);
26429        composeStringExtras("title", element.getTitleElement(), false);
26430      }
26431      if (element.hasStatusElement()) {
26432        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26433        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26434      }
26435      if (element.hasExperimentalElement()) {
26436        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26437        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26438      }
26439      if (element.hasDateElement()) {
26440        composeDateTimeCore("date", element.getDateElement(), false);
26441        composeDateTimeExtras("date", element.getDateElement(), false);
26442      }
26443      if (element.hasPublisherElement()) {
26444        composeStringCore("publisher", element.getPublisherElement(), false);
26445        composeStringExtras("publisher", element.getPublisherElement(), false);
26446      }
26447      if (element.hasContact()) {
26448        openArray("contact");
26449        for (ContactDetail e : element.getContact()) 
26450          composeContactDetail(null, e);
26451        closeArray();
26452      };
26453      if (element.hasDescriptionElement()) {
26454        composeMarkdownCore("description", element.getDescriptionElement(), false);
26455        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26456      }
26457      if (element.hasPurposeElement()) {
26458        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26459        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26460      }
26461      if (element.hasUseContext()) {
26462        openArray("useContext");
26463        for (UsageContext e : element.getUseContext()) 
26464          composeUsageContext(null, e);
26465        closeArray();
26466      };
26467      if (element.hasJurisdiction()) {
26468        openArray("jurisdiction");
26469        for (CodeableConcept e : element.getJurisdiction()) 
26470          composeCodeableConcept(null, e);
26471        closeArray();
26472      };
26473      if (element.hasCodeElement()) {
26474        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26475        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26476      }
26477      if (element.hasSearchElement()) {
26478        composeBooleanCore("search", element.getSearchElement(), false);
26479        composeBooleanExtras("search", element.getSearchElement(), false);
26480      }
26481      if (element.hasResource()) {
26482        openArray("resource");
26483        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
26484          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
26485        closeArray();
26486      };
26487  }
26488
26489  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26490    if (element != null) {
26491      open(name);
26492      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
26493      close();
26494    }
26495  }
26496
26497  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26498      composeBackbone(element);
26499      if (element.hasCodeElement()) {
26500        composeCodeCore("code", element.getCodeElement(), false);
26501        composeCodeExtras("code", element.getCodeElement(), false);
26502      }
26503      if (element.hasParam()) {
26504        openArray("param");
26505        for (StringType e : element.getParam()) 
26506          composeStringCore(null, e, true);
26507        closeArray();
26508        if (anyHasExtras(element.getParam())) {
26509          openArray("_param");
26510          for (StringType e : element.getParam()) 
26511            composeStringExtras(null, e, true);
26512          closeArray();
26513        }
26514      };
26515      if (element.hasDocumentationElement()) {
26516        composeStringCore("documentation", element.getDocumentationElement(), false);
26517        composeStringExtras("documentation", element.getDocumentationElement(), false);
26518      }
26519  }
26520
26521  protected void composeComposition(String name, Composition element) throws IOException {
26522    if (element != null) {
26523      prop("resourceType", name);
26524      composeCompositionInner(element);
26525    }
26526  }
26527
26528  protected void composeCompositionInner(Composition element) throws IOException {
26529      composeDomainResourceElements(element);
26530      if (element.hasIdentifier()) {
26531        composeIdentifier("identifier", element.getIdentifier());
26532      }
26533      if (element.hasStatusElement()) {
26534        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26535        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26536      }
26537      if (element.hasType()) {
26538        composeCodeableConcept("type", element.getType());
26539      }
26540      if (element.hasClass_()) {
26541        composeCodeableConcept("class", element.getClass_());
26542      }
26543      if (element.hasSubject()) {
26544        composeReference("subject", element.getSubject());
26545      }
26546      if (element.hasEncounter()) {
26547        composeReference("encounter", element.getEncounter());
26548      }
26549      if (element.hasDateElement()) {
26550        composeDateTimeCore("date", element.getDateElement(), false);
26551        composeDateTimeExtras("date", element.getDateElement(), false);
26552      }
26553      if (element.hasAuthor()) {
26554        openArray("author");
26555        for (Reference e : element.getAuthor()) 
26556          composeReference(null, e);
26557        closeArray();
26558      };
26559      if (element.hasTitleElement()) {
26560        composeStringCore("title", element.getTitleElement(), false);
26561        composeStringExtras("title", element.getTitleElement(), false);
26562      }
26563      if (element.hasConfidentialityElement()) {
26564        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26565        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26566      }
26567      if (element.hasAttester()) {
26568        openArray("attester");
26569        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
26570          composeCompositionCompositionAttesterComponent(null, e);
26571        closeArray();
26572      };
26573      if (element.hasCustodian()) {
26574        composeReference("custodian", element.getCustodian());
26575      }
26576      if (element.hasRelatesTo()) {
26577        openArray("relatesTo");
26578        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
26579          composeCompositionCompositionRelatesToComponent(null, e);
26580        closeArray();
26581      };
26582      if (element.hasEvent()) {
26583        openArray("event");
26584        for (Composition.CompositionEventComponent e : element.getEvent()) 
26585          composeCompositionCompositionEventComponent(null, e);
26586        closeArray();
26587      };
26588      if (element.hasSection()) {
26589        openArray("section");
26590        for (Composition.SectionComponent e : element.getSection()) 
26591          composeCompositionSectionComponent(null, e);
26592        closeArray();
26593      };
26594  }
26595
26596  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
26597    if (element != null) {
26598      open(name);
26599      composeCompositionCompositionAttesterComponentInner(element);
26600      close();
26601    }
26602  }
26603
26604  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
26605      composeBackbone(element);
26606      if (element.hasMode()) {
26607        openArray("mode");
26608        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26609          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26610        closeArray();
26611        if (anyHasExtras(element.getMode())) {
26612          openArray("_mode");
26613          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26614            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26615          closeArray();
26616        }
26617      };
26618      if (element.hasTimeElement()) {
26619        composeDateTimeCore("time", element.getTimeElement(), false);
26620        composeDateTimeExtras("time", element.getTimeElement(), false);
26621      }
26622      if (element.hasParty()) {
26623        composeReference("party", element.getParty());
26624      }
26625  }
26626
26627  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
26628    if (element != null) {
26629      open(name);
26630      composeCompositionCompositionRelatesToComponentInner(element);
26631      close();
26632    }
26633  }
26634
26635  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
26636      composeBackbone(element);
26637      if (element.hasCodeElement()) {
26638        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26639        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26640      }
26641      if (element.hasTarget()) {
26642        composeType("target", element.getTarget());
26643      }
26644  }
26645
26646  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
26647    if (element != null) {
26648      open(name);
26649      composeCompositionCompositionEventComponentInner(element);
26650      close();
26651    }
26652  }
26653
26654  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
26655      composeBackbone(element);
26656      if (element.hasCode()) {
26657        openArray("code");
26658        for (CodeableConcept e : element.getCode()) 
26659          composeCodeableConcept(null, e);
26660        closeArray();
26661      };
26662      if (element.hasPeriod()) {
26663        composePeriod("period", element.getPeriod());
26664      }
26665      if (element.hasDetail()) {
26666        openArray("detail");
26667        for (Reference e : element.getDetail()) 
26668          composeReference(null, e);
26669        closeArray();
26670      };
26671  }
26672
26673  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
26674    if (element != null) {
26675      open(name);
26676      composeCompositionSectionComponentInner(element);
26677      close();
26678    }
26679  }
26680
26681  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
26682      composeBackbone(element);
26683      if (element.hasTitleElement()) {
26684        composeStringCore("title", element.getTitleElement(), false);
26685        composeStringExtras("title", element.getTitleElement(), false);
26686      }
26687      if (element.hasCode()) {
26688        composeCodeableConcept("code", element.getCode());
26689      }
26690      if (element.hasText()) {
26691        composeNarrative("text", element.getText());
26692      }
26693      if (element.hasModeElement()) {
26694        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
26695        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
26696      }
26697      if (element.hasOrderedBy()) {
26698        composeCodeableConcept("orderedBy", element.getOrderedBy());
26699      }
26700      if (element.hasEntry()) {
26701        openArray("entry");
26702        for (Reference e : element.getEntry()) 
26703          composeReference(null, e);
26704        closeArray();
26705      };
26706      if (element.hasEmptyReason()) {
26707        composeCodeableConcept("emptyReason", element.getEmptyReason());
26708      }
26709      if (element.hasSection()) {
26710        openArray("section");
26711        for (Composition.SectionComponent e : element.getSection()) 
26712          composeCompositionSectionComponent(null, e);
26713        closeArray();
26714      };
26715  }
26716
26717  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
26718    if (element != null) {
26719      prop("resourceType", name);
26720      composeConceptMapInner(element);
26721    }
26722  }
26723
26724  protected void composeConceptMapInner(ConceptMap element) throws IOException {
26725      composeDomainResourceElements(element);
26726      if (element.hasUrlElement()) {
26727        composeUriCore("url", element.getUrlElement(), false);
26728        composeUriExtras("url", element.getUrlElement(), false);
26729      }
26730      if (element.hasIdentifier()) {
26731        composeIdentifier("identifier", element.getIdentifier());
26732      }
26733      if (element.hasVersionElement()) {
26734        composeStringCore("version", element.getVersionElement(), false);
26735        composeStringExtras("version", element.getVersionElement(), false);
26736      }
26737      if (element.hasNameElement()) {
26738        composeStringCore("name", element.getNameElement(), false);
26739        composeStringExtras("name", element.getNameElement(), false);
26740      }
26741      if (element.hasTitleElement()) {
26742        composeStringCore("title", element.getTitleElement(), false);
26743        composeStringExtras("title", element.getTitleElement(), false);
26744      }
26745      if (element.hasStatusElement()) {
26746        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26747        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26748      }
26749      if (element.hasExperimentalElement()) {
26750        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26751        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26752      }
26753      if (element.hasDateElement()) {
26754        composeDateTimeCore("date", element.getDateElement(), false);
26755        composeDateTimeExtras("date", element.getDateElement(), false);
26756      }
26757      if (element.hasPublisherElement()) {
26758        composeStringCore("publisher", element.getPublisherElement(), false);
26759        composeStringExtras("publisher", element.getPublisherElement(), false);
26760      }
26761      if (element.hasContact()) {
26762        openArray("contact");
26763        for (ContactDetail e : element.getContact()) 
26764          composeContactDetail(null, e);
26765        closeArray();
26766      };
26767      if (element.hasDescriptionElement()) {
26768        composeMarkdownCore("description", element.getDescriptionElement(), false);
26769        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26770      }
26771      if (element.hasUseContext()) {
26772        openArray("useContext");
26773        for (UsageContext e : element.getUseContext()) 
26774          composeUsageContext(null, e);
26775        closeArray();
26776      };
26777      if (element.hasJurisdiction()) {
26778        openArray("jurisdiction");
26779        for (CodeableConcept e : element.getJurisdiction()) 
26780          composeCodeableConcept(null, e);
26781        closeArray();
26782      };
26783      if (element.hasPurposeElement()) {
26784        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26785        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26786      }
26787      if (element.hasCopyrightElement()) {
26788        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
26789        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
26790      }
26791      if (element.hasSource()) {
26792        composeType("source", element.getSource());
26793      }
26794      if (element.hasTarget()) {
26795        composeType("target", element.getTarget());
26796      }
26797      if (element.hasGroup()) {
26798        openArray("group");
26799        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
26800          composeConceptMapConceptMapGroupComponent(null, e);
26801        closeArray();
26802      };
26803  }
26804
26805  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
26806    if (element != null) {
26807      open(name);
26808      composeConceptMapConceptMapGroupComponentInner(element);
26809      close();
26810    }
26811  }
26812
26813  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
26814      composeBackbone(element);
26815      if (element.hasSourceElement()) {
26816        composeUriCore("source", element.getSourceElement(), false);
26817        composeUriExtras("source", element.getSourceElement(), false);
26818      }
26819      if (element.hasSourceVersionElement()) {
26820        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
26821        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
26822      }
26823      if (element.hasTargetElement()) {
26824        composeUriCore("target", element.getTargetElement(), false);
26825        composeUriExtras("target", element.getTargetElement(), false);
26826      }
26827      if (element.hasTargetVersionElement()) {
26828        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
26829        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
26830      }
26831      if (element.hasElement()) {
26832        openArray("element");
26833        for (ConceptMap.SourceElementComponent e : element.getElement()) 
26834          composeConceptMapSourceElementComponent(null, e);
26835        closeArray();
26836      };
26837      if (element.hasUnmapped()) {
26838        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
26839      }
26840  }
26841
26842  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
26843    if (element != null) {
26844      open(name);
26845      composeConceptMapSourceElementComponentInner(element);
26846      close();
26847    }
26848  }
26849
26850  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
26851      composeBackbone(element);
26852      if (element.hasCodeElement()) {
26853        composeCodeCore("code", element.getCodeElement(), false);
26854        composeCodeExtras("code", element.getCodeElement(), false);
26855      }
26856      if (element.hasDisplayElement()) {
26857        composeStringCore("display", element.getDisplayElement(), false);
26858        composeStringExtras("display", element.getDisplayElement(), false);
26859      }
26860      if (element.hasTarget()) {
26861        openArray("target");
26862        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
26863          composeConceptMapTargetElementComponent(null, e);
26864        closeArray();
26865      };
26866  }
26867
26868  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
26869    if (element != null) {
26870      open(name);
26871      composeConceptMapTargetElementComponentInner(element);
26872      close();
26873    }
26874  }
26875
26876  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
26877      composeBackbone(element);
26878      if (element.hasCodeElement()) {
26879        composeCodeCore("code", element.getCodeElement(), false);
26880        composeCodeExtras("code", element.getCodeElement(), false);
26881      }
26882      if (element.hasDisplayElement()) {
26883        composeStringCore("display", element.getDisplayElement(), false);
26884        composeStringExtras("display", element.getDisplayElement(), false);
26885      }
26886      if (element.hasEquivalenceElement()) {
26887        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
26888        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
26889      }
26890      if (element.hasCommentElement()) {
26891        composeStringCore("comment", element.getCommentElement(), false);
26892        composeStringExtras("comment", element.getCommentElement(), false);
26893      }
26894      if (element.hasDependsOn()) {
26895        openArray("dependsOn");
26896        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
26897          composeConceptMapOtherElementComponent(null, e);
26898        closeArray();
26899      };
26900      if (element.hasProduct()) {
26901        openArray("product");
26902        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
26903          composeConceptMapOtherElementComponent(null, e);
26904        closeArray();
26905      };
26906  }
26907
26908  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
26909    if (element != null) {
26910      open(name);
26911      composeConceptMapOtherElementComponentInner(element);
26912      close();
26913    }
26914  }
26915
26916  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
26917      composeBackbone(element);
26918      if (element.hasPropertyElement()) {
26919        composeUriCore("property", element.getPropertyElement(), false);
26920        composeUriExtras("property", element.getPropertyElement(), false);
26921      }
26922      if (element.hasSystemElement()) {
26923        composeUriCore("system", element.getSystemElement(), false);
26924        composeUriExtras("system", element.getSystemElement(), false);
26925      }
26926      if (element.hasCodeElement()) {
26927        composeStringCore("code", element.getCodeElement(), false);
26928        composeStringExtras("code", element.getCodeElement(), false);
26929      }
26930      if (element.hasDisplayElement()) {
26931        composeStringCore("display", element.getDisplayElement(), false);
26932        composeStringExtras("display", element.getDisplayElement(), false);
26933      }
26934  }
26935
26936  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
26937    if (element != null) {
26938      open(name);
26939      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
26940      close();
26941    }
26942  }
26943
26944  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
26945      composeBackbone(element);
26946      if (element.hasModeElement()) {
26947        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
26948        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
26949      }
26950      if (element.hasCodeElement()) {
26951        composeCodeCore("code", element.getCodeElement(), false);
26952        composeCodeExtras("code", element.getCodeElement(), false);
26953      }
26954      if (element.hasDisplayElement()) {
26955        composeStringCore("display", element.getDisplayElement(), false);
26956        composeStringExtras("display", element.getDisplayElement(), false);
26957      }
26958      if (element.hasUrlElement()) {
26959        composeUriCore("url", element.getUrlElement(), false);
26960        composeUriExtras("url", element.getUrlElement(), false);
26961      }
26962  }
26963
26964  protected void composeCondition(String name, Condition element) throws IOException {
26965    if (element != null) {
26966      prop("resourceType", name);
26967      composeConditionInner(element);
26968    }
26969  }
26970
26971  protected void composeConditionInner(Condition element) throws IOException {
26972      composeDomainResourceElements(element);
26973      if (element.hasIdentifier()) {
26974        openArray("identifier");
26975        for (Identifier e : element.getIdentifier()) 
26976          composeIdentifier(null, e);
26977        closeArray();
26978      };
26979      if (element.hasClinicalStatusElement()) {
26980        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
26981        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
26982      }
26983      if (element.hasVerificationStatusElement()) {
26984        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
26985        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
26986      }
26987      if (element.hasCategory()) {
26988        openArray("category");
26989        for (CodeableConcept e : element.getCategory()) 
26990          composeCodeableConcept(null, e);
26991        closeArray();
26992      };
26993      if (element.hasSeverity()) {
26994        composeCodeableConcept("severity", element.getSeverity());
26995      }
26996      if (element.hasCode()) {
26997        composeCodeableConcept("code", element.getCode());
26998      }
26999      if (element.hasBodySite()) {
27000        openArray("bodySite");
27001        for (CodeableConcept e : element.getBodySite()) 
27002          composeCodeableConcept(null, e);
27003        closeArray();
27004      };
27005      if (element.hasSubject()) {
27006        composeReference("subject", element.getSubject());
27007      }
27008      if (element.hasContext()) {
27009        composeReference("context", element.getContext());
27010      }
27011      if (element.hasOnset()) {
27012        composeType("onset", element.getOnset());
27013      }
27014      if (element.hasAbatement()) {
27015        composeType("abatement", element.getAbatement());
27016      }
27017      if (element.hasAssertedDateElement()) {
27018        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
27019        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
27020      }
27021      if (element.hasAsserter()) {
27022        composeReference("asserter", element.getAsserter());
27023      }
27024      if (element.hasStage()) {
27025        composeConditionConditionStageComponent("stage", element.getStage());
27026      }
27027      if (element.hasEvidence()) {
27028        openArray("evidence");
27029        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
27030          composeConditionConditionEvidenceComponent(null, e);
27031        closeArray();
27032      };
27033      if (element.hasNote()) {
27034        openArray("note");
27035        for (Annotation e : element.getNote()) 
27036          composeAnnotation(null, e);
27037        closeArray();
27038      };
27039  }
27040
27041  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
27042    if (element != null) {
27043      open(name);
27044      composeConditionConditionStageComponentInner(element);
27045      close();
27046    }
27047  }
27048
27049  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
27050      composeBackbone(element);
27051      if (element.hasSummary()) {
27052        composeCodeableConcept("summary", element.getSummary());
27053      }
27054      if (element.hasAssessment()) {
27055        openArray("assessment");
27056        for (Reference e : element.getAssessment()) 
27057          composeReference(null, e);
27058        closeArray();
27059      };
27060  }
27061
27062  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
27063    if (element != null) {
27064      open(name);
27065      composeConditionConditionEvidenceComponentInner(element);
27066      close();
27067    }
27068  }
27069
27070  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
27071      composeBackbone(element);
27072      if (element.hasCode()) {
27073        openArray("code");
27074        for (CodeableConcept e : element.getCode()) 
27075          composeCodeableConcept(null, e);
27076        closeArray();
27077      };
27078      if (element.hasDetail()) {
27079        openArray("detail");
27080        for (Reference e : element.getDetail()) 
27081          composeReference(null, e);
27082        closeArray();
27083      };
27084  }
27085
27086  protected void composeConsent(String name, Consent element) throws IOException {
27087    if (element != null) {
27088      prop("resourceType", name);
27089      composeConsentInner(element);
27090    }
27091  }
27092
27093  protected void composeConsentInner(Consent element) throws IOException {
27094      composeDomainResourceElements(element);
27095      if (element.hasIdentifier()) {
27096        composeIdentifier("identifier", element.getIdentifier());
27097      }
27098      if (element.hasStatusElement()) {
27099        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27100        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27101      }
27102      if (element.hasCategory()) {
27103        openArray("category");
27104        for (CodeableConcept e : element.getCategory()) 
27105          composeCodeableConcept(null, e);
27106        closeArray();
27107      };
27108      if (element.hasPatient()) {
27109        composeReference("patient", element.getPatient());
27110      }
27111      if (element.hasPeriod()) {
27112        composePeriod("period", element.getPeriod());
27113      }
27114      if (element.hasDateTimeElement()) {
27115        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
27116        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
27117      }
27118      if (element.hasConsentingParty()) {
27119        openArray("consentingParty");
27120        for (Reference e : element.getConsentingParty()) 
27121          composeReference(null, e);
27122        closeArray();
27123      };
27124      if (element.hasActor()) {
27125        openArray("actor");
27126        for (Consent.ConsentActorComponent e : element.getActor()) 
27127          composeConsentConsentActorComponent(null, e);
27128        closeArray();
27129      };
27130      if (element.hasAction()) {
27131        openArray("action");
27132        for (CodeableConcept e : element.getAction()) 
27133          composeCodeableConcept(null, e);
27134        closeArray();
27135      };
27136      if (element.hasOrganization()) {
27137        openArray("organization");
27138        for (Reference e : element.getOrganization()) 
27139          composeReference(null, e);
27140        closeArray();
27141      };
27142      if (element.hasSource()) {
27143        composeType("source", element.getSource());
27144      }
27145      if (element.hasPolicy()) {
27146        openArray("policy");
27147        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
27148          composeConsentConsentPolicyComponent(null, e);
27149        closeArray();
27150      };
27151      if (element.hasPolicyRuleElement()) {
27152        composeUriCore("policyRule", element.getPolicyRuleElement(), false);
27153        composeUriExtras("policyRule", element.getPolicyRuleElement(), false);
27154      }
27155      if (element.hasSecurityLabel()) {
27156        openArray("securityLabel");
27157        for (Coding e : element.getSecurityLabel()) 
27158          composeCoding(null, e);
27159        closeArray();
27160      };
27161      if (element.hasPurpose()) {
27162        openArray("purpose");
27163        for (Coding e : element.getPurpose()) 
27164          composeCoding(null, e);
27165        closeArray();
27166      };
27167      if (element.hasDataPeriod()) {
27168        composePeriod("dataPeriod", element.getDataPeriod());
27169      }
27170      if (element.hasData()) {
27171        openArray("data");
27172        for (Consent.ConsentDataComponent e : element.getData()) 
27173          composeConsentConsentDataComponent(null, e);
27174        closeArray();
27175      };
27176      if (element.hasExcept()) {
27177        openArray("except");
27178        for (Consent.ExceptComponent e : element.getExcept()) 
27179          composeConsentExceptComponent(null, e);
27180        closeArray();
27181      };
27182  }
27183
27184  protected void composeConsentConsentActorComponent(String name, Consent.ConsentActorComponent element) throws IOException {
27185    if (element != null) {
27186      open(name);
27187      composeConsentConsentActorComponentInner(element);
27188      close();
27189    }
27190  }
27191
27192  protected void composeConsentConsentActorComponentInner(Consent.ConsentActorComponent element) throws IOException {
27193      composeBackbone(element);
27194      if (element.hasRole()) {
27195        composeCodeableConcept("role", element.getRole());
27196      }
27197      if (element.hasReference()) {
27198        composeReference("reference", element.getReference());
27199      }
27200  }
27201
27202  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
27203    if (element != null) {
27204      open(name);
27205      composeConsentConsentPolicyComponentInner(element);
27206      close();
27207    }
27208  }
27209
27210  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
27211      composeBackbone(element);
27212      if (element.hasAuthorityElement()) {
27213        composeUriCore("authority", element.getAuthorityElement(), false);
27214        composeUriExtras("authority", element.getAuthorityElement(), false);
27215      }
27216      if (element.hasUriElement()) {
27217        composeUriCore("uri", element.getUriElement(), false);
27218        composeUriExtras("uri", element.getUriElement(), false);
27219      }
27220  }
27221
27222  protected void composeConsentConsentDataComponent(String name, Consent.ConsentDataComponent element) throws IOException {
27223    if (element != null) {
27224      open(name);
27225      composeConsentConsentDataComponentInner(element);
27226      close();
27227    }
27228  }
27229
27230  protected void composeConsentConsentDataComponentInner(Consent.ConsentDataComponent element) throws IOException {
27231      composeBackbone(element);
27232      if (element.hasMeaningElement()) {
27233        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27234        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27235      }
27236      if (element.hasReference()) {
27237        composeReference("reference", element.getReference());
27238      }
27239  }
27240
27241  protected void composeConsentExceptComponent(String name, Consent.ExceptComponent element) throws IOException {
27242    if (element != null) {
27243      open(name);
27244      composeConsentExceptComponentInner(element);
27245      close();
27246    }
27247  }
27248
27249  protected void composeConsentExceptComponentInner(Consent.ExceptComponent element) throws IOException {
27250      composeBackbone(element);
27251      if (element.hasTypeElement()) {
27252        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27253        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27254      }
27255      if (element.hasPeriod()) {
27256        composePeriod("period", element.getPeriod());
27257      }
27258      if (element.hasActor()) {
27259        openArray("actor");
27260        for (Consent.ExceptActorComponent e : element.getActor()) 
27261          composeConsentExceptActorComponent(null, e);
27262        closeArray();
27263      };
27264      if (element.hasAction()) {
27265        openArray("action");
27266        for (CodeableConcept e : element.getAction()) 
27267          composeCodeableConcept(null, e);
27268        closeArray();
27269      };
27270      if (element.hasSecurityLabel()) {
27271        openArray("securityLabel");
27272        for (Coding e : element.getSecurityLabel()) 
27273          composeCoding(null, e);
27274        closeArray();
27275      };
27276      if (element.hasPurpose()) {
27277        openArray("purpose");
27278        for (Coding e : element.getPurpose()) 
27279          composeCoding(null, e);
27280        closeArray();
27281      };
27282      if (element.hasClass_()) {
27283        openArray("class");
27284        for (Coding e : element.getClass_()) 
27285          composeCoding(null, e);
27286        closeArray();
27287      };
27288      if (element.hasCode()) {
27289        openArray("code");
27290        for (Coding e : element.getCode()) 
27291          composeCoding(null, e);
27292        closeArray();
27293      };
27294      if (element.hasDataPeriod()) {
27295        composePeriod("dataPeriod", element.getDataPeriod());
27296      }
27297      if (element.hasData()) {
27298        openArray("data");
27299        for (Consent.ExceptDataComponent e : element.getData()) 
27300          composeConsentExceptDataComponent(null, e);
27301        closeArray();
27302      };
27303  }
27304
27305  protected void composeConsentExceptActorComponent(String name, Consent.ExceptActorComponent element) throws IOException {
27306    if (element != null) {
27307      open(name);
27308      composeConsentExceptActorComponentInner(element);
27309      close();
27310    }
27311  }
27312
27313  protected void composeConsentExceptActorComponentInner(Consent.ExceptActorComponent element) throws IOException {
27314      composeBackbone(element);
27315      if (element.hasRole()) {
27316        composeCodeableConcept("role", element.getRole());
27317      }
27318      if (element.hasReference()) {
27319        composeReference("reference", element.getReference());
27320      }
27321  }
27322
27323  protected void composeConsentExceptDataComponent(String name, Consent.ExceptDataComponent element) throws IOException {
27324    if (element != null) {
27325      open(name);
27326      composeConsentExceptDataComponentInner(element);
27327      close();
27328    }
27329  }
27330
27331  protected void composeConsentExceptDataComponentInner(Consent.ExceptDataComponent element) throws IOException {
27332      composeBackbone(element);
27333      if (element.hasMeaningElement()) {
27334        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27335        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27336      }
27337      if (element.hasReference()) {
27338        composeReference("reference", element.getReference());
27339      }
27340  }
27341
27342  protected void composeContract(String name, Contract element) throws IOException {
27343    if (element != null) {
27344      prop("resourceType", name);
27345      composeContractInner(element);
27346    }
27347  }
27348
27349  protected void composeContractInner(Contract element) throws IOException {
27350      composeDomainResourceElements(element);
27351      if (element.hasIdentifier()) {
27352        composeIdentifier("identifier", element.getIdentifier());
27353      }
27354      if (element.hasStatusElement()) {
27355        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27356        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27357      }
27358      if (element.hasIssuedElement()) {
27359        composeDateTimeCore("issued", element.getIssuedElement(), false);
27360        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27361      }
27362      if (element.hasApplies()) {
27363        composePeriod("applies", element.getApplies());
27364      }
27365      if (element.hasSubject()) {
27366        openArray("subject");
27367        for (Reference e : element.getSubject()) 
27368          composeReference(null, e);
27369        closeArray();
27370      };
27371      if (element.hasTopic()) {
27372        openArray("topic");
27373        for (Reference e : element.getTopic()) 
27374          composeReference(null, e);
27375        closeArray();
27376      };
27377      if (element.hasAuthority()) {
27378        openArray("authority");
27379        for (Reference e : element.getAuthority()) 
27380          composeReference(null, e);
27381        closeArray();
27382      };
27383      if (element.hasDomain()) {
27384        openArray("domain");
27385        for (Reference e : element.getDomain()) 
27386          composeReference(null, e);
27387        closeArray();
27388      };
27389      if (element.hasType()) {
27390        composeCodeableConcept("type", element.getType());
27391      }
27392      if (element.hasSubType()) {
27393        openArray("subType");
27394        for (CodeableConcept e : element.getSubType()) 
27395          composeCodeableConcept(null, e);
27396        closeArray();
27397      };
27398      if (element.hasAction()) {
27399        openArray("action");
27400        for (CodeableConcept e : element.getAction()) 
27401          composeCodeableConcept(null, e);
27402        closeArray();
27403      };
27404      if (element.hasActionReason()) {
27405        openArray("actionReason");
27406        for (CodeableConcept e : element.getActionReason()) 
27407          composeCodeableConcept(null, e);
27408        closeArray();
27409      };
27410      if (element.hasDecisionType()) {
27411        composeCodeableConcept("decisionType", element.getDecisionType());
27412      }
27413      if (element.hasContentDerivative()) {
27414        composeCodeableConcept("contentDerivative", element.getContentDerivative());
27415      }
27416      if (element.hasSecurityLabel()) {
27417        openArray("securityLabel");
27418        for (Coding e : element.getSecurityLabel()) 
27419          composeCoding(null, e);
27420        closeArray();
27421      };
27422      if (element.hasAgent()) {
27423        openArray("agent");
27424        for (Contract.AgentComponent e : element.getAgent()) 
27425          composeContractAgentComponent(null, e);
27426        closeArray();
27427      };
27428      if (element.hasSigner()) {
27429        openArray("signer");
27430        for (Contract.SignatoryComponent e : element.getSigner()) 
27431          composeContractSignatoryComponent(null, e);
27432        closeArray();
27433      };
27434      if (element.hasValuedItem()) {
27435        openArray("valuedItem");
27436        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
27437          composeContractValuedItemComponent(null, e);
27438        closeArray();
27439      };
27440      if (element.hasTerm()) {
27441        openArray("term");
27442        for (Contract.TermComponent e : element.getTerm()) 
27443          composeContractTermComponent(null, e);
27444        closeArray();
27445      };
27446      if (element.hasBinding()) {
27447        composeType("binding", element.getBinding());
27448      }
27449      if (element.hasFriendly()) {
27450        openArray("friendly");
27451        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
27452          composeContractFriendlyLanguageComponent(null, e);
27453        closeArray();
27454      };
27455      if (element.hasLegal()) {
27456        openArray("legal");
27457        for (Contract.LegalLanguageComponent e : element.getLegal()) 
27458          composeContractLegalLanguageComponent(null, e);
27459        closeArray();
27460      };
27461      if (element.hasRule()) {
27462        openArray("rule");
27463        for (Contract.ComputableLanguageComponent e : element.getRule()) 
27464          composeContractComputableLanguageComponent(null, e);
27465        closeArray();
27466      };
27467  }
27468
27469  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
27470    if (element != null) {
27471      open(name);
27472      composeContractAgentComponentInner(element);
27473      close();
27474    }
27475  }
27476
27477  protected void composeContractAgentComponentInner(Contract.AgentComponent element) throws IOException {
27478      composeBackbone(element);
27479      if (element.hasActor()) {
27480        composeReference("actor", element.getActor());
27481      }
27482      if (element.hasRole()) {
27483        openArray("role");
27484        for (CodeableConcept e : element.getRole()) 
27485          composeCodeableConcept(null, e);
27486        closeArray();
27487      };
27488  }
27489
27490  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
27491    if (element != null) {
27492      open(name);
27493      composeContractSignatoryComponentInner(element);
27494      close();
27495    }
27496  }
27497
27498  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
27499      composeBackbone(element);
27500      if (element.hasType()) {
27501        composeCoding("type", element.getType());
27502      }
27503      if (element.hasParty()) {
27504        composeReference("party", element.getParty());
27505      }
27506      if (element.hasSignature()) {
27507        openArray("signature");
27508        for (Signature e : element.getSignature()) 
27509          composeSignature(null, e);
27510        closeArray();
27511      };
27512  }
27513
27514  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
27515    if (element != null) {
27516      open(name);
27517      composeContractValuedItemComponentInner(element);
27518      close();
27519    }
27520  }
27521
27522  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
27523      composeBackbone(element);
27524      if (element.hasEntity()) {
27525        composeType("entity", element.getEntity());
27526      }
27527      if (element.hasIdentifier()) {
27528        composeIdentifier("identifier", element.getIdentifier());
27529      }
27530      if (element.hasEffectiveTimeElement()) {
27531        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
27532        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
27533      }
27534      if (element.hasQuantity()) {
27535        composeSimpleQuantity("quantity", element.getQuantity());
27536      }
27537      if (element.hasUnitPrice()) {
27538        composeMoney("unitPrice", element.getUnitPrice());
27539      }
27540      if (element.hasFactorElement()) {
27541        composeDecimalCore("factor", element.getFactorElement(), false);
27542        composeDecimalExtras("factor", element.getFactorElement(), false);
27543      }
27544      if (element.hasPointsElement()) {
27545        composeDecimalCore("points", element.getPointsElement(), false);
27546        composeDecimalExtras("points", element.getPointsElement(), false);
27547      }
27548      if (element.hasNet()) {
27549        composeMoney("net", element.getNet());
27550      }
27551  }
27552
27553  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
27554    if (element != null) {
27555      open(name);
27556      composeContractTermComponentInner(element);
27557      close();
27558    }
27559  }
27560
27561  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
27562      composeBackbone(element);
27563      if (element.hasIdentifier()) {
27564        composeIdentifier("identifier", element.getIdentifier());
27565      }
27566      if (element.hasIssuedElement()) {
27567        composeDateTimeCore("issued", element.getIssuedElement(), false);
27568        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27569      }
27570      if (element.hasApplies()) {
27571        composePeriod("applies", element.getApplies());
27572      }
27573      if (element.hasType()) {
27574        composeCodeableConcept("type", element.getType());
27575      }
27576      if (element.hasSubType()) {
27577        composeCodeableConcept("subType", element.getSubType());
27578      }
27579      if (element.hasTopic()) {
27580        openArray("topic");
27581        for (Reference e : element.getTopic()) 
27582          composeReference(null, e);
27583        closeArray();
27584      };
27585      if (element.hasAction()) {
27586        openArray("action");
27587        for (CodeableConcept e : element.getAction()) 
27588          composeCodeableConcept(null, e);
27589        closeArray();
27590      };
27591      if (element.hasActionReason()) {
27592        openArray("actionReason");
27593        for (CodeableConcept e : element.getActionReason()) 
27594          composeCodeableConcept(null, e);
27595        closeArray();
27596      };
27597      if (element.hasSecurityLabel()) {
27598        openArray("securityLabel");
27599        for (Coding e : element.getSecurityLabel()) 
27600          composeCoding(null, e);
27601        closeArray();
27602      };
27603      if (element.hasAgent()) {
27604        openArray("agent");
27605        for (Contract.TermAgentComponent e : element.getAgent()) 
27606          composeContractTermAgentComponent(null, e);
27607        closeArray();
27608      };
27609      if (element.hasTextElement()) {
27610        composeStringCore("text", element.getTextElement(), false);
27611        composeStringExtras("text", element.getTextElement(), false);
27612      }
27613      if (element.hasValuedItem()) {
27614        openArray("valuedItem");
27615        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
27616          composeContractTermValuedItemComponent(null, e);
27617        closeArray();
27618      };
27619      if (element.hasGroup()) {
27620        openArray("group");
27621        for (Contract.TermComponent e : element.getGroup()) 
27622          composeContractTermComponent(null, e);
27623        closeArray();
27624      };
27625  }
27626
27627  protected void composeContractTermAgentComponent(String name, Contract.TermAgentComponent element) throws IOException {
27628    if (element != null) {
27629      open(name);
27630      composeContractTermAgentComponentInner(element);
27631      close();
27632    }
27633  }
27634
27635  protected void composeContractTermAgentComponentInner(Contract.TermAgentComponent element) throws IOException {
27636      composeBackbone(element);
27637      if (element.hasActor()) {
27638        composeReference("actor", element.getActor());
27639      }
27640      if (element.hasRole()) {
27641        openArray("role");
27642        for (CodeableConcept e : element.getRole()) 
27643          composeCodeableConcept(null, e);
27644        closeArray();
27645      };
27646  }
27647
27648  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
27649    if (element != null) {
27650      open(name);
27651      composeContractTermValuedItemComponentInner(element);
27652      close();
27653    }
27654  }
27655
27656  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
27657      composeBackbone(element);
27658      if (element.hasEntity()) {
27659        composeType("entity", element.getEntity());
27660      }
27661      if (element.hasIdentifier()) {
27662        composeIdentifier("identifier", element.getIdentifier());
27663      }
27664      if (element.hasEffectiveTimeElement()) {
27665        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
27666        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
27667      }
27668      if (element.hasQuantity()) {
27669        composeSimpleQuantity("quantity", element.getQuantity());
27670      }
27671      if (element.hasUnitPrice()) {
27672        composeMoney("unitPrice", element.getUnitPrice());
27673      }
27674      if (element.hasFactorElement()) {
27675        composeDecimalCore("factor", element.getFactorElement(), false);
27676        composeDecimalExtras("factor", element.getFactorElement(), false);
27677      }
27678      if (element.hasPointsElement()) {
27679        composeDecimalCore("points", element.getPointsElement(), false);
27680        composeDecimalExtras("points", element.getPointsElement(), false);
27681      }
27682      if (element.hasNet()) {
27683        composeMoney("net", element.getNet());
27684      }
27685  }
27686
27687  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
27688    if (element != null) {
27689      open(name);
27690      composeContractFriendlyLanguageComponentInner(element);
27691      close();
27692    }
27693  }
27694
27695  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
27696      composeBackbone(element);
27697      if (element.hasContent()) {
27698        composeType("content", element.getContent());
27699      }
27700  }
27701
27702  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
27703    if (element != null) {
27704      open(name);
27705      composeContractLegalLanguageComponentInner(element);
27706      close();
27707    }
27708  }
27709
27710  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
27711      composeBackbone(element);
27712      if (element.hasContent()) {
27713        composeType("content", element.getContent());
27714      }
27715  }
27716
27717  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
27718    if (element != null) {
27719      open(name);
27720      composeContractComputableLanguageComponentInner(element);
27721      close();
27722    }
27723  }
27724
27725  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
27726      composeBackbone(element);
27727      if (element.hasContent()) {
27728        composeType("content", element.getContent());
27729      }
27730  }
27731
27732  protected void composeCoverage(String name, Coverage element) throws IOException {
27733    if (element != null) {
27734      prop("resourceType", name);
27735      composeCoverageInner(element);
27736    }
27737  }
27738
27739  protected void composeCoverageInner(Coverage element) throws IOException {
27740      composeDomainResourceElements(element);
27741      if (element.hasIdentifier()) {
27742        openArray("identifier");
27743        for (Identifier e : element.getIdentifier()) 
27744          composeIdentifier(null, e);
27745        closeArray();
27746      };
27747      if (element.hasStatusElement()) {
27748        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
27749        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
27750      }
27751      if (element.hasType()) {
27752        composeCodeableConcept("type", element.getType());
27753      }
27754      if (element.hasPolicyHolder()) {
27755        composeReference("policyHolder", element.getPolicyHolder());
27756      }
27757      if (element.hasSubscriber()) {
27758        composeReference("subscriber", element.getSubscriber());
27759      }
27760      if (element.hasSubscriberIdElement()) {
27761        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
27762        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
27763      }
27764      if (element.hasBeneficiary()) {
27765        composeReference("beneficiary", element.getBeneficiary());
27766      }
27767      if (element.hasRelationship()) {
27768        composeCodeableConcept("relationship", element.getRelationship());
27769      }
27770      if (element.hasPeriod()) {
27771        composePeriod("period", element.getPeriod());
27772      }
27773      if (element.hasPayor()) {
27774        openArray("payor");
27775        for (Reference e : element.getPayor()) 
27776          composeReference(null, e);
27777        closeArray();
27778      };
27779      if (element.hasGrouping()) {
27780        composeCoverageGroupComponent("grouping", element.getGrouping());
27781      }
27782      if (element.hasDependentElement()) {
27783        composeStringCore("dependent", element.getDependentElement(), false);
27784        composeStringExtras("dependent", element.getDependentElement(), false);
27785      }
27786      if (element.hasSequenceElement()) {
27787        composeStringCore("sequence", element.getSequenceElement(), false);
27788        composeStringExtras("sequence", element.getSequenceElement(), false);
27789      }
27790      if (element.hasOrderElement()) {
27791        composePositiveIntCore("order", element.getOrderElement(), false);
27792        composePositiveIntExtras("order", element.getOrderElement(), false);
27793      }
27794      if (element.hasNetworkElement()) {
27795        composeStringCore("network", element.getNetworkElement(), false);
27796        composeStringExtras("network", element.getNetworkElement(), false);
27797      }
27798      if (element.hasContract()) {
27799        openArray("contract");
27800        for (Reference e : element.getContract()) 
27801          composeReference(null, e);
27802        closeArray();
27803      };
27804  }
27805
27806  protected void composeCoverageGroupComponent(String name, Coverage.GroupComponent element) throws IOException {
27807    if (element != null) {
27808      open(name);
27809      composeCoverageGroupComponentInner(element);
27810      close();
27811    }
27812  }
27813
27814  protected void composeCoverageGroupComponentInner(Coverage.GroupComponent element) throws IOException {
27815      composeBackbone(element);
27816      if (element.hasGroupElement()) {
27817        composeStringCore("group", element.getGroupElement(), false);
27818        composeStringExtras("group", element.getGroupElement(), false);
27819      }
27820      if (element.hasGroupDisplayElement()) {
27821        composeStringCore("groupDisplay", element.getGroupDisplayElement(), false);
27822        composeStringExtras("groupDisplay", element.getGroupDisplayElement(), false);
27823      }
27824      if (element.hasSubGroupElement()) {
27825        composeStringCore("subGroup", element.getSubGroupElement(), false);
27826        composeStringExtras("subGroup", element.getSubGroupElement(), false);
27827      }
27828      if (element.hasSubGroupDisplayElement()) {
27829        composeStringCore("subGroupDisplay", element.getSubGroupDisplayElement(), false);
27830        composeStringExtras("subGroupDisplay", element.getSubGroupDisplayElement(), false);
27831      }
27832      if (element.hasPlanElement()) {
27833        composeStringCore("plan", element.getPlanElement(), false);
27834        composeStringExtras("plan", element.getPlanElement(), false);
27835      }
27836      if (element.hasPlanDisplayElement()) {
27837        composeStringCore("planDisplay", element.getPlanDisplayElement(), false);
27838        composeStringExtras("planDisplay", element.getPlanDisplayElement(), false);
27839      }
27840      if (element.hasSubPlanElement()) {
27841        composeStringCore("subPlan", element.getSubPlanElement(), false);
27842        composeStringExtras("subPlan", element.getSubPlanElement(), false);
27843      }
27844      if (element.hasSubPlanDisplayElement()) {
27845        composeStringCore("subPlanDisplay", element.getSubPlanDisplayElement(), false);
27846        composeStringExtras("subPlanDisplay", element.getSubPlanDisplayElement(), false);
27847      }
27848      if (element.hasClass_Element()) {
27849        composeStringCore("class", element.getClass_Element(), false);
27850        composeStringExtras("class", element.getClass_Element(), false);
27851      }
27852      if (element.hasClassDisplayElement()) {
27853        composeStringCore("classDisplay", element.getClassDisplayElement(), false);
27854        composeStringExtras("classDisplay", element.getClassDisplayElement(), false);
27855      }
27856      if (element.hasSubClassElement()) {
27857        composeStringCore("subClass", element.getSubClassElement(), false);
27858        composeStringExtras("subClass", element.getSubClassElement(), false);
27859      }
27860      if (element.hasSubClassDisplayElement()) {
27861        composeStringCore("subClassDisplay", element.getSubClassDisplayElement(), false);
27862        composeStringExtras("subClassDisplay", element.getSubClassDisplayElement(), false);
27863      }
27864  }
27865
27866  protected void composeDataElement(String name, DataElement element) throws IOException {
27867    if (element != null) {
27868      prop("resourceType", name);
27869      composeDataElementInner(element);
27870    }
27871  }
27872
27873  protected void composeDataElementInner(DataElement element) throws IOException {
27874      composeDomainResourceElements(element);
27875      if (element.hasUrlElement()) {
27876        composeUriCore("url", element.getUrlElement(), false);
27877        composeUriExtras("url", element.getUrlElement(), false);
27878      }
27879      if (element.hasIdentifier()) {
27880        openArray("identifier");
27881        for (Identifier e : element.getIdentifier()) 
27882          composeIdentifier(null, e);
27883        closeArray();
27884      };
27885      if (element.hasVersionElement()) {
27886        composeStringCore("version", element.getVersionElement(), false);
27887        composeStringExtras("version", element.getVersionElement(), false);
27888      }
27889      if (element.hasStatusElement()) {
27890        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27891        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27892      }
27893      if (element.hasExperimentalElement()) {
27894        composeBooleanCore("experimental", element.getExperimentalElement(), false);
27895        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
27896      }
27897      if (element.hasDateElement()) {
27898        composeDateTimeCore("date", element.getDateElement(), false);
27899        composeDateTimeExtras("date", element.getDateElement(), false);
27900      }
27901      if (element.hasPublisherElement()) {
27902        composeStringCore("publisher", element.getPublisherElement(), false);
27903        composeStringExtras("publisher", element.getPublisherElement(), false);
27904      }
27905      if (element.hasNameElement()) {
27906        composeStringCore("name", element.getNameElement(), false);
27907        composeStringExtras("name", element.getNameElement(), false);
27908      }
27909      if (element.hasTitleElement()) {
27910        composeStringCore("title", element.getTitleElement(), false);
27911        composeStringExtras("title", element.getTitleElement(), false);
27912      }
27913      if (element.hasContact()) {
27914        openArray("contact");
27915        for (ContactDetail e : element.getContact()) 
27916          composeContactDetail(null, e);
27917        closeArray();
27918      };
27919      if (element.hasUseContext()) {
27920        openArray("useContext");
27921        for (UsageContext e : element.getUseContext()) 
27922          composeUsageContext(null, e);
27923        closeArray();
27924      };
27925      if (element.hasJurisdiction()) {
27926        openArray("jurisdiction");
27927        for (CodeableConcept e : element.getJurisdiction()) 
27928          composeCodeableConcept(null, e);
27929        closeArray();
27930      };
27931      if (element.hasCopyrightElement()) {
27932        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
27933        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
27934      }
27935      if (element.hasStringencyElement()) {
27936        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
27937        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
27938      }
27939      if (element.hasMapping()) {
27940        openArray("mapping");
27941        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
27942          composeDataElementDataElementMappingComponent(null, e);
27943        closeArray();
27944      };
27945      if (element.hasElement()) {
27946        openArray("element");
27947        for (ElementDefinition e : element.getElement()) 
27948          composeElementDefinition(null, e);
27949        closeArray();
27950      };
27951  }
27952
27953  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
27954    if (element != null) {
27955      open(name);
27956      composeDataElementDataElementMappingComponentInner(element);
27957      close();
27958    }
27959  }
27960
27961  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
27962      composeBackbone(element);
27963      if (element.hasIdentityElement()) {
27964        composeIdCore("identity", element.getIdentityElement(), false);
27965        composeIdExtras("identity", element.getIdentityElement(), false);
27966      }
27967      if (element.hasUriElement()) {
27968        composeUriCore("uri", element.getUriElement(), false);
27969        composeUriExtras("uri", element.getUriElement(), false);
27970      }
27971      if (element.hasNameElement()) {
27972        composeStringCore("name", element.getNameElement(), false);
27973        composeStringExtras("name", element.getNameElement(), false);
27974      }
27975      if (element.hasCommentElement()) {
27976        composeStringCore("comment", element.getCommentElement(), false);
27977        composeStringExtras("comment", element.getCommentElement(), false);
27978      }
27979  }
27980
27981  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
27982    if (element != null) {
27983      prop("resourceType", name);
27984      composeDetectedIssueInner(element);
27985    }
27986  }
27987
27988  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
27989      composeDomainResourceElements(element);
27990      if (element.hasIdentifier()) {
27991        composeIdentifier("identifier", element.getIdentifier());
27992      }
27993      if (element.hasStatusElement()) {
27994        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
27995        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
27996      }
27997      if (element.hasCategory()) {
27998        composeCodeableConcept("category", element.getCategory());
27999      }
28000      if (element.hasSeverityElement()) {
28001        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28002        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28003      }
28004      if (element.hasPatient()) {
28005        composeReference("patient", element.getPatient());
28006      }
28007      if (element.hasDateElement()) {
28008        composeDateTimeCore("date", element.getDateElement(), false);
28009        composeDateTimeExtras("date", element.getDateElement(), false);
28010      }
28011      if (element.hasAuthor()) {
28012        composeReference("author", element.getAuthor());
28013      }
28014      if (element.hasImplicated()) {
28015        openArray("implicated");
28016        for (Reference e : element.getImplicated()) 
28017          composeReference(null, e);
28018        closeArray();
28019      };
28020      if (element.hasDetailElement()) {
28021        composeStringCore("detail", element.getDetailElement(), false);
28022        composeStringExtras("detail", element.getDetailElement(), false);
28023      }
28024      if (element.hasReferenceElement()) {
28025        composeUriCore("reference", element.getReferenceElement(), false);
28026        composeUriExtras("reference", element.getReferenceElement(), false);
28027      }
28028      if (element.hasMitigation()) {
28029        openArray("mitigation");
28030        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
28031          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
28032        closeArray();
28033      };
28034  }
28035
28036  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28037    if (element != null) {
28038      open(name);
28039      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
28040      close();
28041    }
28042  }
28043
28044  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28045      composeBackbone(element);
28046      if (element.hasAction()) {
28047        composeCodeableConcept("action", element.getAction());
28048      }
28049      if (element.hasDateElement()) {
28050        composeDateTimeCore("date", element.getDateElement(), false);
28051        composeDateTimeExtras("date", element.getDateElement(), false);
28052      }
28053      if (element.hasAuthor()) {
28054        composeReference("author", element.getAuthor());
28055      }
28056  }
28057
28058  protected void composeDevice(String name, Device element) throws IOException {
28059    if (element != null) {
28060      prop("resourceType", name);
28061      composeDeviceInner(element);
28062    }
28063  }
28064
28065  protected void composeDeviceInner(Device element) throws IOException {
28066      composeDomainResourceElements(element);
28067      if (element.hasIdentifier()) {
28068        openArray("identifier");
28069        for (Identifier e : element.getIdentifier()) 
28070          composeIdentifier(null, e);
28071        closeArray();
28072      };
28073      if (element.hasUdi()) {
28074        composeDeviceDeviceUdiComponent("udi", element.getUdi());
28075      }
28076      if (element.hasStatusElement()) {
28077        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28078        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28079      }
28080      if (element.hasType()) {
28081        composeCodeableConcept("type", element.getType());
28082      }
28083      if (element.hasLotNumberElement()) {
28084        composeStringCore("lotNumber", element.getLotNumberElement(), false);
28085        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
28086      }
28087      if (element.hasManufacturerElement()) {
28088        composeStringCore("manufacturer", element.getManufacturerElement(), false);
28089        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
28090      }
28091      if (element.hasManufactureDateElement()) {
28092        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
28093        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
28094      }
28095      if (element.hasExpirationDateElement()) {
28096        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
28097        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
28098      }
28099      if (element.hasModelElement()) {
28100        composeStringCore("model", element.getModelElement(), false);
28101        composeStringExtras("model", element.getModelElement(), false);
28102      }
28103      if (element.hasVersionElement()) {
28104        composeStringCore("version", element.getVersionElement(), false);
28105        composeStringExtras("version", element.getVersionElement(), false);
28106      }
28107      if (element.hasPatient()) {
28108        composeReference("patient", element.getPatient());
28109      }
28110      if (element.hasOwner()) {
28111        composeReference("owner", element.getOwner());
28112      }
28113      if (element.hasContact()) {
28114        openArray("contact");
28115        for (ContactPoint e : element.getContact()) 
28116          composeContactPoint(null, e);
28117        closeArray();
28118      };
28119      if (element.hasLocation()) {
28120        composeReference("location", element.getLocation());
28121      }
28122      if (element.hasUrlElement()) {
28123        composeUriCore("url", element.getUrlElement(), false);
28124        composeUriExtras("url", element.getUrlElement(), false);
28125      }
28126      if (element.hasNote()) {
28127        openArray("note");
28128        for (Annotation e : element.getNote()) 
28129          composeAnnotation(null, e);
28130        closeArray();
28131      };
28132      if (element.hasSafety()) {
28133        openArray("safety");
28134        for (CodeableConcept e : element.getSafety()) 
28135          composeCodeableConcept(null, e);
28136        closeArray();
28137      };
28138  }
28139
28140  protected void composeDeviceDeviceUdiComponent(String name, Device.DeviceUdiComponent element) throws IOException {
28141    if (element != null) {
28142      open(name);
28143      composeDeviceDeviceUdiComponentInner(element);
28144      close();
28145    }
28146  }
28147
28148  protected void composeDeviceDeviceUdiComponentInner(Device.DeviceUdiComponent element) throws IOException {
28149      composeBackbone(element);
28150      if (element.hasDeviceIdentifierElement()) {
28151        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28152        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28153      }
28154      if (element.hasNameElement()) {
28155        composeStringCore("name", element.getNameElement(), false);
28156        composeStringExtras("name", element.getNameElement(), false);
28157      }
28158      if (element.hasJurisdictionElement()) {
28159        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
28160        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
28161      }
28162      if (element.hasCarrierHRFElement()) {
28163        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
28164        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
28165      }
28166      if (element.hasCarrierAIDCElement()) {
28167        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
28168        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
28169      }
28170      if (element.hasIssuerElement()) {
28171        composeUriCore("issuer", element.getIssuerElement(), false);
28172        composeUriExtras("issuer", element.getIssuerElement(), false);
28173      }
28174      if (element.hasEntryTypeElement()) {
28175        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28176        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28177      }
28178  }
28179
28180  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
28181    if (element != null) {
28182      prop("resourceType", name);
28183      composeDeviceComponentInner(element);
28184    }
28185  }
28186
28187  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
28188      composeDomainResourceElements(element);
28189      if (element.hasIdentifier()) {
28190        composeIdentifier("identifier", element.getIdentifier());
28191      }
28192      if (element.hasType()) {
28193        composeCodeableConcept("type", element.getType());
28194      }
28195      if (element.hasLastSystemChangeElement()) {
28196        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
28197        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
28198      }
28199      if (element.hasSource()) {
28200        composeReference("source", element.getSource());
28201      }
28202      if (element.hasParent()) {
28203        composeReference("parent", element.getParent());
28204      }
28205      if (element.hasOperationalStatus()) {
28206        openArray("operationalStatus");
28207        for (CodeableConcept e : element.getOperationalStatus()) 
28208          composeCodeableConcept(null, e);
28209        closeArray();
28210      };
28211      if (element.hasParameterGroup()) {
28212        composeCodeableConcept("parameterGroup", element.getParameterGroup());
28213      }
28214      if (element.hasMeasurementPrincipleElement()) {
28215        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28216        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28217      }
28218      if (element.hasProductionSpecification()) {
28219        openArray("productionSpecification");
28220        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
28221          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
28222        closeArray();
28223      };
28224      if (element.hasLanguageCode()) {
28225        composeCodeableConcept("languageCode", element.getLanguageCode());
28226      }
28227  }
28228
28229  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28230    if (element != null) {
28231      open(name);
28232      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
28233      close();
28234    }
28235  }
28236
28237  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28238      composeBackbone(element);
28239      if (element.hasSpecType()) {
28240        composeCodeableConcept("specType", element.getSpecType());
28241      }
28242      if (element.hasComponentId()) {
28243        composeIdentifier("componentId", element.getComponentId());
28244      }
28245      if (element.hasProductionSpecElement()) {
28246        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
28247        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
28248      }
28249  }
28250
28251  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
28252    if (element != null) {
28253      prop("resourceType", name);
28254      composeDeviceMetricInner(element);
28255    }
28256  }
28257
28258  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
28259      composeDomainResourceElements(element);
28260      if (element.hasIdentifier()) {
28261        composeIdentifier("identifier", element.getIdentifier());
28262      }
28263      if (element.hasType()) {
28264        composeCodeableConcept("type", element.getType());
28265      }
28266      if (element.hasUnit()) {
28267        composeCodeableConcept("unit", element.getUnit());
28268      }
28269      if (element.hasSource()) {
28270        composeReference("source", element.getSource());
28271      }
28272      if (element.hasParent()) {
28273        composeReference("parent", element.getParent());
28274      }
28275      if (element.hasOperationalStatusElement()) {
28276        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28277        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28278      }
28279      if (element.hasColorElement()) {
28280        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28281        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28282      }
28283      if (element.hasCategoryElement()) {
28284        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28285        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28286      }
28287      if (element.hasMeasurementPeriod()) {
28288        composeTiming("measurementPeriod", element.getMeasurementPeriod());
28289      }
28290      if (element.hasCalibration()) {
28291        openArray("calibration");
28292        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
28293          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
28294        closeArray();
28295      };
28296  }
28297
28298  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28299    if (element != null) {
28300      open(name);
28301      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
28302      close();
28303    }
28304  }
28305
28306  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28307      composeBackbone(element);
28308      if (element.hasTypeElement()) {
28309        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28310        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28311      }
28312      if (element.hasStateElement()) {
28313        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28314        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28315      }
28316      if (element.hasTimeElement()) {
28317        composeInstantCore("time", element.getTimeElement(), false);
28318        composeInstantExtras("time", element.getTimeElement(), false);
28319      }
28320  }
28321
28322  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
28323    if (element != null) {
28324      prop("resourceType", name);
28325      composeDeviceRequestInner(element);
28326    }
28327  }
28328
28329  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
28330      composeDomainResourceElements(element);
28331      if (element.hasIdentifier()) {
28332        openArray("identifier");
28333        for (Identifier e : element.getIdentifier()) 
28334          composeIdentifier(null, e);
28335        closeArray();
28336      };
28337      if (element.hasDefinition()) {
28338        openArray("definition");
28339        for (Reference e : element.getDefinition()) 
28340          composeReference(null, e);
28341        closeArray();
28342      };
28343      if (element.hasBasedOn()) {
28344        openArray("basedOn");
28345        for (Reference e : element.getBasedOn()) 
28346          composeReference(null, e);
28347        closeArray();
28348      };
28349      if (element.hasPriorRequest()) {
28350        openArray("priorRequest");
28351        for (Reference e : element.getPriorRequest()) 
28352          composeReference(null, e);
28353        closeArray();
28354      };
28355      if (element.hasGroupIdentifier()) {
28356        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
28357      }
28358      if (element.hasStatusElement()) {
28359        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28360        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28361      }
28362      if (element.hasIntent()) {
28363        composeCodeableConcept("intent", element.getIntent());
28364      }
28365      if (element.hasPriorityElement()) {
28366        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28367        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28368      }
28369      if (element.hasCode()) {
28370        composeType("code", element.getCode());
28371      }
28372      if (element.hasSubject()) {
28373        composeReference("subject", element.getSubject());
28374      }
28375      if (element.hasContext()) {
28376        composeReference("context", element.getContext());
28377      }
28378      if (element.hasOccurrence()) {
28379        composeType("occurrence", element.getOccurrence());
28380      }
28381      if (element.hasAuthoredOnElement()) {
28382        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
28383        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
28384      }
28385      if (element.hasRequester()) {
28386        composeDeviceRequestDeviceRequestRequesterComponent("requester", element.getRequester());
28387      }
28388      if (element.hasPerformerType()) {
28389        composeCodeableConcept("performerType", element.getPerformerType());
28390      }
28391      if (element.hasPerformer()) {
28392        composeReference("performer", element.getPerformer());
28393      }
28394      if (element.hasReasonCode()) {
28395        openArray("reasonCode");
28396        for (CodeableConcept e : element.getReasonCode()) 
28397          composeCodeableConcept(null, e);
28398        closeArray();
28399      };
28400      if (element.hasReasonReference()) {
28401        openArray("reasonReference");
28402        for (Reference e : element.getReasonReference()) 
28403          composeReference(null, e);
28404        closeArray();
28405      };
28406      if (element.hasSupportingInfo()) {
28407        openArray("supportingInfo");
28408        for (Reference e : element.getSupportingInfo()) 
28409          composeReference(null, e);
28410        closeArray();
28411      };
28412      if (element.hasNote()) {
28413        openArray("note");
28414        for (Annotation e : element.getNote()) 
28415          composeAnnotation(null, e);
28416        closeArray();
28417      };
28418      if (element.hasRelevantHistory()) {
28419        openArray("relevantHistory");
28420        for (Reference e : element.getRelevantHistory()) 
28421          composeReference(null, e);
28422        closeArray();
28423      };
28424  }
28425
28426  protected void composeDeviceRequestDeviceRequestRequesterComponent(String name, DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28427    if (element != null) {
28428      open(name);
28429      composeDeviceRequestDeviceRequestRequesterComponentInner(element);
28430      close();
28431    }
28432  }
28433
28434  protected void composeDeviceRequestDeviceRequestRequesterComponentInner(DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28435      composeBackbone(element);
28436      if (element.hasAgent()) {
28437        composeReference("agent", element.getAgent());
28438      }
28439      if (element.hasOnBehalfOf()) {
28440        composeReference("onBehalfOf", element.getOnBehalfOf());
28441      }
28442  }
28443
28444  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
28445    if (element != null) {
28446      prop("resourceType", name);
28447      composeDeviceUseStatementInner(element);
28448    }
28449  }
28450
28451  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
28452      composeDomainResourceElements(element);
28453      if (element.hasIdentifier()) {
28454        openArray("identifier");
28455        for (Identifier e : element.getIdentifier()) 
28456          composeIdentifier(null, e);
28457        closeArray();
28458      };
28459      if (element.hasStatusElement()) {
28460        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28461        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28462      }
28463      if (element.hasSubject()) {
28464        composeReference("subject", element.getSubject());
28465      }
28466      if (element.hasWhenUsed()) {
28467        composePeriod("whenUsed", element.getWhenUsed());
28468      }
28469      if (element.hasTiming()) {
28470        composeType("timing", element.getTiming());
28471      }
28472      if (element.hasRecordedOnElement()) {
28473        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
28474        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
28475      }
28476      if (element.hasSource()) {
28477        composeReference("source", element.getSource());
28478      }
28479      if (element.hasDevice()) {
28480        composeReference("device", element.getDevice());
28481      }
28482      if (element.hasIndication()) {
28483        openArray("indication");
28484        for (CodeableConcept e : element.getIndication()) 
28485          composeCodeableConcept(null, e);
28486        closeArray();
28487      };
28488      if (element.hasBodySite()) {
28489        composeCodeableConcept("bodySite", element.getBodySite());
28490      }
28491      if (element.hasNote()) {
28492        openArray("note");
28493        for (Annotation e : element.getNote()) 
28494          composeAnnotation(null, e);
28495        closeArray();
28496      };
28497  }
28498
28499  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
28500    if (element != null) {
28501      prop("resourceType", name);
28502      composeDiagnosticReportInner(element);
28503    }
28504  }
28505
28506  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
28507      composeDomainResourceElements(element);
28508      if (element.hasIdentifier()) {
28509        openArray("identifier");
28510        for (Identifier e : element.getIdentifier()) 
28511          composeIdentifier(null, e);
28512        closeArray();
28513      };
28514      if (element.hasBasedOn()) {
28515        openArray("basedOn");
28516        for (Reference e : element.getBasedOn()) 
28517          composeReference(null, e);
28518        closeArray();
28519      };
28520      if (element.hasStatusElement()) {
28521        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28522        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28523      }
28524      if (element.hasCategory()) {
28525        composeCodeableConcept("category", element.getCategory());
28526      }
28527      if (element.hasCode()) {
28528        composeCodeableConcept("code", element.getCode());
28529      }
28530      if (element.hasSubject()) {
28531        composeReference("subject", element.getSubject());
28532      }
28533      if (element.hasContext()) {
28534        composeReference("context", element.getContext());
28535      }
28536      if (element.hasEffective()) {
28537        composeType("effective", element.getEffective());
28538      }
28539      if (element.hasIssuedElement()) {
28540        composeInstantCore("issued", element.getIssuedElement(), false);
28541        composeInstantExtras("issued", element.getIssuedElement(), false);
28542      }
28543      if (element.hasPerformer()) {
28544        openArray("performer");
28545        for (DiagnosticReport.DiagnosticReportPerformerComponent e : element.getPerformer()) 
28546          composeDiagnosticReportDiagnosticReportPerformerComponent(null, e);
28547        closeArray();
28548      };
28549      if (element.hasSpecimen()) {
28550        openArray("specimen");
28551        for (Reference e : element.getSpecimen()) 
28552          composeReference(null, e);
28553        closeArray();
28554      };
28555      if (element.hasResult()) {
28556        openArray("result");
28557        for (Reference e : element.getResult()) 
28558          composeReference(null, e);
28559        closeArray();
28560      };
28561      if (element.hasImagingStudy()) {
28562        openArray("imagingStudy");
28563        for (Reference e : element.getImagingStudy()) 
28564          composeReference(null, e);
28565        closeArray();
28566      };
28567      if (element.hasImage()) {
28568        openArray("image");
28569        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
28570          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
28571        closeArray();
28572      };
28573      if (element.hasConclusionElement()) {
28574        composeStringCore("conclusion", element.getConclusionElement(), false);
28575        composeStringExtras("conclusion", element.getConclusionElement(), false);
28576      }
28577      if (element.hasCodedDiagnosis()) {
28578        openArray("codedDiagnosis");
28579        for (CodeableConcept e : element.getCodedDiagnosis()) 
28580          composeCodeableConcept(null, e);
28581        closeArray();
28582      };
28583      if (element.hasPresentedForm()) {
28584        openArray("presentedForm");
28585        for (Attachment e : element.getPresentedForm()) 
28586          composeAttachment(null, e);
28587        closeArray();
28588      };
28589  }
28590
28591  protected void composeDiagnosticReportDiagnosticReportPerformerComponent(String name, DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28592    if (element != null) {
28593      open(name);
28594      composeDiagnosticReportDiagnosticReportPerformerComponentInner(element);
28595      close();
28596    }
28597  }
28598
28599  protected void composeDiagnosticReportDiagnosticReportPerformerComponentInner(DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28600      composeBackbone(element);
28601      if (element.hasRole()) {
28602        composeCodeableConcept("role", element.getRole());
28603      }
28604      if (element.hasActor()) {
28605        composeReference("actor", element.getActor());
28606      }
28607  }
28608
28609  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28610    if (element != null) {
28611      open(name);
28612      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
28613      close();
28614    }
28615  }
28616
28617  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28618      composeBackbone(element);
28619      if (element.hasCommentElement()) {
28620        composeStringCore("comment", element.getCommentElement(), false);
28621        composeStringExtras("comment", element.getCommentElement(), false);
28622      }
28623      if (element.hasLink()) {
28624        composeReference("link", element.getLink());
28625      }
28626  }
28627
28628  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
28629    if (element != null) {
28630      prop("resourceType", name);
28631      composeDocumentManifestInner(element);
28632    }
28633  }
28634
28635  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
28636      composeDomainResourceElements(element);
28637      if (element.hasMasterIdentifier()) {
28638        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
28639      }
28640      if (element.hasIdentifier()) {
28641        openArray("identifier");
28642        for (Identifier e : element.getIdentifier()) 
28643          composeIdentifier(null, e);
28644        closeArray();
28645      };
28646      if (element.hasStatusElement()) {
28647        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28648        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28649      }
28650      if (element.hasType()) {
28651        composeCodeableConcept("type", element.getType());
28652      }
28653      if (element.hasSubject()) {
28654        composeReference("subject", element.getSubject());
28655      }
28656      if (element.hasCreatedElement()) {
28657        composeDateTimeCore("created", element.getCreatedElement(), false);
28658        composeDateTimeExtras("created", element.getCreatedElement(), false);
28659      }
28660      if (element.hasAuthor()) {
28661        openArray("author");
28662        for (Reference e : element.getAuthor()) 
28663          composeReference(null, e);
28664        closeArray();
28665      };
28666      if (element.hasRecipient()) {
28667        openArray("recipient");
28668        for (Reference e : element.getRecipient()) 
28669          composeReference(null, e);
28670        closeArray();
28671      };
28672      if (element.hasSourceElement()) {
28673        composeUriCore("source", element.getSourceElement(), false);
28674        composeUriExtras("source", element.getSourceElement(), false);
28675      }
28676      if (element.hasDescriptionElement()) {
28677        composeStringCore("description", element.getDescriptionElement(), false);
28678        composeStringExtras("description", element.getDescriptionElement(), false);
28679      }
28680      if (element.hasContent()) {
28681        openArray("content");
28682        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
28683          composeDocumentManifestDocumentManifestContentComponent(null, e);
28684        closeArray();
28685      };
28686      if (element.hasRelated()) {
28687        openArray("related");
28688        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
28689          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
28690        closeArray();
28691      };
28692  }
28693
28694  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
28695    if (element != null) {
28696      open(name);
28697      composeDocumentManifestDocumentManifestContentComponentInner(element);
28698      close();
28699    }
28700  }
28701
28702  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
28703      composeBackbone(element);
28704      if (element.hasP()) {
28705        composeType("p", element.getP());
28706      }
28707  }
28708
28709  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
28710    if (element != null) {
28711      open(name);
28712      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
28713      close();
28714    }
28715  }
28716
28717  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
28718      composeBackbone(element);
28719      if (element.hasIdentifier()) {
28720        composeIdentifier("identifier", element.getIdentifier());
28721      }
28722      if (element.hasRef()) {
28723        composeReference("ref", element.getRef());
28724      }
28725  }
28726
28727  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
28728    if (element != null) {
28729      prop("resourceType", name);
28730      composeDocumentReferenceInner(element);
28731    }
28732  }
28733
28734  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
28735      composeDomainResourceElements(element);
28736      if (element.hasMasterIdentifier()) {
28737        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
28738      }
28739      if (element.hasIdentifier()) {
28740        openArray("identifier");
28741        for (Identifier e : element.getIdentifier()) 
28742          composeIdentifier(null, e);
28743        closeArray();
28744      };
28745      if (element.hasStatusElement()) {
28746        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28747        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28748      }
28749      if (element.hasDocStatusElement()) {
28750        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
28751        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
28752      }
28753      if (element.hasType()) {
28754        composeCodeableConcept("type", element.getType());
28755      }
28756      if (element.hasClass_()) {
28757        composeCodeableConcept("class", element.getClass_());
28758      }
28759      if (element.hasSubject()) {
28760        composeReference("subject", element.getSubject());
28761      }
28762      if (element.hasCreatedElement()) {
28763        composeDateTimeCore("created", element.getCreatedElement(), false);
28764        composeDateTimeExtras("created", element.getCreatedElement(), false);
28765      }
28766      if (element.hasIndexedElement()) {
28767        composeInstantCore("indexed", element.getIndexedElement(), false);
28768        composeInstantExtras("indexed", element.getIndexedElement(), false);
28769      }
28770      if (element.hasAuthor()) {
28771        openArray("author");
28772        for (Reference e : element.getAuthor()) 
28773          composeReference(null, e);
28774        closeArray();
28775      };
28776      if (element.hasAuthenticator()) {
28777        composeReference("authenticator", element.getAuthenticator());
28778      }
28779      if (element.hasCustodian()) {
28780        composeReference("custodian", element.getCustodian());
28781      }
28782      if (element.hasRelatesTo()) {
28783        openArray("relatesTo");
28784        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
28785          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
28786        closeArray();
28787      };
28788      if (element.hasDescriptionElement()) {
28789        composeStringCore("description", element.getDescriptionElement(), false);
28790        composeStringExtras("description", element.getDescriptionElement(), false);
28791      }
28792      if (element.hasSecurityLabel()) {
28793        openArray("securityLabel");
28794        for (CodeableConcept e : element.getSecurityLabel()) 
28795          composeCodeableConcept(null, e);
28796        closeArray();
28797      };
28798      if (element.hasContent()) {
28799        openArray("content");
28800        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
28801          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
28802        closeArray();
28803      };
28804      if (element.hasContext()) {
28805        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
28806      }
28807  }
28808
28809  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
28810    if (element != null) {
28811      open(name);
28812      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
28813      close();
28814    }
28815  }
28816
28817  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
28818      composeBackbone(element);
28819      if (element.hasCodeElement()) {
28820        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
28821        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
28822      }
28823      if (element.hasTarget()) {
28824        composeReference("target", element.getTarget());
28825      }
28826  }
28827
28828  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
28829    if (element != null) {
28830      open(name);
28831      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
28832      close();
28833    }
28834  }
28835
28836  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
28837      composeBackbone(element);
28838      if (element.hasAttachment()) {
28839        composeAttachment("attachment", element.getAttachment());
28840      }
28841      if (element.hasFormat()) {
28842        composeCoding("format", element.getFormat());
28843      }
28844  }
28845
28846  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
28847    if (element != null) {
28848      open(name);
28849      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
28850      close();
28851    }
28852  }
28853
28854  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
28855      composeBackbone(element);
28856      if (element.hasEncounter()) {
28857        composeReference("encounter", element.getEncounter());
28858      }
28859      if (element.hasEvent()) {
28860        openArray("event");
28861        for (CodeableConcept e : element.getEvent()) 
28862          composeCodeableConcept(null, e);
28863        closeArray();
28864      };
28865      if (element.hasPeriod()) {
28866        composePeriod("period", element.getPeriod());
28867      }
28868      if (element.hasFacilityType()) {
28869        composeCodeableConcept("facilityType", element.getFacilityType());
28870      }
28871      if (element.hasPracticeSetting()) {
28872        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
28873      }
28874      if (element.hasSourcePatientInfo()) {
28875        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
28876      }
28877      if (element.hasRelated()) {
28878        openArray("related");
28879        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
28880          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
28881        closeArray();
28882      };
28883  }
28884
28885  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
28886    if (element != null) {
28887      open(name);
28888      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
28889      close();
28890    }
28891  }
28892
28893  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
28894      composeBackbone(element);
28895      if (element.hasIdentifier()) {
28896        composeIdentifier("identifier", element.getIdentifier());
28897      }
28898      if (element.hasRef()) {
28899        composeReference("ref", element.getRef());
28900      }
28901  }
28902
28903  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
28904    if (element != null) {
28905      prop("resourceType", name);
28906      composeEligibilityRequestInner(element);
28907    }
28908  }
28909
28910  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
28911      composeDomainResourceElements(element);
28912      if (element.hasIdentifier()) {
28913        openArray("identifier");
28914        for (Identifier e : element.getIdentifier()) 
28915          composeIdentifier(null, e);
28916        closeArray();
28917      };
28918      if (element.hasStatusElement()) {
28919        composeEnumerationCore("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
28920        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
28921      }
28922      if (element.hasPriority()) {
28923        composeCodeableConcept("priority", element.getPriority());
28924      }
28925      if (element.hasPatient()) {
28926        composeReference("patient", element.getPatient());
28927      }
28928      if (element.hasServiced()) {
28929        composeType("serviced", element.getServiced());
28930      }
28931      if (element.hasCreatedElement()) {
28932        composeDateTimeCore("created", element.getCreatedElement(), false);
28933        composeDateTimeExtras("created", element.getCreatedElement(), false);
28934      }
28935      if (element.hasEnterer()) {
28936        composeReference("enterer", element.getEnterer());
28937      }
28938      if (element.hasProvider()) {
28939        composeReference("provider", element.getProvider());
28940      }
28941      if (element.hasOrganization()) {
28942        composeReference("organization", element.getOrganization());
28943      }
28944      if (element.hasInsurer()) {
28945        composeReference("insurer", element.getInsurer());
28946      }
28947      if (element.hasFacility()) {
28948        composeReference("facility", element.getFacility());
28949      }
28950      if (element.hasCoverage()) {
28951        composeReference("coverage", element.getCoverage());
28952      }
28953      if (element.hasBusinessArrangementElement()) {
28954        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
28955        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
28956      }
28957      if (element.hasBenefitCategory()) {
28958        composeCodeableConcept("benefitCategory", element.getBenefitCategory());
28959      }
28960      if (element.hasBenefitSubCategory()) {
28961        composeCodeableConcept("benefitSubCategory", element.getBenefitSubCategory());
28962      }
28963  }
28964
28965  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
28966    if (element != null) {
28967      prop("resourceType", name);
28968      composeEligibilityResponseInner(element);
28969    }
28970  }
28971
28972  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
28973      composeDomainResourceElements(element);
28974      if (element.hasIdentifier()) {
28975        openArray("identifier");
28976        for (Identifier e : element.getIdentifier()) 
28977          composeIdentifier(null, e);
28978        closeArray();
28979      };
28980      if (element.hasStatusElement()) {
28981        composeEnumerationCore("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
28982        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
28983      }
28984      if (element.hasCreatedElement()) {
28985        composeDateTimeCore("created", element.getCreatedElement(), false);
28986        composeDateTimeExtras("created", element.getCreatedElement(), false);
28987      }
28988      if (element.hasRequestProvider()) {
28989        composeReference("requestProvider", element.getRequestProvider());
28990      }
28991      if (element.hasRequestOrganization()) {
28992        composeReference("requestOrganization", element.getRequestOrganization());
28993      }
28994      if (element.hasRequest()) {
28995        composeReference("request", element.getRequest());
28996      }
28997      if (element.hasOutcome()) {
28998        composeCodeableConcept("outcome", element.getOutcome());
28999      }
29000      if (element.hasDispositionElement()) {
29001        composeStringCore("disposition", element.getDispositionElement(), false);
29002        composeStringExtras("disposition", element.getDispositionElement(), false);
29003      }
29004      if (element.hasInsurer()) {
29005        composeReference("insurer", element.getInsurer());
29006      }
29007      if (element.hasInforceElement()) {
29008        composeBooleanCore("inforce", element.getInforceElement(), false);
29009        composeBooleanExtras("inforce", element.getInforceElement(), false);
29010      }
29011      if (element.hasInsurance()) {
29012        openArray("insurance");
29013        for (EligibilityResponse.InsuranceComponent e : element.getInsurance()) 
29014          composeEligibilityResponseInsuranceComponent(null, e);
29015        closeArray();
29016      };
29017      if (element.hasForm()) {
29018        composeCodeableConcept("form", element.getForm());
29019      }
29020      if (element.hasError()) {
29021        openArray("error");
29022        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
29023          composeEligibilityResponseErrorsComponent(null, e);
29024        closeArray();
29025      };
29026  }
29027
29028  protected void composeEligibilityResponseInsuranceComponent(String name, EligibilityResponse.InsuranceComponent element) throws IOException {
29029    if (element != null) {
29030      open(name);
29031      composeEligibilityResponseInsuranceComponentInner(element);
29032      close();
29033    }
29034  }
29035
29036  protected void composeEligibilityResponseInsuranceComponentInner(EligibilityResponse.InsuranceComponent element) throws IOException {
29037      composeBackbone(element);
29038      if (element.hasCoverage()) {
29039        composeReference("coverage", element.getCoverage());
29040      }
29041      if (element.hasContract()) {
29042        composeReference("contract", element.getContract());
29043      }
29044      if (element.hasBenefitBalance()) {
29045        openArray("benefitBalance");
29046        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
29047          composeEligibilityResponseBenefitsComponent(null, e);
29048        closeArray();
29049      };
29050  }
29051
29052  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
29053    if (element != null) {
29054      open(name);
29055      composeEligibilityResponseBenefitsComponentInner(element);
29056      close();
29057    }
29058  }
29059
29060  protected void composeEligibilityResponseBenefitsComponentInner(EligibilityResponse.BenefitsComponent element) throws IOException {
29061      composeBackbone(element);
29062      if (element.hasCategory()) {
29063        composeCodeableConcept("category", element.getCategory());
29064      }
29065      if (element.hasSubCategory()) {
29066        composeCodeableConcept("subCategory", element.getSubCategory());
29067      }
29068      if (element.hasExcludedElement()) {
29069        composeBooleanCore("excluded", element.getExcludedElement(), false);
29070        composeBooleanExtras("excluded", element.getExcludedElement(), false);
29071      }
29072      if (element.hasNameElement()) {
29073        composeStringCore("name", element.getNameElement(), false);
29074        composeStringExtras("name", element.getNameElement(), false);
29075      }
29076      if (element.hasDescriptionElement()) {
29077        composeStringCore("description", element.getDescriptionElement(), false);
29078        composeStringExtras("description", element.getDescriptionElement(), false);
29079      }
29080      if (element.hasNetwork()) {
29081        composeCodeableConcept("network", element.getNetwork());
29082      }
29083      if (element.hasUnit()) {
29084        composeCodeableConcept("unit", element.getUnit());
29085      }
29086      if (element.hasTerm()) {
29087        composeCodeableConcept("term", element.getTerm());
29088      }
29089      if (element.hasFinancial()) {
29090        openArray("financial");
29091        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
29092          composeEligibilityResponseBenefitComponent(null, e);
29093        closeArray();
29094      };
29095  }
29096
29097  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
29098    if (element != null) {
29099      open(name);
29100      composeEligibilityResponseBenefitComponentInner(element);
29101      close();
29102    }
29103  }
29104
29105  protected void composeEligibilityResponseBenefitComponentInner(EligibilityResponse.BenefitComponent element) throws IOException {
29106      composeBackbone(element);
29107      if (element.hasType()) {
29108        composeCodeableConcept("type", element.getType());
29109      }
29110      if (element.hasAllowed()) {
29111        composeType("allowed", element.getAllowed());
29112      }
29113      if (element.hasUsed()) {
29114        composeType("used", element.getUsed());
29115      }
29116  }
29117
29118  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
29119    if (element != null) {
29120      open(name);
29121      composeEligibilityResponseErrorsComponentInner(element);
29122      close();
29123    }
29124  }
29125
29126  protected void composeEligibilityResponseErrorsComponentInner(EligibilityResponse.ErrorsComponent element) throws IOException {
29127      composeBackbone(element);
29128      if (element.hasCode()) {
29129        composeCodeableConcept("code", element.getCode());
29130      }
29131  }
29132
29133  protected void composeEncounter(String name, Encounter element) throws IOException {
29134    if (element != null) {
29135      prop("resourceType", name);
29136      composeEncounterInner(element);
29137    }
29138  }
29139
29140  protected void composeEncounterInner(Encounter element) throws IOException {
29141      composeDomainResourceElements(element);
29142      if (element.hasIdentifier()) {
29143        openArray("identifier");
29144        for (Identifier e : element.getIdentifier()) 
29145          composeIdentifier(null, e);
29146        closeArray();
29147      };
29148      if (element.hasStatusElement()) {
29149        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29150        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29151      }
29152      if (element.hasStatusHistory()) {
29153        openArray("statusHistory");
29154        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
29155          composeEncounterStatusHistoryComponent(null, e);
29156        closeArray();
29157      };
29158      if (element.hasClass_()) {
29159        composeCoding("class", element.getClass_());
29160      }
29161      if (element.hasClassHistory()) {
29162        openArray("classHistory");
29163        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
29164          composeEncounterClassHistoryComponent(null, e);
29165        closeArray();
29166      };
29167      if (element.hasType()) {
29168        openArray("type");
29169        for (CodeableConcept e : element.getType()) 
29170          composeCodeableConcept(null, e);
29171        closeArray();
29172      };
29173      if (element.hasPriority()) {
29174        composeCodeableConcept("priority", element.getPriority());
29175      }
29176      if (element.hasSubject()) {
29177        composeReference("subject", element.getSubject());
29178      }
29179      if (element.hasEpisodeOfCare()) {
29180        openArray("episodeOfCare");
29181        for (Reference e : element.getEpisodeOfCare()) 
29182          composeReference(null, e);
29183        closeArray();
29184      };
29185      if (element.hasIncomingReferral()) {
29186        openArray("incomingReferral");
29187        for (Reference e : element.getIncomingReferral()) 
29188          composeReference(null, e);
29189        closeArray();
29190      };
29191      if (element.hasParticipant()) {
29192        openArray("participant");
29193        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
29194          composeEncounterEncounterParticipantComponent(null, e);
29195        closeArray();
29196      };
29197      if (element.hasAppointment()) {
29198        composeReference("appointment", element.getAppointment());
29199      }
29200      if (element.hasPeriod()) {
29201        composePeriod("period", element.getPeriod());
29202      }
29203      if (element.hasLength()) {
29204        composeDuration("length", element.getLength());
29205      }
29206      if (element.hasReason()) {
29207        openArray("reason");
29208        for (CodeableConcept e : element.getReason()) 
29209          composeCodeableConcept(null, e);
29210        closeArray();
29211      };
29212      if (element.hasDiagnosis()) {
29213        openArray("diagnosis");
29214        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
29215          composeEncounterDiagnosisComponent(null, e);
29216        closeArray();
29217      };
29218      if (element.hasAccount()) {
29219        openArray("account");
29220        for (Reference e : element.getAccount()) 
29221          composeReference(null, e);
29222        closeArray();
29223      };
29224      if (element.hasHospitalization()) {
29225        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
29226      }
29227      if (element.hasLocation()) {
29228        openArray("location");
29229        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
29230          composeEncounterEncounterLocationComponent(null, e);
29231        closeArray();
29232      };
29233      if (element.hasServiceProvider()) {
29234        composeReference("serviceProvider", element.getServiceProvider());
29235      }
29236      if (element.hasPartOf()) {
29237        composeReference("partOf", element.getPartOf());
29238      }
29239  }
29240
29241  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
29242    if (element != null) {
29243      open(name);
29244      composeEncounterStatusHistoryComponentInner(element);
29245      close();
29246    }
29247  }
29248
29249  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
29250      composeBackbone(element);
29251      if (element.hasStatusElement()) {
29252        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29253        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29254      }
29255      if (element.hasPeriod()) {
29256        composePeriod("period", element.getPeriod());
29257      }
29258  }
29259
29260  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
29261    if (element != null) {
29262      open(name);
29263      composeEncounterClassHistoryComponentInner(element);
29264      close();
29265    }
29266  }
29267
29268  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
29269      composeBackbone(element);
29270      if (element.hasClass_()) {
29271        composeCoding("class", element.getClass_());
29272      }
29273      if (element.hasPeriod()) {
29274        composePeriod("period", element.getPeriod());
29275      }
29276  }
29277
29278  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
29279    if (element != null) {
29280      open(name);
29281      composeEncounterEncounterParticipantComponentInner(element);
29282      close();
29283    }
29284  }
29285
29286  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
29287      composeBackbone(element);
29288      if (element.hasType()) {
29289        openArray("type");
29290        for (CodeableConcept e : element.getType()) 
29291          composeCodeableConcept(null, e);
29292        closeArray();
29293      };
29294      if (element.hasPeriod()) {
29295        composePeriod("period", element.getPeriod());
29296      }
29297      if (element.hasIndividual()) {
29298        composeReference("individual", element.getIndividual());
29299      }
29300  }
29301
29302  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
29303    if (element != null) {
29304      open(name);
29305      composeEncounterDiagnosisComponentInner(element);
29306      close();
29307    }
29308  }
29309
29310  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
29311      composeBackbone(element);
29312      if (element.hasCondition()) {
29313        composeReference("condition", element.getCondition());
29314      }
29315      if (element.hasRole()) {
29316        composeCodeableConcept("role", element.getRole());
29317      }
29318      if (element.hasRankElement()) {
29319        composePositiveIntCore("rank", element.getRankElement(), false);
29320        composePositiveIntExtras("rank", element.getRankElement(), false);
29321      }
29322  }
29323
29324  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
29325    if (element != null) {
29326      open(name);
29327      composeEncounterEncounterHospitalizationComponentInner(element);
29328      close();
29329    }
29330  }
29331
29332  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
29333      composeBackbone(element);
29334      if (element.hasPreAdmissionIdentifier()) {
29335        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
29336      }
29337      if (element.hasOrigin()) {
29338        composeReference("origin", element.getOrigin());
29339      }
29340      if (element.hasAdmitSource()) {
29341        composeCodeableConcept("admitSource", element.getAdmitSource());
29342      }
29343      if (element.hasReAdmission()) {
29344        composeCodeableConcept("reAdmission", element.getReAdmission());
29345      }
29346      if (element.hasDietPreference()) {
29347        openArray("dietPreference");
29348        for (CodeableConcept e : element.getDietPreference()) 
29349          composeCodeableConcept(null, e);
29350        closeArray();
29351      };
29352      if (element.hasSpecialCourtesy()) {
29353        openArray("specialCourtesy");
29354        for (CodeableConcept e : element.getSpecialCourtesy()) 
29355          composeCodeableConcept(null, e);
29356        closeArray();
29357      };
29358      if (element.hasSpecialArrangement()) {
29359        openArray("specialArrangement");
29360        for (CodeableConcept e : element.getSpecialArrangement()) 
29361          composeCodeableConcept(null, e);
29362        closeArray();
29363      };
29364      if (element.hasDestination()) {
29365        composeReference("destination", element.getDestination());
29366      }
29367      if (element.hasDischargeDisposition()) {
29368        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
29369      }
29370  }
29371
29372  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
29373    if (element != null) {
29374      open(name);
29375      composeEncounterEncounterLocationComponentInner(element);
29376      close();
29377    }
29378  }
29379
29380  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
29381      composeBackbone(element);
29382      if (element.hasLocation()) {
29383        composeReference("location", element.getLocation());
29384      }
29385      if (element.hasStatusElement()) {
29386        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29387        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29388      }
29389      if (element.hasPeriod()) {
29390        composePeriod("period", element.getPeriod());
29391      }
29392  }
29393
29394  protected void composeEndpoint(String name, Endpoint element) throws IOException {
29395    if (element != null) {
29396      prop("resourceType", name);
29397      composeEndpointInner(element);
29398    }
29399  }
29400
29401  protected void composeEndpointInner(Endpoint element) throws IOException {
29402      composeDomainResourceElements(element);
29403      if (element.hasIdentifier()) {
29404        openArray("identifier");
29405        for (Identifier e : element.getIdentifier()) 
29406          composeIdentifier(null, e);
29407        closeArray();
29408      };
29409      if (element.hasStatusElement()) {
29410        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29411        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29412      }
29413      if (element.hasConnectionType()) {
29414        composeCoding("connectionType", element.getConnectionType());
29415      }
29416      if (element.hasNameElement()) {
29417        composeStringCore("name", element.getNameElement(), false);
29418        composeStringExtras("name", element.getNameElement(), false);
29419      }
29420      if (element.hasManagingOrganization()) {
29421        composeReference("managingOrganization", element.getManagingOrganization());
29422      }
29423      if (element.hasContact()) {
29424        openArray("contact");
29425        for (ContactPoint e : element.getContact()) 
29426          composeContactPoint(null, e);
29427        closeArray();
29428      };
29429      if (element.hasPeriod()) {
29430        composePeriod("period", element.getPeriod());
29431      }
29432      if (element.hasPayloadType()) {
29433        openArray("payloadType");
29434        for (CodeableConcept e : element.getPayloadType()) 
29435          composeCodeableConcept(null, e);
29436        closeArray();
29437      };
29438      if (element.hasPayloadMimeType()) {
29439        openArray("payloadMimeType");
29440        for (CodeType e : element.getPayloadMimeType()) 
29441          composeCodeCore(null, e, true);
29442        closeArray();
29443        if (anyHasExtras(element.getPayloadMimeType())) {
29444          openArray("_payloadMimeType");
29445          for (CodeType e : element.getPayloadMimeType()) 
29446            composeCodeExtras(null, e, true);
29447          closeArray();
29448        }
29449      };
29450      if (element.hasAddressElement()) {
29451        composeUriCore("address", element.getAddressElement(), false);
29452        composeUriExtras("address", element.getAddressElement(), false);
29453      }
29454      if (element.hasHeader()) {
29455        openArray("header");
29456        for (StringType e : element.getHeader()) 
29457          composeStringCore(null, e, true);
29458        closeArray();
29459        if (anyHasExtras(element.getHeader())) {
29460          openArray("_header");
29461          for (StringType e : element.getHeader()) 
29462            composeStringExtras(null, e, true);
29463          closeArray();
29464        }
29465      };
29466  }
29467
29468  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
29469    if (element != null) {
29470      prop("resourceType", name);
29471      composeEnrollmentRequestInner(element);
29472    }
29473  }
29474
29475  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
29476      composeDomainResourceElements(element);
29477      if (element.hasIdentifier()) {
29478        openArray("identifier");
29479        for (Identifier e : element.getIdentifier()) 
29480          composeIdentifier(null, e);
29481        closeArray();
29482      };
29483      if (element.hasStatusElement()) {
29484        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29485        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29486      }
29487      if (element.hasCreatedElement()) {
29488        composeDateTimeCore("created", element.getCreatedElement(), false);
29489        composeDateTimeExtras("created", element.getCreatedElement(), false);
29490      }
29491      if (element.hasInsurer()) {
29492        composeReference("insurer", element.getInsurer());
29493      }
29494      if (element.hasProvider()) {
29495        composeReference("provider", element.getProvider());
29496      }
29497      if (element.hasOrganization()) {
29498        composeReference("organization", element.getOrganization());
29499      }
29500      if (element.hasSubject()) {
29501        composeReference("subject", element.getSubject());
29502      }
29503      if (element.hasCoverage()) {
29504        composeReference("coverage", element.getCoverage());
29505      }
29506  }
29507
29508  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
29509    if (element != null) {
29510      prop("resourceType", name);
29511      composeEnrollmentResponseInner(element);
29512    }
29513  }
29514
29515  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
29516      composeDomainResourceElements(element);
29517      if (element.hasIdentifier()) {
29518        openArray("identifier");
29519        for (Identifier e : element.getIdentifier()) 
29520          composeIdentifier(null, e);
29521        closeArray();
29522      };
29523      if (element.hasStatusElement()) {
29524        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29525        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29526      }
29527      if (element.hasRequest()) {
29528        composeReference("request", element.getRequest());
29529      }
29530      if (element.hasOutcome()) {
29531        composeCodeableConcept("outcome", element.getOutcome());
29532      }
29533      if (element.hasDispositionElement()) {
29534        composeStringCore("disposition", element.getDispositionElement(), false);
29535        composeStringExtras("disposition", element.getDispositionElement(), false);
29536      }
29537      if (element.hasCreatedElement()) {
29538        composeDateTimeCore("created", element.getCreatedElement(), false);
29539        composeDateTimeExtras("created", element.getCreatedElement(), false);
29540      }
29541      if (element.hasOrganization()) {
29542        composeReference("organization", element.getOrganization());
29543      }
29544      if (element.hasRequestProvider()) {
29545        composeReference("requestProvider", element.getRequestProvider());
29546      }
29547      if (element.hasRequestOrganization()) {
29548        composeReference("requestOrganization", element.getRequestOrganization());
29549      }
29550  }
29551
29552  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
29553    if (element != null) {
29554      prop("resourceType", name);
29555      composeEpisodeOfCareInner(element);
29556    }
29557  }
29558
29559  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
29560      composeDomainResourceElements(element);
29561      if (element.hasIdentifier()) {
29562        openArray("identifier");
29563        for (Identifier e : element.getIdentifier()) 
29564          composeIdentifier(null, e);
29565        closeArray();
29566      };
29567      if (element.hasStatusElement()) {
29568        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29569        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29570      }
29571      if (element.hasStatusHistory()) {
29572        openArray("statusHistory");
29573        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
29574          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
29575        closeArray();
29576      };
29577      if (element.hasType()) {
29578        openArray("type");
29579        for (CodeableConcept e : element.getType()) 
29580          composeCodeableConcept(null, e);
29581        closeArray();
29582      };
29583      if (element.hasDiagnosis()) {
29584        openArray("diagnosis");
29585        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
29586          composeEpisodeOfCareDiagnosisComponent(null, e);
29587        closeArray();
29588      };
29589      if (element.hasPatient()) {
29590        composeReference("patient", element.getPatient());
29591      }
29592      if (element.hasManagingOrganization()) {
29593        composeReference("managingOrganization", element.getManagingOrganization());
29594      }
29595      if (element.hasPeriod()) {
29596        composePeriod("period", element.getPeriod());
29597      }
29598      if (element.hasReferralRequest()) {
29599        openArray("referralRequest");
29600        for (Reference e : element.getReferralRequest()) 
29601          composeReference(null, e);
29602        closeArray();
29603      };
29604      if (element.hasCareManager()) {
29605        composeReference("careManager", element.getCareManager());
29606      }
29607      if (element.hasTeam()) {
29608        openArray("team");
29609        for (Reference e : element.getTeam()) 
29610          composeReference(null, e);
29611        closeArray();
29612      };
29613      if (element.hasAccount()) {
29614        openArray("account");
29615        for (Reference e : element.getAccount()) 
29616          composeReference(null, e);
29617        closeArray();
29618      };
29619  }
29620
29621  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29622    if (element != null) {
29623      open(name);
29624      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
29625      close();
29626    }
29627  }
29628
29629  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29630      composeBackbone(element);
29631      if (element.hasStatusElement()) {
29632        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29633        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29634      }
29635      if (element.hasPeriod()) {
29636        composePeriod("period", element.getPeriod());
29637      }
29638  }
29639
29640  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
29641    if (element != null) {
29642      open(name);
29643      composeEpisodeOfCareDiagnosisComponentInner(element);
29644      close();
29645    }
29646  }
29647
29648  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
29649      composeBackbone(element);
29650      if (element.hasCondition()) {
29651        composeReference("condition", element.getCondition());
29652      }
29653      if (element.hasRole()) {
29654        composeCodeableConcept("role", element.getRole());
29655      }
29656      if (element.hasRankElement()) {
29657        composePositiveIntCore("rank", element.getRankElement(), false);
29658        composePositiveIntExtras("rank", element.getRankElement(), false);
29659      }
29660  }
29661
29662  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
29663    if (element != null) {
29664      prop("resourceType", name);
29665      composeExpansionProfileInner(element);
29666    }
29667  }
29668
29669  protected void composeExpansionProfileInner(ExpansionProfile element) throws IOException {
29670      composeDomainResourceElements(element);
29671      if (element.hasUrlElement()) {
29672        composeUriCore("url", element.getUrlElement(), false);
29673        composeUriExtras("url", element.getUrlElement(), false);
29674      }
29675      if (element.hasIdentifier()) {
29676        composeIdentifier("identifier", element.getIdentifier());
29677      }
29678      if (element.hasVersionElement()) {
29679        composeStringCore("version", element.getVersionElement(), false);
29680        composeStringExtras("version", element.getVersionElement(), false);
29681      }
29682      if (element.hasNameElement()) {
29683        composeStringCore("name", element.getNameElement(), false);
29684        composeStringExtras("name", element.getNameElement(), false);
29685      }
29686      if (element.hasStatusElement()) {
29687        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29688        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29689      }
29690      if (element.hasExperimentalElement()) {
29691        composeBooleanCore("experimental", element.getExperimentalElement(), false);
29692        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
29693      }
29694      if (element.hasDateElement()) {
29695        composeDateTimeCore("date", element.getDateElement(), false);
29696        composeDateTimeExtras("date", element.getDateElement(), false);
29697      }
29698      if (element.hasPublisherElement()) {
29699        composeStringCore("publisher", element.getPublisherElement(), false);
29700        composeStringExtras("publisher", element.getPublisherElement(), false);
29701      }
29702      if (element.hasContact()) {
29703        openArray("contact");
29704        for (ContactDetail e : element.getContact()) 
29705          composeContactDetail(null, e);
29706        closeArray();
29707      };
29708      if (element.hasDescriptionElement()) {
29709        composeMarkdownCore("description", element.getDescriptionElement(), false);
29710        composeMarkdownExtras("description", element.getDescriptionElement(), false);
29711      }
29712      if (element.hasUseContext()) {
29713        openArray("useContext");
29714        for (UsageContext e : element.getUseContext()) 
29715          composeUsageContext(null, e);
29716        closeArray();
29717      };
29718      if (element.hasJurisdiction()) {
29719        openArray("jurisdiction");
29720        for (CodeableConcept e : element.getJurisdiction()) 
29721          composeCodeableConcept(null, e);
29722        closeArray();
29723      };
29724      if (element.hasFixedVersion()) {
29725        openArray("fixedVersion");
29726        for (ExpansionProfile.ExpansionProfileFixedVersionComponent e : element.getFixedVersion()) 
29727          composeExpansionProfileExpansionProfileFixedVersionComponent(null, e);
29728        closeArray();
29729      };
29730      if (element.hasExcludedSystem()) {
29731        composeExpansionProfileExpansionProfileExcludedSystemComponent("excludedSystem", element.getExcludedSystem());
29732      }
29733      if (element.hasIncludeDesignationsElement()) {
29734        composeBooleanCore("includeDesignations", element.getIncludeDesignationsElement(), false);
29735        composeBooleanExtras("includeDesignations", element.getIncludeDesignationsElement(), false);
29736      }
29737      if (element.hasDesignation()) {
29738        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
29739      }
29740      if (element.hasIncludeDefinitionElement()) {
29741        composeBooleanCore("includeDefinition", element.getIncludeDefinitionElement(), false);
29742        composeBooleanExtras("includeDefinition", element.getIncludeDefinitionElement(), false);
29743      }
29744      if (element.hasActiveOnlyElement()) {
29745        composeBooleanCore("activeOnly", element.getActiveOnlyElement(), false);
29746        composeBooleanExtras("activeOnly", element.getActiveOnlyElement(), false);
29747      }
29748      if (element.hasExcludeNestedElement()) {
29749        composeBooleanCore("excludeNested", element.getExcludeNestedElement(), false);
29750        composeBooleanExtras("excludeNested", element.getExcludeNestedElement(), false);
29751      }
29752      if (element.hasExcludeNotForUIElement()) {
29753        composeBooleanCore("excludeNotForUI", element.getExcludeNotForUIElement(), false);
29754        composeBooleanExtras("excludeNotForUI", element.getExcludeNotForUIElement(), false);
29755      }
29756      if (element.hasExcludePostCoordinatedElement()) {
29757        composeBooleanCore("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
29758        composeBooleanExtras("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
29759      }
29760      if (element.hasDisplayLanguageElement()) {
29761        composeCodeCore("displayLanguage", element.getDisplayLanguageElement(), false);
29762        composeCodeExtras("displayLanguage", element.getDisplayLanguageElement(), false);
29763      }
29764      if (element.hasLimitedExpansionElement()) {
29765        composeBooleanCore("limitedExpansion", element.getLimitedExpansionElement(), false);
29766        composeBooleanExtras("limitedExpansion", element.getLimitedExpansionElement(), false);
29767      }
29768  }
29769
29770  protected void composeExpansionProfileExpansionProfileFixedVersionComponent(String name, ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
29771    if (element != null) {
29772      open(name);
29773      composeExpansionProfileExpansionProfileFixedVersionComponentInner(element);
29774      close();
29775    }
29776  }
29777
29778  protected void composeExpansionProfileExpansionProfileFixedVersionComponentInner(ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
29779      composeBackbone(element);
29780      if (element.hasSystemElement()) {
29781        composeUriCore("system", element.getSystemElement(), false);
29782        composeUriExtras("system", element.getSystemElement(), false);
29783      }
29784      if (element.hasVersionElement()) {
29785        composeStringCore("version", element.getVersionElement(), false);
29786        composeStringExtras("version", element.getVersionElement(), false);
29787      }
29788      if (element.hasModeElement()) {
29789        composeEnumerationCore("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
29790        composeEnumerationExtras("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
29791      }
29792  }
29793
29794  protected void composeExpansionProfileExpansionProfileExcludedSystemComponent(String name, ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
29795    if (element != null) {
29796      open(name);
29797      composeExpansionProfileExpansionProfileExcludedSystemComponentInner(element);
29798      close();
29799    }
29800  }
29801
29802  protected void composeExpansionProfileExpansionProfileExcludedSystemComponentInner(ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
29803      composeBackbone(element);
29804      if (element.hasSystemElement()) {
29805        composeUriCore("system", element.getSystemElement(), false);
29806        composeUriExtras("system", element.getSystemElement(), false);
29807      }
29808      if (element.hasVersionElement()) {
29809        composeStringCore("version", element.getVersionElement(), false);
29810        composeStringExtras("version", element.getVersionElement(), false);
29811      }
29812  }
29813
29814  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
29815    if (element != null) {
29816      open(name);
29817      composeExpansionProfileExpansionProfileDesignationComponentInner(element);
29818      close();
29819    }
29820  }
29821
29822  protected void composeExpansionProfileExpansionProfileDesignationComponentInner(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
29823      composeBackbone(element);
29824      if (element.hasInclude()) {
29825        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
29826      }
29827      if (element.hasExclude()) {
29828        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
29829      }
29830  }
29831
29832  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
29833    if (element != null) {
29834      open(name);
29835      composeExpansionProfileDesignationIncludeComponentInner(element);
29836      close();
29837    }
29838  }
29839
29840  protected void composeExpansionProfileDesignationIncludeComponentInner(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
29841      composeBackbone(element);
29842      if (element.hasDesignation()) {
29843        openArray("designation");
29844        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
29845          composeExpansionProfileDesignationIncludeDesignationComponent(null, e);
29846        closeArray();
29847      };
29848  }
29849
29850  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
29851    if (element != null) {
29852      open(name);
29853      composeExpansionProfileDesignationIncludeDesignationComponentInner(element);
29854      close();
29855    }
29856  }
29857
29858  protected void composeExpansionProfileDesignationIncludeDesignationComponentInner(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
29859      composeBackbone(element);
29860      if (element.hasLanguageElement()) {
29861        composeCodeCore("language", element.getLanguageElement(), false);
29862        composeCodeExtras("language", element.getLanguageElement(), false);
29863      }
29864      if (element.hasUse()) {
29865        composeCoding("use", element.getUse());
29866      }
29867  }
29868
29869  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
29870    if (element != null) {
29871      open(name);
29872      composeExpansionProfileDesignationExcludeComponentInner(element);
29873      close();
29874    }
29875  }
29876
29877  protected void composeExpansionProfileDesignationExcludeComponentInner(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
29878      composeBackbone(element);
29879      if (element.hasDesignation()) {
29880        openArray("designation");
29881        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
29882          composeExpansionProfileDesignationExcludeDesignationComponent(null, e);
29883        closeArray();
29884      };
29885  }
29886
29887  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
29888    if (element != null) {
29889      open(name);
29890      composeExpansionProfileDesignationExcludeDesignationComponentInner(element);
29891      close();
29892    }
29893  }
29894
29895  protected void composeExpansionProfileDesignationExcludeDesignationComponentInner(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
29896      composeBackbone(element);
29897      if (element.hasLanguageElement()) {
29898        composeCodeCore("language", element.getLanguageElement(), false);
29899        composeCodeExtras("language", element.getLanguageElement(), false);
29900      }
29901      if (element.hasUse()) {
29902        composeCoding("use", element.getUse());
29903      }
29904  }
29905
29906  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
29907    if (element != null) {
29908      prop("resourceType", name);
29909      composeExplanationOfBenefitInner(element);
29910    }
29911  }
29912
29913  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
29914      composeDomainResourceElements(element);
29915      if (element.hasIdentifier()) {
29916        openArray("identifier");
29917        for (Identifier e : element.getIdentifier()) 
29918          composeIdentifier(null, e);
29919        closeArray();
29920      };
29921      if (element.hasStatusElement()) {
29922        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
29923        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
29924      }
29925      if (element.hasType()) {
29926        composeCodeableConcept("type", element.getType());
29927      }
29928      if (element.hasSubType()) {
29929        openArray("subType");
29930        for (CodeableConcept e : element.getSubType()) 
29931          composeCodeableConcept(null, e);
29932        closeArray();
29933      };
29934      if (element.hasPatient()) {
29935        composeReference("patient", element.getPatient());
29936      }
29937      if (element.hasBillablePeriod()) {
29938        composePeriod("billablePeriod", element.getBillablePeriod());
29939      }
29940      if (element.hasCreatedElement()) {
29941        composeDateTimeCore("created", element.getCreatedElement(), false);
29942        composeDateTimeExtras("created", element.getCreatedElement(), false);
29943      }
29944      if (element.hasEnterer()) {
29945        composeReference("enterer", element.getEnterer());
29946      }
29947      if (element.hasInsurer()) {
29948        composeReference("insurer", element.getInsurer());
29949      }
29950      if (element.hasProvider()) {
29951        composeReference("provider", element.getProvider());
29952      }
29953      if (element.hasOrganization()) {
29954        composeReference("organization", element.getOrganization());
29955      }
29956      if (element.hasReferral()) {
29957        composeReference("referral", element.getReferral());
29958      }
29959      if (element.hasFacility()) {
29960        composeReference("facility", element.getFacility());
29961      }
29962      if (element.hasClaim()) {
29963        composeReference("claim", element.getClaim());
29964      }
29965      if (element.hasClaimResponse()) {
29966        composeReference("claimResponse", element.getClaimResponse());
29967      }
29968      if (element.hasOutcome()) {
29969        composeCodeableConcept("outcome", element.getOutcome());
29970      }
29971      if (element.hasDispositionElement()) {
29972        composeStringCore("disposition", element.getDispositionElement(), false);
29973        composeStringExtras("disposition", element.getDispositionElement(), false);
29974      }
29975      if (element.hasRelated()) {
29976        openArray("related");
29977        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
29978          composeExplanationOfBenefitRelatedClaimComponent(null, e);
29979        closeArray();
29980      };
29981      if (element.hasPrescription()) {
29982        composeReference("prescription", element.getPrescription());
29983      }
29984      if (element.hasOriginalPrescription()) {
29985        composeReference("originalPrescription", element.getOriginalPrescription());
29986      }
29987      if (element.hasPayee()) {
29988        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
29989      }
29990      if (element.hasInformation()) {
29991        openArray("information");
29992        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
29993          composeExplanationOfBenefitSupportingInformationComponent(null, e);
29994        closeArray();
29995      };
29996      if (element.hasCareTeam()) {
29997        openArray("careTeam");
29998        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
29999          composeExplanationOfBenefitCareTeamComponent(null, e);
30000        closeArray();
30001      };
30002      if (element.hasDiagnosis()) {
30003        openArray("diagnosis");
30004        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
30005          composeExplanationOfBenefitDiagnosisComponent(null, e);
30006        closeArray();
30007      };
30008      if (element.hasProcedure()) {
30009        openArray("procedure");
30010        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
30011          composeExplanationOfBenefitProcedureComponent(null, e);
30012        closeArray();
30013      };
30014      if (element.hasPrecedenceElement()) {
30015        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
30016        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
30017      }
30018      if (element.hasInsurance()) {
30019        composeExplanationOfBenefitInsuranceComponent("insurance", element.getInsurance());
30020      }
30021      if (element.hasAccident()) {
30022        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
30023      }
30024      if (element.hasEmploymentImpacted()) {
30025        composePeriod("employmentImpacted", element.getEmploymentImpacted());
30026      }
30027      if (element.hasHospitalization()) {
30028        composePeriod("hospitalization", element.getHospitalization());
30029      }
30030      if (element.hasItem()) {
30031        openArray("item");
30032        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
30033          composeExplanationOfBenefitItemComponent(null, e);
30034        closeArray();
30035      };
30036      if (element.hasAddItem()) {
30037        openArray("addItem");
30038        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
30039          composeExplanationOfBenefitAddedItemComponent(null, e);
30040        closeArray();
30041      };
30042      if (element.hasTotalCost()) {
30043        composeMoney("totalCost", element.getTotalCost());
30044      }
30045      if (element.hasUnallocDeductable()) {
30046        composeMoney("unallocDeductable", element.getUnallocDeductable());
30047      }
30048      if (element.hasTotalBenefit()) {
30049        composeMoney("totalBenefit", element.getTotalBenefit());
30050      }
30051      if (element.hasPayment()) {
30052        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
30053      }
30054      if (element.hasForm()) {
30055        composeCodeableConcept("form", element.getForm());
30056      }
30057      if (element.hasProcessNote()) {
30058        openArray("processNote");
30059        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
30060          composeExplanationOfBenefitNoteComponent(null, e);
30061        closeArray();
30062      };
30063      if (element.hasBenefitBalance()) {
30064        openArray("benefitBalance");
30065        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
30066          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
30067        closeArray();
30068      };
30069  }
30070
30071  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30072    if (element != null) {
30073      open(name);
30074      composeExplanationOfBenefitRelatedClaimComponentInner(element);
30075      close();
30076    }
30077  }
30078
30079  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30080      composeBackbone(element);
30081      if (element.hasClaim()) {
30082        composeReference("claim", element.getClaim());
30083      }
30084      if (element.hasRelationship()) {
30085        composeCodeableConcept("relationship", element.getRelationship());
30086      }
30087      if (element.hasReference()) {
30088        composeIdentifier("reference", element.getReference());
30089      }
30090  }
30091
30092  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
30093    if (element != null) {
30094      open(name);
30095      composeExplanationOfBenefitPayeeComponentInner(element);
30096      close();
30097    }
30098  }
30099
30100  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
30101      composeBackbone(element);
30102      if (element.hasType()) {
30103        composeCodeableConcept("type", element.getType());
30104      }
30105      if (element.hasResourceType()) {
30106        composeCodeableConcept("resourceType", element.getResourceType());
30107      }
30108      if (element.hasParty()) {
30109        composeReference("party", element.getParty());
30110      }
30111  }
30112
30113  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
30114    if (element != null) {
30115      open(name);
30116      composeExplanationOfBenefitSupportingInformationComponentInner(element);
30117      close();
30118    }
30119  }
30120
30121  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
30122      composeBackbone(element);
30123      if (element.hasSequenceElement()) {
30124        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30125        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30126      }
30127      if (element.hasCategory()) {
30128        composeCodeableConcept("category", element.getCategory());
30129      }
30130      if (element.hasCode()) {
30131        composeCodeableConcept("code", element.getCode());
30132      }
30133      if (element.hasTiming()) {
30134        composeType("timing", element.getTiming());
30135      }
30136      if (element.hasValue()) {
30137        composeType("value", element.getValue());
30138      }
30139      if (element.hasReason()) {
30140        composeCoding("reason", element.getReason());
30141      }
30142  }
30143
30144  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30145    if (element != null) {
30146      open(name);
30147      composeExplanationOfBenefitCareTeamComponentInner(element);
30148      close();
30149    }
30150  }
30151
30152  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30153      composeBackbone(element);
30154      if (element.hasSequenceElement()) {
30155        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30156        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30157      }
30158      if (element.hasProvider()) {
30159        composeReference("provider", element.getProvider());
30160      }
30161      if (element.hasResponsibleElement()) {
30162        composeBooleanCore("responsible", element.getResponsibleElement(), false);
30163        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
30164      }
30165      if (element.hasRole()) {
30166        composeCodeableConcept("role", element.getRole());
30167      }
30168      if (element.hasQualification()) {
30169        composeCodeableConcept("qualification", element.getQualification());
30170      }
30171  }
30172
30173  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30174    if (element != null) {
30175      open(name);
30176      composeExplanationOfBenefitDiagnosisComponentInner(element);
30177      close();
30178    }
30179  }
30180
30181  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30182      composeBackbone(element);
30183      if (element.hasSequenceElement()) {
30184        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30185        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30186      }
30187      if (element.hasDiagnosis()) {
30188        composeType("diagnosis", element.getDiagnosis());
30189      }
30190      if (element.hasType()) {
30191        openArray("type");
30192        for (CodeableConcept e : element.getType()) 
30193          composeCodeableConcept(null, e);
30194        closeArray();
30195      };
30196      if (element.hasPackageCode()) {
30197        composeCodeableConcept("packageCode", element.getPackageCode());
30198      }
30199  }
30200
30201  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30202    if (element != null) {
30203      open(name);
30204      composeExplanationOfBenefitProcedureComponentInner(element);
30205      close();
30206    }
30207  }
30208
30209  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30210      composeBackbone(element);
30211      if (element.hasSequenceElement()) {
30212        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30213        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30214      }
30215      if (element.hasDateElement()) {
30216        composeDateTimeCore("date", element.getDateElement(), false);
30217        composeDateTimeExtras("date", element.getDateElement(), false);
30218      }
30219      if (element.hasProcedure()) {
30220        composeType("procedure", element.getProcedure());
30221      }
30222  }
30223
30224  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30225    if (element != null) {
30226      open(name);
30227      composeExplanationOfBenefitInsuranceComponentInner(element);
30228      close();
30229    }
30230  }
30231
30232  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30233      composeBackbone(element);
30234      if (element.hasCoverage()) {
30235        composeReference("coverage", element.getCoverage());
30236      }
30237      if (element.hasPreAuthRef()) {
30238        openArray("preAuthRef");
30239        for (StringType e : element.getPreAuthRef()) 
30240          composeStringCore(null, e, true);
30241        closeArray();
30242        if (anyHasExtras(element.getPreAuthRef())) {
30243          openArray("_preAuthRef");
30244          for (StringType e : element.getPreAuthRef()) 
30245            composeStringExtras(null, e, true);
30246          closeArray();
30247        }
30248      };
30249  }
30250
30251  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
30252    if (element != null) {
30253      open(name);
30254      composeExplanationOfBenefitAccidentComponentInner(element);
30255      close();
30256    }
30257  }
30258
30259  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
30260      composeBackbone(element);
30261      if (element.hasDateElement()) {
30262        composeDateCore("date", element.getDateElement(), false);
30263        composeDateExtras("date", element.getDateElement(), false);
30264      }
30265      if (element.hasType()) {
30266        composeCodeableConcept("type", element.getType());
30267      }
30268      if (element.hasLocation()) {
30269        composeType("location", element.getLocation());
30270      }
30271  }
30272
30273  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
30274    if (element != null) {
30275      open(name);
30276      composeExplanationOfBenefitItemComponentInner(element);
30277      close();
30278    }
30279  }
30280
30281  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
30282      composeBackbone(element);
30283      if (element.hasSequenceElement()) {
30284        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30285        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30286      }
30287      if (element.hasCareTeamLinkId()) {
30288        openArray("careTeamLinkId");
30289        for (PositiveIntType e : element.getCareTeamLinkId()) 
30290          composePositiveIntCore(null, e, true);
30291        closeArray();
30292        if (anyHasExtras(element.getCareTeamLinkId())) {
30293          openArray("_careTeamLinkId");
30294          for (PositiveIntType e : element.getCareTeamLinkId()) 
30295            composePositiveIntExtras(null, e, true);
30296          closeArray();
30297        }
30298      };
30299      if (element.hasDiagnosisLinkId()) {
30300        openArray("diagnosisLinkId");
30301        for (PositiveIntType e : element.getDiagnosisLinkId()) 
30302          composePositiveIntCore(null, e, true);
30303        closeArray();
30304        if (anyHasExtras(element.getDiagnosisLinkId())) {
30305          openArray("_diagnosisLinkId");
30306          for (PositiveIntType e : element.getDiagnosisLinkId()) 
30307            composePositiveIntExtras(null, e, true);
30308          closeArray();
30309        }
30310      };
30311      if (element.hasProcedureLinkId()) {
30312        openArray("procedureLinkId");
30313        for (PositiveIntType e : element.getProcedureLinkId()) 
30314          composePositiveIntCore(null, e, true);
30315        closeArray();
30316        if (anyHasExtras(element.getProcedureLinkId())) {
30317          openArray("_procedureLinkId");
30318          for (PositiveIntType e : element.getProcedureLinkId()) 
30319            composePositiveIntExtras(null, e, true);
30320          closeArray();
30321        }
30322      };
30323      if (element.hasInformationLinkId()) {
30324        openArray("informationLinkId");
30325        for (PositiveIntType e : element.getInformationLinkId()) 
30326          composePositiveIntCore(null, e, true);
30327        closeArray();
30328        if (anyHasExtras(element.getInformationLinkId())) {
30329          openArray("_informationLinkId");
30330          for (PositiveIntType e : element.getInformationLinkId()) 
30331            composePositiveIntExtras(null, e, true);
30332          closeArray();
30333        }
30334      };
30335      if (element.hasRevenue()) {
30336        composeCodeableConcept("revenue", element.getRevenue());
30337      }
30338      if (element.hasCategory()) {
30339        composeCodeableConcept("category", element.getCategory());
30340      }
30341      if (element.hasService()) {
30342        composeCodeableConcept("service", element.getService());
30343      }
30344      if (element.hasModifier()) {
30345        openArray("modifier");
30346        for (CodeableConcept e : element.getModifier()) 
30347          composeCodeableConcept(null, e);
30348        closeArray();
30349      };
30350      if (element.hasProgramCode()) {
30351        openArray("programCode");
30352        for (CodeableConcept e : element.getProgramCode()) 
30353          composeCodeableConcept(null, e);
30354        closeArray();
30355      };
30356      if (element.hasServiced()) {
30357        composeType("serviced", element.getServiced());
30358      }
30359      if (element.hasLocation()) {
30360        composeType("location", element.getLocation());
30361      }
30362      if (element.hasQuantity()) {
30363        composeSimpleQuantity("quantity", element.getQuantity());
30364      }
30365      if (element.hasUnitPrice()) {
30366        composeMoney("unitPrice", element.getUnitPrice());
30367      }
30368      if (element.hasFactorElement()) {
30369        composeDecimalCore("factor", element.getFactorElement(), false);
30370        composeDecimalExtras("factor", element.getFactorElement(), false);
30371      }
30372      if (element.hasNet()) {
30373        composeMoney("net", element.getNet());
30374      }
30375      if (element.hasUdi()) {
30376        openArray("udi");
30377        for (Reference e : element.getUdi()) 
30378          composeReference(null, e);
30379        closeArray();
30380      };
30381      if (element.hasBodySite()) {
30382        composeCodeableConcept("bodySite", element.getBodySite());
30383      }
30384      if (element.hasSubSite()) {
30385        openArray("subSite");
30386        for (CodeableConcept e : element.getSubSite()) 
30387          composeCodeableConcept(null, e);
30388        closeArray();
30389      };
30390      if (element.hasEncounter()) {
30391        openArray("encounter");
30392        for (Reference e : element.getEncounter()) 
30393          composeReference(null, e);
30394        closeArray();
30395      };
30396      if (element.hasNoteNumber()) {
30397        openArray("noteNumber");
30398        for (PositiveIntType e : element.getNoteNumber()) 
30399          composePositiveIntCore(null, e, true);
30400        closeArray();
30401        if (anyHasExtras(element.getNoteNumber())) {
30402          openArray("_noteNumber");
30403          for (PositiveIntType e : element.getNoteNumber()) 
30404            composePositiveIntExtras(null, e, true);
30405          closeArray();
30406        }
30407      };
30408      if (element.hasAdjudication()) {
30409        openArray("adjudication");
30410        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30411          composeExplanationOfBenefitAdjudicationComponent(null, e);
30412        closeArray();
30413      };
30414      if (element.hasDetail()) {
30415        openArray("detail");
30416        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
30417          composeExplanationOfBenefitDetailComponent(null, e);
30418        closeArray();
30419      };
30420  }
30421
30422  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30423    if (element != null) {
30424      open(name);
30425      composeExplanationOfBenefitAdjudicationComponentInner(element);
30426      close();
30427    }
30428  }
30429
30430  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30431      composeBackbone(element);
30432      if (element.hasCategory()) {
30433        composeCodeableConcept("category", element.getCategory());
30434      }
30435      if (element.hasReason()) {
30436        composeCodeableConcept("reason", element.getReason());
30437      }
30438      if (element.hasAmount()) {
30439        composeMoney("amount", element.getAmount());
30440      }
30441      if (element.hasValueElement()) {
30442        composeDecimalCore("value", element.getValueElement(), false);
30443        composeDecimalExtras("value", element.getValueElement(), false);
30444      }
30445  }
30446
30447  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
30448    if (element != null) {
30449      open(name);
30450      composeExplanationOfBenefitDetailComponentInner(element);
30451      close();
30452    }
30453  }
30454
30455  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
30456      composeBackbone(element);
30457      if (element.hasSequenceElement()) {
30458        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30459        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30460      }
30461      if (element.hasType()) {
30462        composeCodeableConcept("type", element.getType());
30463      }
30464      if (element.hasRevenue()) {
30465        composeCodeableConcept("revenue", element.getRevenue());
30466      }
30467      if (element.hasCategory()) {
30468        composeCodeableConcept("category", element.getCategory());
30469      }
30470      if (element.hasService()) {
30471        composeCodeableConcept("service", element.getService());
30472      }
30473      if (element.hasModifier()) {
30474        openArray("modifier");
30475        for (CodeableConcept e : element.getModifier()) 
30476          composeCodeableConcept(null, e);
30477        closeArray();
30478      };
30479      if (element.hasProgramCode()) {
30480        openArray("programCode");
30481        for (CodeableConcept e : element.getProgramCode()) 
30482          composeCodeableConcept(null, e);
30483        closeArray();
30484      };
30485      if (element.hasQuantity()) {
30486        composeSimpleQuantity("quantity", element.getQuantity());
30487      }
30488      if (element.hasUnitPrice()) {
30489        composeMoney("unitPrice", element.getUnitPrice());
30490      }
30491      if (element.hasFactorElement()) {
30492        composeDecimalCore("factor", element.getFactorElement(), false);
30493        composeDecimalExtras("factor", element.getFactorElement(), false);
30494      }
30495      if (element.hasNet()) {
30496        composeMoney("net", element.getNet());
30497      }
30498      if (element.hasUdi()) {
30499        openArray("udi");
30500        for (Reference e : element.getUdi()) 
30501          composeReference(null, e);
30502        closeArray();
30503      };
30504      if (element.hasNoteNumber()) {
30505        openArray("noteNumber");
30506        for (PositiveIntType e : element.getNoteNumber()) 
30507          composePositiveIntCore(null, e, true);
30508        closeArray();
30509        if (anyHasExtras(element.getNoteNumber())) {
30510          openArray("_noteNumber");
30511          for (PositiveIntType e : element.getNoteNumber()) 
30512            composePositiveIntExtras(null, e, true);
30513          closeArray();
30514        }
30515      };
30516      if (element.hasAdjudication()) {
30517        openArray("adjudication");
30518        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30519          composeExplanationOfBenefitAdjudicationComponent(null, e);
30520        closeArray();
30521      };
30522      if (element.hasSubDetail()) {
30523        openArray("subDetail");
30524        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
30525          composeExplanationOfBenefitSubDetailComponent(null, e);
30526        closeArray();
30527      };
30528  }
30529
30530  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30531    if (element != null) {
30532      open(name);
30533      composeExplanationOfBenefitSubDetailComponentInner(element);
30534      close();
30535    }
30536  }
30537
30538  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30539      composeBackbone(element);
30540      if (element.hasSequenceElement()) {
30541        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30542        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30543      }
30544      if (element.hasType()) {
30545        composeCodeableConcept("type", element.getType());
30546      }
30547      if (element.hasRevenue()) {
30548        composeCodeableConcept("revenue", element.getRevenue());
30549      }
30550      if (element.hasCategory()) {
30551        composeCodeableConcept("category", element.getCategory());
30552      }
30553      if (element.hasService()) {
30554        composeCodeableConcept("service", element.getService());
30555      }
30556      if (element.hasModifier()) {
30557        openArray("modifier");
30558        for (CodeableConcept e : element.getModifier()) 
30559          composeCodeableConcept(null, e);
30560        closeArray();
30561      };
30562      if (element.hasProgramCode()) {
30563        openArray("programCode");
30564        for (CodeableConcept e : element.getProgramCode()) 
30565          composeCodeableConcept(null, e);
30566        closeArray();
30567      };
30568      if (element.hasQuantity()) {
30569        composeSimpleQuantity("quantity", element.getQuantity());
30570      }
30571      if (element.hasUnitPrice()) {
30572        composeMoney("unitPrice", element.getUnitPrice());
30573      }
30574      if (element.hasFactorElement()) {
30575        composeDecimalCore("factor", element.getFactorElement(), false);
30576        composeDecimalExtras("factor", element.getFactorElement(), false);
30577      }
30578      if (element.hasNet()) {
30579        composeMoney("net", element.getNet());
30580      }
30581      if (element.hasUdi()) {
30582        openArray("udi");
30583        for (Reference e : element.getUdi()) 
30584          composeReference(null, e);
30585        closeArray();
30586      };
30587      if (element.hasNoteNumber()) {
30588        openArray("noteNumber");
30589        for (PositiveIntType e : element.getNoteNumber()) 
30590          composePositiveIntCore(null, e, true);
30591        closeArray();
30592        if (anyHasExtras(element.getNoteNumber())) {
30593          openArray("_noteNumber");
30594          for (PositiveIntType e : element.getNoteNumber()) 
30595            composePositiveIntExtras(null, e, true);
30596          closeArray();
30597        }
30598      };
30599      if (element.hasAdjudication()) {
30600        openArray("adjudication");
30601        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30602          composeExplanationOfBenefitAdjudicationComponent(null, e);
30603        closeArray();
30604      };
30605  }
30606
30607  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30608    if (element != null) {
30609      open(name);
30610      composeExplanationOfBenefitAddedItemComponentInner(element);
30611      close();
30612    }
30613  }
30614
30615  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30616      composeBackbone(element);
30617      if (element.hasSequenceLinkId()) {
30618        openArray("sequenceLinkId");
30619        for (PositiveIntType e : element.getSequenceLinkId()) 
30620          composePositiveIntCore(null, e, true);
30621        closeArray();
30622        if (anyHasExtras(element.getSequenceLinkId())) {
30623          openArray("_sequenceLinkId");
30624          for (PositiveIntType e : element.getSequenceLinkId()) 
30625            composePositiveIntExtras(null, e, true);
30626          closeArray();
30627        }
30628      };
30629      if (element.hasRevenue()) {
30630        composeCodeableConcept("revenue", element.getRevenue());
30631      }
30632      if (element.hasCategory()) {
30633        composeCodeableConcept("category", element.getCategory());
30634      }
30635      if (element.hasService()) {
30636        composeCodeableConcept("service", element.getService());
30637      }
30638      if (element.hasModifier()) {
30639        openArray("modifier");
30640        for (CodeableConcept e : element.getModifier()) 
30641          composeCodeableConcept(null, e);
30642        closeArray();
30643      };
30644      if (element.hasFee()) {
30645        composeMoney("fee", element.getFee());
30646      }
30647      if (element.hasNoteNumber()) {
30648        openArray("noteNumber");
30649        for (PositiveIntType e : element.getNoteNumber()) 
30650          composePositiveIntCore(null, e, true);
30651        closeArray();
30652        if (anyHasExtras(element.getNoteNumber())) {
30653          openArray("_noteNumber");
30654          for (PositiveIntType e : element.getNoteNumber()) 
30655            composePositiveIntExtras(null, e, true);
30656          closeArray();
30657        }
30658      };
30659      if (element.hasAdjudication()) {
30660        openArray("adjudication");
30661        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30662          composeExplanationOfBenefitAdjudicationComponent(null, e);
30663        closeArray();
30664      };
30665      if (element.hasDetail()) {
30666        openArray("detail");
30667        for (ExplanationOfBenefit.AddedItemsDetailComponent e : element.getDetail()) 
30668          composeExplanationOfBenefitAddedItemsDetailComponent(null, e);
30669        closeArray();
30670      };
30671  }
30672
30673  protected void composeExplanationOfBenefitAddedItemsDetailComponent(String name, ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
30674    if (element != null) {
30675      open(name);
30676      composeExplanationOfBenefitAddedItemsDetailComponentInner(element);
30677      close();
30678    }
30679  }
30680
30681  protected void composeExplanationOfBenefitAddedItemsDetailComponentInner(ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
30682      composeBackbone(element);
30683      if (element.hasRevenue()) {
30684        composeCodeableConcept("revenue", element.getRevenue());
30685      }
30686      if (element.hasCategory()) {
30687        composeCodeableConcept("category", element.getCategory());
30688      }
30689      if (element.hasService()) {
30690        composeCodeableConcept("service", element.getService());
30691      }
30692      if (element.hasModifier()) {
30693        openArray("modifier");
30694        for (CodeableConcept e : element.getModifier()) 
30695          composeCodeableConcept(null, e);
30696        closeArray();
30697      };
30698      if (element.hasFee()) {
30699        composeMoney("fee", element.getFee());
30700      }
30701      if (element.hasNoteNumber()) {
30702        openArray("noteNumber");
30703        for (PositiveIntType e : element.getNoteNumber()) 
30704          composePositiveIntCore(null, e, true);
30705        closeArray();
30706        if (anyHasExtras(element.getNoteNumber())) {
30707          openArray("_noteNumber");
30708          for (PositiveIntType e : element.getNoteNumber()) 
30709            composePositiveIntExtras(null, e, true);
30710          closeArray();
30711        }
30712      };
30713      if (element.hasAdjudication()) {
30714        openArray("adjudication");
30715        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30716          composeExplanationOfBenefitAdjudicationComponent(null, e);
30717        closeArray();
30718      };
30719  }
30720
30721  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
30722    if (element != null) {
30723      open(name);
30724      composeExplanationOfBenefitPaymentComponentInner(element);
30725      close();
30726    }
30727  }
30728
30729  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
30730      composeBackbone(element);
30731      if (element.hasType()) {
30732        composeCodeableConcept("type", element.getType());
30733      }
30734      if (element.hasAdjustment()) {
30735        composeMoney("adjustment", element.getAdjustment());
30736      }
30737      if (element.hasAdjustmentReason()) {
30738        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
30739      }
30740      if (element.hasDateElement()) {
30741        composeDateCore("date", element.getDateElement(), false);
30742        composeDateExtras("date", element.getDateElement(), false);
30743      }
30744      if (element.hasAmount()) {
30745        composeMoney("amount", element.getAmount());
30746      }
30747      if (element.hasIdentifier()) {
30748        composeIdentifier("identifier", element.getIdentifier());
30749      }
30750  }
30751
30752  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
30753    if (element != null) {
30754      open(name);
30755      composeExplanationOfBenefitNoteComponentInner(element);
30756      close();
30757    }
30758  }
30759
30760  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
30761      composeBackbone(element);
30762      if (element.hasNumberElement()) {
30763        composePositiveIntCore("number", element.getNumberElement(), false);
30764        composePositiveIntExtras("number", element.getNumberElement(), false);
30765      }
30766      if (element.hasType()) {
30767        composeCodeableConcept("type", element.getType());
30768      }
30769      if (element.hasTextElement()) {
30770        composeStringCore("text", element.getTextElement(), false);
30771        composeStringExtras("text", element.getTextElement(), false);
30772      }
30773      if (element.hasLanguage()) {
30774        composeCodeableConcept("language", element.getLanguage());
30775      }
30776  }
30777
30778  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
30779    if (element != null) {
30780      open(name);
30781      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
30782      close();
30783    }
30784  }
30785
30786  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
30787      composeBackbone(element);
30788      if (element.hasCategory()) {
30789        composeCodeableConcept("category", element.getCategory());
30790      }
30791      if (element.hasSubCategory()) {
30792        composeCodeableConcept("subCategory", element.getSubCategory());
30793      }
30794      if (element.hasExcludedElement()) {
30795        composeBooleanCore("excluded", element.getExcludedElement(), false);
30796        composeBooleanExtras("excluded", element.getExcludedElement(), false);
30797      }
30798      if (element.hasNameElement()) {
30799        composeStringCore("name", element.getNameElement(), false);
30800        composeStringExtras("name", element.getNameElement(), false);
30801      }
30802      if (element.hasDescriptionElement()) {
30803        composeStringCore("description", element.getDescriptionElement(), false);
30804        composeStringExtras("description", element.getDescriptionElement(), false);
30805      }
30806      if (element.hasNetwork()) {
30807        composeCodeableConcept("network", element.getNetwork());
30808      }
30809      if (element.hasUnit()) {
30810        composeCodeableConcept("unit", element.getUnit());
30811      }
30812      if (element.hasTerm()) {
30813        composeCodeableConcept("term", element.getTerm());
30814      }
30815      if (element.hasFinancial()) {
30816        openArray("financial");
30817        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
30818          composeExplanationOfBenefitBenefitComponent(null, e);
30819        closeArray();
30820      };
30821  }
30822
30823  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
30824    if (element != null) {
30825      open(name);
30826      composeExplanationOfBenefitBenefitComponentInner(element);
30827      close();
30828    }
30829  }
30830
30831  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
30832      composeBackbone(element);
30833      if (element.hasType()) {
30834        composeCodeableConcept("type", element.getType());
30835      }
30836      if (element.hasAllowed()) {
30837        composeType("allowed", element.getAllowed());
30838      }
30839      if (element.hasUsed()) {
30840        composeType("used", element.getUsed());
30841      }
30842  }
30843
30844  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
30845    if (element != null) {
30846      prop("resourceType", name);
30847      composeFamilyMemberHistoryInner(element);
30848    }
30849  }
30850
30851  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
30852      composeDomainResourceElements(element);
30853      if (element.hasIdentifier()) {
30854        openArray("identifier");
30855        for (Identifier e : element.getIdentifier()) 
30856          composeIdentifier(null, e);
30857        closeArray();
30858      };
30859      if (element.hasDefinition()) {
30860        openArray("definition");
30861        for (Reference e : element.getDefinition()) 
30862          composeReference(null, e);
30863        closeArray();
30864      };
30865      if (element.hasStatusElement()) {
30866        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
30867        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
30868      }
30869      if (element.hasNotDoneElement()) {
30870        composeBooleanCore("notDone", element.getNotDoneElement(), false);
30871        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
30872      }
30873      if (element.hasNotDoneReason()) {
30874        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
30875      }
30876      if (element.hasPatient()) {
30877        composeReference("patient", element.getPatient());
30878      }
30879      if (element.hasDateElement()) {
30880        composeDateTimeCore("date", element.getDateElement(), false);
30881        composeDateTimeExtras("date", element.getDateElement(), false);
30882      }
30883      if (element.hasNameElement()) {
30884        composeStringCore("name", element.getNameElement(), false);
30885        composeStringExtras("name", element.getNameElement(), false);
30886      }
30887      if (element.hasRelationship()) {
30888        composeCodeableConcept("relationship", element.getRelationship());
30889      }
30890      if (element.hasGenderElement()) {
30891        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30892        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30893      }
30894      if (element.hasBorn()) {
30895        composeType("born", element.getBorn());
30896      }
30897      if (element.hasAge()) {
30898        composeType("age", element.getAge());
30899      }
30900      if (element.hasEstimatedAgeElement()) {
30901        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
30902        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
30903      }
30904      if (element.hasDeceased()) {
30905        composeType("deceased", element.getDeceased());
30906      }
30907      if (element.hasReasonCode()) {
30908        openArray("reasonCode");
30909        for (CodeableConcept e : element.getReasonCode()) 
30910          composeCodeableConcept(null, e);
30911        closeArray();
30912      };
30913      if (element.hasReasonReference()) {
30914        openArray("reasonReference");
30915        for (Reference e : element.getReasonReference()) 
30916          composeReference(null, e);
30917        closeArray();
30918      };
30919      if (element.hasNote()) {
30920        openArray("note");
30921        for (Annotation e : element.getNote()) 
30922          composeAnnotation(null, e);
30923        closeArray();
30924      };
30925      if (element.hasCondition()) {
30926        openArray("condition");
30927        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
30928          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
30929        closeArray();
30930      };
30931  }
30932
30933  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
30934    if (element != null) {
30935      open(name);
30936      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
30937      close();
30938    }
30939  }
30940
30941  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
30942      composeBackbone(element);
30943      if (element.hasCode()) {
30944        composeCodeableConcept("code", element.getCode());
30945      }
30946      if (element.hasOutcome()) {
30947        composeCodeableConcept("outcome", element.getOutcome());
30948      }
30949      if (element.hasOnset()) {
30950        composeType("onset", element.getOnset());
30951      }
30952      if (element.hasNote()) {
30953        openArray("note");
30954        for (Annotation e : element.getNote()) 
30955          composeAnnotation(null, e);
30956        closeArray();
30957      };
30958  }
30959
30960  protected void composeFlag(String name, Flag element) throws IOException {
30961    if (element != null) {
30962      prop("resourceType", name);
30963      composeFlagInner(element);
30964    }
30965  }
30966
30967  protected void composeFlagInner(Flag element) throws IOException {
30968      composeDomainResourceElements(element);
30969      if (element.hasIdentifier()) {
30970        openArray("identifier");
30971        for (Identifier e : element.getIdentifier()) 
30972          composeIdentifier(null, e);
30973        closeArray();
30974      };
30975      if (element.hasStatusElement()) {
30976        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
30977        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
30978      }
30979      if (element.hasCategory()) {
30980        composeCodeableConcept("category", element.getCategory());
30981      }
30982      if (element.hasCode()) {
30983        composeCodeableConcept("code", element.getCode());
30984      }
30985      if (element.hasSubject()) {
30986        composeReference("subject", element.getSubject());
30987      }
30988      if (element.hasPeriod()) {
30989        composePeriod("period", element.getPeriod());
30990      }
30991      if (element.hasEncounter()) {
30992        composeReference("encounter", element.getEncounter());
30993      }
30994      if (element.hasAuthor()) {
30995        composeReference("author", element.getAuthor());
30996      }
30997  }
30998
30999  protected void composeGoal(String name, Goal element) throws IOException {
31000    if (element != null) {
31001      prop("resourceType", name);
31002      composeGoalInner(element);
31003    }
31004  }
31005
31006  protected void composeGoalInner(Goal element) throws IOException {
31007      composeDomainResourceElements(element);
31008      if (element.hasIdentifier()) {
31009        openArray("identifier");
31010        for (Identifier e : element.getIdentifier()) 
31011          composeIdentifier(null, e);
31012        closeArray();
31013      };
31014      if (element.hasStatusElement()) {
31015        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31016        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31017      }
31018      if (element.hasCategory()) {
31019        openArray("category");
31020        for (CodeableConcept e : element.getCategory()) 
31021          composeCodeableConcept(null, e);
31022        closeArray();
31023      };
31024      if (element.hasPriority()) {
31025        composeCodeableConcept("priority", element.getPriority());
31026      }
31027      if (element.hasDescription()) {
31028        composeCodeableConcept("description", element.getDescription());
31029      }
31030      if (element.hasSubject()) {
31031        composeReference("subject", element.getSubject());
31032      }
31033      if (element.hasStart()) {
31034        composeType("start", element.getStart());
31035      }
31036      if (element.hasTarget()) {
31037        composeGoalGoalTargetComponent("target", element.getTarget());
31038      }
31039      if (element.hasStatusDateElement()) {
31040        composeDateCore("statusDate", element.getStatusDateElement(), false);
31041        composeDateExtras("statusDate", element.getStatusDateElement(), false);
31042      }
31043      if (element.hasStatusReasonElement()) {
31044        composeStringCore("statusReason", element.getStatusReasonElement(), false);
31045        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
31046      }
31047      if (element.hasExpressedBy()) {
31048        composeReference("expressedBy", element.getExpressedBy());
31049      }
31050      if (element.hasAddresses()) {
31051        openArray("addresses");
31052        for (Reference e : element.getAddresses()) 
31053          composeReference(null, e);
31054        closeArray();
31055      };
31056      if (element.hasNote()) {
31057        openArray("note");
31058        for (Annotation e : element.getNote()) 
31059          composeAnnotation(null, e);
31060        closeArray();
31061      };
31062      if (element.hasOutcomeCode()) {
31063        openArray("outcomeCode");
31064        for (CodeableConcept e : element.getOutcomeCode()) 
31065          composeCodeableConcept(null, e);
31066        closeArray();
31067      };
31068      if (element.hasOutcomeReference()) {
31069        openArray("outcomeReference");
31070        for (Reference e : element.getOutcomeReference()) 
31071          composeReference(null, e);
31072        closeArray();
31073      };
31074  }
31075
31076  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
31077    if (element != null) {
31078      open(name);
31079      composeGoalGoalTargetComponentInner(element);
31080      close();
31081    }
31082  }
31083
31084  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
31085      composeBackbone(element);
31086      if (element.hasMeasure()) {
31087        composeCodeableConcept("measure", element.getMeasure());
31088      }
31089      if (element.hasDetail()) {
31090        composeType("detail", element.getDetail());
31091      }
31092      if (element.hasDue()) {
31093        composeType("due", element.getDue());
31094      }
31095  }
31096
31097  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
31098    if (element != null) {
31099      prop("resourceType", name);
31100      composeGraphDefinitionInner(element);
31101    }
31102  }
31103
31104  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
31105      composeDomainResourceElements(element);
31106      if (element.hasUrlElement()) {
31107        composeUriCore("url", element.getUrlElement(), false);
31108        composeUriExtras("url", element.getUrlElement(), false);
31109      }
31110      if (element.hasVersionElement()) {
31111        composeStringCore("version", element.getVersionElement(), false);
31112        composeStringExtras("version", element.getVersionElement(), false);
31113      }
31114      if (element.hasNameElement()) {
31115        composeStringCore("name", element.getNameElement(), false);
31116        composeStringExtras("name", element.getNameElement(), false);
31117      }
31118      if (element.hasStatusElement()) {
31119        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31120        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31121      }
31122      if (element.hasExperimentalElement()) {
31123        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31124        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31125      }
31126      if (element.hasDateElement()) {
31127        composeDateTimeCore("date", element.getDateElement(), false);
31128        composeDateTimeExtras("date", element.getDateElement(), false);
31129      }
31130      if (element.hasPublisherElement()) {
31131        composeStringCore("publisher", element.getPublisherElement(), false);
31132        composeStringExtras("publisher", element.getPublisherElement(), false);
31133      }
31134      if (element.hasContact()) {
31135        openArray("contact");
31136        for (ContactDetail e : element.getContact()) 
31137          composeContactDetail(null, e);
31138        closeArray();
31139      };
31140      if (element.hasDescriptionElement()) {
31141        composeMarkdownCore("description", element.getDescriptionElement(), false);
31142        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31143      }
31144      if (element.hasUseContext()) {
31145        openArray("useContext");
31146        for (UsageContext e : element.getUseContext()) 
31147          composeUsageContext(null, e);
31148        closeArray();
31149      };
31150      if (element.hasJurisdiction()) {
31151        openArray("jurisdiction");
31152        for (CodeableConcept e : element.getJurisdiction()) 
31153          composeCodeableConcept(null, e);
31154        closeArray();
31155      };
31156      if (element.hasPurposeElement()) {
31157        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31158        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31159      }
31160      if (element.hasStartElement()) {
31161        composeCodeCore("start", element.getStartElement(), false);
31162        composeCodeExtras("start", element.getStartElement(), false);
31163      }
31164      if (element.hasProfileElement()) {
31165        composeUriCore("profile", element.getProfileElement(), false);
31166        composeUriExtras("profile", element.getProfileElement(), false);
31167      }
31168      if (element.hasLink()) {
31169        openArray("link");
31170        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31171          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31172        closeArray();
31173      };
31174  }
31175
31176  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31177    if (element != null) {
31178      open(name);
31179      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
31180      close();
31181    }
31182  }
31183
31184  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31185      composeBackbone(element);
31186      if (element.hasPathElement()) {
31187        composeStringCore("path", element.getPathElement(), false);
31188        composeStringExtras("path", element.getPathElement(), false);
31189      }
31190      if (element.hasSliceNameElement()) {
31191        composeStringCore("sliceName", element.getSliceNameElement(), false);
31192        composeStringExtras("sliceName", element.getSliceNameElement(), false);
31193      }
31194      if (element.hasMinElement()) {
31195        composeIntegerCore("min", element.getMinElement(), false);
31196        composeIntegerExtras("min", element.getMinElement(), false);
31197      }
31198      if (element.hasMaxElement()) {
31199        composeStringCore("max", element.getMaxElement(), false);
31200        composeStringExtras("max", element.getMaxElement(), false);
31201      }
31202      if (element.hasDescriptionElement()) {
31203        composeStringCore("description", element.getDescriptionElement(), false);
31204        composeStringExtras("description", element.getDescriptionElement(), false);
31205      }
31206      if (element.hasTarget()) {
31207        openArray("target");
31208        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
31209          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
31210        closeArray();
31211      };
31212  }
31213
31214  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31215    if (element != null) {
31216      open(name);
31217      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
31218      close();
31219    }
31220  }
31221
31222  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31223      composeBackbone(element);
31224      if (element.hasTypeElement()) {
31225        composeCodeCore("type", element.getTypeElement(), false);
31226        composeCodeExtras("type", element.getTypeElement(), false);
31227      }
31228      if (element.hasProfileElement()) {
31229        composeUriCore("profile", element.getProfileElement(), false);
31230        composeUriExtras("profile", element.getProfileElement(), false);
31231      }
31232      if (element.hasCompartment()) {
31233        openArray("compartment");
31234        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
31235          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
31236        closeArray();
31237      };
31238      if (element.hasLink()) {
31239        openArray("link");
31240        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31241          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31242        closeArray();
31243      };
31244  }
31245
31246  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31247    if (element != null) {
31248      open(name);
31249      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
31250      close();
31251    }
31252  }
31253
31254  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31255      composeBackbone(element);
31256      if (element.hasCodeElement()) {
31257        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31258        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31259      }
31260      if (element.hasRuleElement()) {
31261        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31262        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31263      }
31264      if (element.hasExpressionElement()) {
31265        composeStringCore("expression", element.getExpressionElement(), false);
31266        composeStringExtras("expression", element.getExpressionElement(), false);
31267      }
31268      if (element.hasDescriptionElement()) {
31269        composeStringCore("description", element.getDescriptionElement(), false);
31270        composeStringExtras("description", element.getDescriptionElement(), false);
31271      }
31272  }
31273
31274  protected void composeGroup(String name, Group element) throws IOException {
31275    if (element != null) {
31276      prop("resourceType", name);
31277      composeGroupInner(element);
31278    }
31279  }
31280
31281  protected void composeGroupInner(Group element) throws IOException {
31282      composeDomainResourceElements(element);
31283      if (element.hasIdentifier()) {
31284        openArray("identifier");
31285        for (Identifier e : element.getIdentifier()) 
31286          composeIdentifier(null, e);
31287        closeArray();
31288      };
31289      if (element.hasActiveElement()) {
31290        composeBooleanCore("active", element.getActiveElement(), false);
31291        composeBooleanExtras("active", element.getActiveElement(), false);
31292      }
31293      if (element.hasTypeElement()) {
31294        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31295        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31296      }
31297      if (element.hasActualElement()) {
31298        composeBooleanCore("actual", element.getActualElement(), false);
31299        composeBooleanExtras("actual", element.getActualElement(), false);
31300      }
31301      if (element.hasCode()) {
31302        composeCodeableConcept("code", element.getCode());
31303      }
31304      if (element.hasNameElement()) {
31305        composeStringCore("name", element.getNameElement(), false);
31306        composeStringExtras("name", element.getNameElement(), false);
31307      }
31308      if (element.hasQuantityElement()) {
31309        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
31310        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
31311      }
31312      if (element.hasCharacteristic()) {
31313        openArray("characteristic");
31314        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
31315          composeGroupGroupCharacteristicComponent(null, e);
31316        closeArray();
31317      };
31318      if (element.hasMember()) {
31319        openArray("member");
31320        for (Group.GroupMemberComponent e : element.getMember()) 
31321          composeGroupGroupMemberComponent(null, e);
31322        closeArray();
31323      };
31324  }
31325
31326  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
31327    if (element != null) {
31328      open(name);
31329      composeGroupGroupCharacteristicComponentInner(element);
31330      close();
31331    }
31332  }
31333
31334  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
31335      composeBackbone(element);
31336      if (element.hasCode()) {
31337        composeCodeableConcept("code", element.getCode());
31338      }
31339      if (element.hasValue()) {
31340        composeType("value", element.getValue());
31341      }
31342      if (element.hasExcludeElement()) {
31343        composeBooleanCore("exclude", element.getExcludeElement(), false);
31344        composeBooleanExtras("exclude", element.getExcludeElement(), false);
31345      }
31346      if (element.hasPeriod()) {
31347        composePeriod("period", element.getPeriod());
31348      }
31349  }
31350
31351  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
31352    if (element != null) {
31353      open(name);
31354      composeGroupGroupMemberComponentInner(element);
31355      close();
31356    }
31357  }
31358
31359  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
31360      composeBackbone(element);
31361      if (element.hasEntity()) {
31362        composeReference("entity", element.getEntity());
31363      }
31364      if (element.hasPeriod()) {
31365        composePeriod("period", element.getPeriod());
31366      }
31367      if (element.hasInactiveElement()) {
31368        composeBooleanCore("inactive", element.getInactiveElement(), false);
31369        composeBooleanExtras("inactive", element.getInactiveElement(), false);
31370      }
31371  }
31372
31373  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
31374    if (element != null) {
31375      prop("resourceType", name);
31376      composeGuidanceResponseInner(element);
31377    }
31378  }
31379
31380  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
31381      composeDomainResourceElements(element);
31382      if (element.hasRequestIdElement()) {
31383        composeIdCore("requestId", element.getRequestIdElement(), false);
31384        composeIdExtras("requestId", element.getRequestIdElement(), false);
31385      }
31386      if (element.hasIdentifier()) {
31387        composeIdentifier("identifier", element.getIdentifier());
31388      }
31389      if (element.hasModule()) {
31390        composeReference("module", element.getModule());
31391      }
31392      if (element.hasStatusElement()) {
31393        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31394        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31395      }
31396      if (element.hasSubject()) {
31397        composeReference("subject", element.getSubject());
31398      }
31399      if (element.hasContext()) {
31400        composeReference("context", element.getContext());
31401      }
31402      if (element.hasOccurrenceDateTimeElement()) {
31403        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31404        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31405      }
31406      if (element.hasPerformer()) {
31407        composeReference("performer", element.getPerformer());
31408      }
31409      if (element.hasReason()) {
31410        composeType("reason", element.getReason());
31411      }
31412      if (element.hasNote()) {
31413        openArray("note");
31414        for (Annotation e : element.getNote()) 
31415          composeAnnotation(null, e);
31416        closeArray();
31417      };
31418      if (element.hasEvaluationMessage()) {
31419        openArray("evaluationMessage");
31420        for (Reference e : element.getEvaluationMessage()) 
31421          composeReference(null, e);
31422        closeArray();
31423      };
31424      if (element.hasOutputParameters()) {
31425        composeReference("outputParameters", element.getOutputParameters());
31426      }
31427      if (element.hasResult()) {
31428        composeReference("result", element.getResult());
31429      }
31430      if (element.hasDataRequirement()) {
31431        openArray("dataRequirement");
31432        for (DataRequirement e : element.getDataRequirement()) 
31433          composeDataRequirement(null, e);
31434        closeArray();
31435      };
31436  }
31437
31438  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
31439    if (element != null) {
31440      prop("resourceType", name);
31441      composeHealthcareServiceInner(element);
31442    }
31443  }
31444
31445  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
31446      composeDomainResourceElements(element);
31447      if (element.hasIdentifier()) {
31448        openArray("identifier");
31449        for (Identifier e : element.getIdentifier()) 
31450          composeIdentifier(null, e);
31451        closeArray();
31452      };
31453      if (element.hasActiveElement()) {
31454        composeBooleanCore("active", element.getActiveElement(), false);
31455        composeBooleanExtras("active", element.getActiveElement(), false);
31456      }
31457      if (element.hasProvidedBy()) {
31458        composeReference("providedBy", element.getProvidedBy());
31459      }
31460      if (element.hasCategory()) {
31461        composeCodeableConcept("category", element.getCategory());
31462      }
31463      if (element.hasType()) {
31464        openArray("type");
31465        for (CodeableConcept e : element.getType()) 
31466          composeCodeableConcept(null, e);
31467        closeArray();
31468      };
31469      if (element.hasSpecialty()) {
31470        openArray("specialty");
31471        for (CodeableConcept e : element.getSpecialty()) 
31472          composeCodeableConcept(null, e);
31473        closeArray();
31474      };
31475      if (element.hasLocation()) {
31476        openArray("location");
31477        for (Reference e : element.getLocation()) 
31478          composeReference(null, e);
31479        closeArray();
31480      };
31481      if (element.hasNameElement()) {
31482        composeStringCore("name", element.getNameElement(), false);
31483        composeStringExtras("name", element.getNameElement(), false);
31484      }
31485      if (element.hasCommentElement()) {
31486        composeStringCore("comment", element.getCommentElement(), false);
31487        composeStringExtras("comment", element.getCommentElement(), false);
31488      }
31489      if (element.hasExtraDetailsElement()) {
31490        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
31491        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
31492      }
31493      if (element.hasPhoto()) {
31494        composeAttachment("photo", element.getPhoto());
31495      }
31496      if (element.hasTelecom()) {
31497        openArray("telecom");
31498        for (ContactPoint e : element.getTelecom()) 
31499          composeContactPoint(null, e);
31500        closeArray();
31501      };
31502      if (element.hasCoverageArea()) {
31503        openArray("coverageArea");
31504        for (Reference e : element.getCoverageArea()) 
31505          composeReference(null, e);
31506        closeArray();
31507      };
31508      if (element.hasServiceProvisionCode()) {
31509        openArray("serviceProvisionCode");
31510        for (CodeableConcept e : element.getServiceProvisionCode()) 
31511          composeCodeableConcept(null, e);
31512        closeArray();
31513      };
31514      if (element.hasEligibility()) {
31515        composeCodeableConcept("eligibility", element.getEligibility());
31516      }
31517      if (element.hasEligibilityNoteElement()) {
31518        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
31519        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
31520      }
31521      if (element.hasProgramName()) {
31522        openArray("programName");
31523        for (StringType e : element.getProgramName()) 
31524          composeStringCore(null, e, true);
31525        closeArray();
31526        if (anyHasExtras(element.getProgramName())) {
31527          openArray("_programName");
31528          for (StringType e : element.getProgramName()) 
31529            composeStringExtras(null, e, true);
31530          closeArray();
31531        }
31532      };
31533      if (element.hasCharacteristic()) {
31534        openArray("characteristic");
31535        for (CodeableConcept e : element.getCharacteristic()) 
31536          composeCodeableConcept(null, e);
31537        closeArray();
31538      };
31539      if (element.hasReferralMethod()) {
31540        openArray("referralMethod");
31541        for (CodeableConcept e : element.getReferralMethod()) 
31542          composeCodeableConcept(null, e);
31543        closeArray();
31544      };
31545      if (element.hasAppointmentRequiredElement()) {
31546        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
31547        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
31548      }
31549      if (element.hasAvailableTime()) {
31550        openArray("availableTime");
31551        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
31552          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
31553        closeArray();
31554      };
31555      if (element.hasNotAvailable()) {
31556        openArray("notAvailable");
31557        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
31558          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
31559        closeArray();
31560      };
31561      if (element.hasAvailabilityExceptionsElement()) {
31562        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31563        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31564      }
31565      if (element.hasEndpoint()) {
31566        openArray("endpoint");
31567        for (Reference e : element.getEndpoint()) 
31568          composeReference(null, e);
31569        closeArray();
31570      };
31571  }
31572
31573  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31574    if (element != null) {
31575      open(name);
31576      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
31577      close();
31578    }
31579  }
31580
31581  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31582      composeBackbone(element);
31583      if (element.hasDaysOfWeek()) {
31584        openArray("daysOfWeek");
31585        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31586          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31587        closeArray();
31588        if (anyHasExtras(element.getDaysOfWeek())) {
31589          openArray("_daysOfWeek");
31590          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31591            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31592          closeArray();
31593        }
31594      };
31595      if (element.hasAllDayElement()) {
31596        composeBooleanCore("allDay", element.getAllDayElement(), false);
31597        composeBooleanExtras("allDay", element.getAllDayElement(), false);
31598      }
31599      if (element.hasAvailableStartTimeElement()) {
31600        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
31601        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
31602      }
31603      if (element.hasAvailableEndTimeElement()) {
31604        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
31605        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
31606      }
31607  }
31608
31609  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31610    if (element != null) {
31611      open(name);
31612      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
31613      close();
31614    }
31615  }
31616
31617  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31618      composeBackbone(element);
31619      if (element.hasDescriptionElement()) {
31620        composeStringCore("description", element.getDescriptionElement(), false);
31621        composeStringExtras("description", element.getDescriptionElement(), false);
31622      }
31623      if (element.hasDuring()) {
31624        composePeriod("during", element.getDuring());
31625      }
31626  }
31627
31628  protected void composeImagingManifest(String name, ImagingManifest element) throws IOException {
31629    if (element != null) {
31630      prop("resourceType", name);
31631      composeImagingManifestInner(element);
31632    }
31633  }
31634
31635  protected void composeImagingManifestInner(ImagingManifest element) throws IOException {
31636      composeDomainResourceElements(element);
31637      if (element.hasIdentifier()) {
31638        composeIdentifier("identifier", element.getIdentifier());
31639      }
31640      if (element.hasPatient()) {
31641        composeReference("patient", element.getPatient());
31642      }
31643      if (element.hasAuthoringTimeElement()) {
31644        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
31645        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
31646      }
31647      if (element.hasAuthor()) {
31648        composeReference("author", element.getAuthor());
31649      }
31650      if (element.hasDescriptionElement()) {
31651        composeStringCore("description", element.getDescriptionElement(), false);
31652        composeStringExtras("description", element.getDescriptionElement(), false);
31653      }
31654      if (element.hasStudy()) {
31655        openArray("study");
31656        for (ImagingManifest.StudyComponent e : element.getStudy()) 
31657          composeImagingManifestStudyComponent(null, e);
31658        closeArray();
31659      };
31660  }
31661
31662  protected void composeImagingManifestStudyComponent(String name, ImagingManifest.StudyComponent element) throws IOException {
31663    if (element != null) {
31664      open(name);
31665      composeImagingManifestStudyComponentInner(element);
31666      close();
31667    }
31668  }
31669
31670  protected void composeImagingManifestStudyComponentInner(ImagingManifest.StudyComponent element) throws IOException {
31671      composeBackbone(element);
31672      if (element.hasUidElement()) {
31673        composeOidCore("uid", element.getUidElement(), false);
31674        composeOidExtras("uid", element.getUidElement(), false);
31675      }
31676      if (element.hasImagingStudy()) {
31677        composeReference("imagingStudy", element.getImagingStudy());
31678      }
31679      if (element.hasEndpoint()) {
31680        openArray("endpoint");
31681        for (Reference e : element.getEndpoint()) 
31682          composeReference(null, e);
31683        closeArray();
31684      };
31685      if (element.hasSeries()) {
31686        openArray("series");
31687        for (ImagingManifest.SeriesComponent e : element.getSeries()) 
31688          composeImagingManifestSeriesComponent(null, e);
31689        closeArray();
31690      };
31691  }
31692
31693  protected void composeImagingManifestSeriesComponent(String name, ImagingManifest.SeriesComponent element) throws IOException {
31694    if (element != null) {
31695      open(name);
31696      composeImagingManifestSeriesComponentInner(element);
31697      close();
31698    }
31699  }
31700
31701  protected void composeImagingManifestSeriesComponentInner(ImagingManifest.SeriesComponent element) throws IOException {
31702      composeBackbone(element);
31703      if (element.hasUidElement()) {
31704        composeOidCore("uid", element.getUidElement(), false);
31705        composeOidExtras("uid", element.getUidElement(), false);
31706      }
31707      if (element.hasEndpoint()) {
31708        openArray("endpoint");
31709        for (Reference e : element.getEndpoint()) 
31710          composeReference(null, e);
31711        closeArray();
31712      };
31713      if (element.hasInstance()) {
31714        openArray("instance");
31715        for (ImagingManifest.InstanceComponent e : element.getInstance()) 
31716          composeImagingManifestInstanceComponent(null, e);
31717        closeArray();
31718      };
31719  }
31720
31721  protected void composeImagingManifestInstanceComponent(String name, ImagingManifest.InstanceComponent element) throws IOException {
31722    if (element != null) {
31723      open(name);
31724      composeImagingManifestInstanceComponentInner(element);
31725      close();
31726    }
31727  }
31728
31729  protected void composeImagingManifestInstanceComponentInner(ImagingManifest.InstanceComponent element) throws IOException {
31730      composeBackbone(element);
31731      if (element.hasSopClassElement()) {
31732        composeOidCore("sopClass", element.getSopClassElement(), false);
31733        composeOidExtras("sopClass", element.getSopClassElement(), false);
31734      }
31735      if (element.hasUidElement()) {
31736        composeOidCore("uid", element.getUidElement(), false);
31737        composeOidExtras("uid", element.getUidElement(), false);
31738      }
31739  }
31740
31741  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
31742    if (element != null) {
31743      prop("resourceType", name);
31744      composeImagingStudyInner(element);
31745    }
31746  }
31747
31748  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
31749      composeDomainResourceElements(element);
31750      if (element.hasUidElement()) {
31751        composeOidCore("uid", element.getUidElement(), false);
31752        composeOidExtras("uid", element.getUidElement(), false);
31753      }
31754      if (element.hasAccession()) {
31755        composeIdentifier("accession", element.getAccession());
31756      }
31757      if (element.hasIdentifier()) {
31758        openArray("identifier");
31759        for (Identifier e : element.getIdentifier()) 
31760          composeIdentifier(null, e);
31761        closeArray();
31762      };
31763      if (element.hasAvailabilityElement()) {
31764        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31765        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31766      }
31767      if (element.hasModalityList()) {
31768        openArray("modalityList");
31769        for (Coding e : element.getModalityList()) 
31770          composeCoding(null, e);
31771        closeArray();
31772      };
31773      if (element.hasPatient()) {
31774        composeReference("patient", element.getPatient());
31775      }
31776      if (element.hasContext()) {
31777        composeReference("context", element.getContext());
31778      }
31779      if (element.hasStartedElement()) {
31780        composeDateTimeCore("started", element.getStartedElement(), false);
31781        composeDateTimeExtras("started", element.getStartedElement(), false);
31782      }
31783      if (element.hasBasedOn()) {
31784        openArray("basedOn");
31785        for (Reference e : element.getBasedOn()) 
31786          composeReference(null, e);
31787        closeArray();
31788      };
31789      if (element.hasReferrer()) {
31790        composeReference("referrer", element.getReferrer());
31791      }
31792      if (element.hasInterpreter()) {
31793        openArray("interpreter");
31794        for (Reference e : element.getInterpreter()) 
31795          composeReference(null, e);
31796        closeArray();
31797      };
31798      if (element.hasEndpoint()) {
31799        openArray("endpoint");
31800        for (Reference e : element.getEndpoint()) 
31801          composeReference(null, e);
31802        closeArray();
31803      };
31804      if (element.hasNumberOfSeriesElement()) {
31805        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
31806        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
31807      }
31808      if (element.hasNumberOfInstancesElement()) {
31809        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
31810        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
31811      }
31812      if (element.hasProcedureReference()) {
31813        openArray("procedureReference");
31814        for (Reference e : element.getProcedureReference()) 
31815          composeReference(null, e);
31816        closeArray();
31817      };
31818      if (element.hasProcedureCode()) {
31819        openArray("procedureCode");
31820        for (CodeableConcept e : element.getProcedureCode()) 
31821          composeCodeableConcept(null, e);
31822        closeArray();
31823      };
31824      if (element.hasReason()) {
31825        composeCodeableConcept("reason", element.getReason());
31826      }
31827      if (element.hasDescriptionElement()) {
31828        composeStringCore("description", element.getDescriptionElement(), false);
31829        composeStringExtras("description", element.getDescriptionElement(), false);
31830      }
31831      if (element.hasSeries()) {
31832        openArray("series");
31833        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
31834          composeImagingStudyImagingStudySeriesComponent(null, e);
31835        closeArray();
31836      };
31837  }
31838
31839  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
31840    if (element != null) {
31841      open(name);
31842      composeImagingStudyImagingStudySeriesComponentInner(element);
31843      close();
31844    }
31845  }
31846
31847  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
31848      composeBackbone(element);
31849      if (element.hasUidElement()) {
31850        composeOidCore("uid", element.getUidElement(), false);
31851        composeOidExtras("uid", element.getUidElement(), false);
31852      }
31853      if (element.hasNumberElement()) {
31854        composeUnsignedIntCore("number", element.getNumberElement(), false);
31855        composeUnsignedIntExtras("number", element.getNumberElement(), false);
31856      }
31857      if (element.hasModality()) {
31858        composeCoding("modality", element.getModality());
31859      }
31860      if (element.hasDescriptionElement()) {
31861        composeStringCore("description", element.getDescriptionElement(), false);
31862        composeStringExtras("description", element.getDescriptionElement(), false);
31863      }
31864      if (element.hasNumberOfInstancesElement()) {
31865        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
31866        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
31867      }
31868      if (element.hasAvailabilityElement()) {
31869        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31870        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31871      }
31872      if (element.hasEndpoint()) {
31873        openArray("endpoint");
31874        for (Reference e : element.getEndpoint()) 
31875          composeReference(null, e);
31876        closeArray();
31877      };
31878      if (element.hasBodySite()) {
31879        composeCoding("bodySite", element.getBodySite());
31880      }
31881      if (element.hasLaterality()) {
31882        composeCoding("laterality", element.getLaterality());
31883      }
31884      if (element.hasStartedElement()) {
31885        composeDateTimeCore("started", element.getStartedElement(), false);
31886        composeDateTimeExtras("started", element.getStartedElement(), false);
31887      }
31888      if (element.hasPerformer()) {
31889        openArray("performer");
31890        for (Reference e : element.getPerformer()) 
31891          composeReference(null, e);
31892        closeArray();
31893      };
31894      if (element.hasInstance()) {
31895        openArray("instance");
31896        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
31897          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
31898        closeArray();
31899      };
31900  }
31901
31902  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
31903    if (element != null) {
31904      open(name);
31905      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
31906      close();
31907    }
31908  }
31909
31910  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
31911      composeBackbone(element);
31912      if (element.hasUidElement()) {
31913        composeOidCore("uid", element.getUidElement(), false);
31914        composeOidExtras("uid", element.getUidElement(), false);
31915      }
31916      if (element.hasNumberElement()) {
31917        composeUnsignedIntCore("number", element.getNumberElement(), false);
31918        composeUnsignedIntExtras("number", element.getNumberElement(), false);
31919      }
31920      if (element.hasSopClassElement()) {
31921        composeOidCore("sopClass", element.getSopClassElement(), false);
31922        composeOidExtras("sopClass", element.getSopClassElement(), false);
31923      }
31924      if (element.hasTitleElement()) {
31925        composeStringCore("title", element.getTitleElement(), false);
31926        composeStringExtras("title", element.getTitleElement(), false);
31927      }
31928  }
31929
31930  protected void composeImmunization(String name, Immunization element) throws IOException {
31931    if (element != null) {
31932      prop("resourceType", name);
31933      composeImmunizationInner(element);
31934    }
31935  }
31936
31937  protected void composeImmunizationInner(Immunization element) throws IOException {
31938      composeDomainResourceElements(element);
31939      if (element.hasIdentifier()) {
31940        openArray("identifier");
31941        for (Identifier e : element.getIdentifier()) 
31942          composeIdentifier(null, e);
31943        closeArray();
31944      };
31945      if (element.hasStatusElement()) {
31946        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
31947        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
31948      }
31949      if (element.hasNotGivenElement()) {
31950        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
31951        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
31952      }
31953      if (element.hasVaccineCode()) {
31954        composeCodeableConcept("vaccineCode", element.getVaccineCode());
31955      }
31956      if (element.hasPatient()) {
31957        composeReference("patient", element.getPatient());
31958      }
31959      if (element.hasEncounter()) {
31960        composeReference("encounter", element.getEncounter());
31961      }
31962      if (element.hasDateElement()) {
31963        composeDateTimeCore("date", element.getDateElement(), false);
31964        composeDateTimeExtras("date", element.getDateElement(), false);
31965      }
31966      if (element.hasPrimarySourceElement()) {
31967        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
31968        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
31969      }
31970      if (element.hasReportOrigin()) {
31971        composeCodeableConcept("reportOrigin", element.getReportOrigin());
31972      }
31973      if (element.hasLocation()) {
31974        composeReference("location", element.getLocation());
31975      }
31976      if (element.hasManufacturer()) {
31977        composeReference("manufacturer", element.getManufacturer());
31978      }
31979      if (element.hasLotNumberElement()) {
31980        composeStringCore("lotNumber", element.getLotNumberElement(), false);
31981        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
31982      }
31983      if (element.hasExpirationDateElement()) {
31984        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
31985        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
31986      }
31987      if (element.hasSite()) {
31988        composeCodeableConcept("site", element.getSite());
31989      }
31990      if (element.hasRoute()) {
31991        composeCodeableConcept("route", element.getRoute());
31992      }
31993      if (element.hasDoseQuantity()) {
31994        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
31995      }
31996      if (element.hasPractitioner()) {
31997        openArray("practitioner");
31998        for (Immunization.ImmunizationPractitionerComponent e : element.getPractitioner()) 
31999          composeImmunizationImmunizationPractitionerComponent(null, e);
32000        closeArray();
32001      };
32002      if (element.hasNote()) {
32003        openArray("note");
32004        for (Annotation e : element.getNote()) 
32005          composeAnnotation(null, e);
32006        closeArray();
32007      };
32008      if (element.hasExplanation()) {
32009        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
32010      }
32011      if (element.hasReaction()) {
32012        openArray("reaction");
32013        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
32014          composeImmunizationImmunizationReactionComponent(null, e);
32015        closeArray();
32016      };
32017      if (element.hasVaccinationProtocol()) {
32018        openArray("vaccinationProtocol");
32019        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
32020          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
32021        closeArray();
32022      };
32023  }
32024
32025  protected void composeImmunizationImmunizationPractitionerComponent(String name, Immunization.ImmunizationPractitionerComponent element) throws IOException {
32026    if (element != null) {
32027      open(name);
32028      composeImmunizationImmunizationPractitionerComponentInner(element);
32029      close();
32030    }
32031  }
32032
32033  protected void composeImmunizationImmunizationPractitionerComponentInner(Immunization.ImmunizationPractitionerComponent element) throws IOException {
32034      composeBackbone(element);
32035      if (element.hasRole()) {
32036        composeCodeableConcept("role", element.getRole());
32037      }
32038      if (element.hasActor()) {
32039        composeReference("actor", element.getActor());
32040      }
32041  }
32042
32043  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
32044    if (element != null) {
32045      open(name);
32046      composeImmunizationImmunizationExplanationComponentInner(element);
32047      close();
32048    }
32049  }
32050
32051  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
32052      composeBackbone(element);
32053      if (element.hasReason()) {
32054        openArray("reason");
32055        for (CodeableConcept e : element.getReason()) 
32056          composeCodeableConcept(null, e);
32057        closeArray();
32058      };
32059      if (element.hasReasonNotGiven()) {
32060        openArray("reasonNotGiven");
32061        for (CodeableConcept e : element.getReasonNotGiven()) 
32062          composeCodeableConcept(null, e);
32063        closeArray();
32064      };
32065  }
32066
32067  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
32068    if (element != null) {
32069      open(name);
32070      composeImmunizationImmunizationReactionComponentInner(element);
32071      close();
32072    }
32073  }
32074
32075  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
32076      composeBackbone(element);
32077      if (element.hasDateElement()) {
32078        composeDateTimeCore("date", element.getDateElement(), false);
32079        composeDateTimeExtras("date", element.getDateElement(), false);
32080      }
32081      if (element.hasDetail()) {
32082        composeReference("detail", element.getDetail());
32083      }
32084      if (element.hasReportedElement()) {
32085        composeBooleanCore("reported", element.getReportedElement(), false);
32086        composeBooleanExtras("reported", element.getReportedElement(), false);
32087      }
32088  }
32089
32090  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32091    if (element != null) {
32092      open(name);
32093      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
32094      close();
32095    }
32096  }
32097
32098  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32099      composeBackbone(element);
32100      if (element.hasDoseSequenceElement()) {
32101        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32102        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32103      }
32104      if (element.hasDescriptionElement()) {
32105        composeStringCore("description", element.getDescriptionElement(), false);
32106        composeStringExtras("description", element.getDescriptionElement(), false);
32107      }
32108      if (element.hasAuthority()) {
32109        composeReference("authority", element.getAuthority());
32110      }
32111      if (element.hasSeriesElement()) {
32112        composeStringCore("series", element.getSeriesElement(), false);
32113        composeStringExtras("series", element.getSeriesElement(), false);
32114      }
32115      if (element.hasSeriesDosesElement()) {
32116        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
32117        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
32118      }
32119      if (element.hasTargetDisease()) {
32120        openArray("targetDisease");
32121        for (CodeableConcept e : element.getTargetDisease()) 
32122          composeCodeableConcept(null, e);
32123        closeArray();
32124      };
32125      if (element.hasDoseStatus()) {
32126        composeCodeableConcept("doseStatus", element.getDoseStatus());
32127      }
32128      if (element.hasDoseStatusReason()) {
32129        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
32130      }
32131  }
32132
32133  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
32134    if (element != null) {
32135      prop("resourceType", name);
32136      composeImmunizationRecommendationInner(element);
32137    }
32138  }
32139
32140  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
32141      composeDomainResourceElements(element);
32142      if (element.hasIdentifier()) {
32143        openArray("identifier");
32144        for (Identifier e : element.getIdentifier()) 
32145          composeIdentifier(null, e);
32146        closeArray();
32147      };
32148      if (element.hasPatient()) {
32149        composeReference("patient", element.getPatient());
32150      }
32151      if (element.hasRecommendation()) {
32152        openArray("recommendation");
32153        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
32154          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
32155        closeArray();
32156      };
32157  }
32158
32159  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32160    if (element != null) {
32161      open(name);
32162      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
32163      close();
32164    }
32165  }
32166
32167  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32168      composeBackbone(element);
32169      if (element.hasDateElement()) {
32170        composeDateTimeCore("date", element.getDateElement(), false);
32171        composeDateTimeExtras("date", element.getDateElement(), false);
32172      }
32173      if (element.hasVaccineCode()) {
32174        composeCodeableConcept("vaccineCode", element.getVaccineCode());
32175      }
32176      if (element.hasTargetDisease()) {
32177        composeCodeableConcept("targetDisease", element.getTargetDisease());
32178      }
32179      if (element.hasDoseNumberElement()) {
32180        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
32181        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
32182      }
32183      if (element.hasForecastStatus()) {
32184        composeCodeableConcept("forecastStatus", element.getForecastStatus());
32185      }
32186      if (element.hasDateCriterion()) {
32187        openArray("dateCriterion");
32188        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
32189          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
32190        closeArray();
32191      };
32192      if (element.hasProtocol()) {
32193        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
32194      }
32195      if (element.hasSupportingImmunization()) {
32196        openArray("supportingImmunization");
32197        for (Reference e : element.getSupportingImmunization()) 
32198          composeReference(null, e);
32199        closeArray();
32200      };
32201      if (element.hasSupportingPatientInformation()) {
32202        openArray("supportingPatientInformation");
32203        for (Reference e : element.getSupportingPatientInformation()) 
32204          composeReference(null, e);
32205        closeArray();
32206      };
32207  }
32208
32209  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32210    if (element != null) {
32211      open(name);
32212      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
32213      close();
32214    }
32215  }
32216
32217  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32218      composeBackbone(element);
32219      if (element.hasCode()) {
32220        composeCodeableConcept("code", element.getCode());
32221      }
32222      if (element.hasValueElement()) {
32223        composeDateTimeCore("value", element.getValueElement(), false);
32224        composeDateTimeExtras("value", element.getValueElement(), false);
32225      }
32226  }
32227
32228  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32229    if (element != null) {
32230      open(name);
32231      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
32232      close();
32233    }
32234  }
32235
32236  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32237      composeBackbone(element);
32238      if (element.hasDoseSequenceElement()) {
32239        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32240        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32241      }
32242      if (element.hasDescriptionElement()) {
32243        composeStringCore("description", element.getDescriptionElement(), false);
32244        composeStringExtras("description", element.getDescriptionElement(), false);
32245      }
32246      if (element.hasAuthority()) {
32247        composeReference("authority", element.getAuthority());
32248      }
32249      if (element.hasSeriesElement()) {
32250        composeStringCore("series", element.getSeriesElement(), false);
32251        composeStringExtras("series", element.getSeriesElement(), false);
32252      }
32253  }
32254
32255  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
32256    if (element != null) {
32257      prop("resourceType", name);
32258      composeImplementationGuideInner(element);
32259    }
32260  }
32261
32262  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
32263      composeDomainResourceElements(element);
32264      if (element.hasUrlElement()) {
32265        composeUriCore("url", element.getUrlElement(), false);
32266        composeUriExtras("url", element.getUrlElement(), false);
32267      }
32268      if (element.hasVersionElement()) {
32269        composeStringCore("version", element.getVersionElement(), false);
32270        composeStringExtras("version", element.getVersionElement(), false);
32271      }
32272      if (element.hasNameElement()) {
32273        composeStringCore("name", element.getNameElement(), false);
32274        composeStringExtras("name", element.getNameElement(), false);
32275      }
32276      if (element.hasStatusElement()) {
32277        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32278        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32279      }
32280      if (element.hasExperimentalElement()) {
32281        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32282        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32283      }
32284      if (element.hasDateElement()) {
32285        composeDateTimeCore("date", element.getDateElement(), false);
32286        composeDateTimeExtras("date", element.getDateElement(), false);
32287      }
32288      if (element.hasPublisherElement()) {
32289        composeStringCore("publisher", element.getPublisherElement(), false);
32290        composeStringExtras("publisher", element.getPublisherElement(), false);
32291      }
32292      if (element.hasContact()) {
32293        openArray("contact");
32294        for (ContactDetail e : element.getContact()) 
32295          composeContactDetail(null, e);
32296        closeArray();
32297      };
32298      if (element.hasDescriptionElement()) {
32299        composeMarkdownCore("description", element.getDescriptionElement(), false);
32300        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32301      }
32302      if (element.hasUseContext()) {
32303        openArray("useContext");
32304        for (UsageContext e : element.getUseContext()) 
32305          composeUsageContext(null, e);
32306        closeArray();
32307      };
32308      if (element.hasJurisdiction()) {
32309        openArray("jurisdiction");
32310        for (CodeableConcept e : element.getJurisdiction()) 
32311          composeCodeableConcept(null, e);
32312        closeArray();
32313      };
32314      if (element.hasCopyrightElement()) {
32315        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32316        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32317      }
32318      if (element.hasFhirVersionElement()) {
32319        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
32320        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
32321      }
32322      if (element.hasDependency()) {
32323        openArray("dependency");
32324        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
32325          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
32326        closeArray();
32327      };
32328      if (element.hasPackage()) {
32329        openArray("package");
32330        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
32331          composeImplementationGuideImplementationGuidePackageComponent(null, e);
32332        closeArray();
32333      };
32334      if (element.hasGlobal()) {
32335        openArray("global");
32336        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
32337          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
32338        closeArray();
32339      };
32340      if (element.hasBinary()) {
32341        openArray("binary");
32342        for (UriType e : element.getBinary()) 
32343          composeUriCore(null, e, true);
32344        closeArray();
32345        if (anyHasExtras(element.getBinary())) {
32346          openArray("_binary");
32347          for (UriType e : element.getBinary()) 
32348            composeUriExtras(null, e, true);
32349          closeArray();
32350        }
32351      };
32352      if (element.hasPage()) {
32353        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
32354      }
32355  }
32356
32357  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32358    if (element != null) {
32359      open(name);
32360      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
32361      close();
32362    }
32363  }
32364
32365  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32366      composeBackbone(element);
32367      if (element.hasTypeElement()) {
32368        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32369        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32370      }
32371      if (element.hasUriElement()) {
32372        composeUriCore("uri", element.getUriElement(), false);
32373        composeUriExtras("uri", element.getUriElement(), false);
32374      }
32375  }
32376
32377  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32378    if (element != null) {
32379      open(name);
32380      composeImplementationGuideImplementationGuidePackageComponentInner(element);
32381      close();
32382    }
32383  }
32384
32385  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32386      composeBackbone(element);
32387      if (element.hasNameElement()) {
32388        composeStringCore("name", element.getNameElement(), false);
32389        composeStringExtras("name", element.getNameElement(), false);
32390      }
32391      if (element.hasDescriptionElement()) {
32392        composeStringCore("description", element.getDescriptionElement(), false);
32393        composeStringExtras("description", element.getDescriptionElement(), false);
32394      }
32395      if (element.hasResource()) {
32396        openArray("resource");
32397        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
32398          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
32399        closeArray();
32400      };
32401  }
32402
32403  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32404    if (element != null) {
32405      open(name);
32406      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
32407      close();
32408    }
32409  }
32410
32411  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32412      composeBackbone(element);
32413      if (element.hasExampleElement()) {
32414        composeBooleanCore("example", element.getExampleElement(), false);
32415        composeBooleanExtras("example", element.getExampleElement(), false);
32416      }
32417      if (element.hasNameElement()) {
32418        composeStringCore("name", element.getNameElement(), false);
32419        composeStringExtras("name", element.getNameElement(), false);
32420      }
32421      if (element.hasDescriptionElement()) {
32422        composeStringCore("description", element.getDescriptionElement(), false);
32423        composeStringExtras("description", element.getDescriptionElement(), false);
32424      }
32425      if (element.hasAcronymElement()) {
32426        composeStringCore("acronym", element.getAcronymElement(), false);
32427        composeStringExtras("acronym", element.getAcronymElement(), false);
32428      }
32429      if (element.hasSource()) {
32430        composeType("source", element.getSource());
32431      }
32432      if (element.hasExampleFor()) {
32433        composeReference("exampleFor", element.getExampleFor());
32434      }
32435  }
32436
32437  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32438    if (element != null) {
32439      open(name);
32440      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
32441      close();
32442    }
32443  }
32444
32445  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32446      composeBackbone(element);
32447      if (element.hasTypeElement()) {
32448        composeCodeCore("type", element.getTypeElement(), false);
32449        composeCodeExtras("type", element.getTypeElement(), false);
32450      }
32451      if (element.hasProfile()) {
32452        composeReference("profile", element.getProfile());
32453      }
32454  }
32455
32456  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32457    if (element != null) {
32458      open(name);
32459      composeImplementationGuideImplementationGuidePageComponentInner(element);
32460      close();
32461    }
32462  }
32463
32464  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32465      composeBackbone(element);
32466      if (element.hasSourceElement()) {
32467        composeUriCore("source", element.getSourceElement(), false);
32468        composeUriExtras("source", element.getSourceElement(), false);
32469      }
32470      if (element.hasTitleElement()) {
32471        composeStringCore("title", element.getTitleElement(), false);
32472        composeStringExtras("title", element.getTitleElement(), false);
32473      }
32474      if (element.hasKindElement()) {
32475        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32476        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32477      }
32478      if (element.hasType()) {
32479        openArray("type");
32480        for (CodeType e : element.getType()) 
32481          composeCodeCore(null, e, true);
32482        closeArray();
32483        if (anyHasExtras(element.getType())) {
32484          openArray("_type");
32485          for (CodeType e : element.getType()) 
32486            composeCodeExtras(null, e, true);
32487          closeArray();
32488        }
32489      };
32490      if (element.hasPackage()) {
32491        openArray("package");
32492        for (StringType e : element.getPackage()) 
32493          composeStringCore(null, e, true);
32494        closeArray();
32495        if (anyHasExtras(element.getPackage())) {
32496          openArray("_package");
32497          for (StringType e : element.getPackage()) 
32498            composeStringExtras(null, e, true);
32499          closeArray();
32500        }
32501      };
32502      if (element.hasFormatElement()) {
32503        composeCodeCore("format", element.getFormatElement(), false);
32504        composeCodeExtras("format", element.getFormatElement(), false);
32505      }
32506      if (element.hasPage()) {
32507        openArray("page");
32508        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
32509          composeImplementationGuideImplementationGuidePageComponent(null, e);
32510        closeArray();
32511      };
32512  }
32513
32514  protected void composeLibrary(String name, Library element) throws IOException {
32515    if (element != null) {
32516      prop("resourceType", name);
32517      composeLibraryInner(element);
32518    }
32519  }
32520
32521  protected void composeLibraryInner(Library element) throws IOException {
32522      composeDomainResourceElements(element);
32523      if (element.hasUrlElement()) {
32524        composeUriCore("url", element.getUrlElement(), false);
32525        composeUriExtras("url", element.getUrlElement(), false);
32526      }
32527      if (element.hasIdentifier()) {
32528        openArray("identifier");
32529        for (Identifier e : element.getIdentifier()) 
32530          composeIdentifier(null, e);
32531        closeArray();
32532      };
32533      if (element.hasVersionElement()) {
32534        composeStringCore("version", element.getVersionElement(), false);
32535        composeStringExtras("version", element.getVersionElement(), false);
32536      }
32537      if (element.hasNameElement()) {
32538        composeStringCore("name", element.getNameElement(), false);
32539        composeStringExtras("name", element.getNameElement(), false);
32540      }
32541      if (element.hasTitleElement()) {
32542        composeStringCore("title", element.getTitleElement(), false);
32543        composeStringExtras("title", element.getTitleElement(), false);
32544      }
32545      if (element.hasStatusElement()) {
32546        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32547        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32548      }
32549      if (element.hasExperimentalElement()) {
32550        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32551        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32552      }
32553      if (element.hasType()) {
32554        composeCodeableConcept("type", element.getType());
32555      }
32556      if (element.hasDateElement()) {
32557        composeDateTimeCore("date", element.getDateElement(), false);
32558        composeDateTimeExtras("date", element.getDateElement(), false);
32559      }
32560      if (element.hasPublisherElement()) {
32561        composeStringCore("publisher", element.getPublisherElement(), false);
32562        composeStringExtras("publisher", element.getPublisherElement(), false);
32563      }
32564      if (element.hasDescriptionElement()) {
32565        composeMarkdownCore("description", element.getDescriptionElement(), false);
32566        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32567      }
32568      if (element.hasPurposeElement()) {
32569        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32570        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32571      }
32572      if (element.hasUsageElement()) {
32573        composeStringCore("usage", element.getUsageElement(), false);
32574        composeStringExtras("usage", element.getUsageElement(), false);
32575      }
32576      if (element.hasApprovalDateElement()) {
32577        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32578        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32579      }
32580      if (element.hasLastReviewDateElement()) {
32581        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32582        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32583      }
32584      if (element.hasEffectivePeriod()) {
32585        composePeriod("effectivePeriod", element.getEffectivePeriod());
32586      }
32587      if (element.hasUseContext()) {
32588        openArray("useContext");
32589        for (UsageContext e : element.getUseContext()) 
32590          composeUsageContext(null, e);
32591        closeArray();
32592      };
32593      if (element.hasJurisdiction()) {
32594        openArray("jurisdiction");
32595        for (CodeableConcept e : element.getJurisdiction()) 
32596          composeCodeableConcept(null, e);
32597        closeArray();
32598      };
32599      if (element.hasTopic()) {
32600        openArray("topic");
32601        for (CodeableConcept e : element.getTopic()) 
32602          composeCodeableConcept(null, e);
32603        closeArray();
32604      };
32605      if (element.hasContributor()) {
32606        openArray("contributor");
32607        for (Contributor e : element.getContributor()) 
32608          composeContributor(null, e);
32609        closeArray();
32610      };
32611      if (element.hasContact()) {
32612        openArray("contact");
32613        for (ContactDetail e : element.getContact()) 
32614          composeContactDetail(null, e);
32615        closeArray();
32616      };
32617      if (element.hasCopyrightElement()) {
32618        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32619        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32620      }
32621      if (element.hasRelatedArtifact()) {
32622        openArray("relatedArtifact");
32623        for (RelatedArtifact e : element.getRelatedArtifact()) 
32624          composeRelatedArtifact(null, e);
32625        closeArray();
32626      };
32627      if (element.hasParameter()) {
32628        openArray("parameter");
32629        for (ParameterDefinition e : element.getParameter()) 
32630          composeParameterDefinition(null, e);
32631        closeArray();
32632      };
32633      if (element.hasDataRequirement()) {
32634        openArray("dataRequirement");
32635        for (DataRequirement e : element.getDataRequirement()) 
32636          composeDataRequirement(null, e);
32637        closeArray();
32638      };
32639      if (element.hasContent()) {
32640        openArray("content");
32641        for (Attachment e : element.getContent()) 
32642          composeAttachment(null, e);
32643        closeArray();
32644      };
32645  }
32646
32647  protected void composeLinkage(String name, Linkage element) throws IOException {
32648    if (element != null) {
32649      prop("resourceType", name);
32650      composeLinkageInner(element);
32651    }
32652  }
32653
32654  protected void composeLinkageInner(Linkage element) throws IOException {
32655      composeDomainResourceElements(element);
32656      if (element.hasActiveElement()) {
32657        composeBooleanCore("active", element.getActiveElement(), false);
32658        composeBooleanExtras("active", element.getActiveElement(), false);
32659      }
32660      if (element.hasAuthor()) {
32661        composeReference("author", element.getAuthor());
32662      }
32663      if (element.hasItem()) {
32664        openArray("item");
32665        for (Linkage.LinkageItemComponent e : element.getItem()) 
32666          composeLinkageLinkageItemComponent(null, e);
32667        closeArray();
32668      };
32669  }
32670
32671  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
32672    if (element != null) {
32673      open(name);
32674      composeLinkageLinkageItemComponentInner(element);
32675      close();
32676    }
32677  }
32678
32679  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
32680      composeBackbone(element);
32681      if (element.hasTypeElement()) {
32682        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
32683        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
32684      }
32685      if (element.hasResource()) {
32686        composeReference("resource", element.getResource());
32687      }
32688  }
32689
32690  protected void composeListResource(String name, ListResource element) throws IOException {
32691    if (element != null) {
32692      prop("resourceType", name);
32693      composeListResourceInner(element);
32694    }
32695  }
32696
32697  protected void composeListResourceInner(ListResource element) throws IOException {
32698      composeDomainResourceElements(element);
32699      if (element.hasIdentifier()) {
32700        openArray("identifier");
32701        for (Identifier e : element.getIdentifier()) 
32702          composeIdentifier(null, e);
32703        closeArray();
32704      };
32705      if (element.hasStatusElement()) {
32706        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
32707        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
32708      }
32709      if (element.hasModeElement()) {
32710        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
32711        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
32712      }
32713      if (element.hasTitleElement()) {
32714        composeStringCore("title", element.getTitleElement(), false);
32715        composeStringExtras("title", element.getTitleElement(), false);
32716      }
32717      if (element.hasCode()) {
32718        composeCodeableConcept("code", element.getCode());
32719      }
32720      if (element.hasSubject()) {
32721        composeReference("subject", element.getSubject());
32722      }
32723      if (element.hasEncounter()) {
32724        composeReference("encounter", element.getEncounter());
32725      }
32726      if (element.hasDateElement()) {
32727        composeDateTimeCore("date", element.getDateElement(), false);
32728        composeDateTimeExtras("date", element.getDateElement(), false);
32729      }
32730      if (element.hasSource()) {
32731        composeReference("source", element.getSource());
32732      }
32733      if (element.hasOrderedBy()) {
32734        composeCodeableConcept("orderedBy", element.getOrderedBy());
32735      }
32736      if (element.hasNote()) {
32737        openArray("note");
32738        for (Annotation e : element.getNote()) 
32739          composeAnnotation(null, e);
32740        closeArray();
32741      };
32742      if (element.hasEntry()) {
32743        openArray("entry");
32744        for (ListResource.ListEntryComponent e : element.getEntry()) 
32745          composeListResourceListEntryComponent(null, e);
32746        closeArray();
32747      };
32748      if (element.hasEmptyReason()) {
32749        composeCodeableConcept("emptyReason", element.getEmptyReason());
32750      }
32751  }
32752
32753  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
32754    if (element != null) {
32755      open(name);
32756      composeListResourceListEntryComponentInner(element);
32757      close();
32758    }
32759  }
32760
32761  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
32762      composeBackbone(element);
32763      if (element.hasFlag()) {
32764        composeCodeableConcept("flag", element.getFlag());
32765      }
32766      if (element.hasDeletedElement()) {
32767        composeBooleanCore("deleted", element.getDeletedElement(), false);
32768        composeBooleanExtras("deleted", element.getDeletedElement(), false);
32769      }
32770      if (element.hasDateElement()) {
32771        composeDateTimeCore("date", element.getDateElement(), false);
32772        composeDateTimeExtras("date", element.getDateElement(), false);
32773      }
32774      if (element.hasItem()) {
32775        composeReference("item", element.getItem());
32776      }
32777  }
32778
32779  protected void composeLocation(String name, Location element) throws IOException {
32780    if (element != null) {
32781      prop("resourceType", name);
32782      composeLocationInner(element);
32783    }
32784  }
32785
32786  protected void composeLocationInner(Location element) throws IOException {
32787      composeDomainResourceElements(element);
32788      if (element.hasIdentifier()) {
32789        openArray("identifier");
32790        for (Identifier e : element.getIdentifier()) 
32791          composeIdentifier(null, e);
32792        closeArray();
32793      };
32794      if (element.hasStatusElement()) {
32795        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
32796        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
32797      }
32798      if (element.hasOperationalStatus()) {
32799        composeCoding("operationalStatus", element.getOperationalStatus());
32800      }
32801      if (element.hasNameElement()) {
32802        composeStringCore("name", element.getNameElement(), false);
32803        composeStringExtras("name", element.getNameElement(), false);
32804      }
32805      if (element.hasAlias()) {
32806        openArray("alias");
32807        for (StringType e : element.getAlias()) 
32808          composeStringCore(null, e, true);
32809        closeArray();
32810        if (anyHasExtras(element.getAlias())) {
32811          openArray("_alias");
32812          for (StringType e : element.getAlias()) 
32813            composeStringExtras(null, e, true);
32814          closeArray();
32815        }
32816      };
32817      if (element.hasDescriptionElement()) {
32818        composeStringCore("description", element.getDescriptionElement(), false);
32819        composeStringExtras("description", element.getDescriptionElement(), false);
32820      }
32821      if (element.hasModeElement()) {
32822        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
32823        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
32824      }
32825      if (element.hasType()) {
32826        composeCodeableConcept("type", element.getType());
32827      }
32828      if (element.hasTelecom()) {
32829        openArray("telecom");
32830        for (ContactPoint e : element.getTelecom()) 
32831          composeContactPoint(null, e);
32832        closeArray();
32833      };
32834      if (element.hasAddress()) {
32835        composeAddress("address", element.getAddress());
32836      }
32837      if (element.hasPhysicalType()) {
32838        composeCodeableConcept("physicalType", element.getPhysicalType());
32839      }
32840      if (element.hasPosition()) {
32841        composeLocationLocationPositionComponent("position", element.getPosition());
32842      }
32843      if (element.hasManagingOrganization()) {
32844        composeReference("managingOrganization", element.getManagingOrganization());
32845      }
32846      if (element.hasPartOf()) {
32847        composeReference("partOf", element.getPartOf());
32848      }
32849      if (element.hasEndpoint()) {
32850        openArray("endpoint");
32851        for (Reference e : element.getEndpoint()) 
32852          composeReference(null, e);
32853        closeArray();
32854      };
32855  }
32856
32857  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
32858    if (element != null) {
32859      open(name);
32860      composeLocationLocationPositionComponentInner(element);
32861      close();
32862    }
32863  }
32864
32865  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
32866      composeBackbone(element);
32867      if (element.hasLongitudeElement()) {
32868        composeDecimalCore("longitude", element.getLongitudeElement(), false);
32869        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
32870      }
32871      if (element.hasLatitudeElement()) {
32872        composeDecimalCore("latitude", element.getLatitudeElement(), false);
32873        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
32874      }
32875      if (element.hasAltitudeElement()) {
32876        composeDecimalCore("altitude", element.getAltitudeElement(), false);
32877        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
32878      }
32879  }
32880
32881  protected void composeMeasure(String name, Measure element) throws IOException {
32882    if (element != null) {
32883      prop("resourceType", name);
32884      composeMeasureInner(element);
32885    }
32886  }
32887
32888  protected void composeMeasureInner(Measure element) throws IOException {
32889      composeDomainResourceElements(element);
32890      if (element.hasUrlElement()) {
32891        composeUriCore("url", element.getUrlElement(), false);
32892        composeUriExtras("url", element.getUrlElement(), false);
32893      }
32894      if (element.hasIdentifier()) {
32895        openArray("identifier");
32896        for (Identifier e : element.getIdentifier()) 
32897          composeIdentifier(null, e);
32898        closeArray();
32899      };
32900      if (element.hasVersionElement()) {
32901        composeStringCore("version", element.getVersionElement(), false);
32902        composeStringExtras("version", element.getVersionElement(), false);
32903      }
32904      if (element.hasNameElement()) {
32905        composeStringCore("name", element.getNameElement(), false);
32906        composeStringExtras("name", element.getNameElement(), false);
32907      }
32908      if (element.hasTitleElement()) {
32909        composeStringCore("title", element.getTitleElement(), false);
32910        composeStringExtras("title", element.getTitleElement(), false);
32911      }
32912      if (element.hasStatusElement()) {
32913        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32914        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32915      }
32916      if (element.hasExperimentalElement()) {
32917        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32918        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32919      }
32920      if (element.hasDateElement()) {
32921        composeDateTimeCore("date", element.getDateElement(), false);
32922        composeDateTimeExtras("date", element.getDateElement(), false);
32923      }
32924      if (element.hasPublisherElement()) {
32925        composeStringCore("publisher", element.getPublisherElement(), false);
32926        composeStringExtras("publisher", element.getPublisherElement(), false);
32927      }
32928      if (element.hasDescriptionElement()) {
32929        composeMarkdownCore("description", element.getDescriptionElement(), false);
32930        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32931      }
32932      if (element.hasPurposeElement()) {
32933        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32934        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32935      }
32936      if (element.hasUsageElement()) {
32937        composeStringCore("usage", element.getUsageElement(), false);
32938        composeStringExtras("usage", element.getUsageElement(), false);
32939      }
32940      if (element.hasApprovalDateElement()) {
32941        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32942        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32943      }
32944      if (element.hasLastReviewDateElement()) {
32945        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32946        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32947      }
32948      if (element.hasEffectivePeriod()) {
32949        composePeriod("effectivePeriod", element.getEffectivePeriod());
32950      }
32951      if (element.hasUseContext()) {
32952        openArray("useContext");
32953        for (UsageContext e : element.getUseContext()) 
32954          composeUsageContext(null, e);
32955        closeArray();
32956      };
32957      if (element.hasJurisdiction()) {
32958        openArray("jurisdiction");
32959        for (CodeableConcept e : element.getJurisdiction()) 
32960          composeCodeableConcept(null, e);
32961        closeArray();
32962      };
32963      if (element.hasTopic()) {
32964        openArray("topic");
32965        for (CodeableConcept e : element.getTopic()) 
32966          composeCodeableConcept(null, e);
32967        closeArray();
32968      };
32969      if (element.hasContributor()) {
32970        openArray("contributor");
32971        for (Contributor e : element.getContributor()) 
32972          composeContributor(null, e);
32973        closeArray();
32974      };
32975      if (element.hasContact()) {
32976        openArray("contact");
32977        for (ContactDetail e : element.getContact()) 
32978          composeContactDetail(null, e);
32979        closeArray();
32980      };
32981      if (element.hasCopyrightElement()) {
32982        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32983        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32984      }
32985      if (element.hasRelatedArtifact()) {
32986        openArray("relatedArtifact");
32987        for (RelatedArtifact e : element.getRelatedArtifact()) 
32988          composeRelatedArtifact(null, e);
32989        closeArray();
32990      };
32991      if (element.hasLibrary()) {
32992        openArray("library");
32993        for (Reference e : element.getLibrary()) 
32994          composeReference(null, e);
32995        closeArray();
32996      };
32997      if (element.hasDisclaimerElement()) {
32998        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
32999        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
33000      }
33001      if (element.hasScoring()) {
33002        composeCodeableConcept("scoring", element.getScoring());
33003      }
33004      if (element.hasCompositeScoring()) {
33005        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
33006      }
33007      if (element.hasType()) {
33008        openArray("type");
33009        for (CodeableConcept e : element.getType()) 
33010          composeCodeableConcept(null, e);
33011        closeArray();
33012      };
33013      if (element.hasRiskAdjustmentElement()) {
33014        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
33015        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
33016      }
33017      if (element.hasRateAggregationElement()) {
33018        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
33019        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
33020      }
33021      if (element.hasRationaleElement()) {
33022        composeMarkdownCore("rationale", element.getRationaleElement(), false);
33023        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
33024      }
33025      if (element.hasClinicalRecommendationStatementElement()) {
33026        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33027        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33028      }
33029      if (element.hasImprovementNotationElement()) {
33030        composeStringCore("improvementNotation", element.getImprovementNotationElement(), false);
33031        composeStringExtras("improvementNotation", element.getImprovementNotationElement(), false);
33032      }
33033      if (element.hasDefinition()) {
33034        openArray("definition");
33035        for (MarkdownType e : element.getDefinition()) 
33036          composeMarkdownCore(null, e, true);
33037        closeArray();
33038        if (anyHasExtras(element.getDefinition())) {
33039          openArray("_definition");
33040          for (MarkdownType e : element.getDefinition()) 
33041            composeMarkdownExtras(null, e, true);
33042          closeArray();
33043        }
33044      };
33045      if (element.hasGuidanceElement()) {
33046        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
33047        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
33048      }
33049      if (element.hasSetElement()) {
33050        composeStringCore("set", element.getSetElement(), false);
33051        composeStringExtras("set", element.getSetElement(), false);
33052      }
33053      if (element.hasGroup()) {
33054        openArray("group");
33055        for (Measure.MeasureGroupComponent e : element.getGroup()) 
33056          composeMeasureMeasureGroupComponent(null, e);
33057        closeArray();
33058      };
33059      if (element.hasSupplementalData()) {
33060        openArray("supplementalData");
33061        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
33062          composeMeasureMeasureSupplementalDataComponent(null, e);
33063        closeArray();
33064      };
33065  }
33066
33067  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
33068    if (element != null) {
33069      open(name);
33070      composeMeasureMeasureGroupComponentInner(element);
33071      close();
33072    }
33073  }
33074
33075  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
33076      composeBackbone(element);
33077      if (element.hasIdentifier()) {
33078        composeIdentifier("identifier", element.getIdentifier());
33079      }
33080      if (element.hasNameElement()) {
33081        composeStringCore("name", element.getNameElement(), false);
33082        composeStringExtras("name", element.getNameElement(), false);
33083      }
33084      if (element.hasDescriptionElement()) {
33085        composeStringCore("description", element.getDescriptionElement(), false);
33086        composeStringExtras("description", element.getDescriptionElement(), false);
33087      }
33088      if (element.hasPopulation()) {
33089        openArray("population");
33090        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
33091          composeMeasureMeasureGroupPopulationComponent(null, e);
33092        closeArray();
33093      };
33094      if (element.hasStratifier()) {
33095        openArray("stratifier");
33096        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
33097          composeMeasureMeasureGroupStratifierComponent(null, e);
33098        closeArray();
33099      };
33100  }
33101
33102  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
33103    if (element != null) {
33104      open(name);
33105      composeMeasureMeasureGroupPopulationComponentInner(element);
33106      close();
33107    }
33108  }
33109
33110  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
33111      composeBackbone(element);
33112      if (element.hasIdentifier()) {
33113        composeIdentifier("identifier", element.getIdentifier());
33114      }
33115      if (element.hasCode()) {
33116        composeCodeableConcept("code", element.getCode());
33117      }
33118      if (element.hasNameElement()) {
33119        composeStringCore("name", element.getNameElement(), false);
33120        composeStringExtras("name", element.getNameElement(), false);
33121      }
33122      if (element.hasDescriptionElement()) {
33123        composeStringCore("description", element.getDescriptionElement(), false);
33124        composeStringExtras("description", element.getDescriptionElement(), false);
33125      }
33126      if (element.hasCriteriaElement()) {
33127        composeStringCore("criteria", element.getCriteriaElement(), false);
33128        composeStringExtras("criteria", element.getCriteriaElement(), false);
33129      }
33130  }
33131
33132  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
33133    if (element != null) {
33134      open(name);
33135      composeMeasureMeasureGroupStratifierComponentInner(element);
33136      close();
33137    }
33138  }
33139
33140  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
33141      composeBackbone(element);
33142      if (element.hasIdentifier()) {
33143        composeIdentifier("identifier", element.getIdentifier());
33144      }
33145      if (element.hasCriteriaElement()) {
33146        composeStringCore("criteria", element.getCriteriaElement(), false);
33147        composeStringExtras("criteria", element.getCriteriaElement(), false);
33148      }
33149      if (element.hasPathElement()) {
33150        composeStringCore("path", element.getPathElement(), false);
33151        composeStringExtras("path", element.getPathElement(), false);
33152      }
33153  }
33154
33155  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
33156    if (element != null) {
33157      open(name);
33158      composeMeasureMeasureSupplementalDataComponentInner(element);
33159      close();
33160    }
33161  }
33162
33163  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
33164      composeBackbone(element);
33165      if (element.hasIdentifier()) {
33166        composeIdentifier("identifier", element.getIdentifier());
33167      }
33168      if (element.hasUsage()) {
33169        openArray("usage");
33170        for (CodeableConcept e : element.getUsage()) 
33171          composeCodeableConcept(null, e);
33172        closeArray();
33173      };
33174      if (element.hasCriteriaElement()) {
33175        composeStringCore("criteria", element.getCriteriaElement(), false);
33176        composeStringExtras("criteria", element.getCriteriaElement(), false);
33177      }
33178      if (element.hasPathElement()) {
33179        composeStringCore("path", element.getPathElement(), false);
33180        composeStringExtras("path", element.getPathElement(), false);
33181      }
33182  }
33183
33184  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
33185    if (element != null) {
33186      prop("resourceType", name);
33187      composeMeasureReportInner(element);
33188    }
33189  }
33190
33191  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
33192      composeDomainResourceElements(element);
33193      if (element.hasIdentifier()) {
33194        composeIdentifier("identifier", element.getIdentifier());
33195      }
33196      if (element.hasStatusElement()) {
33197        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33198        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33199      }
33200      if (element.hasTypeElement()) {
33201        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33202        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33203      }
33204      if (element.hasMeasure()) {
33205        composeReference("measure", element.getMeasure());
33206      }
33207      if (element.hasPatient()) {
33208        composeReference("patient", element.getPatient());
33209      }
33210      if (element.hasDateElement()) {
33211        composeDateTimeCore("date", element.getDateElement(), false);
33212        composeDateTimeExtras("date", element.getDateElement(), false);
33213      }
33214      if (element.hasReportingOrganization()) {
33215        composeReference("reportingOrganization", element.getReportingOrganization());
33216      }
33217      if (element.hasPeriod()) {
33218        composePeriod("period", element.getPeriod());
33219      }
33220      if (element.hasGroup()) {
33221        openArray("group");
33222        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
33223          composeMeasureReportMeasureReportGroupComponent(null, e);
33224        closeArray();
33225      };
33226      if (element.hasEvaluatedResources()) {
33227        composeReference("evaluatedResources", element.getEvaluatedResources());
33228      }
33229  }
33230
33231  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
33232    if (element != null) {
33233      open(name);
33234      composeMeasureReportMeasureReportGroupComponentInner(element);
33235      close();
33236    }
33237  }
33238
33239  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
33240      composeBackbone(element);
33241      if (element.hasIdentifier()) {
33242        composeIdentifier("identifier", element.getIdentifier());
33243      }
33244      if (element.hasPopulation()) {
33245        openArray("population");
33246        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
33247          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
33248        closeArray();
33249      };
33250      if (element.hasMeasureScoreElement()) {
33251        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33252        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33253      }
33254      if (element.hasStratifier()) {
33255        openArray("stratifier");
33256        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
33257          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
33258        closeArray();
33259      };
33260  }
33261
33262  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33263    if (element != null) {
33264      open(name);
33265      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
33266      close();
33267    }
33268  }
33269
33270  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33271      composeBackbone(element);
33272      if (element.hasIdentifier()) {
33273        composeIdentifier("identifier", element.getIdentifier());
33274      }
33275      if (element.hasCode()) {
33276        composeCodeableConcept("code", element.getCode());
33277      }
33278      if (element.hasCountElement()) {
33279        composeIntegerCore("count", element.getCountElement(), false);
33280        composeIntegerExtras("count", element.getCountElement(), false);
33281      }
33282      if (element.hasPatients()) {
33283        composeReference("patients", element.getPatients());
33284      }
33285  }
33286
33287  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33288    if (element != null) {
33289      open(name);
33290      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
33291      close();
33292    }
33293  }
33294
33295  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33296      composeBackbone(element);
33297      if (element.hasIdentifier()) {
33298        composeIdentifier("identifier", element.getIdentifier());
33299      }
33300      if (element.hasStratum()) {
33301        openArray("stratum");
33302        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
33303          composeMeasureReportStratifierGroupComponent(null, e);
33304        closeArray();
33305      };
33306  }
33307
33308  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
33309    if (element != null) {
33310      open(name);
33311      composeMeasureReportStratifierGroupComponentInner(element);
33312      close();
33313    }
33314  }
33315
33316  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
33317      composeBackbone(element);
33318      if (element.hasValueElement()) {
33319        composeStringCore("value", element.getValueElement(), false);
33320        composeStringExtras("value", element.getValueElement(), false);
33321      }
33322      if (element.hasPopulation()) {
33323        openArray("population");
33324        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
33325          composeMeasureReportStratifierGroupPopulationComponent(null, e);
33326        closeArray();
33327      };
33328      if (element.hasMeasureScoreElement()) {
33329        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33330        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33331      }
33332  }
33333
33334  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33335    if (element != null) {
33336      open(name);
33337      composeMeasureReportStratifierGroupPopulationComponentInner(element);
33338      close();
33339    }
33340  }
33341
33342  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33343      composeBackbone(element);
33344      if (element.hasIdentifier()) {
33345        composeIdentifier("identifier", element.getIdentifier());
33346      }
33347      if (element.hasCode()) {
33348        composeCodeableConcept("code", element.getCode());
33349      }
33350      if (element.hasCountElement()) {
33351        composeIntegerCore("count", element.getCountElement(), false);
33352        composeIntegerExtras("count", element.getCountElement(), false);
33353      }
33354      if (element.hasPatients()) {
33355        composeReference("patients", element.getPatients());
33356      }
33357  }
33358
33359  protected void composeMedia(String name, Media element) throws IOException {
33360    if (element != null) {
33361      prop("resourceType", name);
33362      composeMediaInner(element);
33363    }
33364  }
33365
33366  protected void composeMediaInner(Media element) throws IOException {
33367      composeDomainResourceElements(element);
33368      if (element.hasIdentifier()) {
33369        openArray("identifier");
33370        for (Identifier e : element.getIdentifier()) 
33371          composeIdentifier(null, e);
33372        closeArray();
33373      };
33374      if (element.hasBasedOn()) {
33375        openArray("basedOn");
33376        for (Reference e : element.getBasedOn()) 
33377          composeReference(null, e);
33378        closeArray();
33379      };
33380      if (element.hasTypeElement()) {
33381        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33382        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33383      }
33384      if (element.hasSubtype()) {
33385        composeCodeableConcept("subtype", element.getSubtype());
33386      }
33387      if (element.hasView()) {
33388        composeCodeableConcept("view", element.getView());
33389      }
33390      if (element.hasSubject()) {
33391        composeReference("subject", element.getSubject());
33392      }
33393      if (element.hasContext()) {
33394        composeReference("context", element.getContext());
33395      }
33396      if (element.hasOccurrence()) {
33397        composeType("occurrence", element.getOccurrence());
33398      }
33399      if (element.hasOperator()) {
33400        composeReference("operator", element.getOperator());
33401      }
33402      if (element.hasReasonCode()) {
33403        openArray("reasonCode");
33404        for (CodeableConcept e : element.getReasonCode()) 
33405          composeCodeableConcept(null, e);
33406        closeArray();
33407      };
33408      if (element.hasBodySite()) {
33409        composeCodeableConcept("bodySite", element.getBodySite());
33410      }
33411      if (element.hasDevice()) {
33412        composeReference("device", element.getDevice());
33413      }
33414      if (element.hasHeightElement()) {
33415        composePositiveIntCore("height", element.getHeightElement(), false);
33416        composePositiveIntExtras("height", element.getHeightElement(), false);
33417      }
33418      if (element.hasWidthElement()) {
33419        composePositiveIntCore("width", element.getWidthElement(), false);
33420        composePositiveIntExtras("width", element.getWidthElement(), false);
33421      }
33422      if (element.hasFramesElement()) {
33423        composePositiveIntCore("frames", element.getFramesElement(), false);
33424        composePositiveIntExtras("frames", element.getFramesElement(), false);
33425      }
33426      if (element.hasDurationElement()) {
33427        composeUnsignedIntCore("duration", element.getDurationElement(), false);
33428        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
33429      }
33430      if (element.hasContent()) {
33431        composeAttachment("content", element.getContent());
33432      }
33433      if (element.hasNote()) {
33434        openArray("note");
33435        for (Annotation e : element.getNote()) 
33436          composeAnnotation(null, e);
33437        closeArray();
33438      };
33439  }
33440
33441  protected void composeMedication(String name, Medication element) throws IOException {
33442    if (element != null) {
33443      prop("resourceType", name);
33444      composeMedicationInner(element);
33445    }
33446  }
33447
33448  protected void composeMedicationInner(Medication element) throws IOException {
33449      composeDomainResourceElements(element);
33450      if (element.hasCode()) {
33451        composeCodeableConcept("code", element.getCode());
33452      }
33453      if (element.hasStatusElement()) {
33454        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33455        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33456      }
33457      if (element.hasIsBrandElement()) {
33458        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
33459        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
33460      }
33461      if (element.hasIsOverTheCounterElement()) {
33462        composeBooleanCore("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33463        composeBooleanExtras("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33464      }
33465      if (element.hasManufacturer()) {
33466        composeReference("manufacturer", element.getManufacturer());
33467      }
33468      if (element.hasForm()) {
33469        composeCodeableConcept("form", element.getForm());
33470      }
33471      if (element.hasIngredient()) {
33472        openArray("ingredient");
33473        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
33474          composeMedicationMedicationIngredientComponent(null, e);
33475        closeArray();
33476      };
33477      if (element.hasPackage()) {
33478        composeMedicationMedicationPackageComponent("package", element.getPackage());
33479      }
33480      if (element.hasImage()) {
33481        openArray("image");
33482        for (Attachment e : element.getImage()) 
33483          composeAttachment(null, e);
33484        closeArray();
33485      };
33486  }
33487
33488  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
33489    if (element != null) {
33490      open(name);
33491      composeMedicationMedicationIngredientComponentInner(element);
33492      close();
33493    }
33494  }
33495
33496  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
33497      composeBackbone(element);
33498      if (element.hasItem()) {
33499        composeType("item", element.getItem());
33500      }
33501      if (element.hasIsActiveElement()) {
33502        composeBooleanCore("isActive", element.getIsActiveElement(), false);
33503        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
33504      }
33505      if (element.hasAmount()) {
33506        composeRatio("amount", element.getAmount());
33507      }
33508  }
33509
33510  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
33511    if (element != null) {
33512      open(name);
33513      composeMedicationMedicationPackageComponentInner(element);
33514      close();
33515    }
33516  }
33517
33518  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
33519      composeBackbone(element);
33520      if (element.hasContainer()) {
33521        composeCodeableConcept("container", element.getContainer());
33522      }
33523      if (element.hasContent()) {
33524        openArray("content");
33525        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
33526          composeMedicationMedicationPackageContentComponent(null, e);
33527        closeArray();
33528      };
33529      if (element.hasBatch()) {
33530        openArray("batch");
33531        for (Medication.MedicationPackageBatchComponent e : element.getBatch()) 
33532          composeMedicationMedicationPackageBatchComponent(null, e);
33533        closeArray();
33534      };
33535  }
33536
33537  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
33538    if (element != null) {
33539      open(name);
33540      composeMedicationMedicationPackageContentComponentInner(element);
33541      close();
33542    }
33543  }
33544
33545  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
33546      composeBackbone(element);
33547      if (element.hasItem()) {
33548        composeType("item", element.getItem());
33549      }
33550      if (element.hasAmount()) {
33551        composeSimpleQuantity("amount", element.getAmount());
33552      }
33553  }
33554
33555  protected void composeMedicationMedicationPackageBatchComponent(String name, Medication.MedicationPackageBatchComponent element) throws IOException {
33556    if (element != null) {
33557      open(name);
33558      composeMedicationMedicationPackageBatchComponentInner(element);
33559      close();
33560    }
33561  }
33562
33563  protected void composeMedicationMedicationPackageBatchComponentInner(Medication.MedicationPackageBatchComponent element) throws IOException {
33564      composeBackbone(element);
33565      if (element.hasLotNumberElement()) {
33566        composeStringCore("lotNumber", element.getLotNumberElement(), false);
33567        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
33568      }
33569      if (element.hasExpirationDateElement()) {
33570        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
33571        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
33572      }
33573  }
33574
33575  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
33576    if (element != null) {
33577      prop("resourceType", name);
33578      composeMedicationAdministrationInner(element);
33579    }
33580  }
33581
33582  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
33583      composeDomainResourceElements(element);
33584      if (element.hasIdentifier()) {
33585        openArray("identifier");
33586        for (Identifier e : element.getIdentifier()) 
33587          composeIdentifier(null, e);
33588        closeArray();
33589      };
33590      if (element.hasDefinition()) {
33591        openArray("definition");
33592        for (Reference e : element.getDefinition()) 
33593          composeReference(null, e);
33594        closeArray();
33595      };
33596      if (element.hasPartOf()) {
33597        openArray("partOf");
33598        for (Reference e : element.getPartOf()) 
33599          composeReference(null, e);
33600        closeArray();
33601      };
33602      if (element.hasStatusElement()) {
33603        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33604        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33605      }
33606      if (element.hasCategory()) {
33607        composeCodeableConcept("category", element.getCategory());
33608      }
33609      if (element.hasMedication()) {
33610        composeType("medication", element.getMedication());
33611      }
33612      if (element.hasSubject()) {
33613        composeReference("subject", element.getSubject());
33614      }
33615      if (element.hasContext()) {
33616        composeReference("context", element.getContext());
33617      }
33618      if (element.hasSupportingInformation()) {
33619        openArray("supportingInformation");
33620        for (Reference e : element.getSupportingInformation()) 
33621          composeReference(null, e);
33622        closeArray();
33623      };
33624      if (element.hasEffective()) {
33625        composeType("effective", element.getEffective());
33626      }
33627      if (element.hasPerformer()) {
33628        openArray("performer");
33629        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
33630          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
33631        closeArray();
33632      };
33633      if (element.hasNotGivenElement()) {
33634        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
33635        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
33636      }
33637      if (element.hasReasonNotGiven()) {
33638        openArray("reasonNotGiven");
33639        for (CodeableConcept e : element.getReasonNotGiven()) 
33640          composeCodeableConcept(null, e);
33641        closeArray();
33642      };
33643      if (element.hasReasonCode()) {
33644        openArray("reasonCode");
33645        for (CodeableConcept e : element.getReasonCode()) 
33646          composeCodeableConcept(null, e);
33647        closeArray();
33648      };
33649      if (element.hasReasonReference()) {
33650        openArray("reasonReference");
33651        for (Reference e : element.getReasonReference()) 
33652          composeReference(null, e);
33653        closeArray();
33654      };
33655      if (element.hasPrescription()) {
33656        composeReference("prescription", element.getPrescription());
33657      }
33658      if (element.hasDevice()) {
33659        openArray("device");
33660        for (Reference e : element.getDevice()) 
33661          composeReference(null, e);
33662        closeArray();
33663      };
33664      if (element.hasNote()) {
33665        openArray("note");
33666        for (Annotation e : element.getNote()) 
33667          composeAnnotation(null, e);
33668        closeArray();
33669      };
33670      if (element.hasDosage()) {
33671        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
33672      }
33673      if (element.hasEventHistory()) {
33674        openArray("eventHistory");
33675        for (Reference e : element.getEventHistory()) 
33676          composeReference(null, e);
33677        closeArray();
33678      };
33679  }
33680
33681  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
33682    if (element != null) {
33683      open(name);
33684      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
33685      close();
33686    }
33687  }
33688
33689  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
33690      composeBackbone(element);
33691      if (element.hasActor()) {
33692        composeReference("actor", element.getActor());
33693      }
33694      if (element.hasOnBehalfOf()) {
33695        composeReference("onBehalfOf", element.getOnBehalfOf());
33696      }
33697  }
33698
33699  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
33700    if (element != null) {
33701      open(name);
33702      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
33703      close();
33704    }
33705  }
33706
33707  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
33708      composeBackbone(element);
33709      if (element.hasTextElement()) {
33710        composeStringCore("text", element.getTextElement(), false);
33711        composeStringExtras("text", element.getTextElement(), false);
33712      }
33713      if (element.hasSite()) {
33714        composeCodeableConcept("site", element.getSite());
33715      }
33716      if (element.hasRoute()) {
33717        composeCodeableConcept("route", element.getRoute());
33718      }
33719      if (element.hasMethod()) {
33720        composeCodeableConcept("method", element.getMethod());
33721      }
33722      if (element.hasDose()) {
33723        composeSimpleQuantity("dose", element.getDose());
33724      }
33725      if (element.hasRate()) {
33726        composeType("rate", element.getRate());
33727      }
33728  }
33729
33730  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
33731    if (element != null) {
33732      prop("resourceType", name);
33733      composeMedicationDispenseInner(element);
33734    }
33735  }
33736
33737  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
33738      composeDomainResourceElements(element);
33739      if (element.hasIdentifier()) {
33740        openArray("identifier");
33741        for (Identifier e : element.getIdentifier()) 
33742          composeIdentifier(null, e);
33743        closeArray();
33744      };
33745      if (element.hasPartOf()) {
33746        openArray("partOf");
33747        for (Reference e : element.getPartOf()) 
33748          composeReference(null, e);
33749        closeArray();
33750      };
33751      if (element.hasStatusElement()) {
33752        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
33753        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
33754      }
33755      if (element.hasCategory()) {
33756        composeCodeableConcept("category", element.getCategory());
33757      }
33758      if (element.hasMedication()) {
33759        composeType("medication", element.getMedication());
33760      }
33761      if (element.hasSubject()) {
33762        composeReference("subject", element.getSubject());
33763      }
33764      if (element.hasContext()) {
33765        composeReference("context", element.getContext());
33766      }
33767      if (element.hasSupportingInformation()) {
33768        openArray("supportingInformation");
33769        for (Reference e : element.getSupportingInformation()) 
33770          composeReference(null, e);
33771        closeArray();
33772      };
33773      if (element.hasPerformer()) {
33774        openArray("performer");
33775        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
33776          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
33777        closeArray();
33778      };
33779      if (element.hasAuthorizingPrescription()) {
33780        openArray("authorizingPrescription");
33781        for (Reference e : element.getAuthorizingPrescription()) 
33782          composeReference(null, e);
33783        closeArray();
33784      };
33785      if (element.hasType()) {
33786        composeCodeableConcept("type", element.getType());
33787      }
33788      if (element.hasQuantity()) {
33789        composeSimpleQuantity("quantity", element.getQuantity());
33790      }
33791      if (element.hasDaysSupply()) {
33792        composeSimpleQuantity("daysSupply", element.getDaysSupply());
33793      }
33794      if (element.hasWhenPreparedElement()) {
33795        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
33796        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
33797      }
33798      if (element.hasWhenHandedOverElement()) {
33799        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
33800        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
33801      }
33802      if (element.hasDestination()) {
33803        composeReference("destination", element.getDestination());
33804      }
33805      if (element.hasReceiver()) {
33806        openArray("receiver");
33807        for (Reference e : element.getReceiver()) 
33808          composeReference(null, e);
33809        closeArray();
33810      };
33811      if (element.hasNote()) {
33812        openArray("note");
33813        for (Annotation e : element.getNote()) 
33814          composeAnnotation(null, e);
33815        closeArray();
33816      };
33817      if (element.hasDosageInstruction()) {
33818        openArray("dosageInstruction");
33819        for (Dosage e : element.getDosageInstruction()) 
33820          composeDosage(null, e);
33821        closeArray();
33822      };
33823      if (element.hasSubstitution()) {
33824        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
33825      }
33826      if (element.hasDetectedIssue()) {
33827        openArray("detectedIssue");
33828        for (Reference e : element.getDetectedIssue()) 
33829          composeReference(null, e);
33830        closeArray();
33831      };
33832      if (element.hasNotDoneElement()) {
33833        composeBooleanCore("notDone", element.getNotDoneElement(), false);
33834        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
33835      }
33836      if (element.hasNotDoneReason()) {
33837        composeType("notDoneReason", element.getNotDoneReason());
33838      }
33839      if (element.hasEventHistory()) {
33840        openArray("eventHistory");
33841        for (Reference e : element.getEventHistory()) 
33842          composeReference(null, e);
33843        closeArray();
33844      };
33845  }
33846
33847  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
33848    if (element != null) {
33849      open(name);
33850      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
33851      close();
33852    }
33853  }
33854
33855  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
33856      composeBackbone(element);
33857      if (element.hasActor()) {
33858        composeReference("actor", element.getActor());
33859      }
33860      if (element.hasOnBehalfOf()) {
33861        composeReference("onBehalfOf", element.getOnBehalfOf());
33862      }
33863  }
33864
33865  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
33866    if (element != null) {
33867      open(name);
33868      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
33869      close();
33870    }
33871  }
33872
33873  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
33874      composeBackbone(element);
33875      if (element.hasWasSubstitutedElement()) {
33876        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
33877        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
33878      }
33879      if (element.hasType()) {
33880        composeCodeableConcept("type", element.getType());
33881      }
33882      if (element.hasReason()) {
33883        openArray("reason");
33884        for (CodeableConcept e : element.getReason()) 
33885          composeCodeableConcept(null, e);
33886        closeArray();
33887      };
33888      if (element.hasResponsibleParty()) {
33889        openArray("responsibleParty");
33890        for (Reference e : element.getResponsibleParty()) 
33891          composeReference(null, e);
33892        closeArray();
33893      };
33894  }
33895
33896  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
33897    if (element != null) {
33898      prop("resourceType", name);
33899      composeMedicationRequestInner(element);
33900    }
33901  }
33902
33903  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
33904      composeDomainResourceElements(element);
33905      if (element.hasIdentifier()) {
33906        openArray("identifier");
33907        for (Identifier e : element.getIdentifier()) 
33908          composeIdentifier(null, e);
33909        closeArray();
33910      };
33911      if (element.hasDefinition()) {
33912        openArray("definition");
33913        for (Reference e : element.getDefinition()) 
33914          composeReference(null, e);
33915        closeArray();
33916      };
33917      if (element.hasBasedOn()) {
33918        openArray("basedOn");
33919        for (Reference e : element.getBasedOn()) 
33920          composeReference(null, e);
33921        closeArray();
33922      };
33923      if (element.hasGroupIdentifier()) {
33924        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
33925      }
33926      if (element.hasStatusElement()) {
33927        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
33928        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
33929      }
33930      if (element.hasIntentElement()) {
33931        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
33932        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
33933      }
33934      if (element.hasCategory()) {
33935        composeCodeableConcept("category", element.getCategory());
33936      }
33937      if (element.hasPriorityElement()) {
33938        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
33939        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
33940      }
33941      if (element.hasMedication()) {
33942        composeType("medication", element.getMedication());
33943      }
33944      if (element.hasSubject()) {
33945        composeReference("subject", element.getSubject());
33946      }
33947      if (element.hasContext()) {
33948        composeReference("context", element.getContext());
33949      }
33950      if (element.hasSupportingInformation()) {
33951        openArray("supportingInformation");
33952        for (Reference e : element.getSupportingInformation()) 
33953          composeReference(null, e);
33954        closeArray();
33955      };
33956      if (element.hasAuthoredOnElement()) {
33957        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
33958        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
33959      }
33960      if (element.hasRequester()) {
33961        composeMedicationRequestMedicationRequestRequesterComponent("requester", element.getRequester());
33962      }
33963      if (element.hasRecorder()) {
33964        composeReference("recorder", element.getRecorder());
33965      }
33966      if (element.hasReasonCode()) {
33967        openArray("reasonCode");
33968        for (CodeableConcept e : element.getReasonCode()) 
33969          composeCodeableConcept(null, e);
33970        closeArray();
33971      };
33972      if (element.hasReasonReference()) {
33973        openArray("reasonReference");
33974        for (Reference e : element.getReasonReference()) 
33975          composeReference(null, e);
33976        closeArray();
33977      };
33978      if (element.hasNote()) {
33979        openArray("note");
33980        for (Annotation e : element.getNote()) 
33981          composeAnnotation(null, e);
33982        closeArray();
33983      };
33984      if (element.hasDosageInstruction()) {
33985        openArray("dosageInstruction");
33986        for (Dosage e : element.getDosageInstruction()) 
33987          composeDosage(null, e);
33988        closeArray();
33989      };
33990      if (element.hasDispenseRequest()) {
33991        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
33992      }
33993      if (element.hasSubstitution()) {
33994        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
33995      }
33996      if (element.hasPriorPrescription()) {
33997        composeReference("priorPrescription", element.getPriorPrescription());
33998      }
33999      if (element.hasDetectedIssue()) {
34000        openArray("detectedIssue");
34001        for (Reference e : element.getDetectedIssue()) 
34002          composeReference(null, e);
34003        closeArray();
34004      };
34005      if (element.hasEventHistory()) {
34006        openArray("eventHistory");
34007        for (Reference e : element.getEventHistory()) 
34008          composeReference(null, e);
34009        closeArray();
34010      };
34011  }
34012
34013  protected void composeMedicationRequestMedicationRequestRequesterComponent(String name, MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34014    if (element != null) {
34015      open(name);
34016      composeMedicationRequestMedicationRequestRequesterComponentInner(element);
34017      close();
34018    }
34019  }
34020
34021  protected void composeMedicationRequestMedicationRequestRequesterComponentInner(MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34022      composeBackbone(element);
34023      if (element.hasAgent()) {
34024        composeReference("agent", element.getAgent());
34025      }
34026      if (element.hasOnBehalfOf()) {
34027        composeReference("onBehalfOf", element.getOnBehalfOf());
34028      }
34029  }
34030
34031  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34032    if (element != null) {
34033      open(name);
34034      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
34035      close();
34036    }
34037  }
34038
34039  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34040      composeBackbone(element);
34041      if (element.hasValidityPeriod()) {
34042        composePeriod("validityPeriod", element.getValidityPeriod());
34043      }
34044      if (element.hasNumberOfRepeatsAllowedElement()) {
34045        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34046        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34047      }
34048      if (element.hasQuantity()) {
34049        composeSimpleQuantity("quantity", element.getQuantity());
34050      }
34051      if (element.hasExpectedSupplyDuration()) {
34052        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
34053      }
34054      if (element.hasPerformer()) {
34055        composeReference("performer", element.getPerformer());
34056      }
34057  }
34058
34059  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34060    if (element != null) {
34061      open(name);
34062      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
34063      close();
34064    }
34065  }
34066
34067  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34068      composeBackbone(element);
34069      if (element.hasAllowedElement()) {
34070        composeBooleanCore("allowed", element.getAllowedElement(), false);
34071        composeBooleanExtras("allowed", element.getAllowedElement(), false);
34072      }
34073      if (element.hasReason()) {
34074        composeCodeableConcept("reason", element.getReason());
34075      }
34076  }
34077
34078  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
34079    if (element != null) {
34080      prop("resourceType", name);
34081      composeMedicationStatementInner(element);
34082    }
34083  }
34084
34085  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
34086      composeDomainResourceElements(element);
34087      if (element.hasIdentifier()) {
34088        openArray("identifier");
34089        for (Identifier e : element.getIdentifier()) 
34090          composeIdentifier(null, e);
34091        closeArray();
34092      };
34093      if (element.hasBasedOn()) {
34094        openArray("basedOn");
34095        for (Reference e : element.getBasedOn()) 
34096          composeReference(null, e);
34097        closeArray();
34098      };
34099      if (element.hasPartOf()) {
34100        openArray("partOf");
34101        for (Reference e : element.getPartOf()) 
34102          composeReference(null, e);
34103        closeArray();
34104      };
34105      if (element.hasContext()) {
34106        composeReference("context", element.getContext());
34107      }
34108      if (element.hasStatusElement()) {
34109        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34110        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34111      }
34112      if (element.hasCategory()) {
34113        composeCodeableConcept("category", element.getCategory());
34114      }
34115      if (element.hasMedication()) {
34116        composeType("medication", element.getMedication());
34117      }
34118      if (element.hasEffective()) {
34119        composeType("effective", element.getEffective());
34120      }
34121      if (element.hasDateAssertedElement()) {
34122        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
34123        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
34124      }
34125      if (element.hasInformationSource()) {
34126        composeReference("informationSource", element.getInformationSource());
34127      }
34128      if (element.hasSubject()) {
34129        composeReference("subject", element.getSubject());
34130      }
34131      if (element.hasDerivedFrom()) {
34132        openArray("derivedFrom");
34133        for (Reference e : element.getDerivedFrom()) 
34134          composeReference(null, e);
34135        closeArray();
34136      };
34137      if (element.hasTakenElement()) {
34138        composeEnumerationCore("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34139        composeEnumerationExtras("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34140      }
34141      if (element.hasReasonNotTaken()) {
34142        openArray("reasonNotTaken");
34143        for (CodeableConcept e : element.getReasonNotTaken()) 
34144          composeCodeableConcept(null, e);
34145        closeArray();
34146      };
34147      if (element.hasReasonCode()) {
34148        openArray("reasonCode");
34149        for (CodeableConcept e : element.getReasonCode()) 
34150          composeCodeableConcept(null, e);
34151        closeArray();
34152      };
34153      if (element.hasReasonReference()) {
34154        openArray("reasonReference");
34155        for (Reference e : element.getReasonReference()) 
34156          composeReference(null, e);
34157        closeArray();
34158      };
34159      if (element.hasNote()) {
34160        openArray("note");
34161        for (Annotation e : element.getNote()) 
34162          composeAnnotation(null, e);
34163        closeArray();
34164      };
34165      if (element.hasDosage()) {
34166        openArray("dosage");
34167        for (Dosage e : element.getDosage()) 
34168          composeDosage(null, e);
34169        closeArray();
34170      };
34171  }
34172
34173  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
34174    if (element != null) {
34175      prop("resourceType", name);
34176      composeMessageDefinitionInner(element);
34177    }
34178  }
34179
34180  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
34181      composeDomainResourceElements(element);
34182      if (element.hasUrlElement()) {
34183        composeUriCore("url", element.getUrlElement(), false);
34184        composeUriExtras("url", element.getUrlElement(), false);
34185      }
34186      if (element.hasIdentifier()) {
34187        composeIdentifier("identifier", element.getIdentifier());
34188      }
34189      if (element.hasVersionElement()) {
34190        composeStringCore("version", element.getVersionElement(), false);
34191        composeStringExtras("version", element.getVersionElement(), false);
34192      }
34193      if (element.hasNameElement()) {
34194        composeStringCore("name", element.getNameElement(), false);
34195        composeStringExtras("name", element.getNameElement(), false);
34196      }
34197      if (element.hasTitleElement()) {
34198        composeStringCore("title", element.getTitleElement(), false);
34199        composeStringExtras("title", element.getTitleElement(), false);
34200      }
34201      if (element.hasStatusElement()) {
34202        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34203        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34204      }
34205      if (element.hasExperimentalElement()) {
34206        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34207        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34208      }
34209      if (element.hasDateElement()) {
34210        composeDateTimeCore("date", element.getDateElement(), false);
34211        composeDateTimeExtras("date", element.getDateElement(), false);
34212      }
34213      if (element.hasPublisherElement()) {
34214        composeStringCore("publisher", element.getPublisherElement(), false);
34215        composeStringExtras("publisher", element.getPublisherElement(), false);
34216      }
34217      if (element.hasContact()) {
34218        openArray("contact");
34219        for (ContactDetail e : element.getContact()) 
34220          composeContactDetail(null, e);
34221        closeArray();
34222      };
34223      if (element.hasDescriptionElement()) {
34224        composeMarkdownCore("description", element.getDescriptionElement(), false);
34225        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34226      }
34227      if (element.hasUseContext()) {
34228        openArray("useContext");
34229        for (UsageContext e : element.getUseContext()) 
34230          composeUsageContext(null, e);
34231        closeArray();
34232      };
34233      if (element.hasJurisdiction()) {
34234        openArray("jurisdiction");
34235        for (CodeableConcept e : element.getJurisdiction()) 
34236          composeCodeableConcept(null, e);
34237        closeArray();
34238      };
34239      if (element.hasPurposeElement()) {
34240        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34241        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34242      }
34243      if (element.hasCopyrightElement()) {
34244        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34245        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34246      }
34247      if (element.hasBase()) {
34248        composeReference("base", element.getBase());
34249      }
34250      if (element.hasParent()) {
34251        openArray("parent");
34252        for (Reference e : element.getParent()) 
34253          composeReference(null, e);
34254        closeArray();
34255      };
34256      if (element.hasReplaces()) {
34257        openArray("replaces");
34258        for (Reference e : element.getReplaces()) 
34259          composeReference(null, e);
34260        closeArray();
34261      };
34262      if (element.hasEvent()) {
34263        composeCoding("event", element.getEvent());
34264      }
34265      if (element.hasCategoryElement()) {
34266        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34267        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34268      }
34269      if (element.hasFocus()) {
34270        openArray("focus");
34271        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
34272          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
34273        closeArray();
34274      };
34275      if (element.hasResponseRequiredElement()) {
34276        composeBooleanCore("responseRequired", element.getResponseRequiredElement(), false);
34277        composeBooleanExtras("responseRequired", element.getResponseRequiredElement(), false);
34278      }
34279      if (element.hasAllowedResponse()) {
34280        openArray("allowedResponse");
34281        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
34282          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
34283        closeArray();
34284      };
34285  }
34286
34287  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34288    if (element != null) {
34289      open(name);
34290      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
34291      close();
34292    }
34293  }
34294
34295  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34296      composeBackbone(element);
34297      if (element.hasCodeElement()) {
34298        composeCodeCore("code", element.getCodeElement(), false);
34299        composeCodeExtras("code", element.getCodeElement(), false);
34300      }
34301      if (element.hasProfile()) {
34302        composeReference("profile", element.getProfile());
34303      }
34304      if (element.hasMinElement()) {
34305        composeUnsignedIntCore("min", element.getMinElement(), false);
34306        composeUnsignedIntExtras("min", element.getMinElement(), false);
34307      }
34308      if (element.hasMaxElement()) {
34309        composeStringCore("max", element.getMaxElement(), false);
34310        composeStringExtras("max", element.getMaxElement(), false);
34311      }
34312  }
34313
34314  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34315    if (element != null) {
34316      open(name);
34317      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
34318      close();
34319    }
34320  }
34321
34322  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34323      composeBackbone(element);
34324      if (element.hasMessage()) {
34325        composeReference("message", element.getMessage());
34326      }
34327      if (element.hasSituationElement()) {
34328        composeMarkdownCore("situation", element.getSituationElement(), false);
34329        composeMarkdownExtras("situation", element.getSituationElement(), false);
34330      }
34331  }
34332
34333  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
34334    if (element != null) {
34335      prop("resourceType", name);
34336      composeMessageHeaderInner(element);
34337    }
34338  }
34339
34340  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
34341      composeDomainResourceElements(element);
34342      if (element.hasEvent()) {
34343        composeCoding("event", element.getEvent());
34344      }
34345      if (element.hasDestination()) {
34346        openArray("destination");
34347        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
34348          composeMessageHeaderMessageDestinationComponent(null, e);
34349        closeArray();
34350      };
34351      if (element.hasReceiver()) {
34352        composeReference("receiver", element.getReceiver());
34353      }
34354      if (element.hasSender()) {
34355        composeReference("sender", element.getSender());
34356      }
34357      if (element.hasTimestampElement()) {
34358        composeInstantCore("timestamp", element.getTimestampElement(), false);
34359        composeInstantExtras("timestamp", element.getTimestampElement(), false);
34360      }
34361      if (element.hasEnterer()) {
34362        composeReference("enterer", element.getEnterer());
34363      }
34364      if (element.hasAuthor()) {
34365        composeReference("author", element.getAuthor());
34366      }
34367      if (element.hasSource()) {
34368        composeMessageHeaderMessageSourceComponent("source", element.getSource());
34369      }
34370      if (element.hasResponsible()) {
34371        composeReference("responsible", element.getResponsible());
34372      }
34373      if (element.hasReason()) {
34374        composeCodeableConcept("reason", element.getReason());
34375      }
34376      if (element.hasResponse()) {
34377        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
34378      }
34379      if (element.hasFocus()) {
34380        openArray("focus");
34381        for (Reference e : element.getFocus()) 
34382          composeReference(null, e);
34383        closeArray();
34384      };
34385  }
34386
34387  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
34388    if (element != null) {
34389      open(name);
34390      composeMessageHeaderMessageDestinationComponentInner(element);
34391      close();
34392    }
34393  }
34394
34395  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
34396      composeBackbone(element);
34397      if (element.hasNameElement()) {
34398        composeStringCore("name", element.getNameElement(), false);
34399        composeStringExtras("name", element.getNameElement(), false);
34400      }
34401      if (element.hasTarget()) {
34402        composeReference("target", element.getTarget());
34403      }
34404      if (element.hasEndpointElement()) {
34405        composeUriCore("endpoint", element.getEndpointElement(), false);
34406        composeUriExtras("endpoint", element.getEndpointElement(), false);
34407      }
34408  }
34409
34410  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
34411    if (element != null) {
34412      open(name);
34413      composeMessageHeaderMessageSourceComponentInner(element);
34414      close();
34415    }
34416  }
34417
34418  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
34419      composeBackbone(element);
34420      if (element.hasNameElement()) {
34421        composeStringCore("name", element.getNameElement(), false);
34422        composeStringExtras("name", element.getNameElement(), false);
34423      }
34424      if (element.hasSoftwareElement()) {
34425        composeStringCore("software", element.getSoftwareElement(), false);
34426        composeStringExtras("software", element.getSoftwareElement(), false);
34427      }
34428      if (element.hasVersionElement()) {
34429        composeStringCore("version", element.getVersionElement(), false);
34430        composeStringExtras("version", element.getVersionElement(), false);
34431      }
34432      if (element.hasContact()) {
34433        composeContactPoint("contact", element.getContact());
34434      }
34435      if (element.hasEndpointElement()) {
34436        composeUriCore("endpoint", element.getEndpointElement(), false);
34437        composeUriExtras("endpoint", element.getEndpointElement(), false);
34438      }
34439  }
34440
34441  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34442    if (element != null) {
34443      open(name);
34444      composeMessageHeaderMessageHeaderResponseComponentInner(element);
34445      close();
34446    }
34447  }
34448
34449  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34450      composeBackbone(element);
34451      if (element.hasIdentifierElement()) {
34452        composeIdCore("identifier", element.getIdentifierElement(), false);
34453        composeIdExtras("identifier", element.getIdentifierElement(), false);
34454      }
34455      if (element.hasCodeElement()) {
34456        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34457        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34458      }
34459      if (element.hasDetails()) {
34460        composeReference("details", element.getDetails());
34461      }
34462  }
34463
34464  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
34465    if (element != null) {
34466      prop("resourceType", name);
34467      composeNamingSystemInner(element);
34468    }
34469  }
34470
34471  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
34472      composeDomainResourceElements(element);
34473      if (element.hasNameElement()) {
34474        composeStringCore("name", element.getNameElement(), false);
34475        composeStringExtras("name", element.getNameElement(), false);
34476      }
34477      if (element.hasStatusElement()) {
34478        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34479        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34480      }
34481      if (element.hasKindElement()) {
34482        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34483        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34484      }
34485      if (element.hasDateElement()) {
34486        composeDateTimeCore("date", element.getDateElement(), false);
34487        composeDateTimeExtras("date", element.getDateElement(), false);
34488      }
34489      if (element.hasPublisherElement()) {
34490        composeStringCore("publisher", element.getPublisherElement(), false);
34491        composeStringExtras("publisher", element.getPublisherElement(), false);
34492      }
34493      if (element.hasContact()) {
34494        openArray("contact");
34495        for (ContactDetail e : element.getContact()) 
34496          composeContactDetail(null, e);
34497        closeArray();
34498      };
34499      if (element.hasResponsibleElement()) {
34500        composeStringCore("responsible", element.getResponsibleElement(), false);
34501        composeStringExtras("responsible", element.getResponsibleElement(), false);
34502      }
34503      if (element.hasType()) {
34504        composeCodeableConcept("type", element.getType());
34505      }
34506      if (element.hasDescriptionElement()) {
34507        composeMarkdownCore("description", element.getDescriptionElement(), false);
34508        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34509      }
34510      if (element.hasUseContext()) {
34511        openArray("useContext");
34512        for (UsageContext e : element.getUseContext()) 
34513          composeUsageContext(null, e);
34514        closeArray();
34515      };
34516      if (element.hasJurisdiction()) {
34517        openArray("jurisdiction");
34518        for (CodeableConcept e : element.getJurisdiction()) 
34519          composeCodeableConcept(null, e);
34520        closeArray();
34521      };
34522      if (element.hasUsageElement()) {
34523        composeStringCore("usage", element.getUsageElement(), false);
34524        composeStringExtras("usage", element.getUsageElement(), false);
34525      }
34526      if (element.hasUniqueId()) {
34527        openArray("uniqueId");
34528        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
34529          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
34530        closeArray();
34531      };
34532      if (element.hasReplacedBy()) {
34533        composeReference("replacedBy", element.getReplacedBy());
34534      }
34535  }
34536
34537  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34538    if (element != null) {
34539      open(name);
34540      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
34541      close();
34542    }
34543  }
34544
34545  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34546      composeBackbone(element);
34547      if (element.hasTypeElement()) {
34548        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34549        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34550      }
34551      if (element.hasValueElement()) {
34552        composeStringCore("value", element.getValueElement(), false);
34553        composeStringExtras("value", element.getValueElement(), false);
34554      }
34555      if (element.hasPreferredElement()) {
34556        composeBooleanCore("preferred", element.getPreferredElement(), false);
34557        composeBooleanExtras("preferred", element.getPreferredElement(), false);
34558      }
34559      if (element.hasCommentElement()) {
34560        composeStringCore("comment", element.getCommentElement(), false);
34561        composeStringExtras("comment", element.getCommentElement(), false);
34562      }
34563      if (element.hasPeriod()) {
34564        composePeriod("period", element.getPeriod());
34565      }
34566  }
34567
34568  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
34569    if (element != null) {
34570      prop("resourceType", name);
34571      composeNutritionOrderInner(element);
34572    }
34573  }
34574
34575  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
34576      composeDomainResourceElements(element);
34577      if (element.hasIdentifier()) {
34578        openArray("identifier");
34579        for (Identifier e : element.getIdentifier()) 
34580          composeIdentifier(null, e);
34581        closeArray();
34582      };
34583      if (element.hasStatusElement()) {
34584        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34585        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34586      }
34587      if (element.hasPatient()) {
34588        composeReference("patient", element.getPatient());
34589      }
34590      if (element.hasEncounter()) {
34591        composeReference("encounter", element.getEncounter());
34592      }
34593      if (element.hasDateTimeElement()) {
34594        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
34595        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
34596      }
34597      if (element.hasOrderer()) {
34598        composeReference("orderer", element.getOrderer());
34599      }
34600      if (element.hasAllergyIntolerance()) {
34601        openArray("allergyIntolerance");
34602        for (Reference e : element.getAllergyIntolerance()) 
34603          composeReference(null, e);
34604        closeArray();
34605      };
34606      if (element.hasFoodPreferenceModifier()) {
34607        openArray("foodPreferenceModifier");
34608        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
34609          composeCodeableConcept(null, e);
34610        closeArray();
34611      };
34612      if (element.hasExcludeFoodModifier()) {
34613        openArray("excludeFoodModifier");
34614        for (CodeableConcept e : element.getExcludeFoodModifier()) 
34615          composeCodeableConcept(null, e);
34616        closeArray();
34617      };
34618      if (element.hasOralDiet()) {
34619        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
34620      }
34621      if (element.hasSupplement()) {
34622        openArray("supplement");
34623        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
34624          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
34625        closeArray();
34626      };
34627      if (element.hasEnteralFormula()) {
34628        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
34629      }
34630  }
34631
34632  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34633    if (element != null) {
34634      open(name);
34635      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
34636      close();
34637    }
34638  }
34639
34640  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34641      composeBackbone(element);
34642      if (element.hasType()) {
34643        openArray("type");
34644        for (CodeableConcept e : element.getType()) 
34645          composeCodeableConcept(null, e);
34646        closeArray();
34647      };
34648      if (element.hasSchedule()) {
34649        openArray("schedule");
34650        for (Timing e : element.getSchedule()) 
34651          composeTiming(null, e);
34652        closeArray();
34653      };
34654      if (element.hasNutrient()) {
34655        openArray("nutrient");
34656        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
34657          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
34658        closeArray();
34659      };
34660      if (element.hasTexture()) {
34661        openArray("texture");
34662        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
34663          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
34664        closeArray();
34665      };
34666      if (element.hasFluidConsistencyType()) {
34667        openArray("fluidConsistencyType");
34668        for (CodeableConcept e : element.getFluidConsistencyType()) 
34669          composeCodeableConcept(null, e);
34670        closeArray();
34671      };
34672      if (element.hasInstructionElement()) {
34673        composeStringCore("instruction", element.getInstructionElement(), false);
34674        composeStringExtras("instruction", element.getInstructionElement(), false);
34675      }
34676  }
34677
34678  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
34679    if (element != null) {
34680      open(name);
34681      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
34682      close();
34683    }
34684  }
34685
34686  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
34687      composeBackbone(element);
34688      if (element.hasModifier()) {
34689        composeCodeableConcept("modifier", element.getModifier());
34690      }
34691      if (element.hasAmount()) {
34692        composeSimpleQuantity("amount", element.getAmount());
34693      }
34694  }
34695
34696  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
34697    if (element != null) {
34698      open(name);
34699      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
34700      close();
34701    }
34702  }
34703
34704  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
34705      composeBackbone(element);
34706      if (element.hasModifier()) {
34707        composeCodeableConcept("modifier", element.getModifier());
34708      }
34709      if (element.hasFoodType()) {
34710        composeCodeableConcept("foodType", element.getFoodType());
34711      }
34712  }
34713
34714  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
34715    if (element != null) {
34716      open(name);
34717      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
34718      close();
34719    }
34720  }
34721
34722  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
34723      composeBackbone(element);
34724      if (element.hasType()) {
34725        composeCodeableConcept("type", element.getType());
34726      }
34727      if (element.hasProductNameElement()) {
34728        composeStringCore("productName", element.getProductNameElement(), false);
34729        composeStringExtras("productName", element.getProductNameElement(), false);
34730      }
34731      if (element.hasSchedule()) {
34732        openArray("schedule");
34733        for (Timing e : element.getSchedule()) 
34734          composeTiming(null, e);
34735        closeArray();
34736      };
34737      if (element.hasQuantity()) {
34738        composeSimpleQuantity("quantity", element.getQuantity());
34739      }
34740      if (element.hasInstructionElement()) {
34741        composeStringCore("instruction", element.getInstructionElement(), false);
34742        composeStringExtras("instruction", element.getInstructionElement(), false);
34743      }
34744  }
34745
34746  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
34747    if (element != null) {
34748      open(name);
34749      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
34750      close();
34751    }
34752  }
34753
34754  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
34755      composeBackbone(element);
34756      if (element.hasBaseFormulaType()) {
34757        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
34758      }
34759      if (element.hasBaseFormulaProductNameElement()) {
34760        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
34761        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
34762      }
34763      if (element.hasAdditiveType()) {
34764        composeCodeableConcept("additiveType", element.getAdditiveType());
34765      }
34766      if (element.hasAdditiveProductNameElement()) {
34767        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
34768        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
34769      }
34770      if (element.hasCaloricDensity()) {
34771        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
34772      }
34773      if (element.hasRouteofAdministration()) {
34774        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
34775      }
34776      if (element.hasAdministration()) {
34777        openArray("administration");
34778        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
34779          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
34780        closeArray();
34781      };
34782      if (element.hasMaxVolumeToDeliver()) {
34783        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
34784      }
34785      if (element.hasAdministrationInstructionElement()) {
34786        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
34787        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
34788      }
34789  }
34790
34791  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
34792    if (element != null) {
34793      open(name);
34794      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
34795      close();
34796    }
34797  }
34798
34799  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
34800      composeBackbone(element);
34801      if (element.hasSchedule()) {
34802        composeTiming("schedule", element.getSchedule());
34803      }
34804      if (element.hasQuantity()) {
34805        composeSimpleQuantity("quantity", element.getQuantity());
34806      }
34807      if (element.hasRate()) {
34808        composeType("rate", element.getRate());
34809      }
34810  }
34811
34812  protected void composeObservation(String name, Observation element) throws IOException {
34813    if (element != null) {
34814      prop("resourceType", name);
34815      composeObservationInner(element);
34816    }
34817  }
34818
34819  protected void composeObservationInner(Observation element) throws IOException {
34820      composeDomainResourceElements(element);
34821      if (element.hasIdentifier()) {
34822        openArray("identifier");
34823        for (Identifier e : element.getIdentifier()) 
34824          composeIdentifier(null, e);
34825        closeArray();
34826      };
34827      if (element.hasBasedOn()) {
34828        openArray("basedOn");
34829        for (Reference e : element.getBasedOn()) 
34830          composeReference(null, e);
34831        closeArray();
34832      };
34833      if (element.hasStatusElement()) {
34834        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
34835        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
34836      }
34837      if (element.hasCategory()) {
34838        openArray("category");
34839        for (CodeableConcept e : element.getCategory()) 
34840          composeCodeableConcept(null, e);
34841        closeArray();
34842      };
34843      if (element.hasCode()) {
34844        composeCodeableConcept("code", element.getCode());
34845      }
34846      if (element.hasSubject()) {
34847        composeReference("subject", element.getSubject());
34848      }
34849      if (element.hasContext()) {
34850        composeReference("context", element.getContext());
34851      }
34852      if (element.hasEffective()) {
34853        composeType("effective", element.getEffective());
34854      }
34855      if (element.hasIssuedElement()) {
34856        composeInstantCore("issued", element.getIssuedElement(), false);
34857        composeInstantExtras("issued", element.getIssuedElement(), false);
34858      }
34859      if (element.hasPerformer()) {
34860        openArray("performer");
34861        for (Reference e : element.getPerformer()) 
34862          composeReference(null, e);
34863        closeArray();
34864      };
34865      if (element.hasValue()) {
34866        composeType("value", element.getValue());
34867      }
34868      if (element.hasDataAbsentReason()) {
34869        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
34870      }
34871      if (element.hasInterpretation()) {
34872        composeCodeableConcept("interpretation", element.getInterpretation());
34873      }
34874      if (element.hasCommentElement()) {
34875        composeStringCore("comment", element.getCommentElement(), false);
34876        composeStringExtras("comment", element.getCommentElement(), false);
34877      }
34878      if (element.hasBodySite()) {
34879        composeCodeableConcept("bodySite", element.getBodySite());
34880      }
34881      if (element.hasMethod()) {
34882        composeCodeableConcept("method", element.getMethod());
34883      }
34884      if (element.hasSpecimen()) {
34885        composeReference("specimen", element.getSpecimen());
34886      }
34887      if (element.hasDevice()) {
34888        composeReference("device", element.getDevice());
34889      }
34890      if (element.hasReferenceRange()) {
34891        openArray("referenceRange");
34892        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
34893          composeObservationObservationReferenceRangeComponent(null, e);
34894        closeArray();
34895      };
34896      if (element.hasRelated()) {
34897        openArray("related");
34898        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
34899          composeObservationObservationRelatedComponent(null, e);
34900        closeArray();
34901      };
34902      if (element.hasComponent()) {
34903        openArray("component");
34904        for (Observation.ObservationComponentComponent e : element.getComponent()) 
34905          composeObservationObservationComponentComponent(null, e);
34906        closeArray();
34907      };
34908  }
34909
34910  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
34911    if (element != null) {
34912      open(name);
34913      composeObservationObservationReferenceRangeComponentInner(element);
34914      close();
34915    }
34916  }
34917
34918  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
34919      composeBackbone(element);
34920      if (element.hasLow()) {
34921        composeSimpleQuantity("low", element.getLow());
34922      }
34923      if (element.hasHigh()) {
34924        composeSimpleQuantity("high", element.getHigh());
34925      }
34926      if (element.hasType()) {
34927        composeCodeableConcept("type", element.getType());
34928      }
34929      if (element.hasAppliesTo()) {
34930        openArray("appliesTo");
34931        for (CodeableConcept e : element.getAppliesTo()) 
34932          composeCodeableConcept(null, e);
34933        closeArray();
34934      };
34935      if (element.hasAge()) {
34936        composeRange("age", element.getAge());
34937      }
34938      if (element.hasTextElement()) {
34939        composeStringCore("text", element.getTextElement(), false);
34940        composeStringExtras("text", element.getTextElement(), false);
34941      }
34942  }
34943
34944  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
34945    if (element != null) {
34946      open(name);
34947      composeObservationObservationRelatedComponentInner(element);
34948      close();
34949    }
34950  }
34951
34952  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
34953      composeBackbone(element);
34954      if (element.hasTypeElement()) {
34955        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
34956        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
34957      }
34958      if (element.hasTarget()) {
34959        composeReference("target", element.getTarget());
34960      }
34961  }
34962
34963  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
34964    if (element != null) {
34965      open(name);
34966      composeObservationObservationComponentComponentInner(element);
34967      close();
34968    }
34969  }
34970
34971  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
34972      composeBackbone(element);
34973      if (element.hasCode()) {
34974        composeCodeableConcept("code", element.getCode());
34975      }
34976      if (element.hasValue()) {
34977        composeType("value", element.getValue());
34978      }
34979      if (element.hasDataAbsentReason()) {
34980        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
34981      }
34982      if (element.hasInterpretation()) {
34983        composeCodeableConcept("interpretation", element.getInterpretation());
34984      }
34985      if (element.hasReferenceRange()) {
34986        openArray("referenceRange");
34987        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
34988          composeObservationObservationReferenceRangeComponent(null, e);
34989        closeArray();
34990      };
34991  }
34992
34993  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
34994    if (element != null) {
34995      prop("resourceType", name);
34996      composeOperationDefinitionInner(element);
34997    }
34998  }
34999
35000  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
35001      composeDomainResourceElements(element);
35002      if (element.hasUrlElement()) {
35003        composeUriCore("url", element.getUrlElement(), false);
35004        composeUriExtras("url", element.getUrlElement(), false);
35005      }
35006      if (element.hasVersionElement()) {
35007        composeStringCore("version", element.getVersionElement(), false);
35008        composeStringExtras("version", element.getVersionElement(), false);
35009      }
35010      if (element.hasNameElement()) {
35011        composeStringCore("name", element.getNameElement(), false);
35012        composeStringExtras("name", element.getNameElement(), false);
35013      }
35014      if (element.hasStatusElement()) {
35015        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35016        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35017      }
35018      if (element.hasKindElement()) {
35019        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35020        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35021      }
35022      if (element.hasExperimentalElement()) {
35023        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35024        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35025      }
35026      if (element.hasDateElement()) {
35027        composeDateTimeCore("date", element.getDateElement(), false);
35028        composeDateTimeExtras("date", element.getDateElement(), false);
35029      }
35030      if (element.hasPublisherElement()) {
35031        composeStringCore("publisher", element.getPublisherElement(), false);
35032        composeStringExtras("publisher", element.getPublisherElement(), false);
35033      }
35034      if (element.hasContact()) {
35035        openArray("contact");
35036        for (ContactDetail e : element.getContact()) 
35037          composeContactDetail(null, e);
35038        closeArray();
35039      };
35040      if (element.hasDescriptionElement()) {
35041        composeMarkdownCore("description", element.getDescriptionElement(), false);
35042        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35043      }
35044      if (element.hasUseContext()) {
35045        openArray("useContext");
35046        for (UsageContext e : element.getUseContext()) 
35047          composeUsageContext(null, e);
35048        closeArray();
35049      };
35050      if (element.hasJurisdiction()) {
35051        openArray("jurisdiction");
35052        for (CodeableConcept e : element.getJurisdiction()) 
35053          composeCodeableConcept(null, e);
35054        closeArray();
35055      };
35056      if (element.hasPurposeElement()) {
35057        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35058        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35059      }
35060      if (element.hasIdempotentElement()) {
35061        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
35062        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
35063      }
35064      if (element.hasCodeElement()) {
35065        composeCodeCore("code", element.getCodeElement(), false);
35066        composeCodeExtras("code", element.getCodeElement(), false);
35067      }
35068      if (element.hasCommentElement()) {
35069        composeStringCore("comment", element.getCommentElement(), false);
35070        composeStringExtras("comment", element.getCommentElement(), false);
35071      }
35072      if (element.hasBase()) {
35073        composeReference("base", element.getBase());
35074      }
35075      if (element.hasResource()) {
35076        openArray("resource");
35077        for (CodeType e : element.getResource()) 
35078          composeCodeCore(null, e, true);
35079        closeArray();
35080        if (anyHasExtras(element.getResource())) {
35081          openArray("_resource");
35082          for (CodeType e : element.getResource()) 
35083            composeCodeExtras(null, e, true);
35084          closeArray();
35085        }
35086      };
35087      if (element.hasSystemElement()) {
35088        composeBooleanCore("system", element.getSystemElement(), false);
35089        composeBooleanExtras("system", element.getSystemElement(), false);
35090      }
35091      if (element.hasTypeElement()) {
35092        composeBooleanCore("type", element.getTypeElement(), false);
35093        composeBooleanExtras("type", element.getTypeElement(), false);
35094      }
35095      if (element.hasInstanceElement()) {
35096        composeBooleanCore("instance", element.getInstanceElement(), false);
35097        composeBooleanExtras("instance", element.getInstanceElement(), false);
35098      }
35099      if (element.hasParameter()) {
35100        openArray("parameter");
35101        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
35102          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35103        closeArray();
35104      };
35105      if (element.hasOverload()) {
35106        openArray("overload");
35107        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
35108          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
35109        closeArray();
35110      };
35111  }
35112
35113  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35114    if (element != null) {
35115      open(name);
35116      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
35117      close();
35118    }
35119  }
35120
35121  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35122      composeBackbone(element);
35123      if (element.hasNameElement()) {
35124        composeCodeCore("name", element.getNameElement(), false);
35125        composeCodeExtras("name", element.getNameElement(), false);
35126      }
35127      if (element.hasUseElement()) {
35128        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35129        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35130      }
35131      if (element.hasMinElement()) {
35132        composeIntegerCore("min", element.getMinElement(), false);
35133        composeIntegerExtras("min", element.getMinElement(), false);
35134      }
35135      if (element.hasMaxElement()) {
35136        composeStringCore("max", element.getMaxElement(), false);
35137        composeStringExtras("max", element.getMaxElement(), false);
35138      }
35139      if (element.hasDocumentationElement()) {
35140        composeStringCore("documentation", element.getDocumentationElement(), false);
35141        composeStringExtras("documentation", element.getDocumentationElement(), false);
35142      }
35143      if (element.hasTypeElement()) {
35144        composeCodeCore("type", element.getTypeElement(), false);
35145        composeCodeExtras("type", element.getTypeElement(), false);
35146      }
35147      if (element.hasSearchTypeElement()) {
35148        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35149        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35150      }
35151      if (element.hasProfile()) {
35152        composeReference("profile", element.getProfile());
35153      }
35154      if (element.hasBinding()) {
35155        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
35156      }
35157      if (element.hasPart()) {
35158        openArray("part");
35159        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
35160          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35161        closeArray();
35162      };
35163  }
35164
35165  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35166    if (element != null) {
35167      open(name);
35168      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
35169      close();
35170    }
35171  }
35172
35173  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35174      composeBackbone(element);
35175      if (element.hasStrengthElement()) {
35176        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35177        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35178      }
35179      if (element.hasValueSet()) {
35180        composeType("valueSet", element.getValueSet());
35181      }
35182  }
35183
35184  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35185    if (element != null) {
35186      open(name);
35187      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
35188      close();
35189    }
35190  }
35191
35192  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35193      composeBackbone(element);
35194      if (element.hasParameterName()) {
35195        openArray("parameterName");
35196        for (StringType e : element.getParameterName()) 
35197          composeStringCore(null, e, true);
35198        closeArray();
35199        if (anyHasExtras(element.getParameterName())) {
35200          openArray("_parameterName");
35201          for (StringType e : element.getParameterName()) 
35202            composeStringExtras(null, e, true);
35203          closeArray();
35204        }
35205      };
35206      if (element.hasCommentElement()) {
35207        composeStringCore("comment", element.getCommentElement(), false);
35208        composeStringExtras("comment", element.getCommentElement(), false);
35209      }
35210  }
35211
35212  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
35213    if (element != null) {
35214      prop("resourceType", name);
35215      composeOperationOutcomeInner(element);
35216    }
35217  }
35218
35219  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
35220      composeDomainResourceElements(element);
35221      if (element.hasIssue()) {
35222        openArray("issue");
35223        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
35224          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
35225        closeArray();
35226      };
35227  }
35228
35229  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35230    if (element != null) {
35231      open(name);
35232      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
35233      close();
35234    }
35235  }
35236
35237  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35238      composeBackbone(element);
35239      if (element.hasSeverityElement()) {
35240        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35241        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35242      }
35243      if (element.hasCodeElement()) {
35244        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35245        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35246      }
35247      if (element.hasDetails()) {
35248        composeCodeableConcept("details", element.getDetails());
35249      }
35250      if (element.hasDiagnosticsElement()) {
35251        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
35252        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
35253      }
35254      if (element.hasLocation()) {
35255        openArray("location");
35256        for (StringType e : element.getLocation()) 
35257          composeStringCore(null, e, true);
35258        closeArray();
35259        if (anyHasExtras(element.getLocation())) {
35260          openArray("_location");
35261          for (StringType e : element.getLocation()) 
35262            composeStringExtras(null, e, true);
35263          closeArray();
35264        }
35265      };
35266      if (element.hasExpression()) {
35267        openArray("expression");
35268        for (StringType e : element.getExpression()) 
35269          composeStringCore(null, e, true);
35270        closeArray();
35271        if (anyHasExtras(element.getExpression())) {
35272          openArray("_expression");
35273          for (StringType e : element.getExpression()) 
35274            composeStringExtras(null, e, true);
35275          closeArray();
35276        }
35277      };
35278  }
35279
35280  protected void composeOrganization(String name, Organization element) throws IOException {
35281    if (element != null) {
35282      prop("resourceType", name);
35283      composeOrganizationInner(element);
35284    }
35285  }
35286
35287  protected void composeOrganizationInner(Organization element) throws IOException {
35288      composeDomainResourceElements(element);
35289      if (element.hasIdentifier()) {
35290        openArray("identifier");
35291        for (Identifier e : element.getIdentifier()) 
35292          composeIdentifier(null, e);
35293        closeArray();
35294      };
35295      if (element.hasActiveElement()) {
35296        composeBooleanCore("active", element.getActiveElement(), false);
35297        composeBooleanExtras("active", element.getActiveElement(), false);
35298      }
35299      if (element.hasType()) {
35300        openArray("type");
35301        for (CodeableConcept e : element.getType()) 
35302          composeCodeableConcept(null, e);
35303        closeArray();
35304      };
35305      if (element.hasNameElement()) {
35306        composeStringCore("name", element.getNameElement(), false);
35307        composeStringExtras("name", element.getNameElement(), false);
35308      }
35309      if (element.hasAlias()) {
35310        openArray("alias");
35311        for (StringType e : element.getAlias()) 
35312          composeStringCore(null, e, true);
35313        closeArray();
35314        if (anyHasExtras(element.getAlias())) {
35315          openArray("_alias");
35316          for (StringType e : element.getAlias()) 
35317            composeStringExtras(null, e, true);
35318          closeArray();
35319        }
35320      };
35321      if (element.hasTelecom()) {
35322        openArray("telecom");
35323        for (ContactPoint e : element.getTelecom()) 
35324          composeContactPoint(null, e);
35325        closeArray();
35326      };
35327      if (element.hasAddress()) {
35328        openArray("address");
35329        for (Address e : element.getAddress()) 
35330          composeAddress(null, e);
35331        closeArray();
35332      };
35333      if (element.hasPartOf()) {
35334        composeReference("partOf", element.getPartOf());
35335      }
35336      if (element.hasContact()) {
35337        openArray("contact");
35338        for (Organization.OrganizationContactComponent e : element.getContact()) 
35339          composeOrganizationOrganizationContactComponent(null, e);
35340        closeArray();
35341      };
35342      if (element.hasEndpoint()) {
35343        openArray("endpoint");
35344        for (Reference e : element.getEndpoint()) 
35345          composeReference(null, e);
35346        closeArray();
35347      };
35348  }
35349
35350  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
35351    if (element != null) {
35352      open(name);
35353      composeOrganizationOrganizationContactComponentInner(element);
35354      close();
35355    }
35356  }
35357
35358  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
35359      composeBackbone(element);
35360      if (element.hasPurpose()) {
35361        composeCodeableConcept("purpose", element.getPurpose());
35362      }
35363      if (element.hasName()) {
35364        composeHumanName("name", element.getName());
35365      }
35366      if (element.hasTelecom()) {
35367        openArray("telecom");
35368        for (ContactPoint e : element.getTelecom()) 
35369          composeContactPoint(null, e);
35370        closeArray();
35371      };
35372      if (element.hasAddress()) {
35373        composeAddress("address", element.getAddress());
35374      }
35375  }
35376
35377  protected void composePatient(String name, Patient element) throws IOException {
35378    if (element != null) {
35379      prop("resourceType", name);
35380      composePatientInner(element);
35381    }
35382  }
35383
35384  protected void composePatientInner(Patient element) throws IOException {
35385      composeDomainResourceElements(element);
35386      if (element.hasIdentifier()) {
35387        openArray("identifier");
35388        for (Identifier e : element.getIdentifier()) 
35389          composeIdentifier(null, e);
35390        closeArray();
35391      };
35392      if (element.hasActiveElement()) {
35393        composeBooleanCore("active", element.getActiveElement(), false);
35394        composeBooleanExtras("active", element.getActiveElement(), false);
35395      }
35396      if (element.hasName()) {
35397        openArray("name");
35398        for (HumanName e : element.getName()) 
35399          composeHumanName(null, e);
35400        closeArray();
35401      };
35402      if (element.hasTelecom()) {
35403        openArray("telecom");
35404        for (ContactPoint e : element.getTelecom()) 
35405          composeContactPoint(null, e);
35406        closeArray();
35407      };
35408      if (element.hasGenderElement()) {
35409        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35410        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35411      }
35412      if (element.hasBirthDateElement()) {
35413        composeDateCore("birthDate", element.getBirthDateElement(), false);
35414        composeDateExtras("birthDate", element.getBirthDateElement(), false);
35415      }
35416      if (element.hasDeceased()) {
35417        composeType("deceased", element.getDeceased());
35418      }
35419      if (element.hasAddress()) {
35420        openArray("address");
35421        for (Address e : element.getAddress()) 
35422          composeAddress(null, e);
35423        closeArray();
35424      };
35425      if (element.hasMaritalStatus()) {
35426        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
35427      }
35428      if (element.hasMultipleBirth()) {
35429        composeType("multipleBirth", element.getMultipleBirth());
35430      }
35431      if (element.hasPhoto()) {
35432        openArray("photo");
35433        for (Attachment e : element.getPhoto()) 
35434          composeAttachment(null, e);
35435        closeArray();
35436      };
35437      if (element.hasContact()) {
35438        openArray("contact");
35439        for (Patient.ContactComponent e : element.getContact()) 
35440          composePatientContactComponent(null, e);
35441        closeArray();
35442      };
35443      if (element.hasAnimal()) {
35444        composePatientAnimalComponent("animal", element.getAnimal());
35445      }
35446      if (element.hasCommunication()) {
35447        openArray("communication");
35448        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
35449          composePatientPatientCommunicationComponent(null, e);
35450        closeArray();
35451      };
35452      if (element.hasGeneralPractitioner()) {
35453        openArray("generalPractitioner");
35454        for (Reference e : element.getGeneralPractitioner()) 
35455          composeReference(null, e);
35456        closeArray();
35457      };
35458      if (element.hasManagingOrganization()) {
35459        composeReference("managingOrganization", element.getManagingOrganization());
35460      }
35461      if (element.hasLink()) {
35462        openArray("link");
35463        for (Patient.PatientLinkComponent e : element.getLink()) 
35464          composePatientPatientLinkComponent(null, e);
35465        closeArray();
35466      };
35467  }
35468
35469  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
35470    if (element != null) {
35471      open(name);
35472      composePatientContactComponentInner(element);
35473      close();
35474    }
35475  }
35476
35477  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
35478      composeBackbone(element);
35479      if (element.hasRelationship()) {
35480        openArray("relationship");
35481        for (CodeableConcept e : element.getRelationship()) 
35482          composeCodeableConcept(null, e);
35483        closeArray();
35484      };
35485      if (element.hasName()) {
35486        composeHumanName("name", element.getName());
35487      }
35488      if (element.hasTelecom()) {
35489        openArray("telecom");
35490        for (ContactPoint e : element.getTelecom()) 
35491          composeContactPoint(null, e);
35492        closeArray();
35493      };
35494      if (element.hasAddress()) {
35495        composeAddress("address", element.getAddress());
35496      }
35497      if (element.hasGenderElement()) {
35498        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35499        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35500      }
35501      if (element.hasOrganization()) {
35502        composeReference("organization", element.getOrganization());
35503      }
35504      if (element.hasPeriod()) {
35505        composePeriod("period", element.getPeriod());
35506      }
35507  }
35508
35509  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
35510    if (element != null) {
35511      open(name);
35512      composePatientAnimalComponentInner(element);
35513      close();
35514    }
35515  }
35516
35517  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
35518      composeBackbone(element);
35519      if (element.hasSpecies()) {
35520        composeCodeableConcept("species", element.getSpecies());
35521      }
35522      if (element.hasBreed()) {
35523        composeCodeableConcept("breed", element.getBreed());
35524      }
35525      if (element.hasGenderStatus()) {
35526        composeCodeableConcept("genderStatus", element.getGenderStatus());
35527      }
35528  }
35529
35530  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
35531    if (element != null) {
35532      open(name);
35533      composePatientPatientCommunicationComponentInner(element);
35534      close();
35535    }
35536  }
35537
35538  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
35539      composeBackbone(element);
35540      if (element.hasLanguage()) {
35541        composeCodeableConcept("language", element.getLanguage());
35542      }
35543      if (element.hasPreferredElement()) {
35544        composeBooleanCore("preferred", element.getPreferredElement(), false);
35545        composeBooleanExtras("preferred", element.getPreferredElement(), false);
35546      }
35547  }
35548
35549  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
35550    if (element != null) {
35551      open(name);
35552      composePatientPatientLinkComponentInner(element);
35553      close();
35554    }
35555  }
35556
35557  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
35558      composeBackbone(element);
35559      if (element.hasOther()) {
35560        composeReference("other", element.getOther());
35561      }
35562      if (element.hasTypeElement()) {
35563        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35564        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35565      }
35566  }
35567
35568  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
35569    if (element != null) {
35570      prop("resourceType", name);
35571      composePaymentNoticeInner(element);
35572    }
35573  }
35574
35575  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
35576      composeDomainResourceElements(element);
35577      if (element.hasIdentifier()) {
35578        openArray("identifier");
35579        for (Identifier e : element.getIdentifier()) 
35580          composeIdentifier(null, e);
35581        closeArray();
35582      };
35583      if (element.hasStatusElement()) {
35584        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35585        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35586      }
35587      if (element.hasRequest()) {
35588        composeReference("request", element.getRequest());
35589      }
35590      if (element.hasResponse()) {
35591        composeReference("response", element.getResponse());
35592      }
35593      if (element.hasStatusDateElement()) {
35594        composeDateCore("statusDate", element.getStatusDateElement(), false);
35595        composeDateExtras("statusDate", element.getStatusDateElement(), false);
35596      }
35597      if (element.hasCreatedElement()) {
35598        composeDateTimeCore("created", element.getCreatedElement(), false);
35599        composeDateTimeExtras("created", element.getCreatedElement(), false);
35600      }
35601      if (element.hasTarget()) {
35602        composeReference("target", element.getTarget());
35603      }
35604      if (element.hasProvider()) {
35605        composeReference("provider", element.getProvider());
35606      }
35607      if (element.hasOrganization()) {
35608        composeReference("organization", element.getOrganization());
35609      }
35610      if (element.hasPaymentStatus()) {
35611        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
35612      }
35613  }
35614
35615  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
35616    if (element != null) {
35617      prop("resourceType", name);
35618      composePaymentReconciliationInner(element);
35619    }
35620  }
35621
35622  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
35623      composeDomainResourceElements(element);
35624      if (element.hasIdentifier()) {
35625        openArray("identifier");
35626        for (Identifier e : element.getIdentifier()) 
35627          composeIdentifier(null, e);
35628        closeArray();
35629      };
35630      if (element.hasStatusElement()) {
35631        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35632        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35633      }
35634      if (element.hasPeriod()) {
35635        composePeriod("period", element.getPeriod());
35636      }
35637      if (element.hasCreatedElement()) {
35638        composeDateTimeCore("created", element.getCreatedElement(), false);
35639        composeDateTimeExtras("created", element.getCreatedElement(), false);
35640      }
35641      if (element.hasOrganization()) {
35642        composeReference("organization", element.getOrganization());
35643      }
35644      if (element.hasRequest()) {
35645        composeReference("request", element.getRequest());
35646      }
35647      if (element.hasOutcome()) {
35648        composeCodeableConcept("outcome", element.getOutcome());
35649      }
35650      if (element.hasDispositionElement()) {
35651        composeStringCore("disposition", element.getDispositionElement(), false);
35652        composeStringExtras("disposition", element.getDispositionElement(), false);
35653      }
35654      if (element.hasRequestProvider()) {
35655        composeReference("requestProvider", element.getRequestProvider());
35656      }
35657      if (element.hasRequestOrganization()) {
35658        composeReference("requestOrganization", element.getRequestOrganization());
35659      }
35660      if (element.hasDetail()) {
35661        openArray("detail");
35662        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
35663          composePaymentReconciliationDetailsComponent(null, e);
35664        closeArray();
35665      };
35666      if (element.hasForm()) {
35667        composeCodeableConcept("form", element.getForm());
35668      }
35669      if (element.hasTotal()) {
35670        composeMoney("total", element.getTotal());
35671      }
35672      if (element.hasProcessNote()) {
35673        openArray("processNote");
35674        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
35675          composePaymentReconciliationNotesComponent(null, e);
35676        closeArray();
35677      };
35678  }
35679
35680  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
35681    if (element != null) {
35682      open(name);
35683      composePaymentReconciliationDetailsComponentInner(element);
35684      close();
35685    }
35686  }
35687
35688  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
35689      composeBackbone(element);
35690      if (element.hasType()) {
35691        composeCodeableConcept("type", element.getType());
35692      }
35693      if (element.hasRequest()) {
35694        composeReference("request", element.getRequest());
35695      }
35696      if (element.hasResponse()) {
35697        composeReference("response", element.getResponse());
35698      }
35699      if (element.hasSubmitter()) {
35700        composeReference("submitter", element.getSubmitter());
35701      }
35702      if (element.hasPayee()) {
35703        composeReference("payee", element.getPayee());
35704      }
35705      if (element.hasDateElement()) {
35706        composeDateCore("date", element.getDateElement(), false);
35707        composeDateExtras("date", element.getDateElement(), false);
35708      }
35709      if (element.hasAmount()) {
35710        composeMoney("amount", element.getAmount());
35711      }
35712  }
35713
35714  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
35715    if (element != null) {
35716      open(name);
35717      composePaymentReconciliationNotesComponentInner(element);
35718      close();
35719    }
35720  }
35721
35722  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
35723      composeBackbone(element);
35724      if (element.hasType()) {
35725        composeCodeableConcept("type", element.getType());
35726      }
35727      if (element.hasTextElement()) {
35728        composeStringCore("text", element.getTextElement(), false);
35729        composeStringExtras("text", element.getTextElement(), false);
35730      }
35731  }
35732
35733  protected void composePerson(String name, Person element) throws IOException {
35734    if (element != null) {
35735      prop("resourceType", name);
35736      composePersonInner(element);
35737    }
35738  }
35739
35740  protected void composePersonInner(Person element) throws IOException {
35741      composeDomainResourceElements(element);
35742      if (element.hasIdentifier()) {
35743        openArray("identifier");
35744        for (Identifier e : element.getIdentifier()) 
35745          composeIdentifier(null, e);
35746        closeArray();
35747      };
35748      if (element.hasName()) {
35749        openArray("name");
35750        for (HumanName e : element.getName()) 
35751          composeHumanName(null, e);
35752        closeArray();
35753      };
35754      if (element.hasTelecom()) {
35755        openArray("telecom");
35756        for (ContactPoint e : element.getTelecom()) 
35757          composeContactPoint(null, e);
35758        closeArray();
35759      };
35760      if (element.hasGenderElement()) {
35761        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35762        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35763      }
35764      if (element.hasBirthDateElement()) {
35765        composeDateCore("birthDate", element.getBirthDateElement(), false);
35766        composeDateExtras("birthDate", element.getBirthDateElement(), false);
35767      }
35768      if (element.hasAddress()) {
35769        openArray("address");
35770        for (Address e : element.getAddress()) 
35771          composeAddress(null, e);
35772        closeArray();
35773      };
35774      if (element.hasPhoto()) {
35775        composeAttachment("photo", element.getPhoto());
35776      }
35777      if (element.hasManagingOrganization()) {
35778        composeReference("managingOrganization", element.getManagingOrganization());
35779      }
35780      if (element.hasActiveElement()) {
35781        composeBooleanCore("active", element.getActiveElement(), false);
35782        composeBooleanExtras("active", element.getActiveElement(), false);
35783      }
35784      if (element.hasLink()) {
35785        openArray("link");
35786        for (Person.PersonLinkComponent e : element.getLink()) 
35787          composePersonPersonLinkComponent(null, e);
35788        closeArray();
35789      };
35790  }
35791
35792  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
35793    if (element != null) {
35794      open(name);
35795      composePersonPersonLinkComponentInner(element);
35796      close();
35797    }
35798  }
35799
35800  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
35801      composeBackbone(element);
35802      if (element.hasTarget()) {
35803        composeReference("target", element.getTarget());
35804      }
35805      if (element.hasAssuranceElement()) {
35806        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
35807        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
35808      }
35809  }
35810
35811  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
35812    if (element != null) {
35813      prop("resourceType", name);
35814      composePlanDefinitionInner(element);
35815    }
35816  }
35817
35818  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
35819      composeDomainResourceElements(element);
35820      if (element.hasUrlElement()) {
35821        composeUriCore("url", element.getUrlElement(), false);
35822        composeUriExtras("url", element.getUrlElement(), false);
35823      }
35824      if (element.hasIdentifier()) {
35825        openArray("identifier");
35826        for (Identifier e : element.getIdentifier()) 
35827          composeIdentifier(null, e);
35828        closeArray();
35829      };
35830      if (element.hasVersionElement()) {
35831        composeStringCore("version", element.getVersionElement(), false);
35832        composeStringExtras("version", element.getVersionElement(), false);
35833      }
35834      if (element.hasNameElement()) {
35835        composeStringCore("name", element.getNameElement(), false);
35836        composeStringExtras("name", element.getNameElement(), false);
35837      }
35838      if (element.hasTitleElement()) {
35839        composeStringCore("title", element.getTitleElement(), false);
35840        composeStringExtras("title", element.getTitleElement(), false);
35841      }
35842      if (element.hasType()) {
35843        composeCodeableConcept("type", element.getType());
35844      }
35845      if (element.hasStatusElement()) {
35846        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35847        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35848      }
35849      if (element.hasExperimentalElement()) {
35850        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35851        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35852      }
35853      if (element.hasDateElement()) {
35854        composeDateTimeCore("date", element.getDateElement(), false);
35855        composeDateTimeExtras("date", element.getDateElement(), false);
35856      }
35857      if (element.hasPublisherElement()) {
35858        composeStringCore("publisher", element.getPublisherElement(), false);
35859        composeStringExtras("publisher", element.getPublisherElement(), false);
35860      }
35861      if (element.hasDescriptionElement()) {
35862        composeMarkdownCore("description", element.getDescriptionElement(), false);
35863        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35864      }
35865      if (element.hasPurposeElement()) {
35866        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35867        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35868      }
35869      if (element.hasUsageElement()) {
35870        composeStringCore("usage", element.getUsageElement(), false);
35871        composeStringExtras("usage", element.getUsageElement(), false);
35872      }
35873      if (element.hasApprovalDateElement()) {
35874        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35875        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35876      }
35877      if (element.hasLastReviewDateElement()) {
35878        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35879        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35880      }
35881      if (element.hasEffectivePeriod()) {
35882        composePeriod("effectivePeriod", element.getEffectivePeriod());
35883      }
35884      if (element.hasUseContext()) {
35885        openArray("useContext");
35886        for (UsageContext e : element.getUseContext()) 
35887          composeUsageContext(null, e);
35888        closeArray();
35889      };
35890      if (element.hasJurisdiction()) {
35891        openArray("jurisdiction");
35892        for (CodeableConcept e : element.getJurisdiction()) 
35893          composeCodeableConcept(null, e);
35894        closeArray();
35895      };
35896      if (element.hasTopic()) {
35897        openArray("topic");
35898        for (CodeableConcept e : element.getTopic()) 
35899          composeCodeableConcept(null, e);
35900        closeArray();
35901      };
35902      if (element.hasContributor()) {
35903        openArray("contributor");
35904        for (Contributor e : element.getContributor()) 
35905          composeContributor(null, e);
35906        closeArray();
35907      };
35908      if (element.hasContact()) {
35909        openArray("contact");
35910        for (ContactDetail e : element.getContact()) 
35911          composeContactDetail(null, e);
35912        closeArray();
35913      };
35914      if (element.hasCopyrightElement()) {
35915        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35916        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35917      }
35918      if (element.hasRelatedArtifact()) {
35919        openArray("relatedArtifact");
35920        for (RelatedArtifact e : element.getRelatedArtifact()) 
35921          composeRelatedArtifact(null, e);
35922        closeArray();
35923      };
35924      if (element.hasLibrary()) {
35925        openArray("library");
35926        for (Reference e : element.getLibrary()) 
35927          composeReference(null, e);
35928        closeArray();
35929      };
35930      if (element.hasGoal()) {
35931        openArray("goal");
35932        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
35933          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
35934        closeArray();
35935      };
35936      if (element.hasAction()) {
35937        openArray("action");
35938        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
35939          composePlanDefinitionPlanDefinitionActionComponent(null, e);
35940        closeArray();
35941      };
35942  }
35943
35944  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
35945    if (element != null) {
35946      open(name);
35947      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
35948      close();
35949    }
35950  }
35951
35952  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
35953      composeBackbone(element);
35954      if (element.hasCategory()) {
35955        composeCodeableConcept("category", element.getCategory());
35956      }
35957      if (element.hasDescription()) {
35958        composeCodeableConcept("description", element.getDescription());
35959      }
35960      if (element.hasPriority()) {
35961        composeCodeableConcept("priority", element.getPriority());
35962      }
35963      if (element.hasStart()) {
35964        composeCodeableConcept("start", element.getStart());
35965      }
35966      if (element.hasAddresses()) {
35967        openArray("addresses");
35968        for (CodeableConcept e : element.getAddresses()) 
35969          composeCodeableConcept(null, e);
35970        closeArray();
35971      };
35972      if (element.hasDocumentation()) {
35973        openArray("documentation");
35974        for (RelatedArtifact e : element.getDocumentation()) 
35975          composeRelatedArtifact(null, e);
35976        closeArray();
35977      };
35978      if (element.hasTarget()) {
35979        openArray("target");
35980        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
35981          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
35982        closeArray();
35983      };
35984  }
35985
35986  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
35987    if (element != null) {
35988      open(name);
35989      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
35990      close();
35991    }
35992  }
35993
35994  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
35995      composeBackbone(element);
35996      if (element.hasMeasure()) {
35997        composeCodeableConcept("measure", element.getMeasure());
35998      }
35999      if (element.hasDetail()) {
36000        composeType("detail", element.getDetail());
36001      }
36002      if (element.hasDue()) {
36003        composeDuration("due", element.getDue());
36004      }
36005  }
36006
36007  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36008    if (element != null) {
36009      open(name);
36010      composePlanDefinitionPlanDefinitionActionComponentInner(element);
36011      close();
36012    }
36013  }
36014
36015  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36016      composeBackbone(element);
36017      if (element.hasLabelElement()) {
36018        composeStringCore("label", element.getLabelElement(), false);
36019        composeStringExtras("label", element.getLabelElement(), false);
36020      }
36021      if (element.hasTitleElement()) {
36022        composeStringCore("title", element.getTitleElement(), false);
36023        composeStringExtras("title", element.getTitleElement(), false);
36024      }
36025      if (element.hasDescriptionElement()) {
36026        composeStringCore("description", element.getDescriptionElement(), false);
36027        composeStringExtras("description", element.getDescriptionElement(), false);
36028      }
36029      if (element.hasTextEquivalentElement()) {
36030        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
36031        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
36032      }
36033      if (element.hasCode()) {
36034        openArray("code");
36035        for (CodeableConcept e : element.getCode()) 
36036          composeCodeableConcept(null, e);
36037        closeArray();
36038      };
36039      if (element.hasReason()) {
36040        openArray("reason");
36041        for (CodeableConcept e : element.getReason()) 
36042          composeCodeableConcept(null, e);
36043        closeArray();
36044      };
36045      if (element.hasDocumentation()) {
36046        openArray("documentation");
36047        for (RelatedArtifact e : element.getDocumentation()) 
36048          composeRelatedArtifact(null, e);
36049        closeArray();
36050      };
36051      if (element.hasGoalId()) {
36052        openArray("goalId");
36053        for (IdType e : element.getGoalId()) 
36054          composeIdCore(null, e, true);
36055        closeArray();
36056        if (anyHasExtras(element.getGoalId())) {
36057          openArray("_goalId");
36058          for (IdType e : element.getGoalId()) 
36059            composeIdExtras(null, e, true);
36060          closeArray();
36061        }
36062      };
36063      if (element.hasTriggerDefinition()) {
36064        openArray("triggerDefinition");
36065        for (TriggerDefinition e : element.getTriggerDefinition()) 
36066          composeTriggerDefinition(null, e);
36067        closeArray();
36068      };
36069      if (element.hasCondition()) {
36070        openArray("condition");
36071        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
36072          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
36073        closeArray();
36074      };
36075      if (element.hasInput()) {
36076        openArray("input");
36077        for (DataRequirement e : element.getInput()) 
36078          composeDataRequirement(null, e);
36079        closeArray();
36080      };
36081      if (element.hasOutput()) {
36082        openArray("output");
36083        for (DataRequirement e : element.getOutput()) 
36084          composeDataRequirement(null, e);
36085        closeArray();
36086      };
36087      if (element.hasRelatedAction()) {
36088        openArray("relatedAction");
36089        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
36090          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
36091        closeArray();
36092      };
36093      if (element.hasTiming()) {
36094        composeType("timing", element.getTiming());
36095      }
36096      if (element.hasParticipant()) {
36097        openArray("participant");
36098        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
36099          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
36100        closeArray();
36101      };
36102      if (element.hasType()) {
36103        composeCoding("type", element.getType());
36104      }
36105      if (element.hasGroupingBehaviorElement()) {
36106        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36107        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36108      }
36109      if (element.hasSelectionBehaviorElement()) {
36110        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36111        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36112      }
36113      if (element.hasRequiredBehaviorElement()) {
36114        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36115        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36116      }
36117      if (element.hasPrecheckBehaviorElement()) {
36118        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36119        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36120      }
36121      if (element.hasCardinalityBehaviorElement()) {
36122        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36123        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36124      }
36125      if (element.hasDefinition()) {
36126        composeReference("definition", element.getDefinition());
36127      }
36128      if (element.hasTransform()) {
36129        composeReference("transform", element.getTransform());
36130      }
36131      if (element.hasDynamicValue()) {
36132        openArray("dynamicValue");
36133        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
36134          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
36135        closeArray();
36136      };
36137      if (element.hasAction()) {
36138        openArray("action");
36139        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
36140          composePlanDefinitionPlanDefinitionActionComponent(null, e);
36141        closeArray();
36142      };
36143  }
36144
36145  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36146    if (element != null) {
36147      open(name);
36148      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
36149      close();
36150    }
36151  }
36152
36153  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36154      composeBackbone(element);
36155      if (element.hasKindElement()) {
36156        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36157        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36158      }
36159      if (element.hasDescriptionElement()) {
36160        composeStringCore("description", element.getDescriptionElement(), false);
36161        composeStringExtras("description", element.getDescriptionElement(), false);
36162      }
36163      if (element.hasLanguageElement()) {
36164        composeStringCore("language", element.getLanguageElement(), false);
36165        composeStringExtras("language", element.getLanguageElement(), false);
36166      }
36167      if (element.hasExpressionElement()) {
36168        composeStringCore("expression", element.getExpressionElement(), false);
36169        composeStringExtras("expression", element.getExpressionElement(), false);
36170      }
36171  }
36172
36173  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36174    if (element != null) {
36175      open(name);
36176      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
36177      close();
36178    }
36179  }
36180
36181  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36182      composeBackbone(element);
36183      if (element.hasActionIdElement()) {
36184        composeIdCore("actionId", element.getActionIdElement(), false);
36185        composeIdExtras("actionId", element.getActionIdElement(), false);
36186      }
36187      if (element.hasRelationshipElement()) {
36188        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36189        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36190      }
36191      if (element.hasOffset()) {
36192        composeType("offset", element.getOffset());
36193      }
36194  }
36195
36196  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36197    if (element != null) {
36198      open(name);
36199      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
36200      close();
36201    }
36202  }
36203
36204  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36205      composeBackbone(element);
36206      if (element.hasTypeElement()) {
36207        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36208        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36209      }
36210      if (element.hasRole()) {
36211        composeCodeableConcept("role", element.getRole());
36212      }
36213  }
36214
36215  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36216    if (element != null) {
36217      open(name);
36218      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
36219      close();
36220    }
36221  }
36222
36223  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36224      composeBackbone(element);
36225      if (element.hasDescriptionElement()) {
36226        composeStringCore("description", element.getDescriptionElement(), false);
36227        composeStringExtras("description", element.getDescriptionElement(), false);
36228      }
36229      if (element.hasPathElement()) {
36230        composeStringCore("path", element.getPathElement(), false);
36231        composeStringExtras("path", element.getPathElement(), false);
36232      }
36233      if (element.hasLanguageElement()) {
36234        composeStringCore("language", element.getLanguageElement(), false);
36235        composeStringExtras("language", element.getLanguageElement(), false);
36236      }
36237      if (element.hasExpressionElement()) {
36238        composeStringCore("expression", element.getExpressionElement(), false);
36239        composeStringExtras("expression", element.getExpressionElement(), false);
36240      }
36241  }
36242
36243  protected void composePractitioner(String name, Practitioner element) throws IOException {
36244    if (element != null) {
36245      prop("resourceType", name);
36246      composePractitionerInner(element);
36247    }
36248  }
36249
36250  protected void composePractitionerInner(Practitioner element) throws IOException {
36251      composeDomainResourceElements(element);
36252      if (element.hasIdentifier()) {
36253        openArray("identifier");
36254        for (Identifier e : element.getIdentifier()) 
36255          composeIdentifier(null, e);
36256        closeArray();
36257      };
36258      if (element.hasActiveElement()) {
36259        composeBooleanCore("active", element.getActiveElement(), false);
36260        composeBooleanExtras("active", element.getActiveElement(), false);
36261      }
36262      if (element.hasName()) {
36263        openArray("name");
36264        for (HumanName e : element.getName()) 
36265          composeHumanName(null, e);
36266        closeArray();
36267      };
36268      if (element.hasTelecom()) {
36269        openArray("telecom");
36270        for (ContactPoint e : element.getTelecom()) 
36271          composeContactPoint(null, e);
36272        closeArray();
36273      };
36274      if (element.hasAddress()) {
36275        openArray("address");
36276        for (Address e : element.getAddress()) 
36277          composeAddress(null, e);
36278        closeArray();
36279      };
36280      if (element.hasGenderElement()) {
36281        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36282        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36283      }
36284      if (element.hasBirthDateElement()) {
36285        composeDateCore("birthDate", element.getBirthDateElement(), false);
36286        composeDateExtras("birthDate", element.getBirthDateElement(), false);
36287      }
36288      if (element.hasPhoto()) {
36289        openArray("photo");
36290        for (Attachment e : element.getPhoto()) 
36291          composeAttachment(null, e);
36292        closeArray();
36293      };
36294      if (element.hasQualification()) {
36295        openArray("qualification");
36296        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
36297          composePractitionerPractitionerQualificationComponent(null, e);
36298        closeArray();
36299      };
36300      if (element.hasCommunication()) {
36301        openArray("communication");
36302        for (CodeableConcept e : element.getCommunication()) 
36303          composeCodeableConcept(null, e);
36304        closeArray();
36305      };
36306  }
36307
36308  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
36309    if (element != null) {
36310      open(name);
36311      composePractitionerPractitionerQualificationComponentInner(element);
36312      close();
36313    }
36314  }
36315
36316  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
36317      composeBackbone(element);
36318      if (element.hasIdentifier()) {
36319        openArray("identifier");
36320        for (Identifier e : element.getIdentifier()) 
36321          composeIdentifier(null, e);
36322        closeArray();
36323      };
36324      if (element.hasCode()) {
36325        composeCodeableConcept("code", element.getCode());
36326      }
36327      if (element.hasPeriod()) {
36328        composePeriod("period", element.getPeriod());
36329      }
36330      if (element.hasIssuer()) {
36331        composeReference("issuer", element.getIssuer());
36332      }
36333  }
36334
36335  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
36336    if (element != null) {
36337      prop("resourceType", name);
36338      composePractitionerRoleInner(element);
36339    }
36340  }
36341
36342  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
36343      composeDomainResourceElements(element);
36344      if (element.hasIdentifier()) {
36345        openArray("identifier");
36346        for (Identifier e : element.getIdentifier()) 
36347          composeIdentifier(null, e);
36348        closeArray();
36349      };
36350      if (element.hasActiveElement()) {
36351        composeBooleanCore("active", element.getActiveElement(), false);
36352        composeBooleanExtras("active", element.getActiveElement(), false);
36353      }
36354      if (element.hasPeriod()) {
36355        composePeriod("period", element.getPeriod());
36356      }
36357      if (element.hasPractitioner()) {
36358        composeReference("practitioner", element.getPractitioner());
36359      }
36360      if (element.hasOrganization()) {
36361        composeReference("organization", element.getOrganization());
36362      }
36363      if (element.hasCode()) {
36364        openArray("code");
36365        for (CodeableConcept e : element.getCode()) 
36366          composeCodeableConcept(null, e);
36367        closeArray();
36368      };
36369      if (element.hasSpecialty()) {
36370        openArray("specialty");
36371        for (CodeableConcept e : element.getSpecialty()) 
36372          composeCodeableConcept(null, e);
36373        closeArray();
36374      };
36375      if (element.hasLocation()) {
36376        openArray("location");
36377        for (Reference e : element.getLocation()) 
36378          composeReference(null, e);
36379        closeArray();
36380      };
36381      if (element.hasHealthcareService()) {
36382        openArray("healthcareService");
36383        for (Reference e : element.getHealthcareService()) 
36384          composeReference(null, e);
36385        closeArray();
36386      };
36387      if (element.hasTelecom()) {
36388        openArray("telecom");
36389        for (ContactPoint e : element.getTelecom()) 
36390          composeContactPoint(null, e);
36391        closeArray();
36392      };
36393      if (element.hasAvailableTime()) {
36394        openArray("availableTime");
36395        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
36396          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
36397        closeArray();
36398      };
36399      if (element.hasNotAvailable()) {
36400        openArray("notAvailable");
36401        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
36402          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
36403        closeArray();
36404      };
36405      if (element.hasAvailabilityExceptionsElement()) {
36406        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36407        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36408      }
36409      if (element.hasEndpoint()) {
36410        openArray("endpoint");
36411        for (Reference e : element.getEndpoint()) 
36412          composeReference(null, e);
36413        closeArray();
36414      };
36415  }
36416
36417  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36418    if (element != null) {
36419      open(name);
36420      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
36421      close();
36422    }
36423  }
36424
36425  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36426      composeBackbone(element);
36427      if (element.hasDaysOfWeek()) {
36428        openArray("daysOfWeek");
36429        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36430          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36431        closeArray();
36432        if (anyHasExtras(element.getDaysOfWeek())) {
36433          openArray("_daysOfWeek");
36434          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36435            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36436          closeArray();
36437        }
36438      };
36439      if (element.hasAllDayElement()) {
36440        composeBooleanCore("allDay", element.getAllDayElement(), false);
36441        composeBooleanExtras("allDay", element.getAllDayElement(), false);
36442      }
36443      if (element.hasAvailableStartTimeElement()) {
36444        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
36445        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
36446      }
36447      if (element.hasAvailableEndTimeElement()) {
36448        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
36449        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
36450      }
36451  }
36452
36453  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36454    if (element != null) {
36455      open(name);
36456      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
36457      close();
36458    }
36459  }
36460
36461  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36462      composeBackbone(element);
36463      if (element.hasDescriptionElement()) {
36464        composeStringCore("description", element.getDescriptionElement(), false);
36465        composeStringExtras("description", element.getDescriptionElement(), false);
36466      }
36467      if (element.hasDuring()) {
36468        composePeriod("during", element.getDuring());
36469      }
36470  }
36471
36472  protected void composeProcedure(String name, Procedure element) throws IOException {
36473    if (element != null) {
36474      prop("resourceType", name);
36475      composeProcedureInner(element);
36476    }
36477  }
36478
36479  protected void composeProcedureInner(Procedure element) throws IOException {
36480      composeDomainResourceElements(element);
36481      if (element.hasIdentifier()) {
36482        openArray("identifier");
36483        for (Identifier e : element.getIdentifier()) 
36484          composeIdentifier(null, e);
36485        closeArray();
36486      };
36487      if (element.hasDefinition()) {
36488        openArray("definition");
36489        for (Reference e : element.getDefinition()) 
36490          composeReference(null, e);
36491        closeArray();
36492      };
36493      if (element.hasBasedOn()) {
36494        openArray("basedOn");
36495        for (Reference e : element.getBasedOn()) 
36496          composeReference(null, e);
36497        closeArray();
36498      };
36499      if (element.hasPartOf()) {
36500        openArray("partOf");
36501        for (Reference e : element.getPartOf()) 
36502          composeReference(null, e);
36503        closeArray();
36504      };
36505      if (element.hasStatusElement()) {
36506        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36507        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36508      }
36509      if (element.hasNotDoneElement()) {
36510        composeBooleanCore("notDone", element.getNotDoneElement(), false);
36511        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
36512      }
36513      if (element.hasNotDoneReason()) {
36514        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
36515      }
36516      if (element.hasCategory()) {
36517        composeCodeableConcept("category", element.getCategory());
36518      }
36519      if (element.hasCode()) {
36520        composeCodeableConcept("code", element.getCode());
36521      }
36522      if (element.hasSubject()) {
36523        composeReference("subject", element.getSubject());
36524      }
36525      if (element.hasContext()) {
36526        composeReference("context", element.getContext());
36527      }
36528      if (element.hasPerformed()) {
36529        composeType("performed", element.getPerformed());
36530      }
36531      if (element.hasPerformer()) {
36532        openArray("performer");
36533        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
36534          composeProcedureProcedurePerformerComponent(null, e);
36535        closeArray();
36536      };
36537      if (element.hasLocation()) {
36538        composeReference("location", element.getLocation());
36539      }
36540      if (element.hasReasonCode()) {
36541        openArray("reasonCode");
36542        for (CodeableConcept e : element.getReasonCode()) 
36543          composeCodeableConcept(null, e);
36544        closeArray();
36545      };
36546      if (element.hasReasonReference()) {
36547        openArray("reasonReference");
36548        for (Reference e : element.getReasonReference()) 
36549          composeReference(null, e);
36550        closeArray();
36551      };
36552      if (element.hasBodySite()) {
36553        openArray("bodySite");
36554        for (CodeableConcept e : element.getBodySite()) 
36555          composeCodeableConcept(null, e);
36556        closeArray();
36557      };
36558      if (element.hasOutcome()) {
36559        composeCodeableConcept("outcome", element.getOutcome());
36560      }
36561      if (element.hasReport()) {
36562        openArray("report");
36563        for (Reference e : element.getReport()) 
36564          composeReference(null, e);
36565        closeArray();
36566      };
36567      if (element.hasComplication()) {
36568        openArray("complication");
36569        for (CodeableConcept e : element.getComplication()) 
36570          composeCodeableConcept(null, e);
36571        closeArray();
36572      };
36573      if (element.hasComplicationDetail()) {
36574        openArray("complicationDetail");
36575        for (Reference e : element.getComplicationDetail()) 
36576          composeReference(null, e);
36577        closeArray();
36578      };
36579      if (element.hasFollowUp()) {
36580        openArray("followUp");
36581        for (CodeableConcept e : element.getFollowUp()) 
36582          composeCodeableConcept(null, e);
36583        closeArray();
36584      };
36585      if (element.hasNote()) {
36586        openArray("note");
36587        for (Annotation e : element.getNote()) 
36588          composeAnnotation(null, e);
36589        closeArray();
36590      };
36591      if (element.hasFocalDevice()) {
36592        openArray("focalDevice");
36593        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
36594          composeProcedureProcedureFocalDeviceComponent(null, e);
36595        closeArray();
36596      };
36597      if (element.hasUsedReference()) {
36598        openArray("usedReference");
36599        for (Reference e : element.getUsedReference()) 
36600          composeReference(null, e);
36601        closeArray();
36602      };
36603      if (element.hasUsedCode()) {
36604        openArray("usedCode");
36605        for (CodeableConcept e : element.getUsedCode()) 
36606          composeCodeableConcept(null, e);
36607        closeArray();
36608      };
36609  }
36610
36611  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
36612    if (element != null) {
36613      open(name);
36614      composeProcedureProcedurePerformerComponentInner(element);
36615      close();
36616    }
36617  }
36618
36619  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
36620      composeBackbone(element);
36621      if (element.hasRole()) {
36622        composeCodeableConcept("role", element.getRole());
36623      }
36624      if (element.hasActor()) {
36625        composeReference("actor", element.getActor());
36626      }
36627      if (element.hasOnBehalfOf()) {
36628        composeReference("onBehalfOf", element.getOnBehalfOf());
36629      }
36630  }
36631
36632  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36633    if (element != null) {
36634      open(name);
36635      composeProcedureProcedureFocalDeviceComponentInner(element);
36636      close();
36637    }
36638  }
36639
36640  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36641      composeBackbone(element);
36642      if (element.hasAction()) {
36643        composeCodeableConcept("action", element.getAction());
36644      }
36645      if (element.hasManipulated()) {
36646        composeReference("manipulated", element.getManipulated());
36647      }
36648  }
36649
36650  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
36651    if (element != null) {
36652      prop("resourceType", name);
36653      composeProcedureRequestInner(element);
36654    }
36655  }
36656
36657  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
36658      composeDomainResourceElements(element);
36659      if (element.hasIdentifier()) {
36660        openArray("identifier");
36661        for (Identifier e : element.getIdentifier()) 
36662          composeIdentifier(null, e);
36663        closeArray();
36664      };
36665      if (element.hasDefinition()) {
36666        openArray("definition");
36667        for (Reference e : element.getDefinition()) 
36668          composeReference(null, e);
36669        closeArray();
36670      };
36671      if (element.hasBasedOn()) {
36672        openArray("basedOn");
36673        for (Reference e : element.getBasedOn()) 
36674          composeReference(null, e);
36675        closeArray();
36676      };
36677      if (element.hasReplaces()) {
36678        openArray("replaces");
36679        for (Reference e : element.getReplaces()) 
36680          composeReference(null, e);
36681        closeArray();
36682      };
36683      if (element.hasRequisition()) {
36684        composeIdentifier("requisition", element.getRequisition());
36685      }
36686      if (element.hasStatusElement()) {
36687        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
36688        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
36689      }
36690      if (element.hasIntentElement()) {
36691        composeEnumerationCore("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
36692        composeEnumerationExtras("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
36693      }
36694      if (element.hasPriorityElement()) {
36695        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
36696        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
36697      }
36698      if (element.hasDoNotPerformElement()) {
36699        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
36700        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
36701      }
36702      if (element.hasCategory()) {
36703        openArray("category");
36704        for (CodeableConcept e : element.getCategory()) 
36705          composeCodeableConcept(null, e);
36706        closeArray();
36707      };
36708      if (element.hasCode()) {
36709        composeCodeableConcept("code", element.getCode());
36710      }
36711      if (element.hasSubject()) {
36712        composeReference("subject", element.getSubject());
36713      }
36714      if (element.hasContext()) {
36715        composeReference("context", element.getContext());
36716      }
36717      if (element.hasOccurrence()) {
36718        composeType("occurrence", element.getOccurrence());
36719      }
36720      if (element.hasAsNeeded()) {
36721        composeType("asNeeded", element.getAsNeeded());
36722      }
36723      if (element.hasAuthoredOnElement()) {
36724        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
36725        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
36726      }
36727      if (element.hasRequester()) {
36728        composeProcedureRequestProcedureRequestRequesterComponent("requester", element.getRequester());
36729      }
36730      if (element.hasPerformerType()) {
36731        composeCodeableConcept("performerType", element.getPerformerType());
36732      }
36733      if (element.hasPerformer()) {
36734        composeReference("performer", element.getPerformer());
36735      }
36736      if (element.hasReasonCode()) {
36737        openArray("reasonCode");
36738        for (CodeableConcept e : element.getReasonCode()) 
36739          composeCodeableConcept(null, e);
36740        closeArray();
36741      };
36742      if (element.hasReasonReference()) {
36743        openArray("reasonReference");
36744        for (Reference e : element.getReasonReference()) 
36745          composeReference(null, e);
36746        closeArray();
36747      };
36748      if (element.hasSupportingInfo()) {
36749        openArray("supportingInfo");
36750        for (Reference e : element.getSupportingInfo()) 
36751          composeReference(null, e);
36752        closeArray();
36753      };
36754      if (element.hasSpecimen()) {
36755        openArray("specimen");
36756        for (Reference e : element.getSpecimen()) 
36757          composeReference(null, e);
36758        closeArray();
36759      };
36760      if (element.hasBodySite()) {
36761        openArray("bodySite");
36762        for (CodeableConcept e : element.getBodySite()) 
36763          composeCodeableConcept(null, e);
36764        closeArray();
36765      };
36766      if (element.hasNote()) {
36767        openArray("note");
36768        for (Annotation e : element.getNote()) 
36769          composeAnnotation(null, e);
36770        closeArray();
36771      };
36772      if (element.hasRelevantHistory()) {
36773        openArray("relevantHistory");
36774        for (Reference e : element.getRelevantHistory()) 
36775          composeReference(null, e);
36776        closeArray();
36777      };
36778  }
36779
36780  protected void composeProcedureRequestProcedureRequestRequesterComponent(String name, ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
36781    if (element != null) {
36782      open(name);
36783      composeProcedureRequestProcedureRequestRequesterComponentInner(element);
36784      close();
36785    }
36786  }
36787
36788  protected void composeProcedureRequestProcedureRequestRequesterComponentInner(ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
36789      composeBackbone(element);
36790      if (element.hasAgent()) {
36791        composeReference("agent", element.getAgent());
36792      }
36793      if (element.hasOnBehalfOf()) {
36794        composeReference("onBehalfOf", element.getOnBehalfOf());
36795      }
36796  }
36797
36798  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
36799    if (element != null) {
36800      prop("resourceType", name);
36801      composeProcessRequestInner(element);
36802    }
36803  }
36804
36805  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
36806      composeDomainResourceElements(element);
36807      if (element.hasIdentifier()) {
36808        openArray("identifier");
36809        for (Identifier e : element.getIdentifier()) 
36810          composeIdentifier(null, e);
36811        closeArray();
36812      };
36813      if (element.hasStatusElement()) {
36814        composeEnumerationCore("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
36815        composeEnumerationExtras("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
36816      }
36817      if (element.hasActionElement()) {
36818        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
36819        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
36820      }
36821      if (element.hasTarget()) {
36822        composeReference("target", element.getTarget());
36823      }
36824      if (element.hasCreatedElement()) {
36825        composeDateTimeCore("created", element.getCreatedElement(), false);
36826        composeDateTimeExtras("created", element.getCreatedElement(), false);
36827      }
36828      if (element.hasProvider()) {
36829        composeReference("provider", element.getProvider());
36830      }
36831      if (element.hasOrganization()) {
36832        composeReference("organization", element.getOrganization());
36833      }
36834      if (element.hasRequest()) {
36835        composeReference("request", element.getRequest());
36836      }
36837      if (element.hasResponse()) {
36838        composeReference("response", element.getResponse());
36839      }
36840      if (element.hasNullifyElement()) {
36841        composeBooleanCore("nullify", element.getNullifyElement(), false);
36842        composeBooleanExtras("nullify", element.getNullifyElement(), false);
36843      }
36844      if (element.hasReferenceElement()) {
36845        composeStringCore("reference", element.getReferenceElement(), false);
36846        composeStringExtras("reference", element.getReferenceElement(), false);
36847      }
36848      if (element.hasItem()) {
36849        openArray("item");
36850        for (ProcessRequest.ItemsComponent e : element.getItem()) 
36851          composeProcessRequestItemsComponent(null, e);
36852        closeArray();
36853      };
36854      if (element.hasInclude()) {
36855        openArray("include");
36856        for (StringType e : element.getInclude()) 
36857          composeStringCore(null, e, true);
36858        closeArray();
36859        if (anyHasExtras(element.getInclude())) {
36860          openArray("_include");
36861          for (StringType e : element.getInclude()) 
36862            composeStringExtras(null, e, true);
36863          closeArray();
36864        }
36865      };
36866      if (element.hasExclude()) {
36867        openArray("exclude");
36868        for (StringType e : element.getExclude()) 
36869          composeStringCore(null, e, true);
36870        closeArray();
36871        if (anyHasExtras(element.getExclude())) {
36872          openArray("_exclude");
36873          for (StringType e : element.getExclude()) 
36874            composeStringExtras(null, e, true);
36875          closeArray();
36876        }
36877      };
36878      if (element.hasPeriod()) {
36879        composePeriod("period", element.getPeriod());
36880      }
36881  }
36882
36883  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
36884    if (element != null) {
36885      open(name);
36886      composeProcessRequestItemsComponentInner(element);
36887      close();
36888    }
36889  }
36890
36891  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
36892      composeBackbone(element);
36893      if (element.hasSequenceLinkIdElement()) {
36894        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
36895        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
36896      }
36897  }
36898
36899  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
36900    if (element != null) {
36901      prop("resourceType", name);
36902      composeProcessResponseInner(element);
36903    }
36904  }
36905
36906  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
36907      composeDomainResourceElements(element);
36908      if (element.hasIdentifier()) {
36909        openArray("identifier");
36910        for (Identifier e : element.getIdentifier()) 
36911          composeIdentifier(null, e);
36912        closeArray();
36913      };
36914      if (element.hasStatusElement()) {
36915        composeEnumerationCore("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
36916        composeEnumerationExtras("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
36917      }
36918      if (element.hasCreatedElement()) {
36919        composeDateTimeCore("created", element.getCreatedElement(), false);
36920        composeDateTimeExtras("created", element.getCreatedElement(), false);
36921      }
36922      if (element.hasOrganization()) {
36923        composeReference("organization", element.getOrganization());
36924      }
36925      if (element.hasRequest()) {
36926        composeReference("request", element.getRequest());
36927      }
36928      if (element.hasOutcome()) {
36929        composeCodeableConcept("outcome", element.getOutcome());
36930      }
36931      if (element.hasDispositionElement()) {
36932        composeStringCore("disposition", element.getDispositionElement(), false);
36933        composeStringExtras("disposition", element.getDispositionElement(), false);
36934      }
36935      if (element.hasRequestProvider()) {
36936        composeReference("requestProvider", element.getRequestProvider());
36937      }
36938      if (element.hasRequestOrganization()) {
36939        composeReference("requestOrganization", element.getRequestOrganization());
36940      }
36941      if (element.hasForm()) {
36942        composeCodeableConcept("form", element.getForm());
36943      }
36944      if (element.hasProcessNote()) {
36945        openArray("processNote");
36946        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
36947          composeProcessResponseProcessResponseProcessNoteComponent(null, e);
36948        closeArray();
36949      };
36950      if (element.hasError()) {
36951        openArray("error");
36952        for (CodeableConcept e : element.getError()) 
36953          composeCodeableConcept(null, e);
36954        closeArray();
36955      };
36956      if (element.hasCommunicationRequest()) {
36957        openArray("communicationRequest");
36958        for (Reference e : element.getCommunicationRequest()) 
36959          composeReference(null, e);
36960        closeArray();
36961      };
36962  }
36963
36964  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
36965    if (element != null) {
36966      open(name);
36967      composeProcessResponseProcessResponseProcessNoteComponentInner(element);
36968      close();
36969    }
36970  }
36971
36972  protected void composeProcessResponseProcessResponseProcessNoteComponentInner(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
36973      composeBackbone(element);
36974      if (element.hasType()) {
36975        composeCodeableConcept("type", element.getType());
36976      }
36977      if (element.hasTextElement()) {
36978        composeStringCore("text", element.getTextElement(), false);
36979        composeStringExtras("text", element.getTextElement(), false);
36980      }
36981  }
36982
36983  protected void composeProvenance(String name, Provenance element) throws IOException {
36984    if (element != null) {
36985      prop("resourceType", name);
36986      composeProvenanceInner(element);
36987    }
36988  }
36989
36990  protected void composeProvenanceInner(Provenance element) throws IOException {
36991      composeDomainResourceElements(element);
36992      if (element.hasTarget()) {
36993        openArray("target");
36994        for (Reference e : element.getTarget()) 
36995          composeReference(null, e);
36996        closeArray();
36997      };
36998      if (element.hasPeriod()) {
36999        composePeriod("period", element.getPeriod());
37000      }
37001      if (element.hasRecordedElement()) {
37002        composeInstantCore("recorded", element.getRecordedElement(), false);
37003        composeInstantExtras("recorded", element.getRecordedElement(), false);
37004      }
37005      if (element.hasPolicy()) {
37006        openArray("policy");
37007        for (UriType e : element.getPolicy()) 
37008          composeUriCore(null, e, true);
37009        closeArray();
37010        if (anyHasExtras(element.getPolicy())) {
37011          openArray("_policy");
37012          for (UriType e : element.getPolicy()) 
37013            composeUriExtras(null, e, true);
37014          closeArray();
37015        }
37016      };
37017      if (element.hasLocation()) {
37018        composeReference("location", element.getLocation());
37019      }
37020      if (element.hasReason()) {
37021        openArray("reason");
37022        for (Coding e : element.getReason()) 
37023          composeCoding(null, e);
37024        closeArray();
37025      };
37026      if (element.hasActivity()) {
37027        composeCoding("activity", element.getActivity());
37028      }
37029      if (element.hasAgent()) {
37030        openArray("agent");
37031        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37032          composeProvenanceProvenanceAgentComponent(null, e);
37033        closeArray();
37034      };
37035      if (element.hasEntity()) {
37036        openArray("entity");
37037        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
37038          composeProvenanceProvenanceEntityComponent(null, e);
37039        closeArray();
37040      };
37041      if (element.hasSignature()) {
37042        openArray("signature");
37043        for (Signature e : element.getSignature()) 
37044          composeSignature(null, e);
37045        closeArray();
37046      };
37047  }
37048
37049  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
37050    if (element != null) {
37051      open(name);
37052      composeProvenanceProvenanceAgentComponentInner(element);
37053      close();
37054    }
37055  }
37056
37057  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
37058      composeBackbone(element);
37059      if (element.hasRole()) {
37060        openArray("role");
37061        for (CodeableConcept e : element.getRole()) 
37062          composeCodeableConcept(null, e);
37063        closeArray();
37064      };
37065      if (element.hasWho()) {
37066        composeType("who", element.getWho());
37067      }
37068      if (element.hasOnBehalfOf()) {
37069        composeType("onBehalfOf", element.getOnBehalfOf());
37070      }
37071      if (element.hasRelatedAgentType()) {
37072        composeCodeableConcept("relatedAgentType", element.getRelatedAgentType());
37073      }
37074  }
37075
37076  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
37077    if (element != null) {
37078      open(name);
37079      composeProvenanceProvenanceEntityComponentInner(element);
37080      close();
37081    }
37082  }
37083
37084  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
37085      composeBackbone(element);
37086      if (element.hasRoleElement()) {
37087        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37088        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37089      }
37090      if (element.hasWhat()) {
37091        composeType("what", element.getWhat());
37092      }
37093      if (element.hasAgent()) {
37094        openArray("agent");
37095        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37096          composeProvenanceProvenanceAgentComponent(null, e);
37097        closeArray();
37098      };
37099  }
37100
37101  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
37102    if (element != null) {
37103      prop("resourceType", name);
37104      composeQuestionnaireInner(element);
37105    }
37106  }
37107
37108  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
37109      composeDomainResourceElements(element);
37110      if (element.hasUrlElement()) {
37111        composeUriCore("url", element.getUrlElement(), false);
37112        composeUriExtras("url", element.getUrlElement(), false);
37113      }
37114      if (element.hasIdentifier()) {
37115        openArray("identifier");
37116        for (Identifier e : element.getIdentifier()) 
37117          composeIdentifier(null, e);
37118        closeArray();
37119      };
37120      if (element.hasVersionElement()) {
37121        composeStringCore("version", element.getVersionElement(), false);
37122        composeStringExtras("version", element.getVersionElement(), false);
37123      }
37124      if (element.hasNameElement()) {
37125        composeStringCore("name", element.getNameElement(), false);
37126        composeStringExtras("name", element.getNameElement(), false);
37127      }
37128      if (element.hasTitleElement()) {
37129        composeStringCore("title", element.getTitleElement(), false);
37130        composeStringExtras("title", element.getTitleElement(), false);
37131      }
37132      if (element.hasStatusElement()) {
37133        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37134        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37135      }
37136      if (element.hasExperimentalElement()) {
37137        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37138        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37139      }
37140      if (element.hasDateElement()) {
37141        composeDateTimeCore("date", element.getDateElement(), false);
37142        composeDateTimeExtras("date", element.getDateElement(), false);
37143      }
37144      if (element.hasPublisherElement()) {
37145        composeStringCore("publisher", element.getPublisherElement(), false);
37146        composeStringExtras("publisher", element.getPublisherElement(), false);
37147      }
37148      if (element.hasDescriptionElement()) {
37149        composeMarkdownCore("description", element.getDescriptionElement(), false);
37150        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37151      }
37152      if (element.hasPurposeElement()) {
37153        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37154        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37155      }
37156      if (element.hasApprovalDateElement()) {
37157        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
37158        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
37159      }
37160      if (element.hasLastReviewDateElement()) {
37161        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
37162        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
37163      }
37164      if (element.hasEffectivePeriod()) {
37165        composePeriod("effectivePeriod", element.getEffectivePeriod());
37166      }
37167      if (element.hasUseContext()) {
37168        openArray("useContext");
37169        for (UsageContext e : element.getUseContext()) 
37170          composeUsageContext(null, e);
37171        closeArray();
37172      };
37173      if (element.hasJurisdiction()) {
37174        openArray("jurisdiction");
37175        for (CodeableConcept e : element.getJurisdiction()) 
37176          composeCodeableConcept(null, e);
37177        closeArray();
37178      };
37179      if (element.hasContact()) {
37180        openArray("contact");
37181        for (ContactDetail e : element.getContact()) 
37182          composeContactDetail(null, e);
37183        closeArray();
37184      };
37185      if (element.hasCopyrightElement()) {
37186        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37187        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37188      }
37189      if (element.hasCode()) {
37190        openArray("code");
37191        for (Coding e : element.getCode()) 
37192          composeCoding(null, e);
37193        closeArray();
37194      };
37195      if (element.hasSubjectType()) {
37196        openArray("subjectType");
37197        for (CodeType e : element.getSubjectType()) 
37198          composeCodeCore(null, e, true);
37199        closeArray();
37200        if (anyHasExtras(element.getSubjectType())) {
37201          openArray("_subjectType");
37202          for (CodeType e : element.getSubjectType()) 
37203            composeCodeExtras(null, e, true);
37204          closeArray();
37205        }
37206      };
37207      if (element.hasItem()) {
37208        openArray("item");
37209        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37210          composeQuestionnaireQuestionnaireItemComponent(null, e);
37211        closeArray();
37212      };
37213  }
37214
37215  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
37216    if (element != null) {
37217      open(name);
37218      composeQuestionnaireQuestionnaireItemComponentInner(element);
37219      close();
37220    }
37221  }
37222
37223  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
37224      composeBackbone(element);
37225      if (element.hasLinkIdElement()) {
37226        composeStringCore("linkId", element.getLinkIdElement(), false);
37227        composeStringExtras("linkId", element.getLinkIdElement(), false);
37228      }
37229      if (element.hasDefinitionElement()) {
37230        composeUriCore("definition", element.getDefinitionElement(), false);
37231        composeUriExtras("definition", element.getDefinitionElement(), false);
37232      }
37233      if (element.hasCode()) {
37234        openArray("code");
37235        for (Coding e : element.getCode()) 
37236          composeCoding(null, e);
37237        closeArray();
37238      };
37239      if (element.hasPrefixElement()) {
37240        composeStringCore("prefix", element.getPrefixElement(), false);
37241        composeStringExtras("prefix", element.getPrefixElement(), false);
37242      }
37243      if (element.hasTextElement()) {
37244        composeStringCore("text", element.getTextElement(), false);
37245        composeStringExtras("text", element.getTextElement(), false);
37246      }
37247      if (element.hasTypeElement()) {
37248        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37249        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37250      }
37251      if (element.hasEnableWhen()) {
37252        openArray("enableWhen");
37253        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
37254          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
37255        closeArray();
37256      };
37257      if (element.hasRequiredElement()) {
37258        composeBooleanCore("required", element.getRequiredElement(), false);
37259        composeBooleanExtras("required", element.getRequiredElement(), false);
37260      }
37261      if (element.hasRepeatsElement()) {
37262        composeBooleanCore("repeats", element.getRepeatsElement(), false);
37263        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
37264      }
37265      if (element.hasReadOnlyElement()) {
37266        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
37267        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
37268      }
37269      if (element.hasMaxLengthElement()) {
37270        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
37271        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
37272      }
37273      if (element.hasOptions()) {
37274        composeReference("options", element.getOptions());
37275      }
37276      if (element.hasOption()) {
37277        openArray("option");
37278        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
37279          composeQuestionnaireQuestionnaireItemOptionComponent(null, e);
37280        closeArray();
37281      };
37282      if (element.hasInitial()) {
37283        composeType("initial", element.getInitial());
37284      }
37285      if (element.hasItem()) {
37286        openArray("item");
37287        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37288          composeQuestionnaireQuestionnaireItemComponent(null, e);
37289        closeArray();
37290      };
37291  }
37292
37293  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37294    if (element != null) {
37295      open(name);
37296      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
37297      close();
37298    }
37299  }
37300
37301  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37302      composeBackbone(element);
37303      if (element.hasQuestionElement()) {
37304        composeStringCore("question", element.getQuestionElement(), false);
37305        composeStringExtras("question", element.getQuestionElement(), false);
37306      }
37307      if (element.hasHasAnswerElement()) {
37308        composeBooleanCore("hasAnswer", element.getHasAnswerElement(), false);
37309        composeBooleanExtras("hasAnswer", element.getHasAnswerElement(), false);
37310      }
37311      if (element.hasAnswer()) {
37312        composeType("answer", element.getAnswer());
37313      }
37314  }
37315
37316  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37317    if (element != null) {
37318      open(name);
37319      composeQuestionnaireQuestionnaireItemOptionComponentInner(element);
37320      close();
37321    }
37322  }
37323
37324  protected void composeQuestionnaireQuestionnaireItemOptionComponentInner(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37325      composeBackbone(element);
37326      if (element.hasValue()) {
37327        composeType("value", element.getValue());
37328      }
37329  }
37330
37331  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
37332    if (element != null) {
37333      prop("resourceType", name);
37334      composeQuestionnaireResponseInner(element);
37335    }
37336  }
37337
37338  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
37339      composeDomainResourceElements(element);
37340      if (element.hasIdentifier()) {
37341        composeIdentifier("identifier", element.getIdentifier());
37342      }
37343      if (element.hasBasedOn()) {
37344        openArray("basedOn");
37345        for (Reference e : element.getBasedOn()) 
37346          composeReference(null, e);
37347        closeArray();
37348      };
37349      if (element.hasParent()) {
37350        openArray("parent");
37351        for (Reference e : element.getParent()) 
37352          composeReference(null, e);
37353        closeArray();
37354      };
37355      if (element.hasQuestionnaire()) {
37356        composeReference("questionnaire", element.getQuestionnaire());
37357      }
37358      if (element.hasStatusElement()) {
37359        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37360        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37361      }
37362      if (element.hasSubject()) {
37363        composeReference("subject", element.getSubject());
37364      }
37365      if (element.hasContext()) {
37366        composeReference("context", element.getContext());
37367      }
37368      if (element.hasAuthoredElement()) {
37369        composeDateTimeCore("authored", element.getAuthoredElement(), false);
37370        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
37371      }
37372      if (element.hasAuthor()) {
37373        composeReference("author", element.getAuthor());
37374      }
37375      if (element.hasSource()) {
37376        composeReference("source", element.getSource());
37377      }
37378      if (element.hasItem()) {
37379        openArray("item");
37380        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37381          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37382        closeArray();
37383      };
37384  }
37385
37386  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37387    if (element != null) {
37388      open(name);
37389      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
37390      close();
37391    }
37392  }
37393
37394  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37395      composeBackbone(element);
37396      if (element.hasLinkIdElement()) {
37397        composeStringCore("linkId", element.getLinkIdElement(), false);
37398        composeStringExtras("linkId", element.getLinkIdElement(), false);
37399      }
37400      if (element.hasDefinitionElement()) {
37401        composeUriCore("definition", element.getDefinitionElement(), false);
37402        composeUriExtras("definition", element.getDefinitionElement(), false);
37403      }
37404      if (element.hasTextElement()) {
37405        composeStringCore("text", element.getTextElement(), false);
37406        composeStringExtras("text", element.getTextElement(), false);
37407      }
37408      if (element.hasSubject()) {
37409        composeReference("subject", element.getSubject());
37410      }
37411      if (element.hasAnswer()) {
37412        openArray("answer");
37413        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
37414          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
37415        closeArray();
37416      };
37417      if (element.hasItem()) {
37418        openArray("item");
37419        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37420          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37421        closeArray();
37422      };
37423  }
37424
37425  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37426    if (element != null) {
37427      open(name);
37428      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
37429      close();
37430    }
37431  }
37432
37433  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37434      composeBackbone(element);
37435      if (element.hasValue()) {
37436        composeType("value", element.getValue());
37437      }
37438      if (element.hasItem()) {
37439        openArray("item");
37440        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37441          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37442        closeArray();
37443      };
37444  }
37445
37446  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
37447    if (element != null) {
37448      prop("resourceType", name);
37449      composeReferralRequestInner(element);
37450    }
37451  }
37452
37453  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
37454      composeDomainResourceElements(element);
37455      if (element.hasIdentifier()) {
37456        openArray("identifier");
37457        for (Identifier e : element.getIdentifier()) 
37458          composeIdentifier(null, e);
37459        closeArray();
37460      };
37461      if (element.hasDefinition()) {
37462        openArray("definition");
37463        for (Reference e : element.getDefinition()) 
37464          composeReference(null, e);
37465        closeArray();
37466      };
37467      if (element.hasBasedOn()) {
37468        openArray("basedOn");
37469        for (Reference e : element.getBasedOn()) 
37470          composeReference(null, e);
37471        closeArray();
37472      };
37473      if (element.hasReplaces()) {
37474        openArray("replaces");
37475        for (Reference e : element.getReplaces()) 
37476          composeReference(null, e);
37477        closeArray();
37478      };
37479      if (element.hasGroupIdentifier()) {
37480        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37481      }
37482      if (element.hasStatusElement()) {
37483        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37484        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37485      }
37486      if (element.hasIntentElement()) {
37487        composeEnumerationCore("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37488        composeEnumerationExtras("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37489      }
37490      if (element.hasType()) {
37491        composeCodeableConcept("type", element.getType());
37492      }
37493      if (element.hasPriorityElement()) {
37494        composeEnumerationCore("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37495        composeEnumerationExtras("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37496      }
37497      if (element.hasServiceRequested()) {
37498        openArray("serviceRequested");
37499        for (CodeableConcept e : element.getServiceRequested()) 
37500          composeCodeableConcept(null, e);
37501        closeArray();
37502      };
37503      if (element.hasSubject()) {
37504        composeReference("subject", element.getSubject());
37505      }
37506      if (element.hasContext()) {
37507        composeReference("context", element.getContext());
37508      }
37509      if (element.hasOccurrence()) {
37510        composeType("occurrence", element.getOccurrence());
37511      }
37512      if (element.hasAuthoredOnElement()) {
37513        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37514        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37515      }
37516      if (element.hasRequester()) {
37517        composeReferralRequestReferralRequestRequesterComponent("requester", element.getRequester());
37518      }
37519      if (element.hasSpecialty()) {
37520        composeCodeableConcept("specialty", element.getSpecialty());
37521      }
37522      if (element.hasRecipient()) {
37523        openArray("recipient");
37524        for (Reference e : element.getRecipient()) 
37525          composeReference(null, e);
37526        closeArray();
37527      };
37528      if (element.hasReasonCode()) {
37529        openArray("reasonCode");
37530        for (CodeableConcept e : element.getReasonCode()) 
37531          composeCodeableConcept(null, e);
37532        closeArray();
37533      };
37534      if (element.hasReasonReference()) {
37535        openArray("reasonReference");
37536        for (Reference e : element.getReasonReference()) 
37537          composeReference(null, e);
37538        closeArray();
37539      };
37540      if (element.hasDescriptionElement()) {
37541        composeStringCore("description", element.getDescriptionElement(), false);
37542        composeStringExtras("description", element.getDescriptionElement(), false);
37543      }
37544      if (element.hasSupportingInfo()) {
37545        openArray("supportingInfo");
37546        for (Reference e : element.getSupportingInfo()) 
37547          composeReference(null, e);
37548        closeArray();
37549      };
37550      if (element.hasNote()) {
37551        openArray("note");
37552        for (Annotation e : element.getNote()) 
37553          composeAnnotation(null, e);
37554        closeArray();
37555      };
37556      if (element.hasRelevantHistory()) {
37557        openArray("relevantHistory");
37558        for (Reference e : element.getRelevantHistory()) 
37559          composeReference(null, e);
37560        closeArray();
37561      };
37562  }
37563
37564  protected void composeReferralRequestReferralRequestRequesterComponent(String name, ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37565    if (element != null) {
37566      open(name);
37567      composeReferralRequestReferralRequestRequesterComponentInner(element);
37568      close();
37569    }
37570  }
37571
37572  protected void composeReferralRequestReferralRequestRequesterComponentInner(ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37573      composeBackbone(element);
37574      if (element.hasAgent()) {
37575        composeReference("agent", element.getAgent());
37576      }
37577      if (element.hasOnBehalfOf()) {
37578        composeReference("onBehalfOf", element.getOnBehalfOf());
37579      }
37580  }
37581
37582  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
37583    if (element != null) {
37584      prop("resourceType", name);
37585      composeRelatedPersonInner(element);
37586    }
37587  }
37588
37589  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
37590      composeDomainResourceElements(element);
37591      if (element.hasIdentifier()) {
37592        openArray("identifier");
37593        for (Identifier e : element.getIdentifier()) 
37594          composeIdentifier(null, e);
37595        closeArray();
37596      };
37597      if (element.hasActiveElement()) {
37598        composeBooleanCore("active", element.getActiveElement(), false);
37599        composeBooleanExtras("active", element.getActiveElement(), false);
37600      }
37601      if (element.hasPatient()) {
37602        composeReference("patient", element.getPatient());
37603      }
37604      if (element.hasRelationship()) {
37605        composeCodeableConcept("relationship", element.getRelationship());
37606      }
37607      if (element.hasName()) {
37608        openArray("name");
37609        for (HumanName e : element.getName()) 
37610          composeHumanName(null, e);
37611        closeArray();
37612      };
37613      if (element.hasTelecom()) {
37614        openArray("telecom");
37615        for (ContactPoint e : element.getTelecom()) 
37616          composeContactPoint(null, e);
37617        closeArray();
37618      };
37619      if (element.hasGenderElement()) {
37620        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37621        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37622      }
37623      if (element.hasBirthDateElement()) {
37624        composeDateCore("birthDate", element.getBirthDateElement(), false);
37625        composeDateExtras("birthDate", element.getBirthDateElement(), false);
37626      }
37627      if (element.hasAddress()) {
37628        openArray("address");
37629        for (Address e : element.getAddress()) 
37630          composeAddress(null, e);
37631        closeArray();
37632      };
37633      if (element.hasPhoto()) {
37634        openArray("photo");
37635        for (Attachment e : element.getPhoto()) 
37636          composeAttachment(null, e);
37637        closeArray();
37638      };
37639      if (element.hasPeriod()) {
37640        composePeriod("period", element.getPeriod());
37641      }
37642  }
37643
37644  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
37645    if (element != null) {
37646      prop("resourceType", name);
37647      composeRequestGroupInner(element);
37648    }
37649  }
37650
37651  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
37652      composeDomainResourceElements(element);
37653      if (element.hasIdentifier()) {
37654        openArray("identifier");
37655        for (Identifier e : element.getIdentifier()) 
37656          composeIdentifier(null, e);
37657        closeArray();
37658      };
37659      if (element.hasDefinition()) {
37660        openArray("definition");
37661        for (Reference e : element.getDefinition()) 
37662          composeReference(null, e);
37663        closeArray();
37664      };
37665      if (element.hasBasedOn()) {
37666        openArray("basedOn");
37667        for (Reference e : element.getBasedOn()) 
37668          composeReference(null, e);
37669        closeArray();
37670      };
37671      if (element.hasReplaces()) {
37672        openArray("replaces");
37673        for (Reference e : element.getReplaces()) 
37674          composeReference(null, e);
37675        closeArray();
37676      };
37677      if (element.hasGroupIdentifier()) {
37678        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37679      }
37680      if (element.hasStatusElement()) {
37681        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
37682        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
37683      }
37684      if (element.hasIntentElement()) {
37685        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
37686        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
37687      }
37688      if (element.hasPriorityElement()) {
37689        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
37690        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
37691      }
37692      if (element.hasSubject()) {
37693        composeReference("subject", element.getSubject());
37694      }
37695      if (element.hasContext()) {
37696        composeReference("context", element.getContext());
37697      }
37698      if (element.hasAuthoredOnElement()) {
37699        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37700        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37701      }
37702      if (element.hasAuthor()) {
37703        composeReference("author", element.getAuthor());
37704      }
37705      if (element.hasReason()) {
37706        composeType("reason", element.getReason());
37707      }
37708      if (element.hasNote()) {
37709        openArray("note");
37710        for (Annotation e : element.getNote()) 
37711          composeAnnotation(null, e);
37712        closeArray();
37713      };
37714      if (element.hasAction()) {
37715        openArray("action");
37716        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
37717          composeRequestGroupRequestGroupActionComponent(null, e);
37718        closeArray();
37719      };
37720  }
37721
37722  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
37723    if (element != null) {
37724      open(name);
37725      composeRequestGroupRequestGroupActionComponentInner(element);
37726      close();
37727    }
37728  }
37729
37730  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
37731      composeBackbone(element);
37732      if (element.hasLabelElement()) {
37733        composeStringCore("label", element.getLabelElement(), false);
37734        composeStringExtras("label", element.getLabelElement(), false);
37735      }
37736      if (element.hasTitleElement()) {
37737        composeStringCore("title", element.getTitleElement(), false);
37738        composeStringExtras("title", element.getTitleElement(), false);
37739      }
37740      if (element.hasDescriptionElement()) {
37741        composeStringCore("description", element.getDescriptionElement(), false);
37742        composeStringExtras("description", element.getDescriptionElement(), false);
37743      }
37744      if (element.hasTextEquivalentElement()) {
37745        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
37746        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
37747      }
37748      if (element.hasCode()) {
37749        openArray("code");
37750        for (CodeableConcept e : element.getCode()) 
37751          composeCodeableConcept(null, e);
37752        closeArray();
37753      };
37754      if (element.hasDocumentation()) {
37755        openArray("documentation");
37756        for (RelatedArtifact e : element.getDocumentation()) 
37757          composeRelatedArtifact(null, e);
37758        closeArray();
37759      };
37760      if (element.hasCondition()) {
37761        openArray("condition");
37762        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
37763          composeRequestGroupRequestGroupActionConditionComponent(null, e);
37764        closeArray();
37765      };
37766      if (element.hasRelatedAction()) {
37767        openArray("relatedAction");
37768        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
37769          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
37770        closeArray();
37771      };
37772      if (element.hasTiming()) {
37773        composeType("timing", element.getTiming());
37774      }
37775      if (element.hasParticipant()) {
37776        openArray("participant");
37777        for (Reference e : element.getParticipant()) 
37778          composeReference(null, e);
37779        closeArray();
37780      };
37781      if (element.hasType()) {
37782        composeCoding("type", element.getType());
37783      }
37784      if (element.hasGroupingBehaviorElement()) {
37785        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
37786        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
37787      }
37788      if (element.hasSelectionBehaviorElement()) {
37789        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
37790        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
37791      }
37792      if (element.hasRequiredBehaviorElement()) {
37793        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
37794        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
37795      }
37796      if (element.hasPrecheckBehaviorElement()) {
37797        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
37798        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
37799      }
37800      if (element.hasCardinalityBehaviorElement()) {
37801        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
37802        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
37803      }
37804      if (element.hasResource()) {
37805        composeReference("resource", element.getResource());
37806      }
37807      if (element.hasAction()) {
37808        openArray("action");
37809        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
37810          composeRequestGroupRequestGroupActionComponent(null, e);
37811        closeArray();
37812      };
37813  }
37814
37815  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
37816    if (element != null) {
37817      open(name);
37818      composeRequestGroupRequestGroupActionConditionComponentInner(element);
37819      close();
37820    }
37821  }
37822
37823  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
37824      composeBackbone(element);
37825      if (element.hasKindElement()) {
37826        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
37827        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
37828      }
37829      if (element.hasDescriptionElement()) {
37830        composeStringCore("description", element.getDescriptionElement(), false);
37831        composeStringExtras("description", element.getDescriptionElement(), false);
37832      }
37833      if (element.hasLanguageElement()) {
37834        composeStringCore("language", element.getLanguageElement(), false);
37835        composeStringExtras("language", element.getLanguageElement(), false);
37836      }
37837      if (element.hasExpressionElement()) {
37838        composeStringCore("expression", element.getExpressionElement(), false);
37839        composeStringExtras("expression", element.getExpressionElement(), false);
37840      }
37841  }
37842
37843  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
37844    if (element != null) {
37845      open(name);
37846      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
37847      close();
37848    }
37849  }
37850
37851  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
37852      composeBackbone(element);
37853      if (element.hasActionIdElement()) {
37854        composeIdCore("actionId", element.getActionIdElement(), false);
37855        composeIdExtras("actionId", element.getActionIdElement(), false);
37856      }
37857      if (element.hasRelationshipElement()) {
37858        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
37859        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
37860      }
37861      if (element.hasOffset()) {
37862        composeType("offset", element.getOffset());
37863      }
37864  }
37865
37866  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
37867    if (element != null) {
37868      prop("resourceType", name);
37869      composeResearchStudyInner(element);
37870    }
37871  }
37872
37873  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
37874      composeDomainResourceElements(element);
37875      if (element.hasIdentifier()) {
37876        openArray("identifier");
37877        for (Identifier e : element.getIdentifier()) 
37878          composeIdentifier(null, e);
37879        closeArray();
37880      };
37881      if (element.hasTitleElement()) {
37882        composeStringCore("title", element.getTitleElement(), false);
37883        composeStringExtras("title", element.getTitleElement(), false);
37884      }
37885      if (element.hasProtocol()) {
37886        openArray("protocol");
37887        for (Reference e : element.getProtocol()) 
37888          composeReference(null, e);
37889        closeArray();
37890      };
37891      if (element.hasPartOf()) {
37892        openArray("partOf");
37893        for (Reference e : element.getPartOf()) 
37894          composeReference(null, e);
37895        closeArray();
37896      };
37897      if (element.hasStatusElement()) {
37898        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
37899        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
37900      }
37901      if (element.hasCategory()) {
37902        openArray("category");
37903        for (CodeableConcept e : element.getCategory()) 
37904          composeCodeableConcept(null, e);
37905        closeArray();
37906      };
37907      if (element.hasFocus()) {
37908        openArray("focus");
37909        for (CodeableConcept e : element.getFocus()) 
37910          composeCodeableConcept(null, e);
37911        closeArray();
37912      };
37913      if (element.hasContact()) {
37914        openArray("contact");
37915        for (ContactDetail e : element.getContact()) 
37916          composeContactDetail(null, e);
37917        closeArray();
37918      };
37919      if (element.hasRelatedArtifact()) {
37920        openArray("relatedArtifact");
37921        for (RelatedArtifact e : element.getRelatedArtifact()) 
37922          composeRelatedArtifact(null, e);
37923        closeArray();
37924      };
37925      if (element.hasKeyword()) {
37926        openArray("keyword");
37927        for (CodeableConcept e : element.getKeyword()) 
37928          composeCodeableConcept(null, e);
37929        closeArray();
37930      };
37931      if (element.hasJurisdiction()) {
37932        openArray("jurisdiction");
37933        for (CodeableConcept e : element.getJurisdiction()) 
37934          composeCodeableConcept(null, e);
37935        closeArray();
37936      };
37937      if (element.hasDescriptionElement()) {
37938        composeMarkdownCore("description", element.getDescriptionElement(), false);
37939        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37940      }
37941      if (element.hasEnrollment()) {
37942        openArray("enrollment");
37943        for (Reference e : element.getEnrollment()) 
37944          composeReference(null, e);
37945        closeArray();
37946      };
37947      if (element.hasPeriod()) {
37948        composePeriod("period", element.getPeriod());
37949      }
37950      if (element.hasSponsor()) {
37951        composeReference("sponsor", element.getSponsor());
37952      }
37953      if (element.hasPrincipalInvestigator()) {
37954        composeReference("principalInvestigator", element.getPrincipalInvestigator());
37955      }
37956      if (element.hasSite()) {
37957        openArray("site");
37958        for (Reference e : element.getSite()) 
37959          composeReference(null, e);
37960        closeArray();
37961      };
37962      if (element.hasReasonStopped()) {
37963        composeCodeableConcept("reasonStopped", element.getReasonStopped());
37964      }
37965      if (element.hasNote()) {
37966        openArray("note");
37967        for (Annotation e : element.getNote()) 
37968          composeAnnotation(null, e);
37969        closeArray();
37970      };
37971      if (element.hasArm()) {
37972        openArray("arm");
37973        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
37974          composeResearchStudyResearchStudyArmComponent(null, e);
37975        closeArray();
37976      };
37977  }
37978
37979  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
37980    if (element != null) {
37981      open(name);
37982      composeResearchStudyResearchStudyArmComponentInner(element);
37983      close();
37984    }
37985  }
37986
37987  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
37988      composeBackbone(element);
37989      if (element.hasNameElement()) {
37990        composeStringCore("name", element.getNameElement(), false);
37991        composeStringExtras("name", element.getNameElement(), false);
37992      }
37993      if (element.hasCode()) {
37994        composeCodeableConcept("code", element.getCode());
37995      }
37996      if (element.hasDescriptionElement()) {
37997        composeStringCore("description", element.getDescriptionElement(), false);
37998        composeStringExtras("description", element.getDescriptionElement(), false);
37999      }
38000  }
38001
38002  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
38003    if (element != null) {
38004      prop("resourceType", name);
38005      composeResearchSubjectInner(element);
38006    }
38007  }
38008
38009  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
38010      composeDomainResourceElements(element);
38011      if (element.hasIdentifier()) {
38012        composeIdentifier("identifier", element.getIdentifier());
38013      }
38014      if (element.hasStatusElement()) {
38015        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38016        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38017      }
38018      if (element.hasPeriod()) {
38019        composePeriod("period", element.getPeriod());
38020      }
38021      if (element.hasStudy()) {
38022        composeReference("study", element.getStudy());
38023      }
38024      if (element.hasIndividual()) {
38025        composeReference("individual", element.getIndividual());
38026      }
38027      if (element.hasAssignedArmElement()) {
38028        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
38029        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
38030      }
38031      if (element.hasActualArmElement()) {
38032        composeStringCore("actualArm", element.getActualArmElement(), false);
38033        composeStringExtras("actualArm", element.getActualArmElement(), false);
38034      }
38035      if (element.hasConsent()) {
38036        composeReference("consent", element.getConsent());
38037      }
38038  }
38039
38040  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
38041    if (element != null) {
38042      prop("resourceType", name);
38043      composeRiskAssessmentInner(element);
38044    }
38045  }
38046
38047  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
38048      composeDomainResourceElements(element);
38049      if (element.hasIdentifier()) {
38050        composeIdentifier("identifier", element.getIdentifier());
38051      }
38052      if (element.hasBasedOn()) {
38053        composeReference("basedOn", element.getBasedOn());
38054      }
38055      if (element.hasParent()) {
38056        composeReference("parent", element.getParent());
38057      }
38058      if (element.hasStatusElement()) {
38059        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38060        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38061      }
38062      if (element.hasMethod()) {
38063        composeCodeableConcept("method", element.getMethod());
38064      }
38065      if (element.hasCode()) {
38066        composeCodeableConcept("code", element.getCode());
38067      }
38068      if (element.hasSubject()) {
38069        composeReference("subject", element.getSubject());
38070      }
38071      if (element.hasContext()) {
38072        composeReference("context", element.getContext());
38073      }
38074      if (element.hasOccurrence()) {
38075        composeType("occurrence", element.getOccurrence());
38076      }
38077      if (element.hasCondition()) {
38078        composeReference("condition", element.getCondition());
38079      }
38080      if (element.hasPerformer()) {
38081        composeReference("performer", element.getPerformer());
38082      }
38083      if (element.hasReason()) {
38084        composeType("reason", element.getReason());
38085      }
38086      if (element.hasBasis()) {
38087        openArray("basis");
38088        for (Reference e : element.getBasis()) 
38089          composeReference(null, e);
38090        closeArray();
38091      };
38092      if (element.hasPrediction()) {
38093        openArray("prediction");
38094        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
38095          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
38096        closeArray();
38097      };
38098      if (element.hasMitigationElement()) {
38099        composeStringCore("mitigation", element.getMitigationElement(), false);
38100        composeStringExtras("mitigation", element.getMitigationElement(), false);
38101      }
38102      if (element.hasCommentElement()) {
38103        composeStringCore("comment", element.getCommentElement(), false);
38104        composeStringExtras("comment", element.getCommentElement(), false);
38105      }
38106  }
38107
38108  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38109    if (element != null) {
38110      open(name);
38111      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
38112      close();
38113    }
38114  }
38115
38116  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38117      composeBackbone(element);
38118      if (element.hasOutcome()) {
38119        composeCodeableConcept("outcome", element.getOutcome());
38120      }
38121      if (element.hasProbability()) {
38122        composeType("probability", element.getProbability());
38123      }
38124      if (element.hasQualitativeRisk()) {
38125        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
38126      }
38127      if (element.hasRelativeRiskElement()) {
38128        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
38129        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
38130      }
38131      if (element.hasWhen()) {
38132        composeType("when", element.getWhen());
38133      }
38134      if (element.hasRationaleElement()) {
38135        composeStringCore("rationale", element.getRationaleElement(), false);
38136        composeStringExtras("rationale", element.getRationaleElement(), false);
38137      }
38138  }
38139
38140  protected void composeSchedule(String name, Schedule element) throws IOException {
38141    if (element != null) {
38142      prop("resourceType", name);
38143      composeScheduleInner(element);
38144    }
38145  }
38146
38147  protected void composeScheduleInner(Schedule element) throws IOException {
38148      composeDomainResourceElements(element);
38149      if (element.hasIdentifier()) {
38150        openArray("identifier");
38151        for (Identifier e : element.getIdentifier()) 
38152          composeIdentifier(null, e);
38153        closeArray();
38154      };
38155      if (element.hasActiveElement()) {
38156        composeBooleanCore("active", element.getActiveElement(), false);
38157        composeBooleanExtras("active", element.getActiveElement(), false);
38158      }
38159      if (element.hasServiceCategory()) {
38160        composeCodeableConcept("serviceCategory", element.getServiceCategory());
38161      }
38162      if (element.hasServiceType()) {
38163        openArray("serviceType");
38164        for (CodeableConcept e : element.getServiceType()) 
38165          composeCodeableConcept(null, e);
38166        closeArray();
38167      };
38168      if (element.hasSpecialty()) {
38169        openArray("specialty");
38170        for (CodeableConcept e : element.getSpecialty()) 
38171          composeCodeableConcept(null, e);
38172        closeArray();
38173      };
38174      if (element.hasActor()) {
38175        openArray("actor");
38176        for (Reference e : element.getActor()) 
38177          composeReference(null, e);
38178        closeArray();
38179      };
38180      if (element.hasPlanningHorizon()) {
38181        composePeriod("planningHorizon", element.getPlanningHorizon());
38182      }
38183      if (element.hasCommentElement()) {
38184        composeStringCore("comment", element.getCommentElement(), false);
38185        composeStringExtras("comment", element.getCommentElement(), false);
38186      }
38187  }
38188
38189  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
38190    if (element != null) {
38191      prop("resourceType", name);
38192      composeSearchParameterInner(element);
38193    }
38194  }
38195
38196  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
38197      composeDomainResourceElements(element);
38198      if (element.hasUrlElement()) {
38199        composeUriCore("url", element.getUrlElement(), false);
38200        composeUriExtras("url", element.getUrlElement(), false);
38201      }
38202      if (element.hasVersionElement()) {
38203        composeStringCore("version", element.getVersionElement(), false);
38204        composeStringExtras("version", element.getVersionElement(), false);
38205      }
38206      if (element.hasNameElement()) {
38207        composeStringCore("name", element.getNameElement(), false);
38208        composeStringExtras("name", element.getNameElement(), false);
38209      }
38210      if (element.hasStatusElement()) {
38211        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38212        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38213      }
38214      if (element.hasExperimentalElement()) {
38215        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38216        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38217      }
38218      if (element.hasDateElement()) {
38219        composeDateTimeCore("date", element.getDateElement(), false);
38220        composeDateTimeExtras("date", element.getDateElement(), false);
38221      }
38222      if (element.hasPublisherElement()) {
38223        composeStringCore("publisher", element.getPublisherElement(), false);
38224        composeStringExtras("publisher", element.getPublisherElement(), false);
38225      }
38226      if (element.hasContact()) {
38227        openArray("contact");
38228        for (ContactDetail e : element.getContact()) 
38229          composeContactDetail(null, e);
38230        closeArray();
38231      };
38232      if (element.hasUseContext()) {
38233        openArray("useContext");
38234        for (UsageContext e : element.getUseContext()) 
38235          composeUsageContext(null, e);
38236        closeArray();
38237      };
38238      if (element.hasJurisdiction()) {
38239        openArray("jurisdiction");
38240        for (CodeableConcept e : element.getJurisdiction()) 
38241          composeCodeableConcept(null, e);
38242        closeArray();
38243      };
38244      if (element.hasPurposeElement()) {
38245        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38246        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38247      }
38248      if (element.hasCodeElement()) {
38249        composeCodeCore("code", element.getCodeElement(), false);
38250        composeCodeExtras("code", element.getCodeElement(), false);
38251      }
38252      if (element.hasBase()) {
38253        openArray("base");
38254        for (CodeType e : element.getBase()) 
38255          composeCodeCore(null, e, true);
38256        closeArray();
38257        if (anyHasExtras(element.getBase())) {
38258          openArray("_base");
38259          for (CodeType e : element.getBase()) 
38260            composeCodeExtras(null, e, true);
38261          closeArray();
38262        }
38263      };
38264      if (element.hasTypeElement()) {
38265        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38266        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38267      }
38268      if (element.hasDerivedFromElement()) {
38269        composeUriCore("derivedFrom", element.getDerivedFromElement(), false);
38270        composeUriExtras("derivedFrom", element.getDerivedFromElement(), false);
38271      }
38272      if (element.hasDescriptionElement()) {
38273        composeMarkdownCore("description", element.getDescriptionElement(), false);
38274        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38275      }
38276      if (element.hasExpressionElement()) {
38277        composeStringCore("expression", element.getExpressionElement(), false);
38278        composeStringExtras("expression", element.getExpressionElement(), false);
38279      }
38280      if (element.hasXpathElement()) {
38281        composeStringCore("xpath", element.getXpathElement(), false);
38282        composeStringExtras("xpath", element.getXpathElement(), false);
38283      }
38284      if (element.hasXpathUsageElement()) {
38285        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38286        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38287      }
38288      if (element.hasTarget()) {
38289        openArray("target");
38290        for (CodeType e : element.getTarget()) 
38291          composeCodeCore(null, e, true);
38292        closeArray();
38293        if (anyHasExtras(element.getTarget())) {
38294          openArray("_target");
38295          for (CodeType e : element.getTarget()) 
38296            composeCodeExtras(null, e, true);
38297          closeArray();
38298        }
38299      };
38300      if (element.hasComparator()) {
38301        openArray("comparator");
38302        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38303          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38304        closeArray();
38305        if (anyHasExtras(element.getComparator())) {
38306          openArray("_comparator");
38307          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38308            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38309          closeArray();
38310        }
38311      };
38312      if (element.hasModifier()) {
38313        openArray("modifier");
38314        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38315          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38316        closeArray();
38317        if (anyHasExtras(element.getModifier())) {
38318          openArray("_modifier");
38319          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38320            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38321          closeArray();
38322        }
38323      };
38324      if (element.hasChain()) {
38325        openArray("chain");
38326        for (StringType e : element.getChain()) 
38327          composeStringCore(null, e, true);
38328        closeArray();
38329        if (anyHasExtras(element.getChain())) {
38330          openArray("_chain");
38331          for (StringType e : element.getChain()) 
38332            composeStringExtras(null, e, true);
38333          closeArray();
38334        }
38335      };
38336      if (element.hasComponent()) {
38337        openArray("component");
38338        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
38339          composeSearchParameterSearchParameterComponentComponent(null, e);
38340        closeArray();
38341      };
38342  }
38343
38344  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
38345    if (element != null) {
38346      open(name);
38347      composeSearchParameterSearchParameterComponentComponentInner(element);
38348      close();
38349    }
38350  }
38351
38352  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
38353      composeBackbone(element);
38354      if (element.hasDefinition()) {
38355        composeReference("definition", element.getDefinition());
38356      }
38357      if (element.hasExpressionElement()) {
38358        composeStringCore("expression", element.getExpressionElement(), false);
38359        composeStringExtras("expression", element.getExpressionElement(), false);
38360      }
38361  }
38362
38363  protected void composeSequence(String name, Sequence element) throws IOException {
38364    if (element != null) {
38365      prop("resourceType", name);
38366      composeSequenceInner(element);
38367    }
38368  }
38369
38370  protected void composeSequenceInner(Sequence element) throws IOException {
38371      composeDomainResourceElements(element);
38372      if (element.hasIdentifier()) {
38373        openArray("identifier");
38374        for (Identifier e : element.getIdentifier()) 
38375          composeIdentifier(null, e);
38376        closeArray();
38377      };
38378      if (element.hasTypeElement()) {
38379        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38380        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38381      }
38382      if (element.hasCoordinateSystemElement()) {
38383        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
38384        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
38385      }
38386      if (element.hasPatient()) {
38387        composeReference("patient", element.getPatient());
38388      }
38389      if (element.hasSpecimen()) {
38390        composeReference("specimen", element.getSpecimen());
38391      }
38392      if (element.hasDevice()) {
38393        composeReference("device", element.getDevice());
38394      }
38395      if (element.hasPerformer()) {
38396        composeReference("performer", element.getPerformer());
38397      }
38398      if (element.hasQuantity()) {
38399        composeQuantity("quantity", element.getQuantity());
38400      }
38401      if (element.hasReferenceSeq()) {
38402        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
38403      }
38404      if (element.hasVariant()) {
38405        openArray("variant");
38406        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
38407          composeSequenceSequenceVariantComponent(null, e);
38408        closeArray();
38409      };
38410      if (element.hasObservedSeqElement()) {
38411        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
38412        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
38413      }
38414      if (element.hasQuality()) {
38415        openArray("quality");
38416        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
38417          composeSequenceSequenceQualityComponent(null, e);
38418        closeArray();
38419      };
38420      if (element.hasReadCoverageElement()) {
38421        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
38422        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
38423      }
38424      if (element.hasRepository()) {
38425        openArray("repository");
38426        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
38427          composeSequenceSequenceRepositoryComponent(null, e);
38428        closeArray();
38429      };
38430      if (element.hasPointer()) {
38431        openArray("pointer");
38432        for (Reference e : element.getPointer()) 
38433          composeReference(null, e);
38434        closeArray();
38435      };
38436  }
38437
38438  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
38439    if (element != null) {
38440      open(name);
38441      composeSequenceSequenceReferenceSeqComponentInner(element);
38442      close();
38443    }
38444  }
38445
38446  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
38447      composeBackbone(element);
38448      if (element.hasChromosome()) {
38449        composeCodeableConcept("chromosome", element.getChromosome());
38450      }
38451      if (element.hasGenomeBuildElement()) {
38452        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
38453        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
38454      }
38455      if (element.hasReferenceSeqId()) {
38456        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
38457      }
38458      if (element.hasReferenceSeqPointer()) {
38459        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
38460      }
38461      if (element.hasReferenceSeqStringElement()) {
38462        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
38463        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
38464      }
38465      if (element.hasStrandElement()) {
38466        composeIntegerCore("strand", element.getStrandElement(), false);
38467        composeIntegerExtras("strand", element.getStrandElement(), false);
38468      }
38469      if (element.hasWindowStartElement()) {
38470        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
38471        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
38472      }
38473      if (element.hasWindowEndElement()) {
38474        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
38475        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
38476      }
38477  }
38478
38479  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
38480    if (element != null) {
38481      open(name);
38482      composeSequenceSequenceVariantComponentInner(element);
38483      close();
38484    }
38485  }
38486
38487  protected void composeSequenceSequenceVariantComponentInner(Sequence.SequenceVariantComponent element) throws IOException {
38488      composeBackbone(element);
38489      if (element.hasStartElement()) {
38490        composeIntegerCore("start", element.getStartElement(), false);
38491        composeIntegerExtras("start", element.getStartElement(), false);
38492      }
38493      if (element.hasEndElement()) {
38494        composeIntegerCore("end", element.getEndElement(), false);
38495        composeIntegerExtras("end", element.getEndElement(), false);
38496      }
38497      if (element.hasObservedAlleleElement()) {
38498        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
38499        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
38500      }
38501      if (element.hasReferenceAlleleElement()) {
38502        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
38503        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
38504      }
38505      if (element.hasCigarElement()) {
38506        composeStringCore("cigar", element.getCigarElement(), false);
38507        composeStringExtras("cigar", element.getCigarElement(), false);
38508      }
38509      if (element.hasVariantPointer()) {
38510        composeReference("variantPointer", element.getVariantPointer());
38511      }
38512  }
38513
38514  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
38515    if (element != null) {
38516      open(name);
38517      composeSequenceSequenceQualityComponentInner(element);
38518      close();
38519    }
38520  }
38521
38522  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
38523      composeBackbone(element);
38524      if (element.hasTypeElement()) {
38525        composeEnumerationCore("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38526        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38527      }
38528      if (element.hasStandardSequence()) {
38529        composeCodeableConcept("standardSequence", element.getStandardSequence());
38530      }
38531      if (element.hasStartElement()) {
38532        composeIntegerCore("start", element.getStartElement(), false);
38533        composeIntegerExtras("start", element.getStartElement(), false);
38534      }
38535      if (element.hasEndElement()) {
38536        composeIntegerCore("end", element.getEndElement(), false);
38537        composeIntegerExtras("end", element.getEndElement(), false);
38538      }
38539      if (element.hasScore()) {
38540        composeQuantity("score", element.getScore());
38541      }
38542      if (element.hasMethod()) {
38543        composeCodeableConcept("method", element.getMethod());
38544      }
38545      if (element.hasTruthTPElement()) {
38546        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
38547        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
38548      }
38549      if (element.hasQueryTPElement()) {
38550        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
38551        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
38552      }
38553      if (element.hasTruthFNElement()) {
38554        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
38555        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
38556      }
38557      if (element.hasQueryFPElement()) {
38558        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
38559        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
38560      }
38561      if (element.hasGtFPElement()) {
38562        composeDecimalCore("gtFP", element.getGtFPElement(), false);
38563        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
38564      }
38565      if (element.hasPrecisionElement()) {
38566        composeDecimalCore("precision", element.getPrecisionElement(), false);
38567        composeDecimalExtras("precision", element.getPrecisionElement(), false);
38568      }
38569      if (element.hasRecallElement()) {
38570        composeDecimalCore("recall", element.getRecallElement(), false);
38571        composeDecimalExtras("recall", element.getRecallElement(), false);
38572      }
38573      if (element.hasFScoreElement()) {
38574        composeDecimalCore("fScore", element.getFScoreElement(), false);
38575        composeDecimalExtras("fScore", element.getFScoreElement(), false);
38576      }
38577  }
38578
38579  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
38580    if (element != null) {
38581      open(name);
38582      composeSequenceSequenceRepositoryComponentInner(element);
38583      close();
38584    }
38585  }
38586
38587  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
38588      composeBackbone(element);
38589      if (element.hasTypeElement()) {
38590        composeEnumerationCore("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38591        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38592      }
38593      if (element.hasUrlElement()) {
38594        composeUriCore("url", element.getUrlElement(), false);
38595        composeUriExtras("url", element.getUrlElement(), false);
38596      }
38597      if (element.hasNameElement()) {
38598        composeStringCore("name", element.getNameElement(), false);
38599        composeStringExtras("name", element.getNameElement(), false);
38600      }
38601      if (element.hasDatasetIdElement()) {
38602        composeStringCore("datasetId", element.getDatasetIdElement(), false);
38603        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
38604      }
38605      if (element.hasVariantsetIdElement()) {
38606        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
38607        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
38608      }
38609      if (element.hasReadsetIdElement()) {
38610        composeStringCore("readsetId", element.getReadsetIdElement(), false);
38611        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
38612      }
38613  }
38614
38615  protected void composeServiceDefinition(String name, ServiceDefinition element) throws IOException {
38616    if (element != null) {
38617      prop("resourceType", name);
38618      composeServiceDefinitionInner(element);
38619    }
38620  }
38621
38622  protected void composeServiceDefinitionInner(ServiceDefinition element) throws IOException {
38623      composeDomainResourceElements(element);
38624      if (element.hasUrlElement()) {
38625        composeUriCore("url", element.getUrlElement(), false);
38626        composeUriExtras("url", element.getUrlElement(), false);
38627      }
38628      if (element.hasIdentifier()) {
38629        openArray("identifier");
38630        for (Identifier e : element.getIdentifier()) 
38631          composeIdentifier(null, e);
38632        closeArray();
38633      };
38634      if (element.hasVersionElement()) {
38635        composeStringCore("version", element.getVersionElement(), false);
38636        composeStringExtras("version", element.getVersionElement(), false);
38637      }
38638      if (element.hasNameElement()) {
38639        composeStringCore("name", element.getNameElement(), false);
38640        composeStringExtras("name", element.getNameElement(), false);
38641      }
38642      if (element.hasTitleElement()) {
38643        composeStringCore("title", element.getTitleElement(), false);
38644        composeStringExtras("title", element.getTitleElement(), false);
38645      }
38646      if (element.hasStatusElement()) {
38647        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38648        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38649      }
38650      if (element.hasExperimentalElement()) {
38651        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38652        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38653      }
38654      if (element.hasDateElement()) {
38655        composeDateTimeCore("date", element.getDateElement(), false);
38656        composeDateTimeExtras("date", element.getDateElement(), false);
38657      }
38658      if (element.hasPublisherElement()) {
38659        composeStringCore("publisher", element.getPublisherElement(), false);
38660        composeStringExtras("publisher", element.getPublisherElement(), false);
38661      }
38662      if (element.hasDescriptionElement()) {
38663        composeMarkdownCore("description", element.getDescriptionElement(), false);
38664        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38665      }
38666      if (element.hasPurposeElement()) {
38667        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38668        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38669      }
38670      if (element.hasUsageElement()) {
38671        composeStringCore("usage", element.getUsageElement(), false);
38672        composeStringExtras("usage", element.getUsageElement(), false);
38673      }
38674      if (element.hasApprovalDateElement()) {
38675        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
38676        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
38677      }
38678      if (element.hasLastReviewDateElement()) {
38679        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
38680        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
38681      }
38682      if (element.hasEffectivePeriod()) {
38683        composePeriod("effectivePeriod", element.getEffectivePeriod());
38684      }
38685      if (element.hasUseContext()) {
38686        openArray("useContext");
38687        for (UsageContext e : element.getUseContext()) 
38688          composeUsageContext(null, e);
38689        closeArray();
38690      };
38691      if (element.hasJurisdiction()) {
38692        openArray("jurisdiction");
38693        for (CodeableConcept e : element.getJurisdiction()) 
38694          composeCodeableConcept(null, e);
38695        closeArray();
38696      };
38697      if (element.hasTopic()) {
38698        openArray("topic");
38699        for (CodeableConcept e : element.getTopic()) 
38700          composeCodeableConcept(null, e);
38701        closeArray();
38702      };
38703      if (element.hasContributor()) {
38704        openArray("contributor");
38705        for (Contributor e : element.getContributor()) 
38706          composeContributor(null, e);
38707        closeArray();
38708      };
38709      if (element.hasContact()) {
38710        openArray("contact");
38711        for (ContactDetail e : element.getContact()) 
38712          composeContactDetail(null, e);
38713        closeArray();
38714      };
38715      if (element.hasCopyrightElement()) {
38716        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38717        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38718      }
38719      if (element.hasRelatedArtifact()) {
38720        openArray("relatedArtifact");
38721        for (RelatedArtifact e : element.getRelatedArtifact()) 
38722          composeRelatedArtifact(null, e);
38723        closeArray();
38724      };
38725      if (element.hasTrigger()) {
38726        openArray("trigger");
38727        for (TriggerDefinition e : element.getTrigger()) 
38728          composeTriggerDefinition(null, e);
38729        closeArray();
38730      };
38731      if (element.hasDataRequirement()) {
38732        openArray("dataRequirement");
38733        for (DataRequirement e : element.getDataRequirement()) 
38734          composeDataRequirement(null, e);
38735        closeArray();
38736      };
38737      if (element.hasOperationDefinition()) {
38738        composeReference("operationDefinition", element.getOperationDefinition());
38739      }
38740  }
38741
38742  protected void composeSlot(String name, Slot element) throws IOException {
38743    if (element != null) {
38744      prop("resourceType", name);
38745      composeSlotInner(element);
38746    }
38747  }
38748
38749  protected void composeSlotInner(Slot element) throws IOException {
38750      composeDomainResourceElements(element);
38751      if (element.hasIdentifier()) {
38752        openArray("identifier");
38753        for (Identifier e : element.getIdentifier()) 
38754          composeIdentifier(null, e);
38755        closeArray();
38756      };
38757      if (element.hasServiceCategory()) {
38758        composeCodeableConcept("serviceCategory", element.getServiceCategory());
38759      }
38760      if (element.hasServiceType()) {
38761        openArray("serviceType");
38762        for (CodeableConcept e : element.getServiceType()) 
38763          composeCodeableConcept(null, e);
38764        closeArray();
38765      };
38766      if (element.hasSpecialty()) {
38767        openArray("specialty");
38768        for (CodeableConcept e : element.getSpecialty()) 
38769          composeCodeableConcept(null, e);
38770        closeArray();
38771      };
38772      if (element.hasAppointmentType()) {
38773        composeCodeableConcept("appointmentType", element.getAppointmentType());
38774      }
38775      if (element.hasSchedule()) {
38776        composeReference("schedule", element.getSchedule());
38777      }
38778      if (element.hasStatusElement()) {
38779        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
38780        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
38781      }
38782      if (element.hasStartElement()) {
38783        composeInstantCore("start", element.getStartElement(), false);
38784        composeInstantExtras("start", element.getStartElement(), false);
38785      }
38786      if (element.hasEndElement()) {
38787        composeInstantCore("end", element.getEndElement(), false);
38788        composeInstantExtras("end", element.getEndElement(), false);
38789      }
38790      if (element.hasOverbookedElement()) {
38791        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
38792        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
38793      }
38794      if (element.hasCommentElement()) {
38795        composeStringCore("comment", element.getCommentElement(), false);
38796        composeStringExtras("comment", element.getCommentElement(), false);
38797      }
38798  }
38799
38800  protected void composeSpecimen(String name, Specimen element) throws IOException {
38801    if (element != null) {
38802      prop("resourceType", name);
38803      composeSpecimenInner(element);
38804    }
38805  }
38806
38807  protected void composeSpecimenInner(Specimen element) throws IOException {
38808      composeDomainResourceElements(element);
38809      if (element.hasIdentifier()) {
38810        openArray("identifier");
38811        for (Identifier e : element.getIdentifier()) 
38812          composeIdentifier(null, e);
38813        closeArray();
38814      };
38815      if (element.hasAccessionIdentifier()) {
38816        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
38817      }
38818      if (element.hasStatusElement()) {
38819        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
38820        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
38821      }
38822      if (element.hasType()) {
38823        composeCodeableConcept("type", element.getType());
38824      }
38825      if (element.hasSubject()) {
38826        composeReference("subject", element.getSubject());
38827      }
38828      if (element.hasReceivedTimeElement()) {
38829        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
38830        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
38831      }
38832      if (element.hasParent()) {
38833        openArray("parent");
38834        for (Reference e : element.getParent()) 
38835          composeReference(null, e);
38836        closeArray();
38837      };
38838      if (element.hasRequest()) {
38839        openArray("request");
38840        for (Reference e : element.getRequest()) 
38841          composeReference(null, e);
38842        closeArray();
38843      };
38844      if (element.hasCollection()) {
38845        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
38846      }
38847      if (element.hasProcessing()) {
38848        openArray("processing");
38849        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
38850          composeSpecimenSpecimenProcessingComponent(null, e);
38851        closeArray();
38852      };
38853      if (element.hasContainer()) {
38854        openArray("container");
38855        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
38856          composeSpecimenSpecimenContainerComponent(null, e);
38857        closeArray();
38858      };
38859      if (element.hasNote()) {
38860        openArray("note");
38861        for (Annotation e : element.getNote()) 
38862          composeAnnotation(null, e);
38863        closeArray();
38864      };
38865  }
38866
38867  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
38868    if (element != null) {
38869      open(name);
38870      composeSpecimenSpecimenCollectionComponentInner(element);
38871      close();
38872    }
38873  }
38874
38875  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
38876      composeBackbone(element);
38877      if (element.hasCollector()) {
38878        composeReference("collector", element.getCollector());
38879      }
38880      if (element.hasCollected()) {
38881        composeType("collected", element.getCollected());
38882      }
38883      if (element.hasQuantity()) {
38884        composeSimpleQuantity("quantity", element.getQuantity());
38885      }
38886      if (element.hasMethod()) {
38887        composeCodeableConcept("method", element.getMethod());
38888      }
38889      if (element.hasBodySite()) {
38890        composeCodeableConcept("bodySite", element.getBodySite());
38891      }
38892  }
38893
38894  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
38895    if (element != null) {
38896      open(name);
38897      composeSpecimenSpecimenProcessingComponentInner(element);
38898      close();
38899    }
38900  }
38901
38902  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
38903      composeBackbone(element);
38904      if (element.hasDescriptionElement()) {
38905        composeStringCore("description", element.getDescriptionElement(), false);
38906        composeStringExtras("description", element.getDescriptionElement(), false);
38907      }
38908      if (element.hasProcedure()) {
38909        composeCodeableConcept("procedure", element.getProcedure());
38910      }
38911      if (element.hasAdditive()) {
38912        openArray("additive");
38913        for (Reference e : element.getAdditive()) 
38914          composeReference(null, e);
38915        closeArray();
38916      };
38917      if (element.hasTime()) {
38918        composeType("time", element.getTime());
38919      }
38920  }
38921
38922  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
38923    if (element != null) {
38924      open(name);
38925      composeSpecimenSpecimenContainerComponentInner(element);
38926      close();
38927    }
38928  }
38929
38930  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
38931      composeBackbone(element);
38932      if (element.hasIdentifier()) {
38933        openArray("identifier");
38934        for (Identifier e : element.getIdentifier()) 
38935          composeIdentifier(null, e);
38936        closeArray();
38937      };
38938      if (element.hasDescriptionElement()) {
38939        composeStringCore("description", element.getDescriptionElement(), false);
38940        composeStringExtras("description", element.getDescriptionElement(), false);
38941      }
38942      if (element.hasType()) {
38943        composeCodeableConcept("type", element.getType());
38944      }
38945      if (element.hasCapacity()) {
38946        composeSimpleQuantity("capacity", element.getCapacity());
38947      }
38948      if (element.hasSpecimenQuantity()) {
38949        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
38950      }
38951      if (element.hasAdditive()) {
38952        composeType("additive", element.getAdditive());
38953      }
38954  }
38955
38956  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
38957    if (element != null) {
38958      prop("resourceType", name);
38959      composeStructureDefinitionInner(element);
38960    }
38961  }
38962
38963  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
38964      composeDomainResourceElements(element);
38965      if (element.hasUrlElement()) {
38966        composeUriCore("url", element.getUrlElement(), false);
38967        composeUriExtras("url", element.getUrlElement(), false);
38968      }
38969      if (element.hasIdentifier()) {
38970        openArray("identifier");
38971        for (Identifier e : element.getIdentifier()) 
38972          composeIdentifier(null, e);
38973        closeArray();
38974      };
38975      if (element.hasVersionElement()) {
38976        composeStringCore("version", element.getVersionElement(), false);
38977        composeStringExtras("version", element.getVersionElement(), false);
38978      }
38979      if (element.hasNameElement()) {
38980        composeStringCore("name", element.getNameElement(), false);
38981        composeStringExtras("name", element.getNameElement(), false);
38982      }
38983      if (element.hasTitleElement()) {
38984        composeStringCore("title", element.getTitleElement(), false);
38985        composeStringExtras("title", element.getTitleElement(), false);
38986      }
38987      if (element.hasStatusElement()) {
38988        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38989        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38990      }
38991      if (element.hasExperimentalElement()) {
38992        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38993        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38994      }
38995      if (element.hasDateElement()) {
38996        composeDateTimeCore("date", element.getDateElement(), false);
38997        composeDateTimeExtras("date", element.getDateElement(), false);
38998      }
38999      if (element.hasPublisherElement()) {
39000        composeStringCore("publisher", element.getPublisherElement(), false);
39001        composeStringExtras("publisher", element.getPublisherElement(), false);
39002      }
39003      if (element.hasContact()) {
39004        openArray("contact");
39005        for (ContactDetail e : element.getContact()) 
39006          composeContactDetail(null, e);
39007        closeArray();
39008      };
39009      if (element.hasDescriptionElement()) {
39010        composeMarkdownCore("description", element.getDescriptionElement(), false);
39011        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39012      }
39013      if (element.hasUseContext()) {
39014        openArray("useContext");
39015        for (UsageContext e : element.getUseContext()) 
39016          composeUsageContext(null, e);
39017        closeArray();
39018      };
39019      if (element.hasJurisdiction()) {
39020        openArray("jurisdiction");
39021        for (CodeableConcept e : element.getJurisdiction()) 
39022          composeCodeableConcept(null, e);
39023        closeArray();
39024      };
39025      if (element.hasPurposeElement()) {
39026        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39027        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39028      }
39029      if (element.hasCopyrightElement()) {
39030        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39031        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39032      }
39033      if (element.hasKeyword()) {
39034        openArray("keyword");
39035        for (Coding e : element.getKeyword()) 
39036          composeCoding(null, e);
39037        closeArray();
39038      };
39039      if (element.hasFhirVersionElement()) {
39040        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
39041        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
39042      }
39043      if (element.hasMapping()) {
39044        openArray("mapping");
39045        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
39046          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
39047        closeArray();
39048      };
39049      if (element.hasKindElement()) {
39050        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39051        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39052      }
39053      if (element.hasAbstractElement()) {
39054        composeBooleanCore("abstract", element.getAbstractElement(), false);
39055        composeBooleanExtras("abstract", element.getAbstractElement(), false);
39056      }
39057      if (element.hasContextTypeElement()) {
39058        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39059        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39060      }
39061      if (element.hasContext()) {
39062        openArray("context");
39063        for (StringType e : element.getContext()) 
39064          composeStringCore(null, e, true);
39065        closeArray();
39066        if (anyHasExtras(element.getContext())) {
39067          openArray("_context");
39068          for (StringType e : element.getContext()) 
39069            composeStringExtras(null, e, true);
39070          closeArray();
39071        }
39072      };
39073      if (element.hasContextInvariant()) {
39074        openArray("contextInvariant");
39075        for (StringType e : element.getContextInvariant()) 
39076          composeStringCore(null, e, true);
39077        closeArray();
39078        if (anyHasExtras(element.getContextInvariant())) {
39079          openArray("_contextInvariant");
39080          for (StringType e : element.getContextInvariant()) 
39081            composeStringExtras(null, e, true);
39082          closeArray();
39083        }
39084      };
39085      if (element.hasTypeElement()) {
39086        composeCodeCore("type", element.getTypeElement(), false);
39087        composeCodeExtras("type", element.getTypeElement(), false);
39088      }
39089      if (element.hasBaseDefinitionElement()) {
39090        composeUriCore("baseDefinition", element.getBaseDefinitionElement(), false);
39091        composeUriExtras("baseDefinition", element.getBaseDefinitionElement(), false);
39092      }
39093      if (element.hasDerivationElement()) {
39094        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39095        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39096      }
39097      if (element.hasSnapshot()) {
39098        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
39099      }
39100      if (element.hasDifferential()) {
39101        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
39102      }
39103  }
39104
39105  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39106    if (element != null) {
39107      open(name);
39108      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
39109      close();
39110    }
39111  }
39112
39113  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39114      composeBackbone(element);
39115      if (element.hasIdentityElement()) {
39116        composeIdCore("identity", element.getIdentityElement(), false);
39117        composeIdExtras("identity", element.getIdentityElement(), false);
39118      }
39119      if (element.hasUriElement()) {
39120        composeUriCore("uri", element.getUriElement(), false);
39121        composeUriExtras("uri", element.getUriElement(), false);
39122      }
39123      if (element.hasNameElement()) {
39124        composeStringCore("name", element.getNameElement(), false);
39125        composeStringExtras("name", element.getNameElement(), false);
39126      }
39127      if (element.hasCommentElement()) {
39128        composeStringCore("comment", element.getCommentElement(), false);
39129        composeStringExtras("comment", element.getCommentElement(), false);
39130      }
39131  }
39132
39133  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39134    if (element != null) {
39135      open(name);
39136      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
39137      close();
39138    }
39139  }
39140
39141  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39142      composeBackbone(element);
39143      if (element.hasElement()) {
39144        openArray("element");
39145        for (ElementDefinition e : element.getElement()) 
39146          composeElementDefinition(null, e);
39147        closeArray();
39148      };
39149  }
39150
39151  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39152    if (element != null) {
39153      open(name);
39154      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
39155      close();
39156    }
39157  }
39158
39159  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39160      composeBackbone(element);
39161      if (element.hasElement()) {
39162        openArray("element");
39163        for (ElementDefinition e : element.getElement()) 
39164          composeElementDefinition(null, e);
39165        closeArray();
39166      };
39167  }
39168
39169  protected void composeStructureMap(String name, StructureMap element) throws IOException {
39170    if (element != null) {
39171      prop("resourceType", name);
39172      composeStructureMapInner(element);
39173    }
39174  }
39175
39176  protected void composeStructureMapInner(StructureMap element) throws IOException {
39177      composeDomainResourceElements(element);
39178      if (element.hasUrlElement()) {
39179        composeUriCore("url", element.getUrlElement(), false);
39180        composeUriExtras("url", element.getUrlElement(), false);
39181      }
39182      if (element.hasIdentifier()) {
39183        openArray("identifier");
39184        for (Identifier e : element.getIdentifier()) 
39185          composeIdentifier(null, e);
39186        closeArray();
39187      };
39188      if (element.hasVersionElement()) {
39189        composeStringCore("version", element.getVersionElement(), false);
39190        composeStringExtras("version", element.getVersionElement(), false);
39191      }
39192      if (element.hasNameElement()) {
39193        composeStringCore("name", element.getNameElement(), false);
39194        composeStringExtras("name", element.getNameElement(), false);
39195      }
39196      if (element.hasTitleElement()) {
39197        composeStringCore("title", element.getTitleElement(), false);
39198        composeStringExtras("title", element.getTitleElement(), false);
39199      }
39200      if (element.hasStatusElement()) {
39201        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39202        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39203      }
39204      if (element.hasExperimentalElement()) {
39205        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39206        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39207      }
39208      if (element.hasDateElement()) {
39209        composeDateTimeCore("date", element.getDateElement(), false);
39210        composeDateTimeExtras("date", element.getDateElement(), false);
39211      }
39212      if (element.hasPublisherElement()) {
39213        composeStringCore("publisher", element.getPublisherElement(), false);
39214        composeStringExtras("publisher", element.getPublisherElement(), false);
39215      }
39216      if (element.hasContact()) {
39217        openArray("contact");
39218        for (ContactDetail e : element.getContact()) 
39219          composeContactDetail(null, e);
39220        closeArray();
39221      };
39222      if (element.hasDescriptionElement()) {
39223        composeMarkdownCore("description", element.getDescriptionElement(), false);
39224        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39225      }
39226      if (element.hasUseContext()) {
39227        openArray("useContext");
39228        for (UsageContext e : element.getUseContext()) 
39229          composeUsageContext(null, e);
39230        closeArray();
39231      };
39232      if (element.hasJurisdiction()) {
39233        openArray("jurisdiction");
39234        for (CodeableConcept e : element.getJurisdiction()) 
39235          composeCodeableConcept(null, e);
39236        closeArray();
39237      };
39238      if (element.hasPurposeElement()) {
39239        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39240        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39241      }
39242      if (element.hasCopyrightElement()) {
39243        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39244        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39245      }
39246      if (element.hasStructure()) {
39247        openArray("structure");
39248        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
39249          composeStructureMapStructureMapStructureComponent(null, e);
39250        closeArray();
39251      };
39252      if (element.hasImport()) {
39253        openArray("import");
39254        for (UriType e : element.getImport()) 
39255          composeUriCore(null, e, true);
39256        closeArray();
39257        if (anyHasExtras(element.getImport())) {
39258          openArray("_import");
39259          for (UriType e : element.getImport()) 
39260            composeUriExtras(null, e, true);
39261          closeArray();
39262        }
39263      };
39264      if (element.hasGroup()) {
39265        openArray("group");
39266        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
39267          composeStructureMapStructureMapGroupComponent(null, e);
39268        closeArray();
39269      };
39270  }
39271
39272  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
39273    if (element != null) {
39274      open(name);
39275      composeStructureMapStructureMapStructureComponentInner(element);
39276      close();
39277    }
39278  }
39279
39280  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
39281      composeBackbone(element);
39282      if (element.hasUrlElement()) {
39283        composeUriCore("url", element.getUrlElement(), false);
39284        composeUriExtras("url", element.getUrlElement(), false);
39285      }
39286      if (element.hasModeElement()) {
39287        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39288        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39289      }
39290      if (element.hasAliasElement()) {
39291        composeStringCore("alias", element.getAliasElement(), false);
39292        composeStringExtras("alias", element.getAliasElement(), false);
39293      }
39294      if (element.hasDocumentationElement()) {
39295        composeStringCore("documentation", element.getDocumentationElement(), false);
39296        composeStringExtras("documentation", element.getDocumentationElement(), false);
39297      }
39298  }
39299
39300  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
39301    if (element != null) {
39302      open(name);
39303      composeStructureMapStructureMapGroupComponentInner(element);
39304      close();
39305    }
39306  }
39307
39308  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
39309      composeBackbone(element);
39310      if (element.hasNameElement()) {
39311        composeIdCore("name", element.getNameElement(), false);
39312        composeIdExtras("name", element.getNameElement(), false);
39313      }
39314      if (element.hasExtendsElement()) {
39315        composeIdCore("extends", element.getExtendsElement(), false);
39316        composeIdExtras("extends", element.getExtendsElement(), false);
39317      }
39318      if (element.hasTypeModeElement()) {
39319        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39320        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39321      }
39322      if (element.hasDocumentationElement()) {
39323        composeStringCore("documentation", element.getDocumentationElement(), false);
39324        composeStringExtras("documentation", element.getDocumentationElement(), false);
39325      }
39326      if (element.hasInput()) {
39327        openArray("input");
39328        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
39329          composeStructureMapStructureMapGroupInputComponent(null, e);
39330        closeArray();
39331      };
39332      if (element.hasRule()) {
39333        openArray("rule");
39334        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39335          composeStructureMapStructureMapGroupRuleComponent(null, e);
39336        closeArray();
39337      };
39338  }
39339
39340  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
39341    if (element != null) {
39342      open(name);
39343      composeStructureMapStructureMapGroupInputComponentInner(element);
39344      close();
39345    }
39346  }
39347
39348  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
39349      composeBackbone(element);
39350      if (element.hasNameElement()) {
39351        composeIdCore("name", element.getNameElement(), false);
39352        composeIdExtras("name", element.getNameElement(), false);
39353      }
39354      if (element.hasTypeElement()) {
39355        composeStringCore("type", element.getTypeElement(), false);
39356        composeStringExtras("type", element.getTypeElement(), false);
39357      }
39358      if (element.hasModeElement()) {
39359        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39360        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39361      }
39362      if (element.hasDocumentationElement()) {
39363        composeStringCore("documentation", element.getDocumentationElement(), false);
39364        composeStringExtras("documentation", element.getDocumentationElement(), false);
39365      }
39366  }
39367
39368  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39369    if (element != null) {
39370      open(name);
39371      composeStructureMapStructureMapGroupRuleComponentInner(element);
39372      close();
39373    }
39374  }
39375
39376  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39377      composeBackbone(element);
39378      if (element.hasNameElement()) {
39379        composeIdCore("name", element.getNameElement(), false);
39380        composeIdExtras("name", element.getNameElement(), false);
39381      }
39382      if (element.hasSource()) {
39383        openArray("source");
39384        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
39385          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
39386        closeArray();
39387      };
39388      if (element.hasTarget()) {
39389        openArray("target");
39390        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
39391          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
39392        closeArray();
39393      };
39394      if (element.hasRule()) {
39395        openArray("rule");
39396        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39397          composeStructureMapStructureMapGroupRuleComponent(null, e);
39398        closeArray();
39399      };
39400      if (element.hasDependent()) {
39401        openArray("dependent");
39402        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
39403          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
39404        closeArray();
39405      };
39406      if (element.hasDocumentationElement()) {
39407        composeStringCore("documentation", element.getDocumentationElement(), false);
39408        composeStringExtras("documentation", element.getDocumentationElement(), false);
39409      }
39410  }
39411
39412  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39413    if (element != null) {
39414      open(name);
39415      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
39416      close();
39417    }
39418  }
39419
39420  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39421      composeBackbone(element);
39422      if (element.hasContextElement()) {
39423        composeIdCore("context", element.getContextElement(), false);
39424        composeIdExtras("context", element.getContextElement(), false);
39425      }
39426      if (element.hasMinElement()) {
39427        composeIntegerCore("min", element.getMinElement(), false);
39428        composeIntegerExtras("min", element.getMinElement(), false);
39429      }
39430      if (element.hasMaxElement()) {
39431        composeStringCore("max", element.getMaxElement(), false);
39432        composeStringExtras("max", element.getMaxElement(), false);
39433      }
39434      if (element.hasTypeElement()) {
39435        composeStringCore("type", element.getTypeElement(), false);
39436        composeStringExtras("type", element.getTypeElement(), false);
39437      }
39438      if (element.hasDefaultValue()) {
39439        composeType("defaultValue", element.getDefaultValue());
39440      }
39441      if (element.hasElementElement()) {
39442        composeStringCore("element", element.getElementElement(), false);
39443        composeStringExtras("element", element.getElementElement(), false);
39444      }
39445      if (element.hasListModeElement()) {
39446        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39447        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39448      }
39449      if (element.hasVariableElement()) {
39450        composeIdCore("variable", element.getVariableElement(), false);
39451        composeIdExtras("variable", element.getVariableElement(), false);
39452      }
39453      if (element.hasConditionElement()) {
39454        composeStringCore("condition", element.getConditionElement(), false);
39455        composeStringExtras("condition", element.getConditionElement(), false);
39456      }
39457      if (element.hasCheckElement()) {
39458        composeStringCore("check", element.getCheckElement(), false);
39459        composeStringExtras("check", element.getCheckElement(), false);
39460      }
39461  }
39462
39463  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39464    if (element != null) {
39465      open(name);
39466      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
39467      close();
39468    }
39469  }
39470
39471  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39472      composeBackbone(element);
39473      if (element.hasContextElement()) {
39474        composeIdCore("context", element.getContextElement(), false);
39475        composeIdExtras("context", element.getContextElement(), false);
39476      }
39477      if (element.hasContextTypeElement()) {
39478        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39479        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39480      }
39481      if (element.hasElementElement()) {
39482        composeStringCore("element", element.getElementElement(), false);
39483        composeStringExtras("element", element.getElementElement(), false);
39484      }
39485      if (element.hasVariableElement()) {
39486        composeIdCore("variable", element.getVariableElement(), false);
39487        composeIdExtras("variable", element.getVariableElement(), false);
39488      }
39489      if (element.hasListMode()) {
39490        openArray("listMode");
39491        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39492          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39493        closeArray();
39494        if (anyHasExtras(element.getListMode())) {
39495          openArray("_listMode");
39496          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39497            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39498          closeArray();
39499        }
39500      };
39501      if (element.hasListRuleIdElement()) {
39502        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
39503        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
39504      }
39505      if (element.hasTransformElement()) {
39506        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39507        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39508      }
39509      if (element.hasParameter()) {
39510        openArray("parameter");
39511        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
39512          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
39513        closeArray();
39514      };
39515  }
39516
39517  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39518    if (element != null) {
39519      open(name);
39520      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
39521      close();
39522    }
39523  }
39524
39525  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39526      composeBackbone(element);
39527      if (element.hasValue()) {
39528        composeType("value", element.getValue());
39529      }
39530  }
39531
39532  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39533    if (element != null) {
39534      open(name);
39535      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
39536      close();
39537    }
39538  }
39539
39540  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39541      composeBackbone(element);
39542      if (element.hasNameElement()) {
39543        composeIdCore("name", element.getNameElement(), false);
39544        composeIdExtras("name", element.getNameElement(), false);
39545      }
39546      if (element.hasVariable()) {
39547        openArray("variable");
39548        for (StringType e : element.getVariable()) 
39549          composeStringCore(null, e, true);
39550        closeArray();
39551        if (anyHasExtras(element.getVariable())) {
39552          openArray("_variable");
39553          for (StringType e : element.getVariable()) 
39554            composeStringExtras(null, e, true);
39555          closeArray();
39556        }
39557      };
39558  }
39559
39560  protected void composeSubscription(String name, Subscription element) throws IOException {
39561    if (element != null) {
39562      prop("resourceType", name);
39563      composeSubscriptionInner(element);
39564    }
39565  }
39566
39567  protected void composeSubscriptionInner(Subscription element) throws IOException {
39568      composeDomainResourceElements(element);
39569      if (element.hasStatusElement()) {
39570        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39571        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39572      }
39573      if (element.hasContact()) {
39574        openArray("contact");
39575        for (ContactPoint e : element.getContact()) 
39576          composeContactPoint(null, e);
39577        closeArray();
39578      };
39579      if (element.hasEndElement()) {
39580        composeInstantCore("end", element.getEndElement(), false);
39581        composeInstantExtras("end", element.getEndElement(), false);
39582      }
39583      if (element.hasReasonElement()) {
39584        composeStringCore("reason", element.getReasonElement(), false);
39585        composeStringExtras("reason", element.getReasonElement(), false);
39586      }
39587      if (element.hasCriteriaElement()) {
39588        composeStringCore("criteria", element.getCriteriaElement(), false);
39589        composeStringExtras("criteria", element.getCriteriaElement(), false);
39590      }
39591      if (element.hasErrorElement()) {
39592        composeStringCore("error", element.getErrorElement(), false);
39593        composeStringExtras("error", element.getErrorElement(), false);
39594      }
39595      if (element.hasChannel()) {
39596        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
39597      }
39598      if (element.hasTag()) {
39599        openArray("tag");
39600        for (Coding e : element.getTag()) 
39601          composeCoding(null, e);
39602        closeArray();
39603      };
39604  }
39605
39606  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
39607    if (element != null) {
39608      open(name);
39609      composeSubscriptionSubscriptionChannelComponentInner(element);
39610      close();
39611    }
39612  }
39613
39614  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
39615      composeBackbone(element);
39616      if (element.hasTypeElement()) {
39617        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39618        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39619      }
39620      if (element.hasEndpointElement()) {
39621        composeUriCore("endpoint", element.getEndpointElement(), false);
39622        composeUriExtras("endpoint", element.getEndpointElement(), false);
39623      }
39624      if (element.hasPayloadElement()) {
39625        composeStringCore("payload", element.getPayloadElement(), false);
39626        composeStringExtras("payload", element.getPayloadElement(), false);
39627      }
39628      if (element.hasHeader()) {
39629        openArray("header");
39630        for (StringType e : element.getHeader()) 
39631          composeStringCore(null, e, true);
39632        closeArray();
39633        if (anyHasExtras(element.getHeader())) {
39634          openArray("_header");
39635          for (StringType e : element.getHeader()) 
39636            composeStringExtras(null, e, true);
39637          closeArray();
39638        }
39639      };
39640  }
39641
39642  protected void composeSubstance(String name, Substance element) throws IOException {
39643    if (element != null) {
39644      prop("resourceType", name);
39645      composeSubstanceInner(element);
39646    }
39647  }
39648
39649  protected void composeSubstanceInner(Substance element) throws IOException {
39650      composeDomainResourceElements(element);
39651      if (element.hasIdentifier()) {
39652        openArray("identifier");
39653        for (Identifier e : element.getIdentifier()) 
39654          composeIdentifier(null, e);
39655        closeArray();
39656      };
39657      if (element.hasStatusElement()) {
39658        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
39659        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
39660      }
39661      if (element.hasCategory()) {
39662        openArray("category");
39663        for (CodeableConcept e : element.getCategory()) 
39664          composeCodeableConcept(null, e);
39665        closeArray();
39666      };
39667      if (element.hasCode()) {
39668        composeCodeableConcept("code", element.getCode());
39669      }
39670      if (element.hasDescriptionElement()) {
39671        composeStringCore("description", element.getDescriptionElement(), false);
39672        composeStringExtras("description", element.getDescriptionElement(), false);
39673      }
39674      if (element.hasInstance()) {
39675        openArray("instance");
39676        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
39677          composeSubstanceSubstanceInstanceComponent(null, e);
39678        closeArray();
39679      };
39680      if (element.hasIngredient()) {
39681        openArray("ingredient");
39682        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
39683          composeSubstanceSubstanceIngredientComponent(null, e);
39684        closeArray();
39685      };
39686  }
39687
39688  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
39689    if (element != null) {
39690      open(name);
39691      composeSubstanceSubstanceInstanceComponentInner(element);
39692      close();
39693    }
39694  }
39695
39696  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
39697      composeBackbone(element);
39698      if (element.hasIdentifier()) {
39699        composeIdentifier("identifier", element.getIdentifier());
39700      }
39701      if (element.hasExpiryElement()) {
39702        composeDateTimeCore("expiry", element.getExpiryElement(), false);
39703        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
39704      }
39705      if (element.hasQuantity()) {
39706        composeSimpleQuantity("quantity", element.getQuantity());
39707      }
39708  }
39709
39710  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
39711    if (element != null) {
39712      open(name);
39713      composeSubstanceSubstanceIngredientComponentInner(element);
39714      close();
39715    }
39716  }
39717
39718  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
39719      composeBackbone(element);
39720      if (element.hasQuantity()) {
39721        composeRatio("quantity", element.getQuantity());
39722      }
39723      if (element.hasSubstance()) {
39724        composeType("substance", element.getSubstance());
39725      }
39726  }
39727
39728  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
39729    if (element != null) {
39730      prop("resourceType", name);
39731      composeSupplyDeliveryInner(element);
39732    }
39733  }
39734
39735  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
39736      composeDomainResourceElements(element);
39737      if (element.hasIdentifier()) {
39738        composeIdentifier("identifier", element.getIdentifier());
39739      }
39740      if (element.hasBasedOn()) {
39741        openArray("basedOn");
39742        for (Reference e : element.getBasedOn()) 
39743          composeReference(null, e);
39744        closeArray();
39745      };
39746      if (element.hasPartOf()) {
39747        openArray("partOf");
39748        for (Reference e : element.getPartOf()) 
39749          composeReference(null, e);
39750        closeArray();
39751      };
39752      if (element.hasStatusElement()) {
39753        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
39754        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
39755      }
39756      if (element.hasPatient()) {
39757        composeReference("patient", element.getPatient());
39758      }
39759      if (element.hasType()) {
39760        composeCodeableConcept("type", element.getType());
39761      }
39762      if (element.hasSuppliedItem()) {
39763        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
39764      }
39765      if (element.hasOccurrence()) {
39766        composeType("occurrence", element.getOccurrence());
39767      }
39768      if (element.hasSupplier()) {
39769        composeReference("supplier", element.getSupplier());
39770      }
39771      if (element.hasDestination()) {
39772        composeReference("destination", element.getDestination());
39773      }
39774      if (element.hasReceiver()) {
39775        openArray("receiver");
39776        for (Reference e : element.getReceiver()) 
39777          composeReference(null, e);
39778        closeArray();
39779      };
39780  }
39781
39782  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
39783    if (element != null) {
39784      open(name);
39785      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
39786      close();
39787    }
39788  }
39789
39790  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
39791      composeBackbone(element);
39792      if (element.hasQuantity()) {
39793        composeSimpleQuantity("quantity", element.getQuantity());
39794      }
39795      if (element.hasItem()) {
39796        composeType("item", element.getItem());
39797      }
39798  }
39799
39800  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
39801    if (element != null) {
39802      prop("resourceType", name);
39803      composeSupplyRequestInner(element);
39804    }
39805  }
39806
39807  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
39808      composeDomainResourceElements(element);
39809      if (element.hasIdentifier()) {
39810        composeIdentifier("identifier", element.getIdentifier());
39811      }
39812      if (element.hasStatusElement()) {
39813        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
39814        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
39815      }
39816      if (element.hasCategory()) {
39817        composeCodeableConcept("category", element.getCategory());
39818      }
39819      if (element.hasPriorityElement()) {
39820        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
39821        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
39822      }
39823      if (element.hasOrderedItem()) {
39824        composeSupplyRequestSupplyRequestOrderedItemComponent("orderedItem", element.getOrderedItem());
39825      }
39826      if (element.hasOccurrence()) {
39827        composeType("occurrence", element.getOccurrence());
39828      }
39829      if (element.hasAuthoredOnElement()) {
39830        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
39831        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
39832      }
39833      if (element.hasRequester()) {
39834        composeSupplyRequestSupplyRequestRequesterComponent("requester", element.getRequester());
39835      }
39836      if (element.hasSupplier()) {
39837        openArray("supplier");
39838        for (Reference e : element.getSupplier()) 
39839          composeReference(null, e);
39840        closeArray();
39841      };
39842      if (element.hasReason()) {
39843        composeType("reason", element.getReason());
39844      }
39845      if (element.hasDeliverFrom()) {
39846        composeReference("deliverFrom", element.getDeliverFrom());
39847      }
39848      if (element.hasDeliverTo()) {
39849        composeReference("deliverTo", element.getDeliverTo());
39850      }
39851  }
39852
39853  protected void composeSupplyRequestSupplyRequestOrderedItemComponent(String name, SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
39854    if (element != null) {
39855      open(name);
39856      composeSupplyRequestSupplyRequestOrderedItemComponentInner(element);
39857      close();
39858    }
39859  }
39860
39861  protected void composeSupplyRequestSupplyRequestOrderedItemComponentInner(SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
39862      composeBackbone(element);
39863      if (element.hasQuantity()) {
39864        composeQuantity("quantity", element.getQuantity());
39865      }
39866      if (element.hasItem()) {
39867        composeType("item", element.getItem());
39868      }
39869  }
39870
39871  protected void composeSupplyRequestSupplyRequestRequesterComponent(String name, SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
39872    if (element != null) {
39873      open(name);
39874      composeSupplyRequestSupplyRequestRequesterComponentInner(element);
39875      close();
39876    }
39877  }
39878
39879  protected void composeSupplyRequestSupplyRequestRequesterComponentInner(SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
39880      composeBackbone(element);
39881      if (element.hasAgent()) {
39882        composeReference("agent", element.getAgent());
39883      }
39884      if (element.hasOnBehalfOf()) {
39885        composeReference("onBehalfOf", element.getOnBehalfOf());
39886      }
39887  }
39888
39889  protected void composeTask(String name, Task element) throws IOException {
39890    if (element != null) {
39891      prop("resourceType", name);
39892      composeTaskInner(element);
39893    }
39894  }
39895
39896  protected void composeTaskInner(Task element) throws IOException {
39897      composeDomainResourceElements(element);
39898      if (element.hasIdentifier()) {
39899        openArray("identifier");
39900        for (Identifier e : element.getIdentifier()) 
39901          composeIdentifier(null, e);
39902        closeArray();
39903      };
39904      if (element.hasDefinition()) {
39905        composeType("definition", element.getDefinition());
39906      }
39907      if (element.hasBasedOn()) {
39908        openArray("basedOn");
39909        for (Reference e : element.getBasedOn()) 
39910          composeReference(null, e);
39911        closeArray();
39912      };
39913      if (element.hasGroupIdentifier()) {
39914        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
39915      }
39916      if (element.hasPartOf()) {
39917        openArray("partOf");
39918        for (Reference e : element.getPartOf()) 
39919          composeReference(null, e);
39920        closeArray();
39921      };
39922      if (element.hasStatusElement()) {
39923        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
39924        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
39925      }
39926      if (element.hasStatusReason()) {
39927        composeCodeableConcept("statusReason", element.getStatusReason());
39928      }
39929      if (element.hasBusinessStatus()) {
39930        composeCodeableConcept("businessStatus", element.getBusinessStatus());
39931      }
39932      if (element.hasIntentElement()) {
39933        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
39934        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
39935      }
39936      if (element.hasPriorityElement()) {
39937        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
39938        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
39939      }
39940      if (element.hasCode()) {
39941        composeCodeableConcept("code", element.getCode());
39942      }
39943      if (element.hasDescriptionElement()) {
39944        composeStringCore("description", element.getDescriptionElement(), false);
39945        composeStringExtras("description", element.getDescriptionElement(), false);
39946      }
39947      if (element.hasFocus()) {
39948        composeReference("focus", element.getFocus());
39949      }
39950      if (element.hasFor()) {
39951        composeReference("for", element.getFor());
39952      }
39953      if (element.hasContext()) {
39954        composeReference("context", element.getContext());
39955      }
39956      if (element.hasExecutionPeriod()) {
39957        composePeriod("executionPeriod", element.getExecutionPeriod());
39958      }
39959      if (element.hasAuthoredOnElement()) {
39960        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
39961        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
39962      }
39963      if (element.hasLastModifiedElement()) {
39964        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
39965        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
39966      }
39967      if (element.hasRequester()) {
39968        composeTaskTaskRequesterComponent("requester", element.getRequester());
39969      }
39970      if (element.hasPerformerType()) {
39971        openArray("performerType");
39972        for (CodeableConcept e : element.getPerformerType()) 
39973          composeCodeableConcept(null, e);
39974        closeArray();
39975      };
39976      if (element.hasOwner()) {
39977        composeReference("owner", element.getOwner());
39978      }
39979      if (element.hasReason()) {
39980        composeCodeableConcept("reason", element.getReason());
39981      }
39982      if (element.hasNote()) {
39983        openArray("note");
39984        for (Annotation e : element.getNote()) 
39985          composeAnnotation(null, e);
39986        closeArray();
39987      };
39988      if (element.hasRelevantHistory()) {
39989        openArray("relevantHistory");
39990        for (Reference e : element.getRelevantHistory()) 
39991          composeReference(null, e);
39992        closeArray();
39993      };
39994      if (element.hasRestriction()) {
39995        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
39996      }
39997      if (element.hasInput()) {
39998        openArray("input");
39999        for (Task.ParameterComponent e : element.getInput()) 
40000          composeTaskParameterComponent(null, e);
40001        closeArray();
40002      };
40003      if (element.hasOutput()) {
40004        openArray("output");
40005        for (Task.TaskOutputComponent e : element.getOutput()) 
40006          composeTaskTaskOutputComponent(null, e);
40007        closeArray();
40008      };
40009  }
40010
40011  protected void composeTaskTaskRequesterComponent(String name, Task.TaskRequesterComponent element) throws IOException {
40012    if (element != null) {
40013      open(name);
40014      composeTaskTaskRequesterComponentInner(element);
40015      close();
40016    }
40017  }
40018
40019  protected void composeTaskTaskRequesterComponentInner(Task.TaskRequesterComponent element) throws IOException {
40020      composeBackbone(element);
40021      if (element.hasAgent()) {
40022        composeReference("agent", element.getAgent());
40023      }
40024      if (element.hasOnBehalfOf()) {
40025        composeReference("onBehalfOf", element.getOnBehalfOf());
40026      }
40027  }
40028
40029  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
40030    if (element != null) {
40031      open(name);
40032      composeTaskTaskRestrictionComponentInner(element);
40033      close();
40034    }
40035  }
40036
40037  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
40038      composeBackbone(element);
40039      if (element.hasRepetitionsElement()) {
40040        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
40041        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
40042      }
40043      if (element.hasPeriod()) {
40044        composePeriod("period", element.getPeriod());
40045      }
40046      if (element.hasRecipient()) {
40047        openArray("recipient");
40048        for (Reference e : element.getRecipient()) 
40049          composeReference(null, e);
40050        closeArray();
40051      };
40052  }
40053
40054  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
40055    if (element != null) {
40056      open(name);
40057      composeTaskParameterComponentInner(element);
40058      close();
40059    }
40060  }
40061
40062  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
40063      composeBackbone(element);
40064      if (element.hasType()) {
40065        composeCodeableConcept("type", element.getType());
40066      }
40067      if (element.hasValue()) {
40068        composeType("value", element.getValue());
40069      }
40070  }
40071
40072  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
40073    if (element != null) {
40074      open(name);
40075      composeTaskTaskOutputComponentInner(element);
40076      close();
40077    }
40078  }
40079
40080  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
40081      composeBackbone(element);
40082      if (element.hasType()) {
40083        composeCodeableConcept("type", element.getType());
40084      }
40085      if (element.hasValue()) {
40086        composeType("value", element.getValue());
40087      }
40088  }
40089
40090  protected void composeTestReport(String name, TestReport element) throws IOException {
40091    if (element != null) {
40092      prop("resourceType", name);
40093      composeTestReportInner(element);
40094    }
40095  }
40096
40097  protected void composeTestReportInner(TestReport element) throws IOException {
40098      composeDomainResourceElements(element);
40099      if (element.hasIdentifier()) {
40100        composeIdentifier("identifier", element.getIdentifier());
40101      }
40102      if (element.hasNameElement()) {
40103        composeStringCore("name", element.getNameElement(), false);
40104        composeStringExtras("name", element.getNameElement(), false);
40105      }
40106      if (element.hasStatusElement()) {
40107        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40108        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40109      }
40110      if (element.hasTestScript()) {
40111        composeReference("testScript", element.getTestScript());
40112      }
40113      if (element.hasResultElement()) {
40114        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40115        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40116      }
40117      if (element.hasScoreElement()) {
40118        composeDecimalCore("score", element.getScoreElement(), false);
40119        composeDecimalExtras("score", element.getScoreElement(), false);
40120      }
40121      if (element.hasTesterElement()) {
40122        composeStringCore("tester", element.getTesterElement(), false);
40123        composeStringExtras("tester", element.getTesterElement(), false);
40124      }
40125      if (element.hasIssuedElement()) {
40126        composeDateTimeCore("issued", element.getIssuedElement(), false);
40127        composeDateTimeExtras("issued", element.getIssuedElement(), false);
40128      }
40129      if (element.hasParticipant()) {
40130        openArray("participant");
40131        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
40132          composeTestReportTestReportParticipantComponent(null, e);
40133        closeArray();
40134      };
40135      if (element.hasSetup()) {
40136        composeTestReportTestReportSetupComponent("setup", element.getSetup());
40137      }
40138      if (element.hasTest()) {
40139        openArray("test");
40140        for (TestReport.TestReportTestComponent e : element.getTest()) 
40141          composeTestReportTestReportTestComponent(null, e);
40142        closeArray();
40143      };
40144      if (element.hasTeardown()) {
40145        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
40146      }
40147  }
40148
40149  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
40150    if (element != null) {
40151      open(name);
40152      composeTestReportTestReportParticipantComponentInner(element);
40153      close();
40154    }
40155  }
40156
40157  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
40158      composeBackbone(element);
40159      if (element.hasTypeElement()) {
40160        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40161        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40162      }
40163      if (element.hasUriElement()) {
40164        composeUriCore("uri", element.getUriElement(), false);
40165        composeUriExtras("uri", element.getUriElement(), false);
40166      }
40167      if (element.hasDisplayElement()) {
40168        composeStringCore("display", element.getDisplayElement(), false);
40169        composeStringExtras("display", element.getDisplayElement(), false);
40170      }
40171  }
40172
40173  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
40174    if (element != null) {
40175      open(name);
40176      composeTestReportTestReportSetupComponentInner(element);
40177      close();
40178    }
40179  }
40180
40181  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
40182      composeBackbone(element);
40183      if (element.hasAction()) {
40184        openArray("action");
40185        for (TestReport.SetupActionComponent e : element.getAction()) 
40186          composeTestReportSetupActionComponent(null, e);
40187        closeArray();
40188      };
40189  }
40190
40191  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
40192    if (element != null) {
40193      open(name);
40194      composeTestReportSetupActionComponentInner(element);
40195      close();
40196    }
40197  }
40198
40199  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
40200      composeBackbone(element);
40201      if (element.hasOperation()) {
40202        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40203      }
40204      if (element.hasAssert()) {
40205        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40206      }
40207  }
40208
40209  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
40210    if (element != null) {
40211      open(name);
40212      composeTestReportSetupActionOperationComponentInner(element);
40213      close();
40214    }
40215  }
40216
40217  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
40218      composeBackbone(element);
40219      if (element.hasResultElement()) {
40220        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40221        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40222      }
40223      if (element.hasMessageElement()) {
40224        composeMarkdownCore("message", element.getMessageElement(), false);
40225        composeMarkdownExtras("message", element.getMessageElement(), false);
40226      }
40227      if (element.hasDetailElement()) {
40228        composeUriCore("detail", element.getDetailElement(), false);
40229        composeUriExtras("detail", element.getDetailElement(), false);
40230      }
40231  }
40232
40233  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
40234    if (element != null) {
40235      open(name);
40236      composeTestReportSetupActionAssertComponentInner(element);
40237      close();
40238    }
40239  }
40240
40241  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
40242      composeBackbone(element);
40243      if (element.hasResultElement()) {
40244        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40245        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40246      }
40247      if (element.hasMessageElement()) {
40248        composeMarkdownCore("message", element.getMessageElement(), false);
40249        composeMarkdownExtras("message", element.getMessageElement(), false);
40250      }
40251      if (element.hasDetailElement()) {
40252        composeStringCore("detail", element.getDetailElement(), false);
40253        composeStringExtras("detail", element.getDetailElement(), false);
40254      }
40255  }
40256
40257  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
40258    if (element != null) {
40259      open(name);
40260      composeTestReportTestReportTestComponentInner(element);
40261      close();
40262    }
40263  }
40264
40265  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
40266      composeBackbone(element);
40267      if (element.hasNameElement()) {
40268        composeStringCore("name", element.getNameElement(), false);
40269        composeStringExtras("name", element.getNameElement(), false);
40270      }
40271      if (element.hasDescriptionElement()) {
40272        composeStringCore("description", element.getDescriptionElement(), false);
40273        composeStringExtras("description", element.getDescriptionElement(), false);
40274      }
40275      if (element.hasAction()) {
40276        openArray("action");
40277        for (TestReport.TestActionComponent e : element.getAction()) 
40278          composeTestReportTestActionComponent(null, e);
40279        closeArray();
40280      };
40281  }
40282
40283  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
40284    if (element != null) {
40285      open(name);
40286      composeTestReportTestActionComponentInner(element);
40287      close();
40288    }
40289  }
40290
40291  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
40292      composeBackbone(element);
40293      if (element.hasOperation()) {
40294        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40295      }
40296      if (element.hasAssert()) {
40297        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40298      }
40299  }
40300
40301  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
40302    if (element != null) {
40303      open(name);
40304      composeTestReportTestReportTeardownComponentInner(element);
40305      close();
40306    }
40307  }
40308
40309  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
40310      composeBackbone(element);
40311      if (element.hasAction()) {
40312        openArray("action");
40313        for (TestReport.TeardownActionComponent e : element.getAction()) 
40314          composeTestReportTeardownActionComponent(null, e);
40315        closeArray();
40316      };
40317  }
40318
40319  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
40320    if (element != null) {
40321      open(name);
40322      composeTestReportTeardownActionComponentInner(element);
40323      close();
40324    }
40325  }
40326
40327  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
40328      composeBackbone(element);
40329      if (element.hasOperation()) {
40330        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40331      }
40332  }
40333
40334  protected void composeTestScript(String name, TestScript element) throws IOException {
40335    if (element != null) {
40336      prop("resourceType", name);
40337      composeTestScriptInner(element);
40338    }
40339  }
40340
40341  protected void composeTestScriptInner(TestScript element) throws IOException {
40342      composeDomainResourceElements(element);
40343      if (element.hasUrlElement()) {
40344        composeUriCore("url", element.getUrlElement(), false);
40345        composeUriExtras("url", element.getUrlElement(), false);
40346      }
40347      if (element.hasIdentifier()) {
40348        composeIdentifier("identifier", element.getIdentifier());
40349      }
40350      if (element.hasVersionElement()) {
40351        composeStringCore("version", element.getVersionElement(), false);
40352        composeStringExtras("version", element.getVersionElement(), false);
40353      }
40354      if (element.hasNameElement()) {
40355        composeStringCore("name", element.getNameElement(), false);
40356        composeStringExtras("name", element.getNameElement(), false);
40357      }
40358      if (element.hasTitleElement()) {
40359        composeStringCore("title", element.getTitleElement(), false);
40360        composeStringExtras("title", element.getTitleElement(), false);
40361      }
40362      if (element.hasStatusElement()) {
40363        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40364        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40365      }
40366      if (element.hasExperimentalElement()) {
40367        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40368        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40369      }
40370      if (element.hasDateElement()) {
40371        composeDateTimeCore("date", element.getDateElement(), false);
40372        composeDateTimeExtras("date", element.getDateElement(), false);
40373      }
40374      if (element.hasPublisherElement()) {
40375        composeStringCore("publisher", element.getPublisherElement(), false);
40376        composeStringExtras("publisher", element.getPublisherElement(), false);
40377      }
40378      if (element.hasContact()) {
40379        openArray("contact");
40380        for (ContactDetail e : element.getContact()) 
40381          composeContactDetail(null, e);
40382        closeArray();
40383      };
40384      if (element.hasDescriptionElement()) {
40385        composeMarkdownCore("description", element.getDescriptionElement(), false);
40386        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40387      }
40388      if (element.hasUseContext()) {
40389        openArray("useContext");
40390        for (UsageContext e : element.getUseContext()) 
40391          composeUsageContext(null, e);
40392        closeArray();
40393      };
40394      if (element.hasJurisdiction()) {
40395        openArray("jurisdiction");
40396        for (CodeableConcept e : element.getJurisdiction()) 
40397          composeCodeableConcept(null, e);
40398        closeArray();
40399      };
40400      if (element.hasPurposeElement()) {
40401        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40402        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40403      }
40404      if (element.hasCopyrightElement()) {
40405        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40406        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40407      }
40408      if (element.hasOrigin()) {
40409        openArray("origin");
40410        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
40411          composeTestScriptTestScriptOriginComponent(null, e);
40412        closeArray();
40413      };
40414      if (element.hasDestination()) {
40415        openArray("destination");
40416        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
40417          composeTestScriptTestScriptDestinationComponent(null, e);
40418        closeArray();
40419      };
40420      if (element.hasMetadata()) {
40421        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
40422      }
40423      if (element.hasFixture()) {
40424        openArray("fixture");
40425        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
40426          composeTestScriptTestScriptFixtureComponent(null, e);
40427        closeArray();
40428      };
40429      if (element.hasProfile()) {
40430        openArray("profile");
40431        for (Reference e : element.getProfile()) 
40432          composeReference(null, e);
40433        closeArray();
40434      };
40435      if (element.hasVariable()) {
40436        openArray("variable");
40437        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
40438          composeTestScriptTestScriptVariableComponent(null, e);
40439        closeArray();
40440      };
40441      if (element.hasRule()) {
40442        openArray("rule");
40443        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
40444          composeTestScriptTestScriptRuleComponent(null, e);
40445        closeArray();
40446      };
40447      if (element.hasRuleset()) {
40448        openArray("ruleset");
40449        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
40450          composeTestScriptTestScriptRulesetComponent(null, e);
40451        closeArray();
40452      };
40453      if (element.hasSetup()) {
40454        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
40455      }
40456      if (element.hasTest()) {
40457        openArray("test");
40458        for (TestScript.TestScriptTestComponent e : element.getTest()) 
40459          composeTestScriptTestScriptTestComponent(null, e);
40460        closeArray();
40461      };
40462      if (element.hasTeardown()) {
40463        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
40464      }
40465  }
40466
40467  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
40468    if (element != null) {
40469      open(name);
40470      composeTestScriptTestScriptOriginComponentInner(element);
40471      close();
40472    }
40473  }
40474
40475  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
40476      composeBackbone(element);
40477      if (element.hasIndexElement()) {
40478        composeIntegerCore("index", element.getIndexElement(), false);
40479        composeIntegerExtras("index", element.getIndexElement(), false);
40480      }
40481      if (element.hasProfile()) {
40482        composeCoding("profile", element.getProfile());
40483      }
40484  }
40485
40486  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
40487    if (element != null) {
40488      open(name);
40489      composeTestScriptTestScriptDestinationComponentInner(element);
40490      close();
40491    }
40492  }
40493
40494  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
40495      composeBackbone(element);
40496      if (element.hasIndexElement()) {
40497        composeIntegerCore("index", element.getIndexElement(), false);
40498        composeIntegerExtras("index", element.getIndexElement(), false);
40499      }
40500      if (element.hasProfile()) {
40501        composeCoding("profile", element.getProfile());
40502      }
40503  }
40504
40505  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
40506    if (element != null) {
40507      open(name);
40508      composeTestScriptTestScriptMetadataComponentInner(element);
40509      close();
40510    }
40511  }
40512
40513  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
40514      composeBackbone(element);
40515      if (element.hasLink()) {
40516        openArray("link");
40517        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
40518          composeTestScriptTestScriptMetadataLinkComponent(null, e);
40519        closeArray();
40520      };
40521      if (element.hasCapability()) {
40522        openArray("capability");
40523        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
40524          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
40525        closeArray();
40526      };
40527  }
40528
40529  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40530    if (element != null) {
40531      open(name);
40532      composeTestScriptTestScriptMetadataLinkComponentInner(element);
40533      close();
40534    }
40535  }
40536
40537  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40538      composeBackbone(element);
40539      if (element.hasUrlElement()) {
40540        composeUriCore("url", element.getUrlElement(), false);
40541        composeUriExtras("url", element.getUrlElement(), false);
40542      }
40543      if (element.hasDescriptionElement()) {
40544        composeStringCore("description", element.getDescriptionElement(), false);
40545        composeStringExtras("description", element.getDescriptionElement(), false);
40546      }
40547  }
40548
40549  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40550    if (element != null) {
40551      open(name);
40552      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
40553      close();
40554    }
40555  }
40556
40557  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40558      composeBackbone(element);
40559      if (element.hasRequiredElement()) {
40560        composeBooleanCore("required", element.getRequiredElement(), false);
40561        composeBooleanExtras("required", element.getRequiredElement(), false);
40562      }
40563      if (element.hasValidatedElement()) {
40564        composeBooleanCore("validated", element.getValidatedElement(), false);
40565        composeBooleanExtras("validated", element.getValidatedElement(), false);
40566      }
40567      if (element.hasDescriptionElement()) {
40568        composeStringCore("description", element.getDescriptionElement(), false);
40569        composeStringExtras("description", element.getDescriptionElement(), false);
40570      }
40571      if (element.hasOrigin()) {
40572        openArray("origin");
40573        for (IntegerType e : element.getOrigin()) 
40574          composeIntegerCore(null, e, true);
40575        closeArray();
40576        if (anyHasExtras(element.getOrigin())) {
40577          openArray("_origin");
40578          for (IntegerType e : element.getOrigin()) 
40579            composeIntegerExtras(null, e, true);
40580          closeArray();
40581        }
40582      };
40583      if (element.hasDestinationElement()) {
40584        composeIntegerCore("destination", element.getDestinationElement(), false);
40585        composeIntegerExtras("destination", element.getDestinationElement(), false);
40586      }
40587      if (element.hasLink()) {
40588        openArray("link");
40589        for (UriType e : element.getLink()) 
40590          composeUriCore(null, e, true);
40591        closeArray();
40592        if (anyHasExtras(element.getLink())) {
40593          openArray("_link");
40594          for (UriType e : element.getLink()) 
40595            composeUriExtras(null, e, true);
40596          closeArray();
40597        }
40598      };
40599      if (element.hasCapabilities()) {
40600        composeReference("capabilities", element.getCapabilities());
40601      }
40602  }
40603
40604  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
40605    if (element != null) {
40606      open(name);
40607      composeTestScriptTestScriptFixtureComponentInner(element);
40608      close();
40609    }
40610  }
40611
40612  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
40613      composeBackbone(element);
40614      if (element.hasAutocreateElement()) {
40615        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
40616        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
40617      }
40618      if (element.hasAutodeleteElement()) {
40619        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
40620        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
40621      }
40622      if (element.hasResource()) {
40623        composeReference("resource", element.getResource());
40624      }
40625  }
40626
40627  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
40628    if (element != null) {
40629      open(name);
40630      composeTestScriptTestScriptVariableComponentInner(element);
40631      close();
40632    }
40633  }
40634
40635  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
40636      composeBackbone(element);
40637      if (element.hasNameElement()) {
40638        composeStringCore("name", element.getNameElement(), false);
40639        composeStringExtras("name", element.getNameElement(), false);
40640      }
40641      if (element.hasDefaultValueElement()) {
40642        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
40643        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
40644      }
40645      if (element.hasDescriptionElement()) {
40646        composeStringCore("description", element.getDescriptionElement(), false);
40647        composeStringExtras("description", element.getDescriptionElement(), false);
40648      }
40649      if (element.hasExpressionElement()) {
40650        composeStringCore("expression", element.getExpressionElement(), false);
40651        composeStringExtras("expression", element.getExpressionElement(), false);
40652      }
40653      if (element.hasHeaderFieldElement()) {
40654        composeStringCore("headerField", element.getHeaderFieldElement(), false);
40655        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
40656      }
40657      if (element.hasHintElement()) {
40658        composeStringCore("hint", element.getHintElement(), false);
40659        composeStringExtras("hint", element.getHintElement(), false);
40660      }
40661      if (element.hasPathElement()) {
40662        composeStringCore("path", element.getPathElement(), false);
40663        composeStringExtras("path", element.getPathElement(), false);
40664      }
40665      if (element.hasSourceIdElement()) {
40666        composeIdCore("sourceId", element.getSourceIdElement(), false);
40667        composeIdExtras("sourceId", element.getSourceIdElement(), false);
40668      }
40669  }
40670
40671  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
40672    if (element != null) {
40673      open(name);
40674      composeTestScriptTestScriptRuleComponentInner(element);
40675      close();
40676    }
40677  }
40678
40679  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
40680      composeBackbone(element);
40681      if (element.hasResource()) {
40682        composeReference("resource", element.getResource());
40683      }
40684      if (element.hasParam()) {
40685        openArray("param");
40686        for (TestScript.RuleParamComponent e : element.getParam()) 
40687          composeTestScriptRuleParamComponent(null, e);
40688        closeArray();
40689      };
40690  }
40691
40692  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
40693    if (element != null) {
40694      open(name);
40695      composeTestScriptRuleParamComponentInner(element);
40696      close();
40697    }
40698  }
40699
40700  protected void composeTestScriptRuleParamComponentInner(TestScript.RuleParamComponent element) throws IOException {
40701      composeBackbone(element);
40702      if (element.hasNameElement()) {
40703        composeStringCore("name", element.getNameElement(), false);
40704        composeStringExtras("name", element.getNameElement(), false);
40705      }
40706      if (element.hasValueElement()) {
40707        composeStringCore("value", element.getValueElement(), false);
40708        composeStringExtras("value", element.getValueElement(), false);
40709      }
40710  }
40711
40712  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
40713    if (element != null) {
40714      open(name);
40715      composeTestScriptTestScriptRulesetComponentInner(element);
40716      close();
40717    }
40718  }
40719
40720  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
40721      composeBackbone(element);
40722      if (element.hasResource()) {
40723        composeReference("resource", element.getResource());
40724      }
40725      if (element.hasRule()) {
40726        openArray("rule");
40727        for (TestScript.RulesetRuleComponent e : element.getRule()) 
40728          composeTestScriptRulesetRuleComponent(null, e);
40729        closeArray();
40730      };
40731  }
40732
40733  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
40734    if (element != null) {
40735      open(name);
40736      composeTestScriptRulesetRuleComponentInner(element);
40737      close();
40738    }
40739  }
40740
40741  protected void composeTestScriptRulesetRuleComponentInner(TestScript.RulesetRuleComponent element) throws IOException {
40742      composeBackbone(element);
40743      if (element.hasRuleIdElement()) {
40744        composeIdCore("ruleId", element.getRuleIdElement(), false);
40745        composeIdExtras("ruleId", element.getRuleIdElement(), false);
40746      }
40747      if (element.hasParam()) {
40748        openArray("param");
40749        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
40750          composeTestScriptRulesetRuleParamComponent(null, e);
40751        closeArray();
40752      };
40753  }
40754
40755  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
40756    if (element != null) {
40757      open(name);
40758      composeTestScriptRulesetRuleParamComponentInner(element);
40759      close();
40760    }
40761  }
40762
40763  protected void composeTestScriptRulesetRuleParamComponentInner(TestScript.RulesetRuleParamComponent element) throws IOException {
40764      composeBackbone(element);
40765      if (element.hasNameElement()) {
40766        composeStringCore("name", element.getNameElement(), false);
40767        composeStringExtras("name", element.getNameElement(), false);
40768      }
40769      if (element.hasValueElement()) {
40770        composeStringCore("value", element.getValueElement(), false);
40771        composeStringExtras("value", element.getValueElement(), false);
40772      }
40773  }
40774
40775  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
40776    if (element != null) {
40777      open(name);
40778      composeTestScriptTestScriptSetupComponentInner(element);
40779      close();
40780    }
40781  }
40782
40783  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
40784      composeBackbone(element);
40785      if (element.hasAction()) {
40786        openArray("action");
40787        for (TestScript.SetupActionComponent e : element.getAction()) 
40788          composeTestScriptSetupActionComponent(null, e);
40789        closeArray();
40790      };
40791  }
40792
40793  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
40794    if (element != null) {
40795      open(name);
40796      composeTestScriptSetupActionComponentInner(element);
40797      close();
40798    }
40799  }
40800
40801  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
40802      composeBackbone(element);
40803      if (element.hasOperation()) {
40804        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
40805      }
40806      if (element.hasAssert()) {
40807        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
40808      }
40809  }
40810
40811  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
40812    if (element != null) {
40813      open(name);
40814      composeTestScriptSetupActionOperationComponentInner(element);
40815      close();
40816    }
40817  }
40818
40819  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
40820      composeBackbone(element);
40821      if (element.hasType()) {
40822        composeCoding("type", element.getType());
40823      }
40824      if (element.hasResourceElement()) {
40825        composeCodeCore("resource", element.getResourceElement(), false);
40826        composeCodeExtras("resource", element.getResourceElement(), false);
40827      }
40828      if (element.hasLabelElement()) {
40829        composeStringCore("label", element.getLabelElement(), false);
40830        composeStringExtras("label", element.getLabelElement(), false);
40831      }
40832      if (element.hasDescriptionElement()) {
40833        composeStringCore("description", element.getDescriptionElement(), false);
40834        composeStringExtras("description", element.getDescriptionElement(), false);
40835      }
40836      if (element.hasAcceptElement()) {
40837        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
40838        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
40839      }
40840      if (element.hasContentTypeElement()) {
40841        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40842        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40843      }
40844      if (element.hasDestinationElement()) {
40845        composeIntegerCore("destination", element.getDestinationElement(), false);
40846        composeIntegerExtras("destination", element.getDestinationElement(), false);
40847      }
40848      if (element.hasEncodeRequestUrlElement()) {
40849        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
40850        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
40851      }
40852      if (element.hasOriginElement()) {
40853        composeIntegerCore("origin", element.getOriginElement(), false);
40854        composeIntegerExtras("origin", element.getOriginElement(), false);
40855      }
40856      if (element.hasParamsElement()) {
40857        composeStringCore("params", element.getParamsElement(), false);
40858        composeStringExtras("params", element.getParamsElement(), false);
40859      }
40860      if (element.hasRequestHeader()) {
40861        openArray("requestHeader");
40862        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
40863          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
40864        closeArray();
40865      };
40866      if (element.hasRequestIdElement()) {
40867        composeIdCore("requestId", element.getRequestIdElement(), false);
40868        composeIdExtras("requestId", element.getRequestIdElement(), false);
40869      }
40870      if (element.hasResponseIdElement()) {
40871        composeIdCore("responseId", element.getResponseIdElement(), false);
40872        composeIdExtras("responseId", element.getResponseIdElement(), false);
40873      }
40874      if (element.hasSourceIdElement()) {
40875        composeIdCore("sourceId", element.getSourceIdElement(), false);
40876        composeIdExtras("sourceId", element.getSourceIdElement(), false);
40877      }
40878      if (element.hasTargetIdElement()) {
40879        composeIdCore("targetId", element.getTargetIdElement(), false);
40880        composeIdExtras("targetId", element.getTargetIdElement(), false);
40881      }
40882      if (element.hasUrlElement()) {
40883        composeStringCore("url", element.getUrlElement(), false);
40884        composeStringExtras("url", element.getUrlElement(), false);
40885      }
40886  }
40887
40888  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
40889    if (element != null) {
40890      open(name);
40891      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
40892      close();
40893    }
40894  }
40895
40896  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
40897      composeBackbone(element);
40898      if (element.hasFieldElement()) {
40899        composeStringCore("field", element.getFieldElement(), false);
40900        composeStringExtras("field", element.getFieldElement(), false);
40901      }
40902      if (element.hasValueElement()) {
40903        composeStringCore("value", element.getValueElement(), false);
40904        composeStringExtras("value", element.getValueElement(), false);
40905      }
40906  }
40907
40908  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
40909    if (element != null) {
40910      open(name);
40911      composeTestScriptSetupActionAssertComponentInner(element);
40912      close();
40913    }
40914  }
40915
40916  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
40917      composeBackbone(element);
40918      if (element.hasLabelElement()) {
40919        composeStringCore("label", element.getLabelElement(), false);
40920        composeStringExtras("label", element.getLabelElement(), false);
40921      }
40922      if (element.hasDescriptionElement()) {
40923        composeStringCore("description", element.getDescriptionElement(), false);
40924        composeStringExtras("description", element.getDescriptionElement(), false);
40925      }
40926      if (element.hasDirectionElement()) {
40927        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
40928        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
40929      }
40930      if (element.hasCompareToSourceIdElement()) {
40931        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
40932        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
40933      }
40934      if (element.hasCompareToSourceExpressionElement()) {
40935        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
40936        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
40937      }
40938      if (element.hasCompareToSourcePathElement()) {
40939        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
40940        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
40941      }
40942      if (element.hasContentTypeElement()) {
40943        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40944        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40945      }
40946      if (element.hasExpressionElement()) {
40947        composeStringCore("expression", element.getExpressionElement(), false);
40948        composeStringExtras("expression", element.getExpressionElement(), false);
40949      }
40950      if (element.hasHeaderFieldElement()) {
40951        composeStringCore("headerField", element.getHeaderFieldElement(), false);
40952        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
40953      }
40954      if (element.hasMinimumIdElement()) {
40955        composeStringCore("minimumId", element.getMinimumIdElement(), false);
40956        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
40957      }
40958      if (element.hasNavigationLinksElement()) {
40959        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
40960        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
40961      }
40962      if (element.hasOperatorElement()) {
40963        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
40964        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
40965      }
40966      if (element.hasPathElement()) {
40967        composeStringCore("path", element.getPathElement(), false);
40968        composeStringExtras("path", element.getPathElement(), false);
40969      }
40970      if (element.hasRequestMethodElement()) {
40971        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
40972        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
40973      }
40974      if (element.hasRequestURLElement()) {
40975        composeStringCore("requestURL", element.getRequestURLElement(), false);
40976        composeStringExtras("requestURL", element.getRequestURLElement(), false);
40977      }
40978      if (element.hasResourceElement()) {
40979        composeCodeCore("resource", element.getResourceElement(), false);
40980        composeCodeExtras("resource", element.getResourceElement(), false);
40981      }
40982      if (element.hasResponseElement()) {
40983        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
40984        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
40985      }
40986      if (element.hasResponseCodeElement()) {
40987        composeStringCore("responseCode", element.getResponseCodeElement(), false);
40988        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
40989      }
40990      if (element.hasRule()) {
40991        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
40992      }
40993      if (element.hasRuleset()) {
40994        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
40995      }
40996      if (element.hasSourceIdElement()) {
40997        composeIdCore("sourceId", element.getSourceIdElement(), false);
40998        composeIdExtras("sourceId", element.getSourceIdElement(), false);
40999      }
41000      if (element.hasValidateProfileIdElement()) {
41001        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
41002        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
41003      }
41004      if (element.hasValueElement()) {
41005        composeStringCore("value", element.getValueElement(), false);
41006        composeStringExtras("value", element.getValueElement(), false);
41007      }
41008      if (element.hasWarningOnlyElement()) {
41009        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
41010        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
41011      }
41012  }
41013
41014  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
41015    if (element != null) {
41016      open(name);
41017      composeTestScriptActionAssertRuleComponentInner(element);
41018      close();
41019    }
41020  }
41021
41022  protected void composeTestScriptActionAssertRuleComponentInner(TestScript.ActionAssertRuleComponent element) throws IOException {
41023      composeBackbone(element);
41024      if (element.hasRuleIdElement()) {
41025        composeIdCore("ruleId", element.getRuleIdElement(), false);
41026        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41027      }
41028      if (element.hasParam()) {
41029        openArray("param");
41030        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
41031          composeTestScriptActionAssertRuleParamComponent(null, e);
41032        closeArray();
41033      };
41034  }
41035
41036  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
41037    if (element != null) {
41038      open(name);
41039      composeTestScriptActionAssertRuleParamComponentInner(element);
41040      close();
41041    }
41042  }
41043
41044  protected void composeTestScriptActionAssertRuleParamComponentInner(TestScript.ActionAssertRuleParamComponent element) throws IOException {
41045      composeBackbone(element);
41046      if (element.hasNameElement()) {
41047        composeStringCore("name", element.getNameElement(), false);
41048        composeStringExtras("name", element.getNameElement(), false);
41049      }
41050      if (element.hasValueElement()) {
41051        composeStringCore("value", element.getValueElement(), false);
41052        composeStringExtras("value", element.getValueElement(), false);
41053      }
41054  }
41055
41056  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
41057    if (element != null) {
41058      open(name);
41059      composeTestScriptActionAssertRulesetComponentInner(element);
41060      close();
41061    }
41062  }
41063
41064  protected void composeTestScriptActionAssertRulesetComponentInner(TestScript.ActionAssertRulesetComponent element) throws IOException {
41065      composeBackbone(element);
41066      if (element.hasRulesetIdElement()) {
41067        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
41068        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
41069      }
41070      if (element.hasRule()) {
41071        openArray("rule");
41072        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
41073          composeTestScriptActionAssertRulesetRuleComponent(null, e);
41074        closeArray();
41075      };
41076  }
41077
41078  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41079    if (element != null) {
41080      open(name);
41081      composeTestScriptActionAssertRulesetRuleComponentInner(element);
41082      close();
41083    }
41084  }
41085
41086  protected void composeTestScriptActionAssertRulesetRuleComponentInner(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41087      composeBackbone(element);
41088      if (element.hasRuleIdElement()) {
41089        composeIdCore("ruleId", element.getRuleIdElement(), false);
41090        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41091      }
41092      if (element.hasParam()) {
41093        openArray("param");
41094        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
41095          composeTestScriptActionAssertRulesetRuleParamComponent(null, e);
41096        closeArray();
41097      };
41098  }
41099
41100  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41101    if (element != null) {
41102      open(name);
41103      composeTestScriptActionAssertRulesetRuleParamComponentInner(element);
41104      close();
41105    }
41106  }
41107
41108  protected void composeTestScriptActionAssertRulesetRuleParamComponentInner(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41109      composeBackbone(element);
41110      if (element.hasNameElement()) {
41111        composeStringCore("name", element.getNameElement(), false);
41112        composeStringExtras("name", element.getNameElement(), false);
41113      }
41114      if (element.hasValueElement()) {
41115        composeStringCore("value", element.getValueElement(), false);
41116        composeStringExtras("value", element.getValueElement(), false);
41117      }
41118  }
41119
41120  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
41121    if (element != null) {
41122      open(name);
41123      composeTestScriptTestScriptTestComponentInner(element);
41124      close();
41125    }
41126  }
41127
41128  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
41129      composeBackbone(element);
41130      if (element.hasNameElement()) {
41131        composeStringCore("name", element.getNameElement(), false);
41132        composeStringExtras("name", element.getNameElement(), false);
41133      }
41134      if (element.hasDescriptionElement()) {
41135        composeStringCore("description", element.getDescriptionElement(), false);
41136        composeStringExtras("description", element.getDescriptionElement(), false);
41137      }
41138      if (element.hasAction()) {
41139        openArray("action");
41140        for (TestScript.TestActionComponent e : element.getAction()) 
41141          composeTestScriptTestActionComponent(null, e);
41142        closeArray();
41143      };
41144  }
41145
41146  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
41147    if (element != null) {
41148      open(name);
41149      composeTestScriptTestActionComponentInner(element);
41150      close();
41151    }
41152  }
41153
41154  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
41155      composeBackbone(element);
41156      if (element.hasOperation()) {
41157        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41158      }
41159      if (element.hasAssert()) {
41160        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
41161      }
41162  }
41163
41164  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
41165    if (element != null) {
41166      open(name);
41167      composeTestScriptTestScriptTeardownComponentInner(element);
41168      close();
41169    }
41170  }
41171
41172  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
41173      composeBackbone(element);
41174      if (element.hasAction()) {
41175        openArray("action");
41176        for (TestScript.TeardownActionComponent e : element.getAction()) 
41177          composeTestScriptTeardownActionComponent(null, e);
41178        closeArray();
41179      };
41180  }
41181
41182  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
41183    if (element != null) {
41184      open(name);
41185      composeTestScriptTeardownActionComponentInner(element);
41186      close();
41187    }
41188  }
41189
41190  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
41191      composeBackbone(element);
41192      if (element.hasOperation()) {
41193        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41194      }
41195  }
41196
41197  protected void composeValueSet(String name, ValueSet element) throws IOException {
41198    if (element != null) {
41199      prop("resourceType", name);
41200      composeValueSetInner(element);
41201    }
41202  }
41203
41204  protected void composeValueSetInner(ValueSet element) throws IOException {
41205      composeDomainResourceElements(element);
41206      if (element.hasUrlElement()) {
41207        composeUriCore("url", element.getUrlElement(), false);
41208        composeUriExtras("url", element.getUrlElement(), false);
41209      }
41210      if (element.hasIdentifier()) {
41211        openArray("identifier");
41212        for (Identifier e : element.getIdentifier()) 
41213          composeIdentifier(null, e);
41214        closeArray();
41215      };
41216      if (element.hasVersionElement()) {
41217        composeStringCore("version", element.getVersionElement(), false);
41218        composeStringExtras("version", element.getVersionElement(), false);
41219      }
41220      if (element.hasNameElement()) {
41221        composeStringCore("name", element.getNameElement(), false);
41222        composeStringExtras("name", element.getNameElement(), false);
41223      }
41224      if (element.hasTitleElement()) {
41225        composeStringCore("title", element.getTitleElement(), false);
41226        composeStringExtras("title", element.getTitleElement(), false);
41227      }
41228      if (element.hasStatusElement()) {
41229        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41230        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41231      }
41232      if (element.hasExperimentalElement()) {
41233        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41234        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41235      }
41236      if (element.hasDateElement()) {
41237        composeDateTimeCore("date", element.getDateElement(), false);
41238        composeDateTimeExtras("date", element.getDateElement(), false);
41239      }
41240      if (element.hasPublisherElement()) {
41241        composeStringCore("publisher", element.getPublisherElement(), false);
41242        composeStringExtras("publisher", element.getPublisherElement(), false);
41243      }
41244      if (element.hasContact()) {
41245        openArray("contact");
41246        for (ContactDetail e : element.getContact()) 
41247          composeContactDetail(null, e);
41248        closeArray();
41249      };
41250      if (element.hasDescriptionElement()) {
41251        composeMarkdownCore("description", element.getDescriptionElement(), false);
41252        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41253      }
41254      if (element.hasUseContext()) {
41255        openArray("useContext");
41256        for (UsageContext e : element.getUseContext()) 
41257          composeUsageContext(null, e);
41258        closeArray();
41259      };
41260      if (element.hasJurisdiction()) {
41261        openArray("jurisdiction");
41262        for (CodeableConcept e : element.getJurisdiction()) 
41263          composeCodeableConcept(null, e);
41264        closeArray();
41265      };
41266      if (element.hasImmutableElement()) {
41267        composeBooleanCore("immutable", element.getImmutableElement(), false);
41268        composeBooleanExtras("immutable", element.getImmutableElement(), false);
41269      }
41270      if (element.hasPurposeElement()) {
41271        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41272        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41273      }
41274      if (element.hasCopyrightElement()) {
41275        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41276        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41277      }
41278      if (element.hasExtensibleElement()) {
41279        composeBooleanCore("extensible", element.getExtensibleElement(), false);
41280        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
41281      }
41282      if (element.hasCompose()) {
41283        composeValueSetValueSetComposeComponent("compose", element.getCompose());
41284      }
41285      if (element.hasExpansion()) {
41286        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
41287      }
41288  }
41289
41290  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
41291    if (element != null) {
41292      open(name);
41293      composeValueSetValueSetComposeComponentInner(element);
41294      close();
41295    }
41296  }
41297
41298  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
41299      composeBackbone(element);
41300      if (element.hasLockedDateElement()) {
41301        composeDateCore("lockedDate", element.getLockedDateElement(), false);
41302        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
41303      }
41304      if (element.hasInactiveElement()) {
41305        composeBooleanCore("inactive", element.getInactiveElement(), false);
41306        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41307      }
41308      if (element.hasInclude()) {
41309        openArray("include");
41310        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
41311          composeValueSetConceptSetComponent(null, e);
41312        closeArray();
41313      };
41314      if (element.hasExclude()) {
41315        openArray("exclude");
41316        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
41317          composeValueSetConceptSetComponent(null, e);
41318        closeArray();
41319      };
41320  }
41321
41322  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
41323    if (element != null) {
41324      open(name);
41325      composeValueSetConceptSetComponentInner(element);
41326      close();
41327    }
41328  }
41329
41330  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
41331      composeBackbone(element);
41332      if (element.hasSystemElement()) {
41333        composeUriCore("system", element.getSystemElement(), false);
41334        composeUriExtras("system", element.getSystemElement(), false);
41335      }
41336      if (element.hasVersionElement()) {
41337        composeStringCore("version", element.getVersionElement(), false);
41338        composeStringExtras("version", element.getVersionElement(), false);
41339      }
41340      if (element.hasConcept()) {
41341        openArray("concept");
41342        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
41343          composeValueSetConceptReferenceComponent(null, e);
41344        closeArray();
41345      };
41346      if (element.hasFilter()) {
41347        openArray("filter");
41348        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
41349          composeValueSetConceptSetFilterComponent(null, e);
41350        closeArray();
41351      };
41352      if (element.hasValueSet()) {
41353        openArray("valueSet");
41354        for (UriType e : element.getValueSet()) 
41355          composeUriCore(null, e, true);
41356        closeArray();
41357        if (anyHasExtras(element.getValueSet())) {
41358          openArray("_valueSet");
41359          for (UriType e : element.getValueSet()) 
41360            composeUriExtras(null, e, true);
41361          closeArray();
41362        }
41363      };
41364  }
41365
41366  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
41367    if (element != null) {
41368      open(name);
41369      composeValueSetConceptReferenceComponentInner(element);
41370      close();
41371    }
41372  }
41373
41374  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
41375      composeBackbone(element);
41376      if (element.hasCodeElement()) {
41377        composeCodeCore("code", element.getCodeElement(), false);
41378        composeCodeExtras("code", element.getCodeElement(), false);
41379      }
41380      if (element.hasDisplayElement()) {
41381        composeStringCore("display", element.getDisplayElement(), false);
41382        composeStringExtras("display", element.getDisplayElement(), false);
41383      }
41384      if (element.hasDesignation()) {
41385        openArray("designation");
41386        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41387          composeValueSetConceptReferenceDesignationComponent(null, e);
41388        closeArray();
41389      };
41390  }
41391
41392  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41393    if (element != null) {
41394      open(name);
41395      composeValueSetConceptReferenceDesignationComponentInner(element);
41396      close();
41397    }
41398  }
41399
41400  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41401      composeBackbone(element);
41402      if (element.hasLanguageElement()) {
41403        composeCodeCore("language", element.getLanguageElement(), false);
41404        composeCodeExtras("language", element.getLanguageElement(), false);
41405      }
41406      if (element.hasUse()) {
41407        composeCoding("use", element.getUse());
41408      }
41409      if (element.hasValueElement()) {
41410        composeStringCore("value", element.getValueElement(), false);
41411        composeStringExtras("value", element.getValueElement(), false);
41412      }
41413  }
41414
41415  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
41416    if (element != null) {
41417      open(name);
41418      composeValueSetConceptSetFilterComponentInner(element);
41419      close();
41420    }
41421  }
41422
41423  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
41424      composeBackbone(element);
41425      if (element.hasPropertyElement()) {
41426        composeCodeCore("property", element.getPropertyElement(), false);
41427        composeCodeExtras("property", element.getPropertyElement(), false);
41428      }
41429      if (element.hasOpElement()) {
41430        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41431        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41432      }
41433      if (element.hasValueElement()) {
41434        composeCodeCore("value", element.getValueElement(), false);
41435        composeCodeExtras("value", element.getValueElement(), false);
41436      }
41437  }
41438
41439  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
41440    if (element != null) {
41441      open(name);
41442      composeValueSetValueSetExpansionComponentInner(element);
41443      close();
41444    }
41445  }
41446
41447  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
41448      composeBackbone(element);
41449      if (element.hasIdentifierElement()) {
41450        composeUriCore("identifier", element.getIdentifierElement(), false);
41451        composeUriExtras("identifier", element.getIdentifierElement(), false);
41452      }
41453      if (element.hasTimestampElement()) {
41454        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
41455        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
41456      }
41457      if (element.hasTotalElement()) {
41458        composeIntegerCore("total", element.getTotalElement(), false);
41459        composeIntegerExtras("total", element.getTotalElement(), false);
41460      }
41461      if (element.hasOffsetElement()) {
41462        composeIntegerCore("offset", element.getOffsetElement(), false);
41463        composeIntegerExtras("offset", element.getOffsetElement(), false);
41464      }
41465      if (element.hasParameter()) {
41466        openArray("parameter");
41467        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
41468          composeValueSetValueSetExpansionParameterComponent(null, e);
41469        closeArray();
41470      };
41471      if (element.hasContains()) {
41472        openArray("contains");
41473        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41474          composeValueSetValueSetExpansionContainsComponent(null, e);
41475        closeArray();
41476      };
41477  }
41478
41479  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41480    if (element != null) {
41481      open(name);
41482      composeValueSetValueSetExpansionParameterComponentInner(element);
41483      close();
41484    }
41485  }
41486
41487  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41488      composeBackbone(element);
41489      if (element.hasNameElement()) {
41490        composeStringCore("name", element.getNameElement(), false);
41491        composeStringExtras("name", element.getNameElement(), false);
41492      }
41493      if (element.hasValue()) {
41494        composeType("value", element.getValue());
41495      }
41496  }
41497
41498  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41499    if (element != null) {
41500      open(name);
41501      composeValueSetValueSetExpansionContainsComponentInner(element);
41502      close();
41503    }
41504  }
41505
41506  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41507      composeBackbone(element);
41508      if (element.hasSystemElement()) {
41509        composeUriCore("system", element.getSystemElement(), false);
41510        composeUriExtras("system", element.getSystemElement(), false);
41511      }
41512      if (element.hasAbstractElement()) {
41513        composeBooleanCore("abstract", element.getAbstractElement(), false);
41514        composeBooleanExtras("abstract", element.getAbstractElement(), false);
41515      }
41516      if (element.hasInactiveElement()) {
41517        composeBooleanCore("inactive", element.getInactiveElement(), false);
41518        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41519      }
41520      if (element.hasVersionElement()) {
41521        composeStringCore("version", element.getVersionElement(), false);
41522        composeStringExtras("version", element.getVersionElement(), false);
41523      }
41524      if (element.hasCodeElement()) {
41525        composeCodeCore("code", element.getCodeElement(), false);
41526        composeCodeExtras("code", element.getCodeElement(), false);
41527      }
41528      if (element.hasDisplayElement()) {
41529        composeStringCore("display", element.getDisplayElement(), false);
41530        composeStringExtras("display", element.getDisplayElement(), false);
41531      }
41532      if (element.hasDesignation()) {
41533        openArray("designation");
41534        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41535          composeValueSetConceptReferenceDesignationComponent(null, e);
41536        closeArray();
41537      };
41538      if (element.hasContains()) {
41539        openArray("contains");
41540        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41541          composeValueSetValueSetExpansionContainsComponent(null, e);
41542        closeArray();
41543      };
41544  }
41545
41546  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
41547    if (element != null) {
41548      prop("resourceType", name);
41549      composeVisionPrescriptionInner(element);
41550    }
41551  }
41552
41553  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
41554      composeDomainResourceElements(element);
41555      if (element.hasIdentifier()) {
41556        openArray("identifier");
41557        for (Identifier e : element.getIdentifier()) 
41558          composeIdentifier(null, e);
41559        closeArray();
41560      };
41561      if (element.hasStatusElement()) {
41562        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41563        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41564      }
41565      if (element.hasPatient()) {
41566        composeReference("patient", element.getPatient());
41567      }
41568      if (element.hasEncounter()) {
41569        composeReference("encounter", element.getEncounter());
41570      }
41571      if (element.hasDateWrittenElement()) {
41572        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
41573        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
41574      }
41575      if (element.hasPrescriber()) {
41576        composeReference("prescriber", element.getPrescriber());
41577      }
41578      if (element.hasReason()) {
41579        composeType("reason", element.getReason());
41580      }
41581      if (element.hasDispense()) {
41582        openArray("dispense");
41583        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
41584          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
41585        closeArray();
41586      };
41587  }
41588
41589  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41590    if (element != null) {
41591      open(name);
41592      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
41593      close();
41594    }
41595  }
41596
41597  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41598      composeBackbone(element);
41599      if (element.hasProduct()) {
41600        composeCodeableConcept("product", element.getProduct());
41601      }
41602      if (element.hasEyeElement()) {
41603        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41604        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41605      }
41606      if (element.hasSphereElement()) {
41607        composeDecimalCore("sphere", element.getSphereElement(), false);
41608        composeDecimalExtras("sphere", element.getSphereElement(), false);
41609      }
41610      if (element.hasCylinderElement()) {
41611        composeDecimalCore("cylinder", element.getCylinderElement(), false);
41612        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
41613      }
41614      if (element.hasAxisElement()) {
41615        composeIntegerCore("axis", element.getAxisElement(), false);
41616        composeIntegerExtras("axis", element.getAxisElement(), false);
41617      }
41618      if (element.hasPrismElement()) {
41619        composeDecimalCore("prism", element.getPrismElement(), false);
41620        composeDecimalExtras("prism", element.getPrismElement(), false);
41621      }
41622      if (element.hasBaseElement()) {
41623        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41624        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41625      }
41626      if (element.hasAddElement()) {
41627        composeDecimalCore("add", element.getAddElement(), false);
41628        composeDecimalExtras("add", element.getAddElement(), false);
41629      }
41630      if (element.hasPowerElement()) {
41631        composeDecimalCore("power", element.getPowerElement(), false);
41632        composeDecimalExtras("power", element.getPowerElement(), false);
41633      }
41634      if (element.hasBackCurveElement()) {
41635        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
41636        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
41637      }
41638      if (element.hasDiameterElement()) {
41639        composeDecimalCore("diameter", element.getDiameterElement(), false);
41640        composeDecimalExtras("diameter", element.getDiameterElement(), false);
41641      }
41642      if (element.hasDuration()) {
41643        composeSimpleQuantity("duration", element.getDuration());
41644      }
41645      if (element.hasColorElement()) {
41646        composeStringCore("color", element.getColorElement(), false);
41647        composeStringExtras("color", element.getColorElement(), false);
41648      }
41649      if (element.hasBrandElement()) {
41650        composeStringCore("brand", element.getBrandElement(), false);
41651        composeStringExtras("brand", element.getBrandElement(), false);
41652      }
41653      if (element.hasNote()) {
41654        openArray("note");
41655        for (Annotation e : element.getNote()) 
41656          composeAnnotation(null, e);
41657        closeArray();
41658      };
41659  }
41660
41661  @Override
41662  protected void composeResource(Resource resource) throws IOException {
41663    if (resource instanceof Parameters)
41664      composeParameters("Parameters", (Parameters)resource);
41665    else if (resource instanceof Account)
41666      composeAccount("Account", (Account)resource);
41667    else if (resource instanceof ActivityDefinition)
41668      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
41669    else if (resource instanceof AdverseEvent)
41670      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
41671    else if (resource instanceof AllergyIntolerance)
41672      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
41673    else if (resource instanceof Appointment)
41674      composeAppointment("Appointment", (Appointment)resource);
41675    else if (resource instanceof AppointmentResponse)
41676      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
41677    else if (resource instanceof AuditEvent)
41678      composeAuditEvent("AuditEvent", (AuditEvent)resource);
41679    else if (resource instanceof Basic)
41680      composeBasic("Basic", (Basic)resource);
41681    else if (resource instanceof Binary)
41682      composeBinary("Binary", (Binary)resource);
41683    else if (resource instanceof BodySite)
41684      composeBodySite("BodySite", (BodySite)resource);
41685    else if (resource instanceof Bundle)
41686      composeBundle("Bundle", (Bundle)resource);
41687    else if (resource instanceof CapabilityStatement)
41688      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
41689    else if (resource instanceof CarePlan)
41690      composeCarePlan("CarePlan", (CarePlan)resource);
41691    else if (resource instanceof CareTeam)
41692      composeCareTeam("CareTeam", (CareTeam)resource);
41693    else if (resource instanceof ChargeItem)
41694      composeChargeItem("ChargeItem", (ChargeItem)resource);
41695    else if (resource instanceof Claim)
41696      composeClaim("Claim", (Claim)resource);
41697    else if (resource instanceof ClaimResponse)
41698      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
41699    else if (resource instanceof ClinicalImpression)
41700      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
41701    else if (resource instanceof CodeSystem)
41702      composeCodeSystem("CodeSystem", (CodeSystem)resource);
41703    else if (resource instanceof Communication)
41704      composeCommunication("Communication", (Communication)resource);
41705    else if (resource instanceof CommunicationRequest)
41706      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
41707    else if (resource instanceof CompartmentDefinition)
41708      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
41709    else if (resource instanceof Composition)
41710      composeComposition("Composition", (Composition)resource);
41711    else if (resource instanceof ConceptMap)
41712      composeConceptMap("ConceptMap", (ConceptMap)resource);
41713    else if (resource instanceof Condition)
41714      composeCondition("Condition", (Condition)resource);
41715    else if (resource instanceof Consent)
41716      composeConsent("Consent", (Consent)resource);
41717    else if (resource instanceof Contract)
41718      composeContract("Contract", (Contract)resource);
41719    else if (resource instanceof Coverage)
41720      composeCoverage("Coverage", (Coverage)resource);
41721    else if (resource instanceof DataElement)
41722      composeDataElement("DataElement", (DataElement)resource);
41723    else if (resource instanceof DetectedIssue)
41724      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
41725    else if (resource instanceof Device)
41726      composeDevice("Device", (Device)resource);
41727    else if (resource instanceof DeviceComponent)
41728      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
41729    else if (resource instanceof DeviceMetric)
41730      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
41731    else if (resource instanceof DeviceRequest)
41732      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
41733    else if (resource instanceof DeviceUseStatement)
41734      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
41735    else if (resource instanceof DiagnosticReport)
41736      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
41737    else if (resource instanceof DocumentManifest)
41738      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
41739    else if (resource instanceof DocumentReference)
41740      composeDocumentReference("DocumentReference", (DocumentReference)resource);
41741    else if (resource instanceof EligibilityRequest)
41742      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
41743    else if (resource instanceof EligibilityResponse)
41744      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
41745    else if (resource instanceof Encounter)
41746      composeEncounter("Encounter", (Encounter)resource);
41747    else if (resource instanceof Endpoint)
41748      composeEndpoint("Endpoint", (Endpoint)resource);
41749    else if (resource instanceof EnrollmentRequest)
41750      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
41751    else if (resource instanceof EnrollmentResponse)
41752      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
41753    else if (resource instanceof EpisodeOfCare)
41754      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
41755    else if (resource instanceof ExpansionProfile)
41756      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
41757    else if (resource instanceof ExplanationOfBenefit)
41758      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
41759    else if (resource instanceof FamilyMemberHistory)
41760      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
41761    else if (resource instanceof Flag)
41762      composeFlag("Flag", (Flag)resource);
41763    else if (resource instanceof Goal)
41764      composeGoal("Goal", (Goal)resource);
41765    else if (resource instanceof GraphDefinition)
41766      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
41767    else if (resource instanceof Group)
41768      composeGroup("Group", (Group)resource);
41769    else if (resource instanceof GuidanceResponse)
41770      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
41771    else if (resource instanceof HealthcareService)
41772      composeHealthcareService("HealthcareService", (HealthcareService)resource);
41773    else if (resource instanceof ImagingManifest)
41774      composeImagingManifest("ImagingManifest", (ImagingManifest)resource);
41775    else if (resource instanceof ImagingStudy)
41776      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
41777    else if (resource instanceof Immunization)
41778      composeImmunization("Immunization", (Immunization)resource);
41779    else if (resource instanceof ImmunizationRecommendation)
41780      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
41781    else if (resource instanceof ImplementationGuide)
41782      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
41783    else if (resource instanceof Library)
41784      composeLibrary("Library", (Library)resource);
41785    else if (resource instanceof Linkage)
41786      composeLinkage("Linkage", (Linkage)resource);
41787    else if (resource instanceof ListResource)
41788      composeListResource("List", (ListResource)resource);
41789    else if (resource instanceof Location)
41790      composeLocation("Location", (Location)resource);
41791    else if (resource instanceof Measure)
41792      composeMeasure("Measure", (Measure)resource);
41793    else if (resource instanceof MeasureReport)
41794      composeMeasureReport("MeasureReport", (MeasureReport)resource);
41795    else if (resource instanceof Media)
41796      composeMedia("Media", (Media)resource);
41797    else if (resource instanceof Medication)
41798      composeMedication("Medication", (Medication)resource);
41799    else if (resource instanceof MedicationAdministration)
41800      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
41801    else if (resource instanceof MedicationDispense)
41802      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
41803    else if (resource instanceof MedicationRequest)
41804      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
41805    else if (resource instanceof MedicationStatement)
41806      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
41807    else if (resource instanceof MessageDefinition)
41808      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
41809    else if (resource instanceof MessageHeader)
41810      composeMessageHeader("MessageHeader", (MessageHeader)resource);
41811    else if (resource instanceof NamingSystem)
41812      composeNamingSystem("NamingSystem", (NamingSystem)resource);
41813    else if (resource instanceof NutritionOrder)
41814      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
41815    else if (resource instanceof Observation)
41816      composeObservation("Observation", (Observation)resource);
41817    else if (resource instanceof OperationDefinition)
41818      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
41819    else if (resource instanceof OperationOutcome)
41820      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
41821    else if (resource instanceof Organization)
41822      composeOrganization("Organization", (Organization)resource);
41823    else if (resource instanceof Patient)
41824      composePatient("Patient", (Patient)resource);
41825    else if (resource instanceof PaymentNotice)
41826      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
41827    else if (resource instanceof PaymentReconciliation)
41828      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
41829    else if (resource instanceof Person)
41830      composePerson("Person", (Person)resource);
41831    else if (resource instanceof PlanDefinition)
41832      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
41833    else if (resource instanceof Practitioner)
41834      composePractitioner("Practitioner", (Practitioner)resource);
41835    else if (resource instanceof PractitionerRole)
41836      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
41837    else if (resource instanceof Procedure)
41838      composeProcedure("Procedure", (Procedure)resource);
41839    else if (resource instanceof ProcedureRequest)
41840      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
41841    else if (resource instanceof ProcessRequest)
41842      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
41843    else if (resource instanceof ProcessResponse)
41844      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
41845    else if (resource instanceof Provenance)
41846      composeProvenance("Provenance", (Provenance)resource);
41847    else if (resource instanceof Questionnaire)
41848      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
41849    else if (resource instanceof QuestionnaireResponse)
41850      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
41851    else if (resource instanceof ReferralRequest)
41852      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
41853    else if (resource instanceof RelatedPerson)
41854      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
41855    else if (resource instanceof RequestGroup)
41856      composeRequestGroup("RequestGroup", (RequestGroup)resource);
41857    else if (resource instanceof ResearchStudy)
41858      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
41859    else if (resource instanceof ResearchSubject)
41860      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
41861    else if (resource instanceof RiskAssessment)
41862      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
41863    else if (resource instanceof Schedule)
41864      composeSchedule("Schedule", (Schedule)resource);
41865    else if (resource instanceof SearchParameter)
41866      composeSearchParameter("SearchParameter", (SearchParameter)resource);
41867    else if (resource instanceof Sequence)
41868      composeSequence("Sequence", (Sequence)resource);
41869    else if (resource instanceof ServiceDefinition)
41870      composeServiceDefinition("ServiceDefinition", (ServiceDefinition)resource);
41871    else if (resource instanceof Slot)
41872      composeSlot("Slot", (Slot)resource);
41873    else if (resource instanceof Specimen)
41874      composeSpecimen("Specimen", (Specimen)resource);
41875    else if (resource instanceof StructureDefinition)
41876      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
41877    else if (resource instanceof StructureMap)
41878      composeStructureMap("StructureMap", (StructureMap)resource);
41879    else if (resource instanceof Subscription)
41880      composeSubscription("Subscription", (Subscription)resource);
41881    else if (resource instanceof Substance)
41882      composeSubstance("Substance", (Substance)resource);
41883    else if (resource instanceof SupplyDelivery)
41884      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
41885    else if (resource instanceof SupplyRequest)
41886      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
41887    else if (resource instanceof Task)
41888      composeTask("Task", (Task)resource);
41889    else if (resource instanceof TestReport)
41890      composeTestReport("TestReport", (TestReport)resource);
41891    else if (resource instanceof TestScript)
41892      composeTestScript("TestScript", (TestScript)resource);
41893    else if (resource instanceof ValueSet)
41894      composeValueSet("ValueSet", (ValueSet)resource);
41895    else if (resource instanceof VisionPrescription)
41896      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
41897    else if (resource instanceof Binary)
41898      composeBinary("Binary", (Binary)resource);
41899    else
41900      throw new Error("Unhandled resource type "+resource.getClass().getName());
41901  }
41902
41903  protected void composeNamedReference(String name, Resource resource) throws IOException {
41904    if (resource instanceof Parameters)
41905      composeParameters(name, (Parameters)resource);
41906    else if (resource instanceof Account)
41907      composeAccount(name, (Account)resource);
41908    else if (resource instanceof ActivityDefinition)
41909      composeActivityDefinition(name, (ActivityDefinition)resource);
41910    else if (resource instanceof AdverseEvent)
41911      composeAdverseEvent(name, (AdverseEvent)resource);
41912    else if (resource instanceof AllergyIntolerance)
41913      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
41914    else if (resource instanceof Appointment)
41915      composeAppointment(name, (Appointment)resource);
41916    else if (resource instanceof AppointmentResponse)
41917      composeAppointmentResponse(name, (AppointmentResponse)resource);
41918    else if (resource instanceof AuditEvent)
41919      composeAuditEvent(name, (AuditEvent)resource);
41920    else if (resource instanceof Basic)
41921      composeBasic(name, (Basic)resource);
41922    else if (resource instanceof Binary)
41923      composeBinary(name, (Binary)resource);
41924    else if (resource instanceof BodySite)
41925      composeBodySite(name, (BodySite)resource);
41926    else if (resource instanceof Bundle)
41927      composeBundle(name, (Bundle)resource);
41928    else if (resource instanceof CapabilityStatement)
41929      composeCapabilityStatement(name, (CapabilityStatement)resource);
41930    else if (resource instanceof CarePlan)
41931      composeCarePlan(name, (CarePlan)resource);
41932    else if (resource instanceof CareTeam)
41933      composeCareTeam(name, (CareTeam)resource);
41934    else if (resource instanceof ChargeItem)
41935      composeChargeItem(name, (ChargeItem)resource);
41936    else if (resource instanceof Claim)
41937      composeClaim(name, (Claim)resource);
41938    else if (resource instanceof ClaimResponse)
41939      composeClaimResponse(name, (ClaimResponse)resource);
41940    else if (resource instanceof ClinicalImpression)
41941      composeClinicalImpression(name, (ClinicalImpression)resource);
41942    else if (resource instanceof CodeSystem)
41943      composeCodeSystem(name, (CodeSystem)resource);
41944    else if (resource instanceof Communication)
41945      composeCommunication(name, (Communication)resource);
41946    else if (resource instanceof CommunicationRequest)
41947      composeCommunicationRequest(name, (CommunicationRequest)resource);
41948    else if (resource instanceof CompartmentDefinition)
41949      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
41950    else if (resource instanceof Composition)
41951      composeComposition(name, (Composition)resource);
41952    else if (resource instanceof ConceptMap)
41953      composeConceptMap(name, (ConceptMap)resource);
41954    else if (resource instanceof Condition)
41955      composeCondition(name, (Condition)resource);
41956    else if (resource instanceof Consent)
41957      composeConsent(name, (Consent)resource);
41958    else if (resource instanceof Contract)
41959      composeContract(name, (Contract)resource);
41960    else if (resource instanceof Coverage)
41961      composeCoverage(name, (Coverage)resource);
41962    else if (resource instanceof DataElement)
41963      composeDataElement(name, (DataElement)resource);
41964    else if (resource instanceof DetectedIssue)
41965      composeDetectedIssue(name, (DetectedIssue)resource);
41966    else if (resource instanceof Device)
41967      composeDevice(name, (Device)resource);
41968    else if (resource instanceof DeviceComponent)
41969      composeDeviceComponent(name, (DeviceComponent)resource);
41970    else if (resource instanceof DeviceMetric)
41971      composeDeviceMetric(name, (DeviceMetric)resource);
41972    else if (resource instanceof DeviceRequest)
41973      composeDeviceRequest(name, (DeviceRequest)resource);
41974    else if (resource instanceof DeviceUseStatement)
41975      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
41976    else if (resource instanceof DiagnosticReport)
41977      composeDiagnosticReport(name, (DiagnosticReport)resource);
41978    else if (resource instanceof DocumentManifest)
41979      composeDocumentManifest(name, (DocumentManifest)resource);
41980    else if (resource instanceof DocumentReference)
41981      composeDocumentReference(name, (DocumentReference)resource);
41982    else if (resource instanceof EligibilityRequest)
41983      composeEligibilityRequest(name, (EligibilityRequest)resource);
41984    else if (resource instanceof EligibilityResponse)
41985      composeEligibilityResponse(name, (EligibilityResponse)resource);
41986    else if (resource instanceof Encounter)
41987      composeEncounter(name, (Encounter)resource);
41988    else if (resource instanceof Endpoint)
41989      composeEndpoint(name, (Endpoint)resource);
41990    else if (resource instanceof EnrollmentRequest)
41991      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
41992    else if (resource instanceof EnrollmentResponse)
41993      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
41994    else if (resource instanceof EpisodeOfCare)
41995      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
41996    else if (resource instanceof ExpansionProfile)
41997      composeExpansionProfile(name, (ExpansionProfile)resource);
41998    else if (resource instanceof ExplanationOfBenefit)
41999      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
42000    else if (resource instanceof FamilyMemberHistory)
42001      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
42002    else if (resource instanceof Flag)
42003      composeFlag(name, (Flag)resource);
42004    else if (resource instanceof Goal)
42005      composeGoal(name, (Goal)resource);
42006    else if (resource instanceof GraphDefinition)
42007      composeGraphDefinition(name, (GraphDefinition)resource);
42008    else if (resource instanceof Group)
42009      composeGroup(name, (Group)resource);
42010    else if (resource instanceof GuidanceResponse)
42011      composeGuidanceResponse(name, (GuidanceResponse)resource);
42012    else if (resource instanceof HealthcareService)
42013      composeHealthcareService(name, (HealthcareService)resource);
42014    else if (resource instanceof ImagingManifest)
42015      composeImagingManifest(name, (ImagingManifest)resource);
42016    else if (resource instanceof ImagingStudy)
42017      composeImagingStudy(name, (ImagingStudy)resource);
42018    else if (resource instanceof Immunization)
42019      composeImmunization(name, (Immunization)resource);
42020    else if (resource instanceof ImmunizationRecommendation)
42021      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
42022    else if (resource instanceof ImplementationGuide)
42023      composeImplementationGuide(name, (ImplementationGuide)resource);
42024    else if (resource instanceof Library)
42025      composeLibrary(name, (Library)resource);
42026    else if (resource instanceof Linkage)
42027      composeLinkage(name, (Linkage)resource);
42028    else if (resource instanceof ListResource)
42029      composeListResource(name, (ListResource)resource);
42030    else if (resource instanceof Location)
42031      composeLocation(name, (Location)resource);
42032    else if (resource instanceof Measure)
42033      composeMeasure(name, (Measure)resource);
42034    else if (resource instanceof MeasureReport)
42035      composeMeasureReport(name, (MeasureReport)resource);
42036    else if (resource instanceof Media)
42037      composeMedia(name, (Media)resource);
42038    else if (resource instanceof Medication)
42039      composeMedication(name, (Medication)resource);
42040    else if (resource instanceof MedicationAdministration)
42041      composeMedicationAdministration(name, (MedicationAdministration)resource);
42042    else if (resource instanceof MedicationDispense)
42043      composeMedicationDispense(name, (MedicationDispense)resource);
42044    else if (resource instanceof MedicationRequest)
42045      composeMedicationRequest(name, (MedicationRequest)resource);
42046    else if (resource instanceof MedicationStatement)
42047      composeMedicationStatement(name, (MedicationStatement)resource);
42048    else if (resource instanceof MessageDefinition)
42049      composeMessageDefinition(name, (MessageDefinition)resource);
42050    else if (resource instanceof MessageHeader)
42051      composeMessageHeader(name, (MessageHeader)resource);
42052    else if (resource instanceof NamingSystem)
42053      composeNamingSystem(name, (NamingSystem)resource);
42054    else if (resource instanceof NutritionOrder)
42055      composeNutritionOrder(name, (NutritionOrder)resource);
42056    else if (resource instanceof Observation)
42057      composeObservation(name, (Observation)resource);
42058    else if (resource instanceof OperationDefinition)
42059      composeOperationDefinition(name, (OperationDefinition)resource);
42060    else if (resource instanceof OperationOutcome)
42061      composeOperationOutcome(name, (OperationOutcome)resource);
42062    else if (resource instanceof Organization)
42063      composeOrganization(name, (Organization)resource);
42064    else if (resource instanceof Patient)
42065      composePatient(name, (Patient)resource);
42066    else if (resource instanceof PaymentNotice)
42067      composePaymentNotice(name, (PaymentNotice)resource);
42068    else if (resource instanceof PaymentReconciliation)
42069      composePaymentReconciliation(name, (PaymentReconciliation)resource);
42070    else if (resource instanceof Person)
42071      composePerson(name, (Person)resource);
42072    else if (resource instanceof PlanDefinition)
42073      composePlanDefinition(name, (PlanDefinition)resource);
42074    else if (resource instanceof Practitioner)
42075      composePractitioner(name, (Practitioner)resource);
42076    else if (resource instanceof PractitionerRole)
42077      composePractitionerRole(name, (PractitionerRole)resource);
42078    else if (resource instanceof Procedure)
42079      composeProcedure(name, (Procedure)resource);
42080    else if (resource instanceof ProcedureRequest)
42081      composeProcedureRequest(name, (ProcedureRequest)resource);
42082    else if (resource instanceof ProcessRequest)
42083      composeProcessRequest(name, (ProcessRequest)resource);
42084    else if (resource instanceof ProcessResponse)
42085      composeProcessResponse(name, (ProcessResponse)resource);
42086    else if (resource instanceof Provenance)
42087      composeProvenance(name, (Provenance)resource);
42088    else if (resource instanceof Questionnaire)
42089      composeQuestionnaire(name, (Questionnaire)resource);
42090    else if (resource instanceof QuestionnaireResponse)
42091      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
42092    else if (resource instanceof ReferralRequest)
42093      composeReferralRequest(name, (ReferralRequest)resource);
42094    else if (resource instanceof RelatedPerson)
42095      composeRelatedPerson(name, (RelatedPerson)resource);
42096    else if (resource instanceof RequestGroup)
42097      composeRequestGroup(name, (RequestGroup)resource);
42098    else if (resource instanceof ResearchStudy)
42099      composeResearchStudy(name, (ResearchStudy)resource);
42100    else if (resource instanceof ResearchSubject)
42101      composeResearchSubject(name, (ResearchSubject)resource);
42102    else if (resource instanceof RiskAssessment)
42103      composeRiskAssessment(name, (RiskAssessment)resource);
42104    else if (resource instanceof Schedule)
42105      composeSchedule(name, (Schedule)resource);
42106    else if (resource instanceof SearchParameter)
42107      composeSearchParameter(name, (SearchParameter)resource);
42108    else if (resource instanceof Sequence)
42109      composeSequence(name, (Sequence)resource);
42110    else if (resource instanceof ServiceDefinition)
42111      composeServiceDefinition(name, (ServiceDefinition)resource);
42112    else if (resource instanceof Slot)
42113      composeSlot(name, (Slot)resource);
42114    else if (resource instanceof Specimen)
42115      composeSpecimen(name, (Specimen)resource);
42116    else if (resource instanceof StructureDefinition)
42117      composeStructureDefinition(name, (StructureDefinition)resource);
42118    else if (resource instanceof StructureMap)
42119      composeStructureMap(name, (StructureMap)resource);
42120    else if (resource instanceof Subscription)
42121      composeSubscription(name, (Subscription)resource);
42122    else if (resource instanceof Substance)
42123      composeSubstance(name, (Substance)resource);
42124    else if (resource instanceof SupplyDelivery)
42125      composeSupplyDelivery(name, (SupplyDelivery)resource);
42126    else if (resource instanceof SupplyRequest)
42127      composeSupplyRequest(name, (SupplyRequest)resource);
42128    else if (resource instanceof Task)
42129      composeTask(name, (Task)resource);
42130    else if (resource instanceof TestReport)
42131      composeTestReport(name, (TestReport)resource);
42132    else if (resource instanceof TestScript)
42133      composeTestScript(name, (TestScript)resource);
42134    else if (resource instanceof ValueSet)
42135      composeValueSet(name, (ValueSet)resource);
42136    else if (resource instanceof VisionPrescription)
42137      composeVisionPrescription(name, (VisionPrescription)resource);
42138    else if (resource instanceof Binary)
42139      composeBinary(name, (Binary)resource);
42140    else
42141      throw new Error("Unhandled resource type "+resource.getClass().getName());
42142  }
42143
42144  protected void composeType(String prefix, Type type) throws IOException {
42145    if (type == null)
42146      ;
42147    else if (type instanceof SimpleQuantity)
42148       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
42149    else if (type instanceof Duration)
42150       composeDuration(prefix+"Duration", (Duration) type);
42151    else if (type instanceof Count)
42152       composeCount(prefix+"Count", (Count) type);
42153    else if (type instanceof Money)
42154       composeMoney(prefix+"Money", (Money) type);
42155    else if (type instanceof Distance)
42156       composeDistance(prefix+"Distance", (Distance) type);
42157    else if (type instanceof Age)
42158       composeAge(prefix+"Age", (Age) type);
42159    else if (type instanceof Reference)
42160       composeReference(prefix+"Reference", (Reference) type);
42161    else if (type instanceof Quantity)
42162       composeQuantity(prefix+"Quantity", (Quantity) type);
42163    else if (type instanceof Period)
42164       composePeriod(prefix+"Period", (Period) type);
42165    else if (type instanceof Attachment)
42166       composeAttachment(prefix+"Attachment", (Attachment) type);
42167    else if (type instanceof Range)
42168       composeRange(prefix+"Range", (Range) type);
42169    else if (type instanceof Annotation)
42170       composeAnnotation(prefix+"Annotation", (Annotation) type);
42171    else if (type instanceof Identifier)
42172       composeIdentifier(prefix+"Identifier", (Identifier) type);
42173    else if (type instanceof Coding)
42174       composeCoding(prefix+"Coding", (Coding) type);
42175    else if (type instanceof Signature)
42176       composeSignature(prefix+"Signature", (Signature) type);
42177    else if (type instanceof SampledData)
42178       composeSampledData(prefix+"SampledData", (SampledData) type);
42179    else if (type instanceof Ratio)
42180       composeRatio(prefix+"Ratio", (Ratio) type);
42181    else if (type instanceof CodeableConcept)
42182       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
42183    else if (type instanceof Meta)
42184       composeMeta(prefix+"Meta", (Meta) type);
42185    else if (type instanceof Address)
42186       composeAddress(prefix+"Address", (Address) type);
42187    else if (type instanceof TriggerDefinition)
42188       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
42189    else if (type instanceof Contributor)
42190       composeContributor(prefix+"Contributor", (Contributor) type);
42191    else if (type instanceof DataRequirement)
42192       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
42193    else if (type instanceof Dosage)
42194       composeDosage(prefix+"Dosage", (Dosage) type);
42195    else if (type instanceof RelatedArtifact)
42196       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
42197    else if (type instanceof ContactDetail)
42198       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
42199    else if (type instanceof HumanName)
42200       composeHumanName(prefix+"HumanName", (HumanName) type);
42201    else if (type instanceof ContactPoint)
42202       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
42203    else if (type instanceof UsageContext)
42204       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
42205    else if (type instanceof Timing)
42206       composeTiming(prefix+"Timing", (Timing) type);
42207    else if (type instanceof ElementDefinition)
42208       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
42209    else if (type instanceof ParameterDefinition)
42210       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
42211    else if (type instanceof CodeType) {
42212      composeCodeCore(prefix+"Code", (CodeType) type, false);
42213      composeCodeExtras(prefix+"Code", (CodeType) type, false);
42214    }
42215    else if (type instanceof OidType) {
42216      composeOidCore(prefix+"Oid", (OidType) type, false);
42217      composeOidExtras(prefix+"Oid", (OidType) type, false);
42218    }
42219    else if (type instanceof UuidType) {
42220      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
42221      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
42222    }
42223    else if (type instanceof UnsignedIntType) {
42224      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42225      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42226    }
42227    else if (type instanceof MarkdownType) {
42228      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
42229      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
42230    }
42231    else if (type instanceof IdType) {
42232      composeIdCore(prefix+"Id", (IdType) type, false);
42233      composeIdExtras(prefix+"Id", (IdType) type, false);
42234    }
42235    else if (type instanceof PositiveIntType) {
42236      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
42237      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
42238    }
42239    else if (type instanceof DateType) {
42240      composeDateCore(prefix+"Date", (DateType) type, false);
42241      composeDateExtras(prefix+"Date", (DateType) type, false);
42242    }
42243    else if (type instanceof DateTimeType) {
42244      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
42245      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
42246    }
42247    else if (type instanceof StringType) {
42248      composeStringCore(prefix+"String", (StringType) type, false);
42249      composeStringExtras(prefix+"String", (StringType) type, false);
42250    }
42251    else if (type instanceof IntegerType) {
42252      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
42253      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
42254    }
42255    else if (type instanceof UriType) {
42256      composeUriCore(prefix+"Uri", (UriType) type, false);
42257      composeUriExtras(prefix+"Uri", (UriType) type, false);
42258    }
42259    else if (type instanceof InstantType) {
42260      composeInstantCore(prefix+"Instant", (InstantType) type, false);
42261      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
42262    }
42263    else if (type instanceof BooleanType) {
42264      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
42265      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
42266    }
42267    else if (type instanceof Base64BinaryType) {
42268      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
42269      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
42270    }
42271    else if (type instanceof TimeType) {
42272      composeTimeCore(prefix+"Time", (TimeType) type, false);
42273      composeTimeExtras(prefix+"Time", (TimeType) type, false);
42274    }
42275    else if (type instanceof DecimalType) {
42276      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
42277      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
42278    }
42279    else
42280      throw new Error("Unhandled type");
42281  }
42282
42283  protected void composeTypeInner(Type type) throws IOException {
42284    if (type == null)
42285      ;
42286    else if (type instanceof Duration)
42287       composeDurationInner((Duration) type);
42288    else if (type instanceof Count)
42289       composeCountInner((Count) type);
42290    else if (type instanceof Money)
42291       composeMoneyInner((Money) type);
42292    else if (type instanceof Distance)
42293       composeDistanceInner((Distance) type);
42294    else if (type instanceof Age)
42295       composeAgeInner((Age) type);
42296    else if (type instanceof Reference)
42297       composeReferenceInner((Reference) type);
42298    else if (type instanceof Quantity)
42299       composeQuantityInner((Quantity) type);
42300    else if (type instanceof Period)
42301       composePeriodInner((Period) type);
42302    else if (type instanceof Attachment)
42303       composeAttachmentInner((Attachment) type);
42304    else if (type instanceof Range)
42305       composeRangeInner((Range) type);
42306    else if (type instanceof Annotation)
42307       composeAnnotationInner((Annotation) type);
42308    else if (type instanceof Identifier)
42309       composeIdentifierInner((Identifier) type);
42310    else if (type instanceof Coding)
42311       composeCodingInner((Coding) type);
42312    else if (type instanceof Signature)
42313       composeSignatureInner((Signature) type);
42314    else if (type instanceof SampledData)
42315       composeSampledDataInner((SampledData) type);
42316    else if (type instanceof Ratio)
42317       composeRatioInner((Ratio) type);
42318    else if (type instanceof CodeableConcept)
42319       composeCodeableConceptInner((CodeableConcept) type);
42320    else if (type instanceof SimpleQuantity)
42321       composeSimpleQuantityInner((SimpleQuantity) type);
42322    else if (type instanceof Meta)
42323       composeMetaInner((Meta) type);
42324    else if (type instanceof Address)
42325       composeAddressInner((Address) type);
42326    else if (type instanceof TriggerDefinition)
42327       composeTriggerDefinitionInner((TriggerDefinition) type);
42328    else if (type instanceof Contributor)
42329       composeContributorInner((Contributor) type);
42330    else if (type instanceof DataRequirement)
42331       composeDataRequirementInner((DataRequirement) type);
42332    else if (type instanceof Dosage)
42333       composeDosageInner((Dosage) type);
42334    else if (type instanceof RelatedArtifact)
42335       composeRelatedArtifactInner((RelatedArtifact) type);
42336    else if (type instanceof ContactDetail)
42337       composeContactDetailInner((ContactDetail) type);
42338    else if (type instanceof HumanName)
42339       composeHumanNameInner((HumanName) type);
42340    else if (type instanceof ContactPoint)
42341       composeContactPointInner((ContactPoint) type);
42342    else if (type instanceof UsageContext)
42343       composeUsageContextInner((UsageContext) type);
42344    else if (type instanceof Timing)
42345       composeTimingInner((Timing) type);
42346    else if (type instanceof ElementDefinition)
42347       composeElementDefinitionInner((ElementDefinition) type);
42348    else if (type instanceof ParameterDefinition)
42349       composeParameterDefinitionInner((ParameterDefinition) type);
42350    else
42351      throw new Error("Unhandled type");
42352  }
42353
42354}
42355