001package org.hl7.fhir.dstu2.formats;
002
003
004
005
006import java.io.IOException;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036
037// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
038import org.hl7.fhir.dstu2.model.*;
039import org.hl7.fhir.exceptions.FHIRFormatError;
040import org.hl7.fhir.utilities.Utilities;
041
042import com.google.gson.JsonArray;
043import com.google.gson.JsonObject;
044
045public class JsonParser extends JsonParserBase {
046
047  public JsonParser() {
048    super();
049  }
050
051  public JsonParser(boolean allowUnknownContent) {
052    super();
053    setAllowUnknownContent(allowUnknownContent);
054  }
055
056
057  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
058    super.parseElementProperties(json, element);
059    if (json.has("extension")) {
060      JsonArray array = json.getAsJsonArray("extension");
061      for (int i = 0; i < array.size(); i++) {
062        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
063      }
064    };
065  }
066
067  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
068    parseElementProperties(json, element);
069    if (json.has("modifierExtension")) {
070      JsonArray array = json.getAsJsonArray("modifierExtension");
071      for (int i = 0; i < array.size(); i++) {
072        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
073      }
074    }
075  }
076
077  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
078    parseElementProperties(json, element);
079  }
080
081  @SuppressWarnings("unchecked")
082  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
083    Enumeration<E> res = new Enumeration<E>(e);
084    if (s != null)
085      res.setValue((E) e.fromCode(s));
086    return res;
087  }
088
089  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
090    DateType res = new DateType(v);
091    return res;
092  }
093
094  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
095    DateTimeType res = new DateTimeType(v);
096    return res;
097  }
098
099  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
100    CodeType res = new CodeType(v);
101    return res;
102  }
103
104  protected StringType parseString(String v) throws IOException, FHIRFormatError {
105    StringType res = new StringType(v);
106    return res;
107  }
108
109  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
110    IntegerType res = new IntegerType(v);
111    return res;
112  }
113
114  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
115    OidType res = new OidType(v);
116    return res;
117  }
118
119  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
120    UriType res = new UriType(v);
121    return res;
122  }
123
124  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
125    UuidType res = new UuidType(v);
126    return res;
127  }
128
129  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
130    InstantType res = new InstantType(v);
131    return res;
132  }
133
134  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
135    BooleanType res = new BooleanType(v);
136    return res;
137  }
138
139  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
140    Base64BinaryType res = new Base64BinaryType(v);
141    return res;
142  }
143
144  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
145    UnsignedIntType res = new UnsignedIntType(v);
146    return res;
147  }
148
149  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
150    MarkdownType res = new MarkdownType(v);
151    return res;
152  }
153
154  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
155    TimeType res = new TimeType(v);
156    return res;
157  }
158
159  protected IdType parseId(String v) throws IOException, FHIRFormatError {
160    IdType res = new IdType(v);
161    return res;
162  }
163
164  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
165    PositiveIntType res = new PositiveIntType(v);
166    return res;
167  }
168
169  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
170    DecimalType res = new DecimalType(v);
171    return res;
172  }
173
174  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
175    Extension res = new Extension();
176    parseElementProperties(json, res);
177    if (json.has("url"))
178      res.setUrlElement(parseUri(json.get("url").getAsString()));
179    if (json.has("_url"))
180      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
181    Type value = parseType("value", json);
182    if (value != null)
183      res.setValue(value);
184    return res;
185  }
186
187  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
188    Narrative res = new Narrative();
189    parseElementProperties(json, res);
190    if (json.has("status"))
191      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
192    if (json.has("_status"))
193      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
194    if (json.has("div"))
195      res.setDiv(parseXhtml(json.get("div").getAsString()));
196    return res;
197  }
198
199  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
200    Identifier res = new Identifier();
201    parseTypeProperties(json, res);
202    if (json.has("use"))
203      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
204    if (json.has("_use"))
205      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
206    if (json.has("type"))
207      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
208    if (json.has("system"))
209      res.setSystemElement(parseUri(json.get("system").getAsString()));
210    if (json.has("_system"))
211      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
212    if (json.has("value"))
213      res.setValueElement(parseString(json.get("value").getAsString()));
214    if (json.has("_value"))
215      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
216    if (json.has("period"))
217      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
218    if (json.has("assigner"))
219      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
220    return res;
221  }
222
223  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
224    Coding res = new Coding();
225    parseTypeProperties(json, res);
226    if (json.has("system"))
227      res.setSystemElement(parseUri(json.get("system").getAsString()));
228    if (json.has("_system"))
229      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
230    if (json.has("version"))
231      res.setVersionElement(parseString(json.get("version").getAsString()));
232    if (json.has("_version"))
233      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
234    if (json.has("code"))
235      res.setCodeElement(parseCode(json.get("code").getAsString()));
236    if (json.has("_code"))
237      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
238    if (json.has("display"))
239      res.setDisplayElement(parseString(json.get("display").getAsString()));
240    if (json.has("_display"))
241      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
242    if (json.has("userSelected"))
243      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
244    if (json.has("_userSelected"))
245      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
246    return res;
247  }
248
249  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
250    Reference res = new Reference();
251    parseTypeProperties(json, res);
252    if (json.has("reference"))
253      res.setReferenceElement(parseString(json.get("reference").getAsString()));
254    if (json.has("_reference"))
255      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
256    if (json.has("display"))
257      res.setDisplayElement(parseString(json.get("display").getAsString()));
258    if (json.has("_display"))
259      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
260    return res;
261  }
262
263  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
264    Signature res = new Signature();
265    parseTypeProperties(json, res);
266    if (json.has("type")) {
267      JsonArray array = json.getAsJsonArray("type");
268      for (int i = 0; i < array.size(); i++) {
269        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
270      }
271    };
272    if (json.has("when"))
273      res.setWhenElement(parseInstant(json.get("when").getAsString()));
274    if (json.has("_when"))
275      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
276    Type who = parseType("who", json);
277    if (who != null)
278      res.setWho(who);
279    if (json.has("contentType"))
280      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
281    if (json.has("_contentType"))
282      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
283    if (json.has("blob"))
284      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
285    if (json.has("_blob"))
286      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
287    return res;
288  }
289
290  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
291    SampledData res = new SampledData();
292    parseTypeProperties(json, res);
293    if (json.has("origin"))
294      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
295    if (json.has("period"))
296      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
297    if (json.has("_period"))
298      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
299    if (json.has("factor"))
300      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
301    if (json.has("_factor"))
302      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
303    if (json.has("lowerLimit"))
304      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
305    if (json.has("_lowerLimit"))
306      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
307    if (json.has("upperLimit"))
308      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
309    if (json.has("_upperLimit"))
310      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
311    if (json.has("dimensions"))
312      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
313    if (json.has("_dimensions"))
314      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
315    if (json.has("data"))
316      res.setDataElement(parseString(json.get("data").getAsString()));
317    if (json.has("_data"))
318      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
319    return res;
320  }
321
322  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
323    Quantity res = new Quantity();
324    parseTypeProperties(json, res);
325    if (json.has("value"))
326      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
327    if (json.has("_value"))
328      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
329    if (json.has("comparator"))
330      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
331    if (json.has("_comparator"))
332      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
333    if (json.has("unit"))
334      res.setUnitElement(parseString(json.get("unit").getAsString()));
335    if (json.has("_unit"))
336      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
337    if (json.has("system"))
338      res.setSystemElement(parseUri(json.get("system").getAsString()));
339    if (json.has("_system"))
340      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
341    if (json.has("code"))
342      res.setCodeElement(parseCode(json.get("code").getAsString()));
343    if (json.has("_code"))
344      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
345    return res;
346  }
347
348  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
349    Period res = new Period();
350    parseTypeProperties(json, res);
351    if (json.has("start"))
352      res.setStartElement(parseDateTime(json.get("start").getAsString()));
353    if (json.has("_start"))
354      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
355    if (json.has("end"))
356      res.setEndElement(parseDateTime(json.get("end").getAsString()));
357    if (json.has("_end"))
358      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
359    return res;
360  }
361
362  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
363    Attachment res = new Attachment();
364    parseTypeProperties(json, res);
365    if (json.has("contentType"))
366      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
367    if (json.has("_contentType"))
368      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
369    if (json.has("language"))
370      res.setLanguageElement(parseCode(json.get("language").getAsString()));
371    if (json.has("_language"))
372      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
373    if (json.has("data"))
374      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
375    if (json.has("_data"))
376      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
377    if (json.has("url"))
378      res.setUrlElement(parseUri(json.get("url").getAsString()));
379    if (json.has("_url"))
380      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
381    if (json.has("size"))
382      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
383    if (json.has("_size"))
384      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
385    if (json.has("hash"))
386      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
387    if (json.has("_hash"))
388      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
389    if (json.has("title"))
390      res.setTitleElement(parseString(json.get("title").getAsString()));
391    if (json.has("_title"))
392      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
393    if (json.has("creation"))
394      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
395    if (json.has("_creation"))
396      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
397    return res;
398  }
399
400  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
401    Ratio res = new Ratio();
402    parseTypeProperties(json, res);
403    if (json.has("numerator"))
404      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
405    if (json.has("denominator"))
406      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
407    return res;
408  }
409
410  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
411    Range res = new Range();
412    parseTypeProperties(json, res);
413    if (json.has("low"))
414      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
415    if (json.has("high"))
416      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
417    return res;
418  }
419
420  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
421    Annotation res = new Annotation();
422    parseTypeProperties(json, res);
423    Type author = parseType("author", json);
424    if (author != null)
425      res.setAuthor(author);
426    if (json.has("time"))
427      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
428    if (json.has("_time"))
429      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
430    if (json.has("text"))
431      res.setTextElement(parseString(json.get("text").getAsString()));
432    if (json.has("_text"))
433      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
434    return res;
435  }
436
437  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
438    CodeableConcept res = new CodeableConcept();
439    parseTypeProperties(json, res);
440    if (json.has("coding")) {
441      JsonArray array = json.getAsJsonArray("coding");
442      for (int i = 0; i < array.size(); i++) {
443        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
444      }
445    };
446    if (json.has("text"))
447      res.setTextElement(parseString(json.get("text").getAsString()));
448    if (json.has("_text"))
449      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
450    return res;
451  }
452
453  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
454    Money res = new Money();
455    parseElementProperties(json, res);
456    if (json.has("value"))
457      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
458    if (json.has("_value"))
459      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
460    if (json.has("comparator"))
461      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
462    if (json.has("_comparator"))
463      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
464    if (json.has("unit"))
465      res.setUnitElement(parseString(json.get("unit").getAsString()));
466    if (json.has("_unit"))
467      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
468    if (json.has("system"))
469      res.setSystemElement(parseUri(json.get("system").getAsString()));
470    if (json.has("_system"))
471      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
472    if (json.has("code"))
473      res.setCodeElement(parseCode(json.get("code").getAsString()));
474    if (json.has("_code"))
475      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
476    return res;
477  }
478
479  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
480    SimpleQuantity res = new SimpleQuantity();
481    parseElementProperties(json, res);
482    if (json.has("value"))
483      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
484    if (json.has("_value"))
485      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
486    if (json.has("comparator"))
487      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
488    if (json.has("_comparator"))
489      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
490    if (json.has("unit"))
491      res.setUnitElement(parseString(json.get("unit").getAsString()));
492    if (json.has("_unit"))
493      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
494    if (json.has("system"))
495      res.setSystemElement(parseUri(json.get("system").getAsString()));
496    if (json.has("_system"))
497      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
498    if (json.has("code"))
499      res.setCodeElement(parseCode(json.get("code").getAsString()));
500    if (json.has("_code"))
501      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
502    return res;
503  }
504
505  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
506    Duration res = new Duration();
507    parseElementProperties(json, res);
508    if (json.has("value"))
509      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
510    if (json.has("_value"))
511      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
512    if (json.has("comparator"))
513      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
514    if (json.has("_comparator"))
515      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
516    if (json.has("unit"))
517      res.setUnitElement(parseString(json.get("unit").getAsString()));
518    if (json.has("_unit"))
519      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
520    if (json.has("system"))
521      res.setSystemElement(parseUri(json.get("system").getAsString()));
522    if (json.has("_system"))
523      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
524    if (json.has("code"))
525      res.setCodeElement(parseCode(json.get("code").getAsString()));
526    if (json.has("_code"))
527      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
528    return res;
529  }
530
531  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
532    Count res = new Count();
533    parseElementProperties(json, res);
534    if (json.has("value"))
535      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
536    if (json.has("_value"))
537      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
538    if (json.has("comparator"))
539      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
540    if (json.has("_comparator"))
541      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
542    if (json.has("unit"))
543      res.setUnitElement(parseString(json.get("unit").getAsString()));
544    if (json.has("_unit"))
545      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
546    if (json.has("system"))
547      res.setSystemElement(parseUri(json.get("system").getAsString()));
548    if (json.has("_system"))
549      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
550    if (json.has("code"))
551      res.setCodeElement(parseCode(json.get("code").getAsString()));
552    if (json.has("_code"))
553      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
554    return res;
555  }
556
557  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
558    Distance res = new Distance();
559    parseElementProperties(json, res);
560    if (json.has("value"))
561      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
562    if (json.has("_value"))
563      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
564    if (json.has("comparator"))
565      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
566    if (json.has("_comparator"))
567      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
568    if (json.has("unit"))
569      res.setUnitElement(parseString(json.get("unit").getAsString()));
570    if (json.has("_unit"))
571      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
572    if (json.has("system"))
573      res.setSystemElement(parseUri(json.get("system").getAsString()));
574    if (json.has("_system"))
575      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
576    if (json.has("code"))
577      res.setCodeElement(parseCode(json.get("code").getAsString()));
578    if (json.has("_code"))
579      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
580    return res;
581  }
582
583  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
584    Age res = new Age();
585    parseElementProperties(json, res);
586    if (json.has("value"))
587      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
588    if (json.has("_value"))
589      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
590    if (json.has("comparator"))
591      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
592    if (json.has("_comparator"))
593      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
594    if (json.has("unit"))
595      res.setUnitElement(parseString(json.get("unit").getAsString()));
596    if (json.has("_unit"))
597      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
598    if (json.has("system"))
599      res.setSystemElement(parseUri(json.get("system").getAsString()));
600    if (json.has("_system"))
601      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
602    if (json.has("code"))
603      res.setCodeElement(parseCode(json.get("code").getAsString()));
604    if (json.has("_code"))
605      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
606    return res;
607  }
608
609  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
610    HumanName res = new HumanName();
611    parseElementProperties(json, res);
612    if (json.has("use"))
613      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
614    if (json.has("_use"))
615      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
616    if (json.has("text"))
617      res.setTextElement(parseString(json.get("text").getAsString()));
618    if (json.has("_text"))
619      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
620    if (json.has("family")) {
621      JsonArray array = json.getAsJsonArray("family");
622      for (int i = 0; i < array.size(); i++) {
623        res.getFamily().add(parseString(array.get(i).getAsString()));
624      }
625    };
626    if (json.has("_family")) {
627      JsonArray array = json.getAsJsonArray("_family");
628      for (int i = 0; i < array.size(); i++) {
629        if (i == res.getFamily().size())
630          res.getFamily().add(parseString(null));
631        if (array.get(i) instanceof JsonObject) 
632          parseElementProperties(array.get(i).getAsJsonObject(), res.getFamily().get(i));
633      }
634    };
635    if (json.has("given")) {
636      JsonArray array = json.getAsJsonArray("given");
637      for (int i = 0; i < array.size(); i++) {
638        res.getGiven().add(parseString(array.get(i).getAsString()));
639      }
640    };
641    if (json.has("_given")) {
642      JsonArray array = json.getAsJsonArray("_given");
643      for (int i = 0; i < array.size(); i++) {
644        if (i == res.getGiven().size())
645          res.getGiven().add(parseString(null));
646        if (array.get(i) instanceof JsonObject) 
647          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
648      }
649    };
650    if (json.has("prefix")) {
651      JsonArray array = json.getAsJsonArray("prefix");
652      for (int i = 0; i < array.size(); i++) {
653        res.getPrefix().add(parseString(array.get(i).getAsString()));
654      }
655    };
656    if (json.has("_prefix")) {
657      JsonArray array = json.getAsJsonArray("_prefix");
658      for (int i = 0; i < array.size(); i++) {
659        if (i == res.getPrefix().size())
660          res.getPrefix().add(parseString(null));
661        if (array.get(i) instanceof JsonObject) 
662          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
663      }
664    };
665    if (json.has("suffix")) {
666      JsonArray array = json.getAsJsonArray("suffix");
667      for (int i = 0; i < array.size(); i++) {
668        res.getSuffix().add(parseString(array.get(i).getAsString()));
669      }
670    };
671    if (json.has("_suffix")) {
672      JsonArray array = json.getAsJsonArray("_suffix");
673      for (int i = 0; i < array.size(); i++) {
674        if (i == res.getSuffix().size())
675          res.getSuffix().add(parseString(null));
676        if (array.get(i) instanceof JsonObject) 
677          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
678      }
679    };
680    if (json.has("period"))
681      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
682    return res;
683  }
684
685  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
686    ContactPoint res = new ContactPoint();
687    parseElementProperties(json, res);
688    if (json.has("system"))
689      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
690    if (json.has("_system"))
691      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
692    if (json.has("value"))
693      res.setValueElement(parseString(json.get("value").getAsString()));
694    if (json.has("_value"))
695      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
696    if (json.has("use"))
697      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
698    if (json.has("_use"))
699      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
700    if (json.has("rank"))
701      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
702    if (json.has("_rank"))
703      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
704    if (json.has("period"))
705      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
706    return res;
707  }
708
709  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
710    Meta res = new Meta();
711    parseElementProperties(json, res);
712    if (json.has("versionId"))
713      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
714    if (json.has("_versionId"))
715      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
716    if (json.has("lastUpdated"))
717      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
718    if (json.has("_lastUpdated"))
719      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
720    if (json.has("profile")) {
721      JsonArray array = json.getAsJsonArray("profile");
722      for (int i = 0; i < array.size(); i++) {
723        res.getProfile().add(parseUri(array.get(i).getAsString()));
724      }
725    };
726    if (json.has("_profile")) {
727      JsonArray array = json.getAsJsonArray("_profile");
728      for (int i = 0; i < array.size(); i++) {
729        if (i == res.getProfile().size())
730          res.getProfile().add(parseUri(null));
731        if (array.get(i) instanceof JsonObject) 
732          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
733      }
734    };
735    if (json.has("security")) {
736      JsonArray array = json.getAsJsonArray("security");
737      for (int i = 0; i < array.size(); i++) {
738        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
739      }
740    };
741    if (json.has("tag")) {
742      JsonArray array = json.getAsJsonArray("tag");
743      for (int i = 0; i < array.size(); i++) {
744        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
745      }
746    };
747    return res;
748  }
749
750  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
751    Address res = new Address();
752    parseElementProperties(json, res);
753    if (json.has("use"))
754      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
755    if (json.has("_use"))
756      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
757    if (json.has("type"))
758      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
759    if (json.has("_type"))
760      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
761    if (json.has("text"))
762      res.setTextElement(parseString(json.get("text").getAsString()));
763    if (json.has("_text"))
764      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
765    if (json.has("line")) {
766      JsonArray array = json.getAsJsonArray("line");
767      for (int i = 0; i < array.size(); i++) {
768        res.getLine().add(parseString(array.get(i).getAsString()));
769      }
770    };
771    if (json.has("_line")) {
772      JsonArray array = json.getAsJsonArray("_line");
773      for (int i = 0; i < array.size(); i++) {
774        if (i == res.getLine().size())
775          res.getLine().add(parseString(null));
776        if (array.get(i) instanceof JsonObject) 
777          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
778      }
779    };
780    if (json.has("city"))
781      res.setCityElement(parseString(json.get("city").getAsString()));
782    if (json.has("_city"))
783      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
784    if (json.has("district"))
785      res.setDistrictElement(parseString(json.get("district").getAsString()));
786    if (json.has("_district"))
787      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
788    if (json.has("state"))
789      res.setStateElement(parseString(json.get("state").getAsString()));
790    if (json.has("_state"))
791      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
792    if (json.has("postalCode"))
793      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
794    if (json.has("_postalCode"))
795      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
796    if (json.has("country"))
797      res.setCountryElement(parseString(json.get("country").getAsString()));
798    if (json.has("_country"))
799      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
800    if (json.has("period"))
801      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
802    return res;
803  }
804
805  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
806    Timing res = new Timing();
807    parseElementProperties(json, res);
808    if (json.has("event")) {
809      JsonArray array = json.getAsJsonArray("event");
810      for (int i = 0; i < array.size(); i++) {
811        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
812      }
813    };
814    if (json.has("_event")) {
815      JsonArray array = json.getAsJsonArray("_event");
816      for (int i = 0; i < array.size(); i++) {
817        if (i == res.getEvent().size())
818          res.getEvent().add(parseDateTime(null));
819        if (array.get(i) instanceof JsonObject) 
820          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
821      }
822    };
823    if (json.has("repeat"))
824      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
825    if (json.has("code"))
826      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
827    return res;
828  }
829
830  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
831    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
832    parseElementProperties(json, res);
833    Type bounds = parseType("bounds", json);
834    if (bounds != null)
835      res.setBounds(bounds);
836    if (json.has("count"))
837      res.setCountElement(parseInteger(json.get("count").getAsLong()));
838    if (json.has("_count"))
839      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
840    if (json.has("duration"))
841      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
842    if (json.has("_duration"))
843      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
844    if (json.has("durationMax"))
845      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
846    if (json.has("_durationMax"))
847      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
848    if (json.has("durationUnits"))
849      res.setDurationUnitsElement(parseEnumeration(json.get("durationUnits").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
850    if (json.has("_durationUnits"))
851      parseElementProperties(json.getAsJsonObject("_durationUnits"), res.getDurationUnitsElement());
852    if (json.has("frequency"))
853      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
854    if (json.has("_frequency"))
855      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
856    if (json.has("frequencyMax"))
857      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
858    if (json.has("_frequencyMax"))
859      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
860    if (json.has("period"))
861      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
862    if (json.has("_period"))
863      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
864    if (json.has("periodMax"))
865      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
866    if (json.has("_periodMax"))
867      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
868    if (json.has("periodUnits"))
869      res.setPeriodUnitsElement(parseEnumeration(json.get("periodUnits").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
870    if (json.has("_periodUnits"))
871      parseElementProperties(json.getAsJsonObject("_periodUnits"), res.getPeriodUnitsElement());
872    if (json.has("when"))
873      res.setWhenElement(parseEnumeration(json.get("when").getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
874    if (json.has("_when"))
875      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
876    return res;
877  }
878
879  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
880    ElementDefinition res = new ElementDefinition();
881    parseElementProperties(json, res);
882    if (json.has("path"))
883      res.setPathElement(parseString(json.get("path").getAsString()));
884    if (json.has("_path"))
885      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
886    if (json.has("representation")) {
887      JsonArray array = json.getAsJsonArray("representation");
888      for (int i = 0; i < array.size(); i++) {
889        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
890      }
891    };
892    if (json.has("_representation")) {
893      JsonArray array = json.getAsJsonArray("_representation");
894      for (int i = 0; i < array.size(); i++) {
895        if (i == res.getRepresentation().size())
896          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
897        if (array.get(i) instanceof JsonObject) 
898          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
899      }
900    };
901    if (json.has("name"))
902      res.setNameElement(parseString(json.get("name").getAsString()));
903    if (json.has("_name"))
904      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
905    if (json.has("label"))
906      res.setLabelElement(parseString(json.get("label").getAsString()));
907    if (json.has("_label"))
908      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
909    if (json.has("code")) {
910      JsonArray array = json.getAsJsonArray("code");
911      for (int i = 0; i < array.size(); i++) {
912        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
913      }
914    };
915    if (json.has("slicing"))
916      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
917    if (json.has("short"))
918      res.setShortElement(parseString(json.get("short").getAsString()));
919    if (json.has("_short"))
920      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
921    if (json.has("definition"))
922      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
923    if (json.has("_definition"))
924      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
925    if (json.has("comments"))
926      res.setCommentsElement(parseMarkdown(json.get("comments").getAsString()));
927    if (json.has("_comments"))
928      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
929    if (json.has("requirements"))
930      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
931    if (json.has("_requirements"))
932      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
933    if (json.has("alias")) {
934      JsonArray array = json.getAsJsonArray("alias");
935      for (int i = 0; i < array.size(); i++) {
936        res.getAlias().add(parseString(array.get(i).getAsString()));
937      }
938    };
939    if (json.has("_alias")) {
940      JsonArray array = json.getAsJsonArray("_alias");
941      for (int i = 0; i < array.size(); i++) {
942        if (i == res.getAlias().size())
943          res.getAlias().add(parseString(null));
944        if (array.get(i) instanceof JsonObject) 
945          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
946      }
947    };
948    if (json.has("min"))
949      res.setMinElement(parseInteger(json.get("min").getAsLong()));
950    if (json.has("_min"))
951      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
952    if (json.has("max"))
953      res.setMaxElement(parseString(json.get("max").getAsString()));
954    if (json.has("_max"))
955      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
956    if (json.has("base"))
957      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
958    if (json.has("type")) {
959      JsonArray array = json.getAsJsonArray("type");
960      for (int i = 0; i < array.size(); i++) {
961        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
962      }
963    };
964    if (json.has("nameReference"))
965      res.setNameReferenceElement(parseString(json.get("nameReference").getAsString()));
966    if (json.has("_nameReference"))
967      parseElementProperties(json.getAsJsonObject("_nameReference"), res.getNameReferenceElement());
968    Type defaultValue = parseType("defaultValue", json);
969    if (defaultValue != null)
970      res.setDefaultValue(defaultValue);
971    if (json.has("meaningWhenMissing"))
972      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
973    if (json.has("_meaningWhenMissing"))
974      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
975    Type fixed = parseType("fixed", json);
976    if (fixed != null)
977      res.setFixed(fixed);
978    Type pattern = parseType("pattern", json);
979    if (pattern != null)
980      res.setPattern(pattern);
981    Type example = parseType("example", json);
982    if (example != null)
983      res.setExample(example);
984    Type minValue = parseType("minValue", json);
985    if (minValue != null)
986      res.setMinValue(minValue);
987    Type maxValue = parseType("maxValue", json);
988    if (maxValue != null)
989      res.setMaxValue(maxValue);
990    if (json.has("maxLength"))
991      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
992    if (json.has("_maxLength"))
993      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
994    if (json.has("condition")) {
995      JsonArray array = json.getAsJsonArray("condition");
996      for (int i = 0; i < array.size(); i++) {
997        res.getCondition().add(parseId(array.get(i).getAsString()));
998      }
999    };
1000    if (json.has("_condition")) {
1001      JsonArray array = json.getAsJsonArray("_condition");
1002      for (int i = 0; i < array.size(); i++) {
1003        if (i == res.getCondition().size())
1004          res.getCondition().add(parseId(null));
1005        if (array.get(i) instanceof JsonObject) 
1006          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1007      }
1008    };
1009    if (json.has("constraint")) {
1010      JsonArray array = json.getAsJsonArray("constraint");
1011      for (int i = 0; i < array.size(); i++) {
1012        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1013      }
1014    };
1015    if (json.has("mustSupport"))
1016      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1017    if (json.has("_mustSupport"))
1018      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1019    if (json.has("isModifier"))
1020      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1021    if (json.has("_isModifier"))
1022      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1023    if (json.has("isSummary"))
1024      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1025    if (json.has("_isSummary"))
1026      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1027    if (json.has("binding"))
1028      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1029    if (json.has("mapping")) {
1030      JsonArray array = json.getAsJsonArray("mapping");
1031      for (int i = 0; i < array.size(); i++) {
1032        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1033      }
1034    };
1035    return res;
1036  }
1037
1038  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1039    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1040    parseElementProperties(json, res);
1041    if (json.has("discriminator")) {
1042      JsonArray array = json.getAsJsonArray("discriminator");
1043      for (int i = 0; i < array.size(); i++) {
1044        res.getDiscriminator().add(parseString(array.get(i).getAsString()));
1045      }
1046    };
1047    if (json.has("_discriminator")) {
1048      JsonArray array = json.getAsJsonArray("_discriminator");
1049      for (int i = 0; i < array.size(); i++) {
1050        if (i == res.getDiscriminator().size())
1051          res.getDiscriminator().add(parseString(null));
1052        if (array.get(i) instanceof JsonObject) 
1053          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiscriminator().get(i));
1054      }
1055    };
1056    if (json.has("description"))
1057      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1058    if (json.has("_description"))
1059      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1060    if (json.has("ordered"))
1061      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1062    if (json.has("_ordered"))
1063      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1064    if (json.has("rules"))
1065      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1066    if (json.has("_rules"))
1067      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1068    return res;
1069  }
1070
1071  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1072    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1073    parseElementProperties(json, res);
1074    if (json.has("path"))
1075      res.setPathElement(parseString(json.get("path").getAsString()));
1076    if (json.has("_path"))
1077      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1078    if (json.has("min"))
1079      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1080    if (json.has("_min"))
1081      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1082    if (json.has("max"))
1083      res.setMaxElement(parseString(json.get("max").getAsString()));
1084    if (json.has("_max"))
1085      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1086    return res;
1087  }
1088
1089  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1090    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1091    parseElementProperties(json, res);
1092    if (json.has("code"))
1093      res.setCodeElement(parseCode(json.get("code").getAsString()));
1094    if (json.has("_code"))
1095      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1096    if (json.has("profile")) {
1097      JsonArray array = json.getAsJsonArray("profile");
1098      for (int i = 0; i < array.size(); i++) {
1099        res.getProfile().add(parseUri(array.get(i).getAsString()));
1100      }
1101    };
1102    if (json.has("_profile")) {
1103      JsonArray array = json.getAsJsonArray("_profile");
1104      for (int i = 0; i < array.size(); i++) {
1105        if (i == res.getProfile().size())
1106          res.getProfile().add(parseUri(null));
1107        if (array.get(i) instanceof JsonObject) 
1108          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1109      }
1110    };
1111    if (json.has("aggregation")) {
1112      JsonArray array = json.getAsJsonArray("aggregation");
1113      for (int i = 0; i < array.size(); i++) {
1114        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1115      }
1116    };
1117    if (json.has("_aggregation")) {
1118      JsonArray array = json.getAsJsonArray("_aggregation");
1119      for (int i = 0; i < array.size(); i++) {
1120        if (i == res.getAggregation().size())
1121          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1122        if (array.get(i) instanceof JsonObject) 
1123          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1124      }
1125    };
1126    return res;
1127  }
1128
1129  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1130    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1131    parseElementProperties(json, res);
1132    if (json.has("key"))
1133      res.setKeyElement(parseId(json.get("key").getAsString()));
1134    if (json.has("_key"))
1135      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1136    if (json.has("requirements"))
1137      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1138    if (json.has("_requirements"))
1139      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1140    if (json.has("severity"))
1141      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1142    if (json.has("_severity"))
1143      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1144    if (json.has("human"))
1145      res.setHumanElement(parseString(json.get("human").getAsString()));
1146    if (json.has("_human"))
1147      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1148    if (json.has("xpath"))
1149      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1150    if (json.has("_xpath"))
1151      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1152    return res;
1153  }
1154
1155  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1156    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1157    parseElementProperties(json, res);
1158    if (json.has("strength"))
1159      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1160    if (json.has("_strength"))
1161      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1162    if (json.has("description"))
1163      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1164    if (json.has("_description"))
1165      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1166    Type valueSet = parseType("valueSet", json);
1167    if (valueSet != null)
1168      res.setValueSet(valueSet);
1169    return res;
1170  }
1171
1172  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1173    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1174    parseElementProperties(json, res);
1175    if (json.has("identity"))
1176      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1177    if (json.has("_identity"))
1178      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1179    if (json.has("language"))
1180      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1181    if (json.has("_language"))
1182      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1183    if (json.has("map"))
1184      res.setMapElement(parseString(json.get("map").getAsString()));
1185    if (json.has("_map"))
1186      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1187    return res;
1188  }
1189
1190  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1191    parseResourceProperties(json, res);
1192    if (json.has("text"))
1193      res.setText(parseNarrative(json.getAsJsonObject("text")));
1194    if (json.has("contained")) {
1195      JsonArray array = json.getAsJsonArray("contained");
1196      for (int i = 0; i < array.size(); i++) {
1197        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1198      }
1199    };
1200    if (json.has("extension")) {
1201      JsonArray array = json.getAsJsonArray("extension");
1202      for (int i = 0; i < array.size(); i++) {
1203        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1204      }
1205    };
1206    if (json.has("modifierExtension")) {
1207      JsonArray array = json.getAsJsonArray("modifierExtension");
1208      for (int i = 0; i < array.size(); i++) {
1209        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1210      }
1211    };
1212  }
1213
1214  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1215    Parameters res = new Parameters();
1216    parseResourceProperties(json, res);
1217    if (json.has("parameter")) {
1218      JsonArray array = json.getAsJsonArray("parameter");
1219      for (int i = 0; i < array.size(); i++) {
1220        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1221      }
1222    };
1223    return res;
1224  }
1225
1226  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1227    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1228    parseBackboneProperties(json, res);
1229    if (json.has("name"))
1230      res.setNameElement(parseString(json.get("name").getAsString()));
1231    if (json.has("_name"))
1232      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1233    Type value = parseType("value", json);
1234    if (value != null)
1235      res.setValue(value);
1236    if (json.has("resource"))
1237      res.setResource(parseResource(json.getAsJsonObject("resource")));
1238    if (json.has("part")) {
1239      JsonArray array = json.getAsJsonArray("part");
1240      for (int i = 0; i < array.size(); i++) {
1241        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1242      }
1243    };
1244    return res;
1245  }
1246
1247  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1248    if (json.has("id"))
1249      res.setIdElement(parseId(json.get("id").getAsString()));
1250    if (json.has("_id"))
1251      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1252    if (json.has("meta"))
1253      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1254    if (json.has("implicitRules"))
1255      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1256    if (json.has("_implicitRules"))
1257      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1258    if (json.has("language"))
1259      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1260    if (json.has("_language"))
1261      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1262  }
1263
1264  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1265    Account res = new Account();
1266    parseDomainResourceProperties(json, res);
1267    if (json.has("identifier")) {
1268      JsonArray array = json.getAsJsonArray("identifier");
1269      for (int i = 0; i < array.size(); i++) {
1270        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1271      }
1272    };
1273    if (json.has("name"))
1274      res.setNameElement(parseString(json.get("name").getAsString()));
1275    if (json.has("_name"))
1276      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1277    if (json.has("type"))
1278      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1279    if (json.has("status"))
1280      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1281    if (json.has("_status"))
1282      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1283    if (json.has("activePeriod"))
1284      res.setActivePeriod(parsePeriod(json.getAsJsonObject("activePeriod")));
1285    if (json.has("currency"))
1286      res.setCurrency(parseCoding(json.getAsJsonObject("currency")));
1287    if (json.has("balance"))
1288      res.setBalance(parseMoney(json.getAsJsonObject("balance")));
1289    if (json.has("coveragePeriod"))
1290      res.setCoveragePeriod(parsePeriod(json.getAsJsonObject("coveragePeriod")));
1291    if (json.has("subject"))
1292      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1293    if (json.has("owner"))
1294      res.setOwner(parseReference(json.getAsJsonObject("owner")));
1295    if (json.has("description"))
1296      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1297    if (json.has("_description"))
1298      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1299    return res;
1300  }
1301
1302  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
1303    AllergyIntolerance res = new AllergyIntolerance();
1304    parseDomainResourceProperties(json, res);
1305    if (json.has("identifier")) {
1306      JsonArray array = json.getAsJsonArray("identifier");
1307      for (int i = 0; i < array.size(); i++) {
1308        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1309      }
1310    };
1311    if (json.has("onset"))
1312      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1313    if (json.has("_onset"))
1314      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1315    if (json.has("recordedDate"))
1316      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
1317    if (json.has("_recordedDate"))
1318      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
1319    if (json.has("recorder"))
1320      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
1321    if (json.has("patient"))
1322      res.setPatient(parseReference(json.getAsJsonObject("patient")));
1323    if (json.has("reporter"))
1324      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
1325    if (json.has("substance"))
1326      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1327    if (json.has("status"))
1328      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AllergyIntolerance.AllergyIntoleranceStatus.NULL, new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory()));
1329    if (json.has("_status"))
1330      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1331    if (json.has("criticality"))
1332      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
1333    if (json.has("_criticality"))
1334      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
1335    if (json.has("type"))
1336      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
1337    if (json.has("_type"))
1338      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1339    if (json.has("category"))
1340      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
1341    if (json.has("_category"))
1342      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
1343    if (json.has("lastOccurence"))
1344      res.setLastOccurenceElement(parseDateTime(json.get("lastOccurence").getAsString()));
1345    if (json.has("_lastOccurence"))
1346      parseElementProperties(json.getAsJsonObject("_lastOccurence"), res.getLastOccurenceElement());
1347    if (json.has("note"))
1348      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
1349    if (json.has("reaction")) {
1350      JsonArray array = json.getAsJsonArray("reaction");
1351      for (int i = 0; i < array.size(); i++) {
1352        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
1353      }
1354    };
1355    return res;
1356  }
1357
1358  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
1359    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
1360    parseBackboneProperties(json, res);
1361    if (json.has("substance"))
1362      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1363    if (json.has("certainty"))
1364      res.setCertaintyElement(parseEnumeration(json.get("certainty").getAsString(), AllergyIntolerance.AllergyIntoleranceCertainty.NULL, new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory()));
1365    if (json.has("_certainty"))
1366      parseElementProperties(json.getAsJsonObject("_certainty"), res.getCertaintyElement());
1367    if (json.has("manifestation")) {
1368      JsonArray array = json.getAsJsonArray("manifestation");
1369      for (int i = 0; i < array.size(); i++) {
1370        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1371      }
1372    };
1373    if (json.has("description"))
1374      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1375    if (json.has("_description"))
1376      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1377    if (json.has("onset"))
1378      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1379    if (json.has("_onset"))
1380      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1381    if (json.has("severity"))
1382      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
1383    if (json.has("_severity"))
1384      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1385    if (json.has("exposureRoute"))
1386      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
1387    if (json.has("note"))
1388      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
1389    return res;
1390  }
1391
1392  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
1393    Appointment res = new Appointment();
1394    parseDomainResourceProperties(json, res);
1395    if (json.has("identifier")) {
1396      JsonArray array = json.getAsJsonArray("identifier");
1397      for (int i = 0; i < array.size(); i++) {
1398        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1399      }
1400    };
1401    if (json.has("status"))
1402      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
1403    if (json.has("_status"))
1404      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1405    if (json.has("type"))
1406      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1407    if (json.has("reason"))
1408      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
1409    if (json.has("priority"))
1410      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
1411    if (json.has("_priority"))
1412      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
1413    if (json.has("description"))
1414      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1415    if (json.has("_description"))
1416      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1417    if (json.has("start"))
1418      res.setStartElement(parseInstant(json.get("start").getAsString()));
1419    if (json.has("_start"))
1420      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1421    if (json.has("end"))
1422      res.setEndElement(parseInstant(json.get("end").getAsString()));
1423    if (json.has("_end"))
1424      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1425    if (json.has("minutesDuration"))
1426      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
1427    if (json.has("_minutesDuration"))
1428      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
1429    if (json.has("slot")) {
1430      JsonArray array = json.getAsJsonArray("slot");
1431      for (int i = 0; i < array.size(); i++) {
1432        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
1433      }
1434    };
1435    if (json.has("comment"))
1436      res.setCommentElement(parseString(json.get("comment").getAsString()));
1437    if (json.has("_comment"))
1438      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1439    if (json.has("participant")) {
1440      JsonArray array = json.getAsJsonArray("participant");
1441      for (int i = 0; i < array.size(); i++) {
1442        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
1443      }
1444    };
1445    return res;
1446  }
1447
1448  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
1449    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
1450    parseBackboneProperties(json, res);
1451    if (json.has("type")) {
1452      JsonArray array = json.getAsJsonArray("type");
1453      for (int i = 0; i < array.size(); i++) {
1454        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1455      }
1456    };
1457    if (json.has("actor"))
1458      res.setActor(parseReference(json.getAsJsonObject("actor")));
1459    if (json.has("required"))
1460      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
1461    if (json.has("_required"))
1462      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
1463    if (json.has("status"))
1464      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
1465    if (json.has("_status"))
1466      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1467    return res;
1468  }
1469
1470  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
1471    AppointmentResponse res = new AppointmentResponse();
1472    parseDomainResourceProperties(json, res);
1473    if (json.has("identifier")) {
1474      JsonArray array = json.getAsJsonArray("identifier");
1475      for (int i = 0; i < array.size(); i++) {
1476        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1477      }
1478    };
1479    if (json.has("appointment"))
1480      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
1481    if (json.has("start"))
1482      res.setStartElement(parseInstant(json.get("start").getAsString()));
1483    if (json.has("_start"))
1484      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1485    if (json.has("end"))
1486      res.setEndElement(parseInstant(json.get("end").getAsString()));
1487    if (json.has("_end"))
1488      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1489    if (json.has("participantType")) {
1490      JsonArray array = json.getAsJsonArray("participantType");
1491      for (int i = 0; i < array.size(); i++) {
1492        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1493      }
1494    };
1495    if (json.has("actor"))
1496      res.setActor(parseReference(json.getAsJsonObject("actor")));
1497    if (json.has("participantStatus"))
1498      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
1499    if (json.has("_participantStatus"))
1500      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
1501    if (json.has("comment"))
1502      res.setCommentElement(parseString(json.get("comment").getAsString()));
1503    if (json.has("_comment"))
1504      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1505    return res;
1506  }
1507
1508  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
1509    AuditEvent res = new AuditEvent();
1510    parseDomainResourceProperties(json, res);
1511    if (json.has("event"))
1512      res.setEvent(parseAuditEventAuditEventEventComponent(json.getAsJsonObject("event"), res));
1513    if (json.has("participant")) {
1514      JsonArray array = json.getAsJsonArray("participant");
1515      for (int i = 0; i < array.size(); i++) {
1516        res.getParticipant().add(parseAuditEventAuditEventParticipantComponent(array.get(i).getAsJsonObject(), res));
1517      }
1518    };
1519    if (json.has("source"))
1520      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
1521    if (json.has("object")) {
1522      JsonArray array = json.getAsJsonArray("object");
1523      for (int i = 0; i < array.size(); i++) {
1524        res.getObject().add(parseAuditEventAuditEventObjectComponent(array.get(i).getAsJsonObject(), res));
1525      }
1526    };
1527    return res;
1528  }
1529
1530  protected AuditEvent.AuditEventEventComponent parseAuditEventAuditEventEventComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1531    AuditEvent.AuditEventEventComponent res = new AuditEvent.AuditEventEventComponent();
1532    parseBackboneProperties(json, res);
1533    if (json.has("type"))
1534      res.setType(parseCoding(json.getAsJsonObject("type")));
1535    if (json.has("subtype")) {
1536      JsonArray array = json.getAsJsonArray("subtype");
1537      for (int i = 0; i < array.size(); i++) {
1538        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
1539      }
1540    };
1541    if (json.has("action"))
1542      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
1543    if (json.has("_action"))
1544      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
1545    if (json.has("dateTime"))
1546      res.setDateTimeElement(parseInstant(json.get("dateTime").getAsString()));
1547    if (json.has("_dateTime"))
1548      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
1549    if (json.has("outcome"))
1550      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
1551    if (json.has("_outcome"))
1552      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
1553    if (json.has("outcomeDesc"))
1554      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
1555    if (json.has("_outcomeDesc"))
1556      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
1557    if (json.has("purposeOfEvent")) {
1558      JsonArray array = json.getAsJsonArray("purposeOfEvent");
1559      for (int i = 0; i < array.size(); i++) {
1560        res.getPurposeOfEvent().add(parseCoding(array.get(i).getAsJsonObject()));
1561      }
1562    };
1563    return res;
1564  }
1565
1566  protected AuditEvent.AuditEventParticipantComponent parseAuditEventAuditEventParticipantComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1567    AuditEvent.AuditEventParticipantComponent res = new AuditEvent.AuditEventParticipantComponent();
1568    parseBackboneProperties(json, res);
1569    if (json.has("role")) {
1570      JsonArray array = json.getAsJsonArray("role");
1571      for (int i = 0; i < array.size(); i++) {
1572        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1573      }
1574    };
1575    if (json.has("reference"))
1576      res.setReference(parseReference(json.getAsJsonObject("reference")));
1577    if (json.has("userId"))
1578      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
1579    if (json.has("altId"))
1580      res.setAltIdElement(parseString(json.get("altId").getAsString()));
1581    if (json.has("_altId"))
1582      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
1583    if (json.has("name"))
1584      res.setNameElement(parseString(json.get("name").getAsString()));
1585    if (json.has("_name"))
1586      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1587    if (json.has("requestor"))
1588      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
1589    if (json.has("_requestor"))
1590      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
1591    if (json.has("location"))
1592      res.setLocation(parseReference(json.getAsJsonObject("location")));
1593    if (json.has("policy")) {
1594      JsonArray array = json.getAsJsonArray("policy");
1595      for (int i = 0; i < array.size(); i++) {
1596        res.getPolicy().add(parseUri(array.get(i).getAsString()));
1597      }
1598    };
1599    if (json.has("_policy")) {
1600      JsonArray array = json.getAsJsonArray("_policy");
1601      for (int i = 0; i < array.size(); i++) {
1602        if (i == res.getPolicy().size())
1603          res.getPolicy().add(parseUri(null));
1604        if (array.get(i) instanceof JsonObject) 
1605          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
1606      }
1607    };
1608    if (json.has("media"))
1609      res.setMedia(parseCoding(json.getAsJsonObject("media")));
1610    if (json.has("network"))
1611      res.setNetwork(parseAuditEventAuditEventParticipantNetworkComponent(json.getAsJsonObject("network"), owner));
1612    if (json.has("purposeOfUse")) {
1613      JsonArray array = json.getAsJsonArray("purposeOfUse");
1614      for (int i = 0; i < array.size(); i++) {
1615        res.getPurposeOfUse().add(parseCoding(array.get(i).getAsJsonObject()));
1616      }
1617    };
1618    return res;
1619  }
1620
1621  protected AuditEvent.AuditEventParticipantNetworkComponent parseAuditEventAuditEventParticipantNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1622    AuditEvent.AuditEventParticipantNetworkComponent res = new AuditEvent.AuditEventParticipantNetworkComponent();
1623    parseBackboneProperties(json, res);
1624    if (json.has("address"))
1625      res.setAddressElement(parseString(json.get("address").getAsString()));
1626    if (json.has("_address"))
1627      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
1628    if (json.has("type"))
1629      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventParticipantNetworkType.NULL, new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory()));
1630    if (json.has("_type"))
1631      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1632    return res;
1633  }
1634
1635  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1636    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
1637    parseBackboneProperties(json, res);
1638    if (json.has("site"))
1639      res.setSiteElement(parseString(json.get("site").getAsString()));
1640    if (json.has("_site"))
1641      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
1642    if (json.has("identifier"))
1643      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1644    if (json.has("type")) {
1645      JsonArray array = json.getAsJsonArray("type");
1646      for (int i = 0; i < array.size(); i++) {
1647        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1648      }
1649    };
1650    return res;
1651  }
1652
1653  protected AuditEvent.AuditEventObjectComponent parseAuditEventAuditEventObjectComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1654    AuditEvent.AuditEventObjectComponent res = new AuditEvent.AuditEventObjectComponent();
1655    parseBackboneProperties(json, res);
1656    if (json.has("identifier"))
1657      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1658    if (json.has("reference"))
1659      res.setReference(parseReference(json.getAsJsonObject("reference")));
1660    if (json.has("type"))
1661      res.setType(parseCoding(json.getAsJsonObject("type")));
1662    if (json.has("role"))
1663      res.setRole(parseCoding(json.getAsJsonObject("role")));
1664    if (json.has("lifecycle"))
1665      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
1666    if (json.has("securityLabel")) {
1667      JsonArray array = json.getAsJsonArray("securityLabel");
1668      for (int i = 0; i < array.size(); i++) {
1669        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
1670      }
1671    };
1672    if (json.has("name"))
1673      res.setNameElement(parseString(json.get("name").getAsString()));
1674    if (json.has("_name"))
1675      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1676    if (json.has("description"))
1677      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1678    if (json.has("_description"))
1679      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1680    if (json.has("query"))
1681      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
1682    if (json.has("_query"))
1683      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
1684    if (json.has("detail")) {
1685      JsonArray array = json.getAsJsonArray("detail");
1686      for (int i = 0; i < array.size(); i++) {
1687        res.getDetail().add(parseAuditEventAuditEventObjectDetailComponent(array.get(i).getAsJsonObject(), owner));
1688      }
1689    };
1690    return res;
1691  }
1692
1693  protected AuditEvent.AuditEventObjectDetailComponent parseAuditEventAuditEventObjectDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1694    AuditEvent.AuditEventObjectDetailComponent res = new AuditEvent.AuditEventObjectDetailComponent();
1695    parseBackboneProperties(json, res);
1696    if (json.has("type"))
1697      res.setTypeElement(parseString(json.get("type").getAsString()));
1698    if (json.has("_type"))
1699      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1700    if (json.has("value"))
1701      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
1702    if (json.has("_value"))
1703      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1704    return res;
1705  }
1706
1707  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
1708    Basic res = new Basic();
1709    parseDomainResourceProperties(json, res);
1710    if (json.has("identifier")) {
1711      JsonArray array = json.getAsJsonArray("identifier");
1712      for (int i = 0; i < array.size(); i++) {
1713        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1714      }
1715    };
1716    if (json.has("code"))
1717      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1718    if (json.has("subject"))
1719      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1720    if (json.has("author"))
1721      res.setAuthor(parseReference(json.getAsJsonObject("author")));
1722    if (json.has("created"))
1723      res.setCreatedElement(parseDate(json.get("created").getAsString()));
1724    if (json.has("_created"))
1725      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
1726    return res;
1727  }
1728
1729  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
1730    Binary res = new Binary();
1731    parseResourceProperties(json, res);
1732    if (json.has("contentType"))
1733      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
1734    if (json.has("_contentType"))
1735      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
1736    if (json.has("content"))
1737      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
1738    if (json.has("_content"))
1739      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
1740    return res;
1741  }
1742
1743  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
1744    BodySite res = new BodySite();
1745    parseDomainResourceProperties(json, res);
1746    if (json.has("patient"))
1747      res.setPatient(parseReference(json.getAsJsonObject("patient")));
1748    if (json.has("identifier")) {
1749      JsonArray array = json.getAsJsonArray("identifier");
1750      for (int i = 0; i < array.size(); i++) {
1751        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1752      }
1753    };
1754    if (json.has("code"))
1755      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1756    if (json.has("modifier")) {
1757      JsonArray array = json.getAsJsonArray("modifier");
1758      for (int i = 0; i < array.size(); i++) {
1759        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1760      }
1761    };
1762    if (json.has("description"))
1763      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1764    if (json.has("_description"))
1765      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1766    if (json.has("image")) {
1767      JsonArray array = json.getAsJsonArray("image");
1768      for (int i = 0; i < array.size(); i++) {
1769        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1770      }
1771    };
1772    return res;
1773  }
1774
1775  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
1776    Bundle res = new Bundle();
1777    parseResourceProperties(json, res);
1778    if (json.has("type"))
1779      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
1780    if (json.has("_type"))
1781      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1782    if (json.has("total"))
1783      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
1784    if (json.has("_total"))
1785      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
1786    if (json.has("link")) {
1787      JsonArray array = json.getAsJsonArray("link");
1788      for (int i = 0; i < array.size(); i++) {
1789        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
1790      }
1791    };
1792    if (json.has("entry")) {
1793      JsonArray array = json.getAsJsonArray("entry");
1794      for (int i = 0; i < array.size(); i++) {
1795        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
1796      }
1797    };
1798    if (json.has("signature"))
1799      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
1800    return res;
1801  }
1802
1803  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1804    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
1805    parseBackboneProperties(json, res);
1806    if (json.has("relation"))
1807      res.setRelationElement(parseString(json.get("relation").getAsString()));
1808    if (json.has("_relation"))
1809      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
1810    if (json.has("url"))
1811      res.setUrlElement(parseUri(json.get("url").getAsString()));
1812    if (json.has("_url"))
1813      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1814    return res;
1815  }
1816
1817  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1818    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
1819    parseBackboneProperties(json, res);
1820    if (json.has("link")) {
1821      JsonArray array = json.getAsJsonArray("link");
1822      for (int i = 0; i < array.size(); i++) {
1823        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
1824      }
1825    };
1826    if (json.has("fullUrl"))
1827      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
1828    if (json.has("_fullUrl"))
1829      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
1830    if (json.has("resource"))
1831      res.setResource(parseResource(json.getAsJsonObject("resource")));
1832    if (json.has("search"))
1833      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
1834    if (json.has("request"))
1835      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
1836    if (json.has("response"))
1837      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
1838    return res;
1839  }
1840
1841  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1842    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
1843    parseBackboneProperties(json, res);
1844    if (json.has("mode"))
1845      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
1846    if (json.has("_mode"))
1847      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
1848    if (json.has("score"))
1849      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
1850    if (json.has("_score"))
1851      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
1852    return res;
1853  }
1854
1855  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1856    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
1857    parseBackboneProperties(json, res);
1858    if (json.has("method"))
1859      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
1860    if (json.has("_method"))
1861      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
1862    if (json.has("url"))
1863      res.setUrlElement(parseUri(json.get("url").getAsString()));
1864    if (json.has("_url"))
1865      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1866    if (json.has("ifNoneMatch"))
1867      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
1868    if (json.has("_ifNoneMatch"))
1869      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
1870    if (json.has("ifModifiedSince"))
1871      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
1872    if (json.has("_ifModifiedSince"))
1873      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
1874    if (json.has("ifMatch"))
1875      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
1876    if (json.has("_ifMatch"))
1877      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
1878    if (json.has("ifNoneExist"))
1879      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
1880    if (json.has("_ifNoneExist"))
1881      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
1882    return res;
1883  }
1884
1885  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1886    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
1887    parseBackboneProperties(json, res);
1888    if (json.has("status"))
1889      res.setStatusElement(parseString(json.get("status").getAsString()));
1890    if (json.has("_status"))
1891      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1892    if (json.has("location"))
1893      res.setLocationElement(parseUri(json.get("location").getAsString()));
1894    if (json.has("_location"))
1895      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
1896    if (json.has("etag"))
1897      res.setEtagElement(parseString(json.get("etag").getAsString()));
1898    if (json.has("_etag"))
1899      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
1900    if (json.has("lastModified"))
1901      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
1902    if (json.has("_lastModified"))
1903      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
1904    return res;
1905  }
1906
1907  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
1908    CarePlan res = new CarePlan();
1909    parseDomainResourceProperties(json, res);
1910    if (json.has("identifier")) {
1911      JsonArray array = json.getAsJsonArray("identifier");
1912      for (int i = 0; i < array.size(); i++) {
1913        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1914      }
1915    };
1916    if (json.has("subject"))
1917      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1918    if (json.has("status"))
1919      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
1920    if (json.has("_status"))
1921      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1922    if (json.has("context"))
1923      res.setContext(parseReference(json.getAsJsonObject("context")));
1924    if (json.has("period"))
1925      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1926    if (json.has("author")) {
1927      JsonArray array = json.getAsJsonArray("author");
1928      for (int i = 0; i < array.size(); i++) {
1929        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
1930      }
1931    };
1932    if (json.has("modified"))
1933      res.setModifiedElement(parseDateTime(json.get("modified").getAsString()));
1934    if (json.has("_modified"))
1935      parseElementProperties(json.getAsJsonObject("_modified"), res.getModifiedElement());
1936    if (json.has("category")) {
1937      JsonArray array = json.getAsJsonArray("category");
1938      for (int i = 0; i < array.size(); i++) {
1939        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1940      }
1941    };
1942    if (json.has("description"))
1943      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1944    if (json.has("_description"))
1945      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1946    if (json.has("addresses")) {
1947      JsonArray array = json.getAsJsonArray("addresses");
1948      for (int i = 0; i < array.size(); i++) {
1949        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
1950      }
1951    };
1952    if (json.has("support")) {
1953      JsonArray array = json.getAsJsonArray("support");
1954      for (int i = 0; i < array.size(); i++) {
1955        res.getSupport().add(parseReference(array.get(i).getAsJsonObject()));
1956      }
1957    };
1958    if (json.has("relatedPlan")) {
1959      JsonArray array = json.getAsJsonArray("relatedPlan");
1960      for (int i = 0; i < array.size(); i++) {
1961        res.getRelatedPlan().add(parseCarePlanCarePlanRelatedPlanComponent(array.get(i).getAsJsonObject(), res));
1962      }
1963    };
1964    if (json.has("participant")) {
1965      JsonArray array = json.getAsJsonArray("participant");
1966      for (int i = 0; i < array.size(); i++) {
1967        res.getParticipant().add(parseCarePlanCarePlanParticipantComponent(array.get(i).getAsJsonObject(), res));
1968      }
1969    };
1970    if (json.has("goal")) {
1971      JsonArray array = json.getAsJsonArray("goal");
1972      for (int i = 0; i < array.size(); i++) {
1973        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
1974      }
1975    };
1976    if (json.has("activity")) {
1977      JsonArray array = json.getAsJsonArray("activity");
1978      for (int i = 0; i < array.size(); i++) {
1979        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
1980      }
1981    };
1982    if (json.has("note"))
1983      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
1984    return res;
1985  }
1986
1987  protected CarePlan.CarePlanRelatedPlanComponent parseCarePlanCarePlanRelatedPlanComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
1988    CarePlan.CarePlanRelatedPlanComponent res = new CarePlan.CarePlanRelatedPlanComponent();
1989    parseBackboneProperties(json, res);
1990    if (json.has("code"))
1991      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CarePlan.CarePlanRelationship.NULL, new CarePlan.CarePlanRelationshipEnumFactory()));
1992    if (json.has("_code"))
1993      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1994    if (json.has("plan"))
1995      res.setPlan(parseReference(json.getAsJsonObject("plan")));
1996    return res;
1997  }
1998
1999  protected CarePlan.CarePlanParticipantComponent parseCarePlanCarePlanParticipantComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2000    CarePlan.CarePlanParticipantComponent res = new CarePlan.CarePlanParticipantComponent();
2001    parseBackboneProperties(json, res);
2002    if (json.has("role"))
2003      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2004    if (json.has("member"))
2005      res.setMember(parseReference(json.getAsJsonObject("member")));
2006    return res;
2007  }
2008
2009  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2010    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
2011    parseBackboneProperties(json, res);
2012    if (json.has("actionResulting")) {
2013      JsonArray array = json.getAsJsonArray("actionResulting");
2014      for (int i = 0; i < array.size(); i++) {
2015        res.getActionResulting().add(parseReference(array.get(i).getAsJsonObject()));
2016      }
2017    };
2018    if (json.has("progress")) {
2019      JsonArray array = json.getAsJsonArray("progress");
2020      for (int i = 0; i < array.size(); i++) {
2021        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
2022      }
2023    };
2024    if (json.has("reference"))
2025      res.setReference(parseReference(json.getAsJsonObject("reference")));
2026    if (json.has("detail"))
2027      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
2028    return res;
2029  }
2030
2031  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2032    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
2033    parseBackboneProperties(json, res);
2034    if (json.has("category"))
2035      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
2036    if (json.has("code"))
2037      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2038    if (json.has("reasonCode")) {
2039      JsonArray array = json.getAsJsonArray("reasonCode");
2040      for (int i = 0; i < array.size(); i++) {
2041        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2042      }
2043    };
2044    if (json.has("reasonReference")) {
2045      JsonArray array = json.getAsJsonArray("reasonReference");
2046      for (int i = 0; i < array.size(); i++) {
2047        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2048      }
2049    };
2050    if (json.has("goal")) {
2051      JsonArray array = json.getAsJsonArray("goal");
2052      for (int i = 0; i < array.size(); i++) {
2053        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
2054      }
2055    };
2056    if (json.has("status"))
2057      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
2058    if (json.has("_status"))
2059      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2060    if (json.has("statusReason"))
2061      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
2062    if (json.has("prohibited"))
2063      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
2064    if (json.has("_prohibited"))
2065      parseElementProperties(json.getAsJsonObject("_prohibited"), res.getProhibitedElement());
2066    Type scheduled = parseType("scheduled", json);
2067    if (scheduled != null)
2068      res.setScheduled(scheduled);
2069    if (json.has("location"))
2070      res.setLocation(parseReference(json.getAsJsonObject("location")));
2071    if (json.has("performer")) {
2072      JsonArray array = json.getAsJsonArray("performer");
2073      for (int i = 0; i < array.size(); i++) {
2074        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
2075      }
2076    };
2077    Type product = parseType("product", json);
2078    if (product != null)
2079      res.setProduct(product);
2080    if (json.has("dailyAmount"))
2081      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
2082    if (json.has("quantity"))
2083      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2084    if (json.has("description"))
2085      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2086    if (json.has("_description"))
2087      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2088    return res;
2089  }
2090
2091  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
2092    Claim res = new Claim();
2093    parseDomainResourceProperties(json, res);
2094    if (json.has("type"))
2095      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Claim.ClaimType.NULL, new Claim.ClaimTypeEnumFactory()));
2096    if (json.has("_type"))
2097      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2098    if (json.has("identifier")) {
2099      JsonArray array = json.getAsJsonArray("identifier");
2100      for (int i = 0; i < array.size(); i++) {
2101        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2102      }
2103    };
2104    if (json.has("ruleset"))
2105      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
2106    if (json.has("originalRuleset"))
2107      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2108    if (json.has("created"))
2109      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2110    if (json.has("_created"))
2111      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2112    if (json.has("target"))
2113      res.setTarget(parseReference(json.getAsJsonObject("target")));
2114    if (json.has("provider"))
2115      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2116    if (json.has("organization"))
2117      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2118    if (json.has("use"))
2119      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
2120    if (json.has("_use"))
2121      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
2122    if (json.has("priority"))
2123      res.setPriority(parseCoding(json.getAsJsonObject("priority")));
2124    if (json.has("fundsReserve"))
2125      res.setFundsReserve(parseCoding(json.getAsJsonObject("fundsReserve")));
2126    if (json.has("enterer"))
2127      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
2128    if (json.has("facility"))
2129      res.setFacility(parseReference(json.getAsJsonObject("facility")));
2130    if (json.has("prescription"))
2131      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
2132    if (json.has("originalPrescription"))
2133      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
2134    if (json.has("payee"))
2135      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
2136    if (json.has("referral"))
2137      res.setReferral(parseReference(json.getAsJsonObject("referral")));
2138    if (json.has("diagnosis")) {
2139      JsonArray array = json.getAsJsonArray("diagnosis");
2140      for (int i = 0; i < array.size(); i++) {
2141        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
2142      }
2143    };
2144    if (json.has("condition")) {
2145      JsonArray array = json.getAsJsonArray("condition");
2146      for (int i = 0; i < array.size(); i++) {
2147        res.getCondition().add(parseCoding(array.get(i).getAsJsonObject()));
2148      }
2149    };
2150    if (json.has("patient"))
2151      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2152    if (json.has("coverage")) {
2153      JsonArray array = json.getAsJsonArray("coverage");
2154      for (int i = 0; i < array.size(); i++) {
2155        res.getCoverage().add(parseClaimCoverageComponent(array.get(i).getAsJsonObject(), res));
2156      }
2157    };
2158    if (json.has("exception")) {
2159      JsonArray array = json.getAsJsonArray("exception");
2160      for (int i = 0; i < array.size(); i++) {
2161        res.getException().add(parseCoding(array.get(i).getAsJsonObject()));
2162      }
2163    };
2164    if (json.has("school"))
2165      res.setSchoolElement(parseString(json.get("school").getAsString()));
2166    if (json.has("_school"))
2167      parseElementProperties(json.getAsJsonObject("_school"), res.getSchoolElement());
2168    if (json.has("accident"))
2169      res.setAccidentElement(parseDate(json.get("accident").getAsString()));
2170    if (json.has("_accident"))
2171      parseElementProperties(json.getAsJsonObject("_accident"), res.getAccidentElement());
2172    if (json.has("accidentType"))
2173      res.setAccidentType(parseCoding(json.getAsJsonObject("accidentType")));
2174    if (json.has("interventionException")) {
2175      JsonArray array = json.getAsJsonArray("interventionException");
2176      for (int i = 0; i < array.size(); i++) {
2177        res.getInterventionException().add(parseCoding(array.get(i).getAsJsonObject()));
2178      }
2179    };
2180    if (json.has("item")) {
2181      JsonArray array = json.getAsJsonArray("item");
2182      for (int i = 0; i < array.size(); i++) {
2183        res.getItem().add(parseClaimItemsComponent(array.get(i).getAsJsonObject(), res));
2184      }
2185    };
2186    if (json.has("additionalMaterials")) {
2187      JsonArray array = json.getAsJsonArray("additionalMaterials");
2188      for (int i = 0; i < array.size(); i++) {
2189        res.getAdditionalMaterials().add(parseCoding(array.get(i).getAsJsonObject()));
2190      }
2191    };
2192    if (json.has("missingTeeth")) {
2193      JsonArray array = json.getAsJsonArray("missingTeeth");
2194      for (int i = 0; i < array.size(); i++) {
2195        res.getMissingTeeth().add(parseClaimMissingTeethComponent(array.get(i).getAsJsonObject(), res));
2196      }
2197    };
2198    return res;
2199  }
2200
2201  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2202    Claim.PayeeComponent res = new Claim.PayeeComponent();
2203    parseBackboneProperties(json, res);
2204    if (json.has("type"))
2205      res.setType(parseCoding(json.getAsJsonObject("type")));
2206    if (json.has("provider"))
2207      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2208    if (json.has("organization"))
2209      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2210    if (json.has("person"))
2211      res.setPerson(parseReference(json.getAsJsonObject("person")));
2212    return res;
2213  }
2214
2215  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2216    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
2217    parseBackboneProperties(json, res);
2218    if (json.has("sequence"))
2219      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2220    if (json.has("_sequence"))
2221      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2222    if (json.has("diagnosis"))
2223      res.setDiagnosis(parseCoding(json.getAsJsonObject("diagnosis")));
2224    return res;
2225  }
2226
2227  protected Claim.CoverageComponent parseClaimCoverageComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2228    Claim.CoverageComponent res = new Claim.CoverageComponent();
2229    parseBackboneProperties(json, res);
2230    if (json.has("sequence"))
2231      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2232    if (json.has("_sequence"))
2233      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2234    if (json.has("focal"))
2235      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
2236    if (json.has("_focal"))
2237      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
2238    if (json.has("coverage"))
2239      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2240    if (json.has("businessArrangement"))
2241      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
2242    if (json.has("_businessArrangement"))
2243      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
2244    if (json.has("relationship"))
2245      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
2246    if (json.has("preAuthRef")) {
2247      JsonArray array = json.getAsJsonArray("preAuthRef");
2248      for (int i = 0; i < array.size(); i++) {
2249        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
2250      }
2251    };
2252    if (json.has("_preAuthRef")) {
2253      JsonArray array = json.getAsJsonArray("_preAuthRef");
2254      for (int i = 0; i < array.size(); i++) {
2255        if (i == res.getPreAuthRef().size())
2256          res.getPreAuthRef().add(parseString(null));
2257        if (array.get(i) instanceof JsonObject) 
2258          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
2259      }
2260    };
2261    if (json.has("claimResponse"))
2262      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
2263    if (json.has("originalRuleset"))
2264      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2265    return res;
2266  }
2267
2268  protected Claim.ItemsComponent parseClaimItemsComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2269    Claim.ItemsComponent res = new Claim.ItemsComponent();
2270    parseBackboneProperties(json, res);
2271    if (json.has("sequence"))
2272      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2273    if (json.has("_sequence"))
2274      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2275    if (json.has("type"))
2276      res.setType(parseCoding(json.getAsJsonObject("type")));
2277    if (json.has("provider"))
2278      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2279    if (json.has("diagnosisLinkId")) {
2280      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
2281      for (int i = 0; i < array.size(); i++) {
2282        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2283      }
2284    };
2285    if (json.has("_diagnosisLinkId")) {
2286      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
2287      for (int i = 0; i < array.size(); i++) {
2288        if (i == res.getDiagnosisLinkId().size())
2289          res.getDiagnosisLinkId().add(parsePositiveInt(null));
2290        if (array.get(i) instanceof JsonObject) 
2291          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
2292      }
2293    };
2294    if (json.has("service"))
2295      res.setService(parseCoding(json.getAsJsonObject("service")));
2296    if (json.has("serviceDate"))
2297      res.setServiceDateElement(parseDate(json.get("serviceDate").getAsString()));
2298    if (json.has("_serviceDate"))
2299      parseElementProperties(json.getAsJsonObject("_serviceDate"), res.getServiceDateElement());
2300    if (json.has("quantity"))
2301      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2302    if (json.has("unitPrice"))
2303      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2304    if (json.has("factor"))
2305      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2306    if (json.has("_factor"))
2307      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2308    if (json.has("points"))
2309      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2310    if (json.has("_points"))
2311      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2312    if (json.has("net"))
2313      res.setNet(parseMoney(json.getAsJsonObject("net")));
2314    if (json.has("udi"))
2315      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2316    if (json.has("bodySite"))
2317      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
2318    if (json.has("subSite")) {
2319      JsonArray array = json.getAsJsonArray("subSite");
2320      for (int i = 0; i < array.size(); i++) {
2321        res.getSubSite().add(parseCoding(array.get(i).getAsJsonObject()));
2322      }
2323    };
2324    if (json.has("modifier")) {
2325      JsonArray array = json.getAsJsonArray("modifier");
2326      for (int i = 0; i < array.size(); i++) {
2327        res.getModifier().add(parseCoding(array.get(i).getAsJsonObject()));
2328      }
2329    };
2330    if (json.has("detail")) {
2331      JsonArray array = json.getAsJsonArray("detail");
2332      for (int i = 0; i < array.size(); i++) {
2333        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
2334      }
2335    };
2336    if (json.has("prosthesis"))
2337      res.setProsthesis(parseClaimProsthesisComponent(json.getAsJsonObject("prosthesis"), owner));
2338    return res;
2339  }
2340
2341  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2342    Claim.DetailComponent res = new Claim.DetailComponent();
2343    parseBackboneProperties(json, res);
2344    if (json.has("sequence"))
2345      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2346    if (json.has("_sequence"))
2347      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2348    if (json.has("type"))
2349      res.setType(parseCoding(json.getAsJsonObject("type")));
2350    if (json.has("service"))
2351      res.setService(parseCoding(json.getAsJsonObject("service")));
2352    if (json.has("quantity"))
2353      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2354    if (json.has("unitPrice"))
2355      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2356    if (json.has("factor"))
2357      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2358    if (json.has("_factor"))
2359      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2360    if (json.has("points"))
2361      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2362    if (json.has("_points"))
2363      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2364    if (json.has("net"))
2365      res.setNet(parseMoney(json.getAsJsonObject("net")));
2366    if (json.has("udi"))
2367      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2368    if (json.has("subDetail")) {
2369      JsonArray array = json.getAsJsonArray("subDetail");
2370      for (int i = 0; i < array.size(); i++) {
2371        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
2372      }
2373    };
2374    return res;
2375  }
2376
2377  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2378    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
2379    parseBackboneProperties(json, res);
2380    if (json.has("sequence"))
2381      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2382    if (json.has("_sequence"))
2383      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2384    if (json.has("type"))
2385      res.setType(parseCoding(json.getAsJsonObject("type")));
2386    if (json.has("service"))
2387      res.setService(parseCoding(json.getAsJsonObject("service")));
2388    if (json.has("quantity"))
2389      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2390    if (json.has("unitPrice"))
2391      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2392    if (json.has("factor"))
2393      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2394    if (json.has("_factor"))
2395      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2396    if (json.has("points"))
2397      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2398    if (json.has("_points"))
2399      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2400    if (json.has("net"))
2401      res.setNet(parseMoney(json.getAsJsonObject("net")));
2402    if (json.has("udi"))
2403      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2404    return res;
2405  }
2406
2407  protected Claim.ProsthesisComponent parseClaimProsthesisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2408    Claim.ProsthesisComponent res = new Claim.ProsthesisComponent();
2409    parseBackboneProperties(json, res);
2410    if (json.has("initial"))
2411      res.setInitialElement(parseBoolean(json.get("initial").getAsBoolean()));
2412    if (json.has("_initial"))
2413      parseElementProperties(json.getAsJsonObject("_initial"), res.getInitialElement());
2414    if (json.has("priorDate"))
2415      res.setPriorDateElement(parseDate(json.get("priorDate").getAsString()));
2416    if (json.has("_priorDate"))
2417      parseElementProperties(json.getAsJsonObject("_priorDate"), res.getPriorDateElement());
2418    if (json.has("priorMaterial"))
2419      res.setPriorMaterial(parseCoding(json.getAsJsonObject("priorMaterial")));
2420    return res;
2421  }
2422
2423  protected Claim.MissingTeethComponent parseClaimMissingTeethComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2424    Claim.MissingTeethComponent res = new Claim.MissingTeethComponent();
2425    parseBackboneProperties(json, res);
2426    if (json.has("tooth"))
2427      res.setTooth(parseCoding(json.getAsJsonObject("tooth")));
2428    if (json.has("reason"))
2429      res.setReason(parseCoding(json.getAsJsonObject("reason")));
2430    if (json.has("extractionDate"))
2431      res.setExtractionDateElement(parseDate(json.get("extractionDate").getAsString()));
2432    if (json.has("_extractionDate"))
2433      parseElementProperties(json.getAsJsonObject("_extractionDate"), res.getExtractionDateElement());
2434    return res;
2435  }
2436
2437  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
2438    ClaimResponse res = new ClaimResponse();
2439    parseDomainResourceProperties(json, res);
2440    if (json.has("identifier")) {
2441      JsonArray array = json.getAsJsonArray("identifier");
2442      for (int i = 0; i < array.size(); i++) {
2443        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2444      }
2445    };
2446    if (json.has("request"))
2447      res.setRequest(parseReference(json.getAsJsonObject("request")));
2448    if (json.has("ruleset"))
2449      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
2450    if (json.has("originalRuleset"))
2451      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2452    if (json.has("created"))
2453      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2454    if (json.has("_created"))
2455      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2456    if (json.has("organization"))
2457      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2458    if (json.has("requestProvider"))
2459      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
2460    if (json.has("requestOrganization"))
2461      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
2462    if (json.has("outcome"))
2463      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
2464    if (json.has("_outcome"))
2465      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2466    if (json.has("disposition"))
2467      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
2468    if (json.has("_disposition"))
2469      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
2470    if (json.has("payeeType"))
2471      res.setPayeeType(parseCoding(json.getAsJsonObject("payeeType")));
2472    if (json.has("item")) {
2473      JsonArray array = json.getAsJsonArray("item");
2474      for (int i = 0; i < array.size(); i++) {
2475        res.getItem().add(parseClaimResponseItemsComponent(array.get(i).getAsJsonObject(), res));
2476      }
2477    };
2478    if (json.has("addItem")) {
2479      JsonArray array = json.getAsJsonArray("addItem");
2480      for (int i = 0; i < array.size(); i++) {
2481        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
2482      }
2483    };
2484    if (json.has("error")) {
2485      JsonArray array = json.getAsJsonArray("error");
2486      for (int i = 0; i < array.size(); i++) {
2487        res.getError().add(parseClaimResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
2488      }
2489    };
2490    if (json.has("totalCost"))
2491      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
2492    if (json.has("unallocDeductable"))
2493      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
2494    if (json.has("totalBenefit"))
2495      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
2496    if (json.has("paymentAdjustment"))
2497      res.setPaymentAdjustment(parseMoney(json.getAsJsonObject("paymentAdjustment")));
2498    if (json.has("paymentAdjustmentReason"))
2499      res.setPaymentAdjustmentReason(parseCoding(json.getAsJsonObject("paymentAdjustmentReason")));
2500    if (json.has("paymentDate"))
2501      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
2502    if (json.has("_paymentDate"))
2503      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
2504    if (json.has("paymentAmount"))
2505      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
2506    if (json.has("paymentRef"))
2507      res.setPaymentRef(parseIdentifier(json.getAsJsonObject("paymentRef")));
2508    if (json.has("reserved"))
2509      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
2510    if (json.has("form"))
2511      res.setForm(parseCoding(json.getAsJsonObject("form")));
2512    if (json.has("note")) {
2513      JsonArray array = json.getAsJsonArray("note");
2514      for (int i = 0; i < array.size(); i++) {
2515        res.getNote().add(parseClaimResponseNotesComponent(array.get(i).getAsJsonObject(), res));
2516      }
2517    };
2518    if (json.has("coverage")) {
2519      JsonArray array = json.getAsJsonArray("coverage");
2520      for (int i = 0; i < array.size(); i++) {
2521        res.getCoverage().add(parseClaimResponseCoverageComponent(array.get(i).getAsJsonObject(), res));
2522      }
2523    };
2524    return res;
2525  }
2526
2527  protected ClaimResponse.ItemsComponent parseClaimResponseItemsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2528    ClaimResponse.ItemsComponent res = new ClaimResponse.ItemsComponent();
2529    parseBackboneProperties(json, res);
2530    if (json.has("sequenceLinkId"))
2531      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2532    if (json.has("_sequenceLinkId"))
2533      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2534    if (json.has("noteNumber")) {
2535      JsonArray array = json.getAsJsonArray("noteNumber");
2536      for (int i = 0; i < array.size(); i++) {
2537        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
2538      }
2539    };
2540    if (json.has("_noteNumber")) {
2541      JsonArray array = json.getAsJsonArray("_noteNumber");
2542      for (int i = 0; i < array.size(); i++) {
2543        if (i == res.getNoteNumber().size())
2544          res.getNoteNumber().add(parsePositiveInt(null));
2545        if (array.get(i) instanceof JsonObject) 
2546          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
2547      }
2548    };
2549    if (json.has("adjudication")) {
2550      JsonArray array = json.getAsJsonArray("adjudication");
2551      for (int i = 0; i < array.size(); i++) {
2552        res.getAdjudication().add(parseClaimResponseItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2553      }
2554    };
2555    if (json.has("detail")) {
2556      JsonArray array = json.getAsJsonArray("detail");
2557      for (int i = 0; i < array.size(); i++) {
2558        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
2559      }
2560    };
2561    return res;
2562  }
2563
2564  protected ClaimResponse.ItemAdjudicationComponent parseClaimResponseItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2565    ClaimResponse.ItemAdjudicationComponent res = new ClaimResponse.ItemAdjudicationComponent();
2566    parseBackboneProperties(json, res);
2567    if (json.has("code"))
2568      res.setCode(parseCoding(json.getAsJsonObject("code")));
2569    if (json.has("amount"))
2570      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2571    if (json.has("value"))
2572      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2573    if (json.has("_value"))
2574      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2575    return res;
2576  }
2577
2578  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2579    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
2580    parseBackboneProperties(json, res);
2581    if (json.has("sequenceLinkId"))
2582      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2583    if (json.has("_sequenceLinkId"))
2584      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2585    if (json.has("adjudication")) {
2586      JsonArray array = json.getAsJsonArray("adjudication");
2587      for (int i = 0; i < array.size(); i++) {
2588        res.getAdjudication().add(parseClaimResponseDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2589      }
2590    };
2591    if (json.has("subDetail")) {
2592      JsonArray array = json.getAsJsonArray("subDetail");
2593      for (int i = 0; i < array.size(); i++) {
2594        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
2595      }
2596    };
2597    return res;
2598  }
2599
2600  protected ClaimResponse.DetailAdjudicationComponent parseClaimResponseDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2601    ClaimResponse.DetailAdjudicationComponent res = new ClaimResponse.DetailAdjudicationComponent();
2602    parseBackboneProperties(json, res);
2603    if (json.has("code"))
2604      res.setCode(parseCoding(json.getAsJsonObject("code")));
2605    if (json.has("amount"))
2606      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2607    if (json.has("value"))
2608      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2609    if (json.has("_value"))
2610      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2611    return res;
2612  }
2613
2614  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2615    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
2616    parseBackboneProperties(json, res);
2617    if (json.has("sequenceLinkId"))
2618      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2619    if (json.has("_sequenceLinkId"))
2620      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2621    if (json.has("adjudication")) {
2622      JsonArray array = json.getAsJsonArray("adjudication");
2623      for (int i = 0; i < array.size(); i++) {
2624        res.getAdjudication().add(parseClaimResponseSubdetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2625      }
2626    };
2627    return res;
2628  }
2629
2630  protected ClaimResponse.SubdetailAdjudicationComponent parseClaimResponseSubdetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2631    ClaimResponse.SubdetailAdjudicationComponent res = new ClaimResponse.SubdetailAdjudicationComponent();
2632    parseBackboneProperties(json, res);
2633    if (json.has("code"))
2634      res.setCode(parseCoding(json.getAsJsonObject("code")));
2635    if (json.has("amount"))
2636      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2637    if (json.has("value"))
2638      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2639    if (json.has("_value"))
2640      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2641    return res;
2642  }
2643
2644  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2645    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
2646    parseBackboneProperties(json, res);
2647    if (json.has("sequenceLinkId")) {
2648      JsonArray array = json.getAsJsonArray("sequenceLinkId");
2649      for (int i = 0; i < array.size(); i++) {
2650        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2651      }
2652    };
2653    if (json.has("_sequenceLinkId")) {
2654      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
2655      for (int i = 0; i < array.size(); i++) {
2656        if (i == res.getSequenceLinkId().size())
2657          res.getSequenceLinkId().add(parsePositiveInt(null));
2658        if (array.get(i) instanceof JsonObject) 
2659          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
2660      }
2661    };
2662    if (json.has("service"))
2663      res.setService(parseCoding(json.getAsJsonObject("service")));
2664    if (json.has("fee"))
2665      res.setFee(parseMoney(json.getAsJsonObject("fee")));
2666    if (json.has("noteNumberLinkId")) {
2667      JsonArray array = json.getAsJsonArray("noteNumberLinkId");
2668      for (int i = 0; i < array.size(); i++) {
2669        res.getNoteNumberLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2670      }
2671    };
2672    if (json.has("_noteNumberLinkId")) {
2673      JsonArray array = json.getAsJsonArray("_noteNumberLinkId");
2674      for (int i = 0; i < array.size(); i++) {
2675        if (i == res.getNoteNumberLinkId().size())
2676          res.getNoteNumberLinkId().add(parsePositiveInt(null));
2677        if (array.get(i) instanceof JsonObject) 
2678          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumberLinkId().get(i));
2679      }
2680    };
2681    if (json.has("adjudication")) {
2682      JsonArray array = json.getAsJsonArray("adjudication");
2683      for (int i = 0; i < array.size(); i++) {
2684        res.getAdjudication().add(parseClaimResponseAddedItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2685      }
2686    };
2687    if (json.has("detail")) {
2688      JsonArray array = json.getAsJsonArray("detail");
2689      for (int i = 0; i < array.size(); i++) {
2690        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
2691      }
2692    };
2693    return res;
2694  }
2695
2696  protected ClaimResponse.AddedItemAdjudicationComponent parseClaimResponseAddedItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2697    ClaimResponse.AddedItemAdjudicationComponent res = new ClaimResponse.AddedItemAdjudicationComponent();
2698    parseBackboneProperties(json, res);
2699    if (json.has("code"))
2700      res.setCode(parseCoding(json.getAsJsonObject("code")));
2701    if (json.has("amount"))
2702      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2703    if (json.has("value"))
2704      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2705    if (json.has("_value"))
2706      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2707    return res;
2708  }
2709
2710  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2711    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
2712    parseBackboneProperties(json, res);
2713    if (json.has("service"))
2714      res.setService(parseCoding(json.getAsJsonObject("service")));
2715    if (json.has("fee"))
2716      res.setFee(parseMoney(json.getAsJsonObject("fee")));
2717    if (json.has("adjudication")) {
2718      JsonArray array = json.getAsJsonArray("adjudication");
2719      for (int i = 0; i < array.size(); i++) {
2720        res.getAdjudication().add(parseClaimResponseAddedItemDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2721      }
2722    };
2723    return res;
2724  }
2725
2726  protected ClaimResponse.AddedItemDetailAdjudicationComponent parseClaimResponseAddedItemDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2727    ClaimResponse.AddedItemDetailAdjudicationComponent res = new ClaimResponse.AddedItemDetailAdjudicationComponent();
2728    parseBackboneProperties(json, res);
2729    if (json.has("code"))
2730      res.setCode(parseCoding(json.getAsJsonObject("code")));
2731    if (json.has("amount"))
2732      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2733    if (json.has("value"))
2734      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2735    if (json.has("_value"))
2736      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2737    return res;
2738  }
2739
2740  protected ClaimResponse.ErrorsComponent parseClaimResponseErrorsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2741    ClaimResponse.ErrorsComponent res = new ClaimResponse.ErrorsComponent();
2742    parseBackboneProperties(json, res);
2743    if (json.has("sequenceLinkId"))
2744      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2745    if (json.has("_sequenceLinkId"))
2746      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2747    if (json.has("detailSequenceLinkId"))
2748      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
2749    if (json.has("_detailSequenceLinkId"))
2750      parseElementProperties(json.getAsJsonObject("_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
2751    if (json.has("subdetailSequenceLinkId"))
2752      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
2753    if (json.has("_subdetailSequenceLinkId"))
2754      parseElementProperties(json.getAsJsonObject("_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
2755    if (json.has("code"))
2756      res.setCode(parseCoding(json.getAsJsonObject("code")));
2757    return res;
2758  }
2759
2760  protected ClaimResponse.NotesComponent parseClaimResponseNotesComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2761    ClaimResponse.NotesComponent res = new ClaimResponse.NotesComponent();
2762    parseBackboneProperties(json, res);
2763    if (json.has("number"))
2764      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
2765    if (json.has("_number"))
2766      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
2767    if (json.has("type"))
2768      res.setType(parseCoding(json.getAsJsonObject("type")));
2769    if (json.has("text"))
2770      res.setTextElement(parseString(json.get("text").getAsString()));
2771    if (json.has("_text"))
2772      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
2773    return res;
2774  }
2775
2776  protected ClaimResponse.CoverageComponent parseClaimResponseCoverageComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2777    ClaimResponse.CoverageComponent res = new ClaimResponse.CoverageComponent();
2778    parseBackboneProperties(json, res);
2779    if (json.has("sequence"))
2780      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2781    if (json.has("_sequence"))
2782      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2783    if (json.has("focal"))
2784      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
2785    if (json.has("_focal"))
2786      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
2787    if (json.has("coverage"))
2788      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2789    if (json.has("businessArrangement"))
2790      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
2791    if (json.has("_businessArrangement"))
2792      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
2793    if (json.has("relationship"))
2794      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
2795    if (json.has("preAuthRef")) {
2796      JsonArray array = json.getAsJsonArray("preAuthRef");
2797      for (int i = 0; i < array.size(); i++) {
2798        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
2799      }
2800    };
2801    if (json.has("_preAuthRef")) {
2802      JsonArray array = json.getAsJsonArray("_preAuthRef");
2803      for (int i = 0; i < array.size(); i++) {
2804        if (i == res.getPreAuthRef().size())
2805          res.getPreAuthRef().add(parseString(null));
2806        if (array.get(i) instanceof JsonObject) 
2807          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
2808      }
2809    };
2810    if (json.has("claimResponse"))
2811      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
2812    if (json.has("originalRuleset"))
2813      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2814    return res;
2815  }
2816
2817  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
2818    ClinicalImpression res = new ClinicalImpression();
2819    parseDomainResourceProperties(json, res);
2820    if (json.has("patient"))
2821      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2822    if (json.has("assessor"))
2823      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
2824    if (json.has("status"))
2825      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
2826    if (json.has("_status"))
2827      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2828    if (json.has("date"))
2829      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2830    if (json.has("_date"))
2831      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2832    if (json.has("description"))
2833      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2834    if (json.has("_description"))
2835      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2836    if (json.has("previous"))
2837      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
2838    if (json.has("problem")) {
2839      JsonArray array = json.getAsJsonArray("problem");
2840      for (int i = 0; i < array.size(); i++) {
2841        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
2842      }
2843    };
2844    Type trigger = parseType("trigger", json);
2845    if (trigger != null)
2846      res.setTrigger(trigger);
2847    if (json.has("investigations")) {
2848      JsonArray array = json.getAsJsonArray("investigations");
2849      for (int i = 0; i < array.size(); i++) {
2850        res.getInvestigations().add(parseClinicalImpressionClinicalImpressionInvestigationsComponent(array.get(i).getAsJsonObject(), res));
2851      }
2852    };
2853    if (json.has("protocol"))
2854      res.setProtocolElement(parseUri(json.get("protocol").getAsString()));
2855    if (json.has("_protocol"))
2856      parseElementProperties(json.getAsJsonObject("_protocol"), res.getProtocolElement());
2857    if (json.has("summary"))
2858      res.setSummaryElement(parseString(json.get("summary").getAsString()));
2859    if (json.has("_summary"))
2860      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
2861    if (json.has("finding")) {
2862      JsonArray array = json.getAsJsonArray("finding");
2863      for (int i = 0; i < array.size(); i++) {
2864        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
2865      }
2866    };
2867    if (json.has("resolved")) {
2868      JsonArray array = json.getAsJsonArray("resolved");
2869      for (int i = 0; i < array.size(); i++) {
2870        res.getResolved().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2871      }
2872    };
2873    if (json.has("ruledOut")) {
2874      JsonArray array = json.getAsJsonArray("ruledOut");
2875      for (int i = 0; i < array.size(); i++) {
2876        res.getRuledOut().add(parseClinicalImpressionClinicalImpressionRuledOutComponent(array.get(i).getAsJsonObject(), res));
2877      }
2878    };
2879    if (json.has("prognosis"))
2880      res.setPrognosisElement(parseString(json.get("prognosis").getAsString()));
2881    if (json.has("_prognosis"))
2882      parseElementProperties(json.getAsJsonObject("_prognosis"), res.getPrognosisElement());
2883    if (json.has("plan")) {
2884      JsonArray array = json.getAsJsonArray("plan");
2885      for (int i = 0; i < array.size(); i++) {
2886        res.getPlan().add(parseReference(array.get(i).getAsJsonObject()));
2887      }
2888    };
2889    if (json.has("action")) {
2890      JsonArray array = json.getAsJsonArray("action");
2891      for (int i = 0; i < array.size(); i++) {
2892        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
2893      }
2894    };
2895    return res;
2896  }
2897
2898  protected ClinicalImpression.ClinicalImpressionInvestigationsComponent parseClinicalImpressionClinicalImpressionInvestigationsComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2899    ClinicalImpression.ClinicalImpressionInvestigationsComponent res = new ClinicalImpression.ClinicalImpressionInvestigationsComponent();
2900    parseBackboneProperties(json, res);
2901    if (json.has("code"))
2902      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2903    if (json.has("item")) {
2904      JsonArray array = json.getAsJsonArray("item");
2905      for (int i = 0; i < array.size(); i++) {
2906        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
2907      }
2908    };
2909    return res;
2910  }
2911
2912  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2913    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
2914    parseBackboneProperties(json, res);
2915    if (json.has("item"))
2916      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
2917    if (json.has("cause"))
2918      res.setCauseElement(parseString(json.get("cause").getAsString()));
2919    if (json.has("_cause"))
2920      parseElementProperties(json.getAsJsonObject("_cause"), res.getCauseElement());
2921    return res;
2922  }
2923
2924  protected ClinicalImpression.ClinicalImpressionRuledOutComponent parseClinicalImpressionClinicalImpressionRuledOutComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2925    ClinicalImpression.ClinicalImpressionRuledOutComponent res = new ClinicalImpression.ClinicalImpressionRuledOutComponent();
2926    parseBackboneProperties(json, res);
2927    if (json.has("item"))
2928      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
2929    if (json.has("reason"))
2930      res.setReasonElement(parseString(json.get("reason").getAsString()));
2931    if (json.has("_reason"))
2932      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
2933    return res;
2934  }
2935
2936  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
2937    Communication res = new Communication();
2938    parseDomainResourceProperties(json, res);
2939    if (json.has("identifier")) {
2940      JsonArray array = json.getAsJsonArray("identifier");
2941      for (int i = 0; i < array.size(); i++) {
2942        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2943      }
2944    };
2945    if (json.has("category"))
2946      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
2947    if (json.has("sender"))
2948      res.setSender(parseReference(json.getAsJsonObject("sender")));
2949    if (json.has("recipient")) {
2950      JsonArray array = json.getAsJsonArray("recipient");
2951      for (int i = 0; i < array.size(); i++) {
2952        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
2953      }
2954    };
2955    if (json.has("payload")) {
2956      JsonArray array = json.getAsJsonArray("payload");
2957      for (int i = 0; i < array.size(); i++) {
2958        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
2959      }
2960    };
2961    if (json.has("medium")) {
2962      JsonArray array = json.getAsJsonArray("medium");
2963      for (int i = 0; i < array.size(); i++) {
2964        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2965      }
2966    };
2967    if (json.has("status"))
2968      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
2969    if (json.has("_status"))
2970      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2971    if (json.has("encounter"))
2972      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2973    if (json.has("sent"))
2974      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
2975    if (json.has("_sent"))
2976      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
2977    if (json.has("received"))
2978      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
2979    if (json.has("_received"))
2980      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
2981    if (json.has("reason")) {
2982      JsonArray array = json.getAsJsonArray("reason");
2983      for (int i = 0; i < array.size(); i++) {
2984        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2985      }
2986    };
2987    if (json.has("subject"))
2988      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2989    if (json.has("requestDetail"))
2990      res.setRequestDetail(parseReference(json.getAsJsonObject("requestDetail")));
2991    return res;
2992  }
2993
2994  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
2995    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
2996    parseBackboneProperties(json, res);
2997    Type content = parseType("content", json);
2998    if (content != null)
2999      res.setContent(content);
3000    return res;
3001  }
3002
3003  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
3004    CommunicationRequest res = new CommunicationRequest();
3005    parseDomainResourceProperties(json, res);
3006    if (json.has("identifier")) {
3007      JsonArray array = json.getAsJsonArray("identifier");
3008      for (int i = 0; i < array.size(); i++) {
3009        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3010      }
3011    };
3012    if (json.has("category"))
3013      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3014    if (json.has("sender"))
3015      res.setSender(parseReference(json.getAsJsonObject("sender")));
3016    if (json.has("recipient")) {
3017      JsonArray array = json.getAsJsonArray("recipient");
3018      for (int i = 0; i < array.size(); i++) {
3019        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
3020      }
3021    };
3022    if (json.has("payload")) {
3023      JsonArray array = json.getAsJsonArray("payload");
3024      for (int i = 0; i < array.size(); i++) {
3025        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
3026      }
3027    };
3028    if (json.has("medium")) {
3029      JsonArray array = json.getAsJsonArray("medium");
3030      for (int i = 0; i < array.size(); i++) {
3031        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3032      }
3033    };
3034    if (json.has("requester"))
3035      res.setRequester(parseReference(json.getAsJsonObject("requester")));
3036    if (json.has("status"))
3037      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
3038    if (json.has("_status"))
3039      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3040    if (json.has("encounter"))
3041      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3042    Type scheduled = parseType("scheduled", json);
3043    if (scheduled != null)
3044      res.setScheduled(scheduled);
3045    if (json.has("reason")) {
3046      JsonArray array = json.getAsJsonArray("reason");
3047      for (int i = 0; i < array.size(); i++) {
3048        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3049      }
3050    };
3051    if (json.has("requestedOn"))
3052      res.setRequestedOnElement(parseDateTime(json.get("requestedOn").getAsString()));
3053    if (json.has("_requestedOn"))
3054      parseElementProperties(json.getAsJsonObject("_requestedOn"), res.getRequestedOnElement());
3055    if (json.has("subject"))
3056      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3057    if (json.has("priority"))
3058      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
3059    return res;
3060  }
3061
3062  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
3063    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
3064    parseBackboneProperties(json, res);
3065    Type content = parseType("content", json);
3066    if (content != null)
3067      res.setContent(content);
3068    return res;
3069  }
3070
3071  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
3072    Composition res = new Composition();
3073    parseDomainResourceProperties(json, res);
3074    if (json.has("identifier"))
3075      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3076    if (json.has("date"))
3077      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3078    if (json.has("_date"))
3079      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3080    if (json.has("type"))
3081      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3082    if (json.has("class"))
3083      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
3084    if (json.has("title"))
3085      res.setTitleElement(parseString(json.get("title").getAsString()));
3086    if (json.has("_title"))
3087      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3088    if (json.has("status"))
3089      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
3090    if (json.has("_status"))
3091      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3092    if (json.has("confidentiality"))
3093      res.setConfidentialityElement(parseCode(json.get("confidentiality").getAsString()));
3094    if (json.has("_confidentiality"))
3095      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
3096    if (json.has("subject"))
3097      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3098    if (json.has("author")) {
3099      JsonArray array = json.getAsJsonArray("author");
3100      for (int i = 0; i < array.size(); i++) {
3101        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3102      }
3103    };
3104    if (json.has("attester")) {
3105      JsonArray array = json.getAsJsonArray("attester");
3106      for (int i = 0; i < array.size(); i++) {
3107        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
3108      }
3109    };
3110    if (json.has("custodian"))
3111      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3112    if (json.has("event")) {
3113      JsonArray array = json.getAsJsonArray("event");
3114      for (int i = 0; i < array.size(); i++) {
3115        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
3116      }
3117    };
3118    if (json.has("encounter"))
3119      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3120    if (json.has("section")) {
3121      JsonArray array = json.getAsJsonArray("section");
3122      for (int i = 0; i < array.size(); i++) {
3123        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
3124      }
3125    };
3126    return res;
3127  }
3128
3129  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3130    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
3131    parseBackboneProperties(json, res);
3132    if (json.has("mode")) {
3133      JsonArray array = json.getAsJsonArray("mode");
3134      for (int i = 0; i < array.size(); i++) {
3135        res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
3136      }
3137    };
3138    if (json.has("_mode")) {
3139      JsonArray array = json.getAsJsonArray("_mode");
3140      for (int i = 0; i < array.size(); i++) {
3141        if (i == res.getMode().size())
3142          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
3143        if (array.get(i) instanceof JsonObject) 
3144          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
3145      }
3146    };
3147    if (json.has("time"))
3148      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
3149    if (json.has("_time"))
3150      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
3151    if (json.has("party"))
3152      res.setParty(parseReference(json.getAsJsonObject("party")));
3153    return res;
3154  }
3155
3156  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3157    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
3158    parseBackboneProperties(json, res);
3159    if (json.has("code")) {
3160      JsonArray array = json.getAsJsonArray("code");
3161      for (int i = 0; i < array.size(); i++) {
3162        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3163      }
3164    };
3165    if (json.has("period"))
3166      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3167    if (json.has("detail")) {
3168      JsonArray array = json.getAsJsonArray("detail");
3169      for (int i = 0; i < array.size(); i++) {
3170        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
3171      }
3172    };
3173    return res;
3174  }
3175
3176  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3177    Composition.SectionComponent res = new Composition.SectionComponent();
3178    parseBackboneProperties(json, res);
3179    if (json.has("title"))
3180      res.setTitleElement(parseString(json.get("title").getAsString()));
3181    if (json.has("_title"))
3182      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3183    if (json.has("code"))
3184      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3185    if (json.has("text"))
3186      res.setText(parseNarrative(json.getAsJsonObject("text")));
3187    if (json.has("mode"))
3188      res.setModeElement(parseCode(json.get("mode").getAsString()));
3189    if (json.has("_mode"))
3190      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3191    if (json.has("orderedBy"))
3192      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
3193    if (json.has("entry")) {
3194      JsonArray array = json.getAsJsonArray("entry");
3195      for (int i = 0; i < array.size(); i++) {
3196        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
3197      }
3198    };
3199    if (json.has("emptyReason"))
3200      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
3201    if (json.has("section")) {
3202      JsonArray array = json.getAsJsonArray("section");
3203      for (int i = 0; i < array.size(); i++) {
3204        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
3205      }
3206    };
3207    return res;
3208  }
3209
3210  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
3211    ConceptMap res = new ConceptMap();
3212    parseDomainResourceProperties(json, res);
3213    if (json.has("url"))
3214      res.setUrlElement(parseUri(json.get("url").getAsString()));
3215    if (json.has("_url"))
3216      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3217    if (json.has("identifier"))
3218      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3219    if (json.has("version"))
3220      res.setVersionElement(parseString(json.get("version").getAsString()));
3221    if (json.has("_version"))
3222      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3223    if (json.has("name"))
3224      res.setNameElement(parseString(json.get("name").getAsString()));
3225    if (json.has("_name"))
3226      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3227    if (json.has("status"))
3228      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3229    if (json.has("_status"))
3230      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3231    if (json.has("experimental"))
3232      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3233    if (json.has("_experimental"))
3234      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3235    if (json.has("publisher"))
3236      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3237    if (json.has("_publisher"))
3238      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3239    if (json.has("contact")) {
3240      JsonArray array = json.getAsJsonArray("contact");
3241      for (int i = 0; i < array.size(); i++) {
3242        res.getContact().add(parseConceptMapConceptMapContactComponent(array.get(i).getAsJsonObject(), res));
3243      }
3244    };
3245    if (json.has("date"))
3246      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3247    if (json.has("_date"))
3248      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3249    if (json.has("description"))
3250      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3251    if (json.has("_description"))
3252      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3253    if (json.has("useContext")) {
3254      JsonArray array = json.getAsJsonArray("useContext");
3255      for (int i = 0; i < array.size(); i++) {
3256        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3257      }
3258    };
3259    if (json.has("requirements"))
3260      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
3261    if (json.has("_requirements"))
3262      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
3263    if (json.has("copyright"))
3264      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
3265    if (json.has("_copyright"))
3266      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3267    Type source = parseType("source", json);
3268    if (source != null)
3269      res.setSource(source);
3270    Type target = parseType("target", json);
3271    if (target != null)
3272      res.setTarget(target);
3273    if (json.has("element")) {
3274      JsonArray array = json.getAsJsonArray("element");
3275      for (int i = 0; i < array.size(); i++) {
3276        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), res));
3277      }
3278    };
3279    return res;
3280  }
3281
3282  protected ConceptMap.ConceptMapContactComponent parseConceptMapConceptMapContactComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3283    ConceptMap.ConceptMapContactComponent res = new ConceptMap.ConceptMapContactComponent();
3284    parseBackboneProperties(json, res);
3285    if (json.has("name"))
3286      res.setNameElement(parseString(json.get("name").getAsString()));
3287    if (json.has("_name"))
3288      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3289    if (json.has("telecom")) {
3290      JsonArray array = json.getAsJsonArray("telecom");
3291      for (int i = 0; i < array.size(); i++) {
3292        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
3293      }
3294    };
3295    return res;
3296  }
3297
3298  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3299    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
3300    parseBackboneProperties(json, res);
3301    if (json.has("codeSystem"))
3302      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3303    if (json.has("_codeSystem"))
3304      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3305    if (json.has("code"))
3306      res.setCodeElement(parseCode(json.get("code").getAsString()));
3307    if (json.has("_code"))
3308      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3309    if (json.has("target")) {
3310      JsonArray array = json.getAsJsonArray("target");
3311      for (int i = 0; i < array.size(); i++) {
3312        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
3313      }
3314    };
3315    return res;
3316  }
3317
3318  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3319    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
3320    parseBackboneProperties(json, res);
3321    if (json.has("codeSystem"))
3322      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3323    if (json.has("_codeSystem"))
3324      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3325    if (json.has("code"))
3326      res.setCodeElement(parseCode(json.get("code").getAsString()));
3327    if (json.has("_code"))
3328      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3329    if (json.has("equivalence"))
3330      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
3331    if (json.has("_equivalence"))
3332      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
3333    if (json.has("comments"))
3334      res.setCommentsElement(parseString(json.get("comments").getAsString()));
3335    if (json.has("_comments"))
3336      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
3337    if (json.has("dependsOn")) {
3338      JsonArray array = json.getAsJsonArray("dependsOn");
3339      for (int i = 0; i < array.size(); i++) {
3340        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
3341      }
3342    };
3343    if (json.has("product")) {
3344      JsonArray array = json.getAsJsonArray("product");
3345      for (int i = 0; i < array.size(); i++) {
3346        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
3347      }
3348    };
3349    return res;
3350  }
3351
3352  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3353    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
3354    parseBackboneProperties(json, res);
3355    if (json.has("element"))
3356      res.setElementElement(parseUri(json.get("element").getAsString()));
3357    if (json.has("_element"))
3358      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
3359    if (json.has("codeSystem"))
3360      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3361    if (json.has("_codeSystem"))
3362      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3363    if (json.has("code"))
3364      res.setCodeElement(parseString(json.get("code").getAsString()));
3365    if (json.has("_code"))
3366      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3367    return res;
3368  }
3369
3370  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
3371    Condition res = new Condition();
3372    parseDomainResourceProperties(json, res);
3373    if (json.has("identifier")) {
3374      JsonArray array = json.getAsJsonArray("identifier");
3375      for (int i = 0; i < array.size(); i++) {
3376        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3377      }
3378    };
3379    if (json.has("patient"))
3380      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3381    if (json.has("encounter"))
3382      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3383    if (json.has("asserter"))
3384      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
3385    if (json.has("dateRecorded"))
3386      res.setDateRecordedElement(parseDate(json.get("dateRecorded").getAsString()));
3387    if (json.has("_dateRecorded"))
3388      parseElementProperties(json.getAsJsonObject("_dateRecorded"), res.getDateRecordedElement());
3389    if (json.has("code"))
3390      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3391    if (json.has("category"))
3392      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3393    if (json.has("clinicalStatus"))
3394      res.setClinicalStatusElement(parseCode(json.get("clinicalStatus").getAsString()));
3395    if (json.has("_clinicalStatus"))
3396      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
3397    if (json.has("verificationStatus"))
3398      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
3399    if (json.has("_verificationStatus"))
3400      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
3401    if (json.has("severity"))
3402      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
3403    Type onset = parseType("onset", json);
3404    if (onset != null)
3405      res.setOnset(onset);
3406    Type abatement = parseType("abatement", json);
3407    if (abatement != null)
3408      res.setAbatement(abatement);
3409    if (json.has("stage"))
3410      res.setStage(parseConditionConditionStageComponent(json.getAsJsonObject("stage"), res));
3411    if (json.has("evidence")) {
3412      JsonArray array = json.getAsJsonArray("evidence");
3413      for (int i = 0; i < array.size(); i++) {
3414        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
3415      }
3416    };
3417    if (json.has("bodySite")) {
3418      JsonArray array = json.getAsJsonArray("bodySite");
3419      for (int i = 0; i < array.size(); i++) {
3420        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3421      }
3422    };
3423    if (json.has("notes"))
3424      res.setNotesElement(parseString(json.get("notes").getAsString()));
3425    if (json.has("_notes"))
3426      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
3427    return res;
3428  }
3429
3430  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
3431    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
3432    parseBackboneProperties(json, res);
3433    if (json.has("summary"))
3434      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
3435    if (json.has("assessment")) {
3436      JsonArray array = json.getAsJsonArray("assessment");
3437      for (int i = 0; i < array.size(); i++) {
3438        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
3439      }
3440    };
3441    return res;
3442  }
3443
3444  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
3445    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
3446    parseBackboneProperties(json, res);
3447    if (json.has("code"))
3448      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3449    if (json.has("detail")) {
3450      JsonArray array = json.getAsJsonArray("detail");
3451      for (int i = 0; i < array.size(); i++) {
3452        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
3453      }
3454    };
3455    return res;
3456  }
3457
3458  protected Conformance parseConformance(JsonObject json) throws IOException, FHIRFormatError {
3459    Conformance res = new Conformance();
3460    parseDomainResourceProperties(json, res);
3461    if (json.has("url"))
3462      res.setUrlElement(parseUri(json.get("url").getAsString()));
3463    if (json.has("_url"))
3464      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3465    if (json.has("version"))
3466      res.setVersionElement(parseString(json.get("version").getAsString()));
3467    if (json.has("_version"))
3468      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3469    if (json.has("name"))
3470      res.setNameElement(parseString(json.get("name").getAsString()));
3471    if (json.has("_name"))
3472      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3473    if (json.has("status"))
3474      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3475    if (json.has("_status"))
3476      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3477    if (json.has("experimental"))
3478      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3479    if (json.has("_experimental"))
3480      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3481    if (json.has("publisher"))
3482      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3483    if (json.has("_publisher"))
3484      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3485    if (json.has("contact")) {
3486      JsonArray array = json.getAsJsonArray("contact");
3487      for (int i = 0; i < array.size(); i++) {
3488        res.getContact().add(parseConformanceConformanceContactComponent(array.get(i).getAsJsonObject(), res));
3489      }
3490    };
3491    if (json.has("date"))
3492      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3493    if (json.has("_date"))
3494      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3495    if (json.has("description"))
3496      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3497    if (json.has("_description"))
3498      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3499    if (json.has("requirements"))
3500      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
3501    if (json.has("_requirements"))
3502      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
3503    if (json.has("copyright"))
3504      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
3505    if (json.has("_copyright"))
3506      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3507    if (json.has("kind"))
3508      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Conformance.ConformanceStatementKind.NULL, new Conformance.ConformanceStatementKindEnumFactory()));
3509    if (json.has("_kind"))
3510      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3511    if (json.has("software"))
3512      res.setSoftware(parseConformanceConformanceSoftwareComponent(json.getAsJsonObject("software"), res));
3513    if (json.has("implementation"))
3514      res.setImplementation(parseConformanceConformanceImplementationComponent(json.getAsJsonObject("implementation"), res));
3515    if (json.has("fhirVersion"))
3516      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3517    if (json.has("_fhirVersion"))
3518      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3519    if (json.has("acceptUnknown"))
3520      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), Conformance.UnknownContentCode.NULL, new Conformance.UnknownContentCodeEnumFactory()));
3521    if (json.has("_acceptUnknown"))
3522      parseElementProperties(json.getAsJsonObject("_acceptUnknown"), res.getAcceptUnknownElement());
3523    if (json.has("format")) {
3524      JsonArray array = json.getAsJsonArray("format");
3525      for (int i = 0; i < array.size(); i++) {
3526        res.getFormat().add(parseCode(array.get(i).getAsString()));
3527      }
3528    };
3529    if (json.has("_format")) {
3530      JsonArray array = json.getAsJsonArray("_format");
3531      for (int i = 0; i < array.size(); i++) {
3532        if (i == res.getFormat().size())
3533          res.getFormat().add(parseCode(null));
3534        if (array.get(i) instanceof JsonObject) 
3535          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3536      }
3537    };
3538    if (json.has("profile")) {
3539      JsonArray array = json.getAsJsonArray("profile");
3540      for (int i = 0; i < array.size(); i++) {
3541        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
3542      }
3543    };
3544    if (json.has("rest")) {
3545      JsonArray array = json.getAsJsonArray("rest");
3546      for (int i = 0; i < array.size(); i++) {
3547        res.getRest().add(parseConformanceConformanceRestComponent(array.get(i).getAsJsonObject(), res));
3548      }
3549    };
3550    if (json.has("messaging")) {
3551      JsonArray array = json.getAsJsonArray("messaging");
3552      for (int i = 0; i < array.size(); i++) {
3553        res.getMessaging().add(parseConformanceConformanceMessagingComponent(array.get(i).getAsJsonObject(), res));
3554      }
3555    };
3556    if (json.has("document")) {
3557      JsonArray array = json.getAsJsonArray("document");
3558      for (int i = 0; i < array.size(); i++) {
3559        res.getDocument().add(parseConformanceConformanceDocumentComponent(array.get(i).getAsJsonObject(), res));
3560      }
3561    };
3562    return res;
3563  }
3564
3565  protected Conformance.ConformanceContactComponent parseConformanceConformanceContactComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3566    Conformance.ConformanceContactComponent res = new Conformance.ConformanceContactComponent();
3567    parseBackboneProperties(json, res);
3568    if (json.has("name"))
3569      res.setNameElement(parseString(json.get("name").getAsString()));
3570    if (json.has("_name"))
3571      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3572    if (json.has("telecom")) {
3573      JsonArray array = json.getAsJsonArray("telecom");
3574      for (int i = 0; i < array.size(); i++) {
3575        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
3576      }
3577    };
3578    return res;
3579  }
3580
3581  protected Conformance.ConformanceSoftwareComponent parseConformanceConformanceSoftwareComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3582    Conformance.ConformanceSoftwareComponent res = new Conformance.ConformanceSoftwareComponent();
3583    parseBackboneProperties(json, res);
3584    if (json.has("name"))
3585      res.setNameElement(parseString(json.get("name").getAsString()));
3586    if (json.has("_name"))
3587      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3588    if (json.has("version"))
3589      res.setVersionElement(parseString(json.get("version").getAsString()));
3590    if (json.has("_version"))
3591      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3592    if (json.has("releaseDate"))
3593      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3594    if (json.has("_releaseDate"))
3595      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3596    return res;
3597  }
3598
3599  protected Conformance.ConformanceImplementationComponent parseConformanceConformanceImplementationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3600    Conformance.ConformanceImplementationComponent res = new Conformance.ConformanceImplementationComponent();
3601    parseBackboneProperties(json, res);
3602    if (json.has("description"))
3603      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3604    if (json.has("_description"))
3605      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3606    if (json.has("url"))
3607      res.setUrlElement(parseUri(json.get("url").getAsString()));
3608    if (json.has("_url"))
3609      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3610    return res;
3611  }
3612
3613  protected Conformance.ConformanceRestComponent parseConformanceConformanceRestComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3614    Conformance.ConformanceRestComponent res = new Conformance.ConformanceRestComponent();
3615    parseBackboneProperties(json, res);
3616    if (json.has("mode"))
3617      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.RestfulConformanceMode.NULL, new Conformance.RestfulConformanceModeEnumFactory()));
3618    if (json.has("_mode"))
3619      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3620    if (json.has("documentation"))
3621      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3622    if (json.has("_documentation"))
3623      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3624    if (json.has("security"))
3625      res.setSecurity(parseConformanceConformanceRestSecurityComponent(json.getAsJsonObject("security"), owner));
3626    if (json.has("resource")) {
3627      JsonArray array = json.getAsJsonArray("resource");
3628      for (int i = 0; i < array.size(); i++) {
3629        res.getResource().add(parseConformanceConformanceRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3630      }
3631    };
3632    if (json.has("interaction")) {
3633      JsonArray array = json.getAsJsonArray("interaction");
3634      for (int i = 0; i < array.size(); i++) {
3635        res.getInteraction().add(parseConformanceSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3636      }
3637    };
3638    if (json.has("transactionMode"))
3639      res.setTransactionModeElement(parseEnumeration(json.get("transactionMode").getAsString(), Conformance.TransactionMode.NULL, new Conformance.TransactionModeEnumFactory()));
3640    if (json.has("_transactionMode"))
3641      parseElementProperties(json.getAsJsonObject("_transactionMode"), res.getTransactionModeElement());
3642    if (json.has("searchParam")) {
3643      JsonArray array = json.getAsJsonArray("searchParam");
3644      for (int i = 0; i < array.size(); i++) {
3645        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3646      }
3647    };
3648    if (json.has("operation")) {
3649      JsonArray array = json.getAsJsonArray("operation");
3650      for (int i = 0; i < array.size(); i++) {
3651        res.getOperation().add(parseConformanceConformanceRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3652      }
3653    };
3654    if (json.has("compartment")) {
3655      JsonArray array = json.getAsJsonArray("compartment");
3656      for (int i = 0; i < array.size(); i++) {
3657        res.getCompartment().add(parseUri(array.get(i).getAsString()));
3658      }
3659    };
3660    if (json.has("_compartment")) {
3661      JsonArray array = json.getAsJsonArray("_compartment");
3662      for (int i = 0; i < array.size(); i++) {
3663        if (i == res.getCompartment().size())
3664          res.getCompartment().add(parseUri(null));
3665        if (array.get(i) instanceof JsonObject) 
3666          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3667      }
3668    };
3669    return res;
3670  }
3671
3672  protected Conformance.ConformanceRestSecurityComponent parseConformanceConformanceRestSecurityComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3673    Conformance.ConformanceRestSecurityComponent res = new Conformance.ConformanceRestSecurityComponent();
3674    parseBackboneProperties(json, res);
3675    if (json.has("cors"))
3676      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3677    if (json.has("_cors"))
3678      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3679    if (json.has("service")) {
3680      JsonArray array = json.getAsJsonArray("service");
3681      for (int i = 0; i < array.size(); i++) {
3682        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3683      }
3684    };
3685    if (json.has("description"))
3686      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3687    if (json.has("_description"))
3688      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3689    if (json.has("certificate")) {
3690      JsonArray array = json.getAsJsonArray("certificate");
3691      for (int i = 0; i < array.size(); i++) {
3692        res.getCertificate().add(parseConformanceConformanceRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3693      }
3694    };
3695    return res;
3696  }
3697
3698  protected Conformance.ConformanceRestSecurityCertificateComponent parseConformanceConformanceRestSecurityCertificateComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3699    Conformance.ConformanceRestSecurityCertificateComponent res = new Conformance.ConformanceRestSecurityCertificateComponent();
3700    parseBackboneProperties(json, res);
3701    if (json.has("type"))
3702      res.setTypeElement(parseCode(json.get("type").getAsString()));
3703    if (json.has("_type"))
3704      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3705    if (json.has("blob"))
3706      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3707    if (json.has("_blob"))
3708      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
3709    return res;
3710  }
3711
3712  protected Conformance.ConformanceRestResourceComponent parseConformanceConformanceRestResourceComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3713    Conformance.ConformanceRestResourceComponent res = new Conformance.ConformanceRestResourceComponent();
3714    parseBackboneProperties(json, res);
3715    if (json.has("type"))
3716      res.setTypeElement(parseCode(json.get("type").getAsString()));
3717    if (json.has("_type"))
3718      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3719    if (json.has("profile"))
3720      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3721    if (json.has("interaction")) {
3722      JsonArray array = json.getAsJsonArray("interaction");
3723      for (int i = 0; i < array.size(); i++) {
3724        res.getInteraction().add(parseConformanceResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3725      }
3726    };
3727    if (json.has("versioning"))
3728      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), Conformance.ResourceVersionPolicy.NULL, new Conformance.ResourceVersionPolicyEnumFactory()));
3729    if (json.has("_versioning"))
3730      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3731    if (json.has("readHistory"))
3732      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3733    if (json.has("_readHistory"))
3734      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3735    if (json.has("updateCreate"))
3736      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3737    if (json.has("_updateCreate"))
3738      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3739    if (json.has("conditionalCreate"))
3740      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3741    if (json.has("_conditionalCreate"))
3742      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3743    if (json.has("conditionalUpdate"))
3744      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3745    if (json.has("_conditionalUpdate"))
3746      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3747    if (json.has("conditionalDelete"))
3748      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), Conformance.ConditionalDeleteStatus.NULL, new Conformance.ConditionalDeleteStatusEnumFactory()));
3749    if (json.has("_conditionalDelete"))
3750      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3751    if (json.has("searchInclude")) {
3752      JsonArray array = json.getAsJsonArray("searchInclude");
3753      for (int i = 0; i < array.size(); i++) {
3754        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3755      }
3756    };
3757    if (json.has("_searchInclude")) {
3758      JsonArray array = json.getAsJsonArray("_searchInclude");
3759      for (int i = 0; i < array.size(); i++) {
3760        if (i == res.getSearchInclude().size())
3761          res.getSearchInclude().add(parseString(null));
3762        if (array.get(i) instanceof JsonObject) 
3763          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3764      }
3765    };
3766    if (json.has("searchRevInclude")) {
3767      JsonArray array = json.getAsJsonArray("searchRevInclude");
3768      for (int i = 0; i < array.size(); i++) {
3769        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3770      }
3771    };
3772    if (json.has("_searchRevInclude")) {
3773      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3774      for (int i = 0; i < array.size(); i++) {
3775        if (i == res.getSearchRevInclude().size())
3776          res.getSearchRevInclude().add(parseString(null));
3777        if (array.get(i) instanceof JsonObject) 
3778          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3779      }
3780    };
3781    if (json.has("searchParam")) {
3782      JsonArray array = json.getAsJsonArray("searchParam");
3783      for (int i = 0; i < array.size(); i++) {
3784        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3785      }
3786    };
3787    return res;
3788  }
3789
3790  protected Conformance.ResourceInteractionComponent parseConformanceResourceInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3791    Conformance.ResourceInteractionComponent res = new Conformance.ResourceInteractionComponent();
3792    parseBackboneProperties(json, res);
3793    if (json.has("code"))
3794      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.TypeRestfulInteraction.NULL, new Conformance.TypeRestfulInteractionEnumFactory()));
3795    if (json.has("_code"))
3796      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3797    if (json.has("documentation"))
3798      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3799    if (json.has("_documentation"))
3800      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3801    return res;
3802  }
3803
3804  protected Conformance.ConformanceRestResourceSearchParamComponent parseConformanceConformanceRestResourceSearchParamComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3805    Conformance.ConformanceRestResourceSearchParamComponent res = new Conformance.ConformanceRestResourceSearchParamComponent();
3806    parseBackboneProperties(json, res);
3807    if (json.has("name"))
3808      res.setNameElement(parseString(json.get("name").getAsString()));
3809    if (json.has("_name"))
3810      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3811    if (json.has("definition"))
3812      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3813    if (json.has("_definition"))
3814      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3815    if (json.has("type"))
3816      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3817    if (json.has("_type"))
3818      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3819    if (json.has("documentation"))
3820      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3821    if (json.has("_documentation"))
3822      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3823    if (json.has("target")) {
3824      JsonArray array = json.getAsJsonArray("target");
3825      for (int i = 0; i < array.size(); i++) {
3826        res.getTarget().add(parseCode(array.get(i).getAsString()));
3827      }
3828    };
3829    if (json.has("_target")) {
3830      JsonArray array = json.getAsJsonArray("_target");
3831      for (int i = 0; i < array.size(); i++) {
3832        if (i == res.getTarget().size())
3833          res.getTarget().add(parseCode(null));
3834        if (array.get(i) instanceof JsonObject) 
3835          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
3836      }
3837    };
3838    if (json.has("modifier")) {
3839      JsonArray array = json.getAsJsonArray("modifier");
3840      for (int i = 0; i < array.size(); i++) {
3841        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
3842      }
3843    };
3844    if (json.has("_modifier")) {
3845      JsonArray array = json.getAsJsonArray("_modifier");
3846      for (int i = 0; i < array.size(); i++) {
3847        if (i == res.getModifier().size())
3848          res.getModifier().add(parseEnumeration(null, Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
3849        if (array.get(i) instanceof JsonObject) 
3850          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
3851      }
3852    };
3853    if (json.has("chain")) {
3854      JsonArray array = json.getAsJsonArray("chain");
3855      for (int i = 0; i < array.size(); i++) {
3856        res.getChain().add(parseString(array.get(i).getAsString()));
3857      }
3858    };
3859    if (json.has("_chain")) {
3860      JsonArray array = json.getAsJsonArray("_chain");
3861      for (int i = 0; i < array.size(); i++) {
3862        if (i == res.getChain().size())
3863          res.getChain().add(parseString(null));
3864        if (array.get(i) instanceof JsonObject) 
3865          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
3866      }
3867    };
3868    return res;
3869  }
3870
3871  protected Conformance.SystemInteractionComponent parseConformanceSystemInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3872    Conformance.SystemInteractionComponent res = new Conformance.SystemInteractionComponent();
3873    parseBackboneProperties(json, res);
3874    if (json.has("code"))
3875      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.SystemRestfulInteraction.NULL, new Conformance.SystemRestfulInteractionEnumFactory()));
3876    if (json.has("_code"))
3877      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3878    if (json.has("documentation"))
3879      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3880    if (json.has("_documentation"))
3881      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3882    return res;
3883  }
3884
3885  protected Conformance.ConformanceRestOperationComponent parseConformanceConformanceRestOperationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3886    Conformance.ConformanceRestOperationComponent res = new Conformance.ConformanceRestOperationComponent();
3887    parseBackboneProperties(json, res);
3888    if (json.has("name"))
3889      res.setNameElement(parseString(json.get("name").getAsString()));
3890    if (json.has("_name"))
3891      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3892    if (json.has("definition"))
3893      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3894    return res;
3895  }
3896
3897  protected Conformance.ConformanceMessagingComponent parseConformanceConformanceMessagingComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3898    Conformance.ConformanceMessagingComponent res = new Conformance.ConformanceMessagingComponent();
3899    parseBackboneProperties(json, res);
3900    if (json.has("endpoint")) {
3901      JsonArray array = json.getAsJsonArray("endpoint");
3902      for (int i = 0; i < array.size(); i++) {
3903        res.getEndpoint().add(parseConformanceConformanceMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3904      }
3905    };
3906    if (json.has("reliableCache"))
3907      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3908    if (json.has("_reliableCache"))
3909      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3910    if (json.has("documentation"))
3911      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3912    if (json.has("_documentation"))
3913      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3914    if (json.has("event")) {
3915      JsonArray array = json.getAsJsonArray("event");
3916      for (int i = 0; i < array.size(); i++) {
3917        res.getEvent().add(parseConformanceConformanceMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3918      }
3919    };
3920    return res;
3921  }
3922
3923  protected Conformance.ConformanceMessagingEndpointComponent parseConformanceConformanceMessagingEndpointComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3924    Conformance.ConformanceMessagingEndpointComponent res = new Conformance.ConformanceMessagingEndpointComponent();
3925    parseBackboneProperties(json, res);
3926    if (json.has("protocol"))
3927      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3928    if (json.has("address"))
3929      res.setAddressElement(parseUri(json.get("address").getAsString()));
3930    if (json.has("_address"))
3931      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3932    return res;
3933  }
3934
3935  protected Conformance.ConformanceMessagingEventComponent parseConformanceConformanceMessagingEventComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3936    Conformance.ConformanceMessagingEventComponent res = new Conformance.ConformanceMessagingEventComponent();
3937    parseBackboneProperties(json, res);
3938    if (json.has("code"))
3939      res.setCode(parseCoding(json.getAsJsonObject("code")));
3940    if (json.has("category"))
3941      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), Conformance.MessageSignificanceCategory.NULL, new Conformance.MessageSignificanceCategoryEnumFactory()));
3942    if (json.has("_category"))
3943      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
3944    if (json.has("mode"))
3945      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.ConformanceEventMode.NULL, new Conformance.ConformanceEventModeEnumFactory()));
3946    if (json.has("_mode"))
3947      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3948    if (json.has("focus"))
3949      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3950    if (json.has("_focus"))
3951      parseElementProperties(json.getAsJsonObject("_focus"), res.getFocusElement());
3952    if (json.has("request"))
3953      res.setRequest(parseReference(json.getAsJsonObject("request")));
3954    if (json.has("response"))
3955      res.setResponse(parseReference(json.getAsJsonObject("response")));
3956    if (json.has("documentation"))
3957      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3958    if (json.has("_documentation"))
3959      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3960    return res;
3961  }
3962
3963  protected Conformance.ConformanceDocumentComponent parseConformanceConformanceDocumentComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3964    Conformance.ConformanceDocumentComponent res = new Conformance.ConformanceDocumentComponent();
3965    parseBackboneProperties(json, res);
3966    if (json.has("mode"))
3967      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.DocumentMode.NULL, new Conformance.DocumentModeEnumFactory()));
3968    if (json.has("_mode"))
3969      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3970    if (json.has("documentation"))
3971      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3972    if (json.has("_documentation"))
3973      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3974    if (json.has("profile"))
3975      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3976    return res;
3977  }
3978
3979  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
3980    Contract res = new Contract();
3981    parseDomainResourceProperties(json, res);
3982    if (json.has("identifier"))
3983      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3984    if (json.has("issued"))
3985      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
3986    if (json.has("_issued"))
3987      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
3988    if (json.has("applies"))
3989      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
3990    if (json.has("subject")) {
3991      JsonArray array = json.getAsJsonArray("subject");
3992      for (int i = 0; i < array.size(); i++) {
3993        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
3994      }
3995    };
3996    if (json.has("authority")) {
3997      JsonArray array = json.getAsJsonArray("authority");
3998      for (int i = 0; i < array.size(); i++) {
3999        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
4000      }
4001    };
4002    if (json.has("domain")) {
4003      JsonArray array = json.getAsJsonArray("domain");
4004      for (int i = 0; i < array.size(); i++) {
4005        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
4006      }
4007    };
4008    if (json.has("type"))
4009      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4010    if (json.has("subType")) {
4011      JsonArray array = json.getAsJsonArray("subType");
4012      for (int i = 0; i < array.size(); i++) {
4013        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4014      }
4015    };
4016    if (json.has("action")) {
4017      JsonArray array = json.getAsJsonArray("action");
4018      for (int i = 0; i < array.size(); i++) {
4019        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4020      }
4021    };
4022    if (json.has("actionReason")) {
4023      JsonArray array = json.getAsJsonArray("actionReason");
4024      for (int i = 0; i < array.size(); i++) {
4025        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4026      }
4027    };
4028    if (json.has("actor")) {
4029      JsonArray array = json.getAsJsonArray("actor");
4030      for (int i = 0; i < array.size(); i++) {
4031        res.getActor().add(parseContractActorComponent(array.get(i).getAsJsonObject(), res));
4032      }
4033    };
4034    if (json.has("valuedItem")) {
4035      JsonArray array = json.getAsJsonArray("valuedItem");
4036      for (int i = 0; i < array.size(); i++) {
4037        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
4038      }
4039    };
4040    if (json.has("signer")) {
4041      JsonArray array = json.getAsJsonArray("signer");
4042      for (int i = 0; i < array.size(); i++) {
4043        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
4044      }
4045    };
4046    if (json.has("term")) {
4047      JsonArray array = json.getAsJsonArray("term");
4048      for (int i = 0; i < array.size(); i++) {
4049        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
4050      }
4051    };
4052    Type binding = parseType("binding", json);
4053    if (binding != null)
4054      res.setBinding(binding);
4055    if (json.has("friendly")) {
4056      JsonArray array = json.getAsJsonArray("friendly");
4057      for (int i = 0; i < array.size(); i++) {
4058        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
4059      }
4060    };
4061    if (json.has("legal")) {
4062      JsonArray array = json.getAsJsonArray("legal");
4063      for (int i = 0; i < array.size(); i++) {
4064        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
4065      }
4066    };
4067    if (json.has("rule")) {
4068      JsonArray array = json.getAsJsonArray("rule");
4069      for (int i = 0; i < array.size(); i++) {
4070        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
4071      }
4072    };
4073    return res;
4074  }
4075
4076  protected Contract.ActorComponent parseContractActorComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4077    Contract.ActorComponent res = new Contract.ActorComponent();
4078    parseBackboneProperties(json, res);
4079    if (json.has("entity"))
4080      res.setEntity(parseReference(json.getAsJsonObject("entity")));
4081    if (json.has("role")) {
4082      JsonArray array = json.getAsJsonArray("role");
4083      for (int i = 0; i < array.size(); i++) {
4084        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4085      }
4086    };
4087    return res;
4088  }
4089
4090  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4091    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
4092    parseBackboneProperties(json, res);
4093    Type entity = parseType("entity", json);
4094    if (entity != null)
4095      res.setEntity(entity);
4096    if (json.has("identifier"))
4097      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4098    if (json.has("effectiveTime"))
4099      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
4100    if (json.has("_effectiveTime"))
4101      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
4102    if (json.has("quantity"))
4103      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4104    if (json.has("unitPrice"))
4105      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4106    if (json.has("factor"))
4107      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4108    if (json.has("_factor"))
4109      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4110    if (json.has("points"))
4111      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
4112    if (json.has("_points"))
4113      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
4114    if (json.has("net"))
4115      res.setNet(parseMoney(json.getAsJsonObject("net")));
4116    return res;
4117  }
4118
4119  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4120    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
4121    parseBackboneProperties(json, res);
4122    if (json.has("type"))
4123      res.setType(parseCoding(json.getAsJsonObject("type")));
4124    if (json.has("party"))
4125      res.setParty(parseReference(json.getAsJsonObject("party")));
4126    if (json.has("signature"))
4127      res.setSignatureElement(parseString(json.get("signature").getAsString()));
4128    if (json.has("_signature"))
4129      parseElementProperties(json.getAsJsonObject("_signature"), res.getSignatureElement());
4130    return res;
4131  }
4132
4133  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4134    Contract.TermComponent res = new Contract.TermComponent();
4135    parseBackboneProperties(json, res);
4136    if (json.has("identifier"))
4137      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4138    if (json.has("issued"))
4139      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
4140    if (json.has("_issued"))
4141      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
4142    if (json.has("applies"))
4143      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
4144    if (json.has("type"))
4145      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4146    if (json.has("subType"))
4147      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
4148    if (json.has("subject"))
4149      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4150    if (json.has("action")) {
4151      JsonArray array = json.getAsJsonArray("action");
4152      for (int i = 0; i < array.size(); i++) {
4153        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4154      }
4155    };
4156    if (json.has("actionReason")) {
4157      JsonArray array = json.getAsJsonArray("actionReason");
4158      for (int i = 0; i < array.size(); i++) {
4159        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4160      }
4161    };
4162    if (json.has("actor")) {
4163      JsonArray array = json.getAsJsonArray("actor");
4164      for (int i = 0; i < array.size(); i++) {
4165        res.getActor().add(parseContractTermActorComponent(array.get(i).getAsJsonObject(), owner));
4166      }
4167    };
4168    if (json.has("text"))
4169      res.setTextElement(parseString(json.get("text").getAsString()));
4170    if (json.has("_text"))
4171      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
4172    if (json.has("valuedItem")) {
4173      JsonArray array = json.getAsJsonArray("valuedItem");
4174      for (int i = 0; i < array.size(); i++) {
4175        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
4176      }
4177    };
4178    if (json.has("group")) {
4179      JsonArray array = json.getAsJsonArray("group");
4180      for (int i = 0; i < array.size(); i++) {
4181        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
4182      }
4183    };
4184    return res;
4185  }
4186
4187  protected Contract.TermActorComponent parseContractTermActorComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4188    Contract.TermActorComponent res = new Contract.TermActorComponent();
4189    parseBackboneProperties(json, res);
4190    if (json.has("entity"))
4191      res.setEntity(parseReference(json.getAsJsonObject("entity")));
4192    if (json.has("role")) {
4193      JsonArray array = json.getAsJsonArray("role");
4194      for (int i = 0; i < array.size(); i++) {
4195        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4196      }
4197    };
4198    return res;
4199  }
4200
4201  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4202    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
4203    parseBackboneProperties(json, res);
4204    Type entity = parseType("entity", json);
4205    if (entity != null)
4206      res.setEntity(entity);
4207    if (json.has("identifier"))
4208      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4209    if (json.has("effectiveTime"))
4210      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
4211    if (json.has("_effectiveTime"))
4212      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
4213    if (json.has("quantity"))
4214      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4215    if (json.has("unitPrice"))
4216      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4217    if (json.has("factor"))
4218      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4219    if (json.has("_factor"))
4220      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4221    if (json.has("points"))
4222      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
4223    if (json.has("_points"))
4224      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
4225    if (json.has("net"))
4226      res.setNet(parseMoney(json.getAsJsonObject("net")));
4227    return res;
4228  }
4229
4230  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4231    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
4232    parseBackboneProperties(json, res);
4233    Type content = parseType("content", json);
4234    if (content != null)
4235      res.setContent(content);
4236    return res;
4237  }
4238
4239  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4240    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
4241    parseBackboneProperties(json, res);
4242    Type content = parseType("content", json);
4243    if (content != null)
4244      res.setContent(content);
4245    return res;
4246  }
4247
4248  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4249    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
4250    parseBackboneProperties(json, res);
4251    Type content = parseType("content", json);
4252    if (content != null)
4253      res.setContent(content);
4254    return res;
4255  }
4256
4257  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
4258    Coverage res = new Coverage();
4259    parseDomainResourceProperties(json, res);
4260    if (json.has("issuer"))
4261      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
4262    if (json.has("bin"))
4263      res.setBin(parseIdentifier(json.getAsJsonObject("bin")));
4264    if (json.has("period"))
4265      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4266    if (json.has("type"))
4267      res.setType(parseCoding(json.getAsJsonObject("type")));
4268    if (json.has("subscriberId"))
4269      res.setSubscriberId(parseIdentifier(json.getAsJsonObject("subscriberId")));
4270    if (json.has("identifier")) {
4271      JsonArray array = json.getAsJsonArray("identifier");
4272      for (int i = 0; i < array.size(); i++) {
4273        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4274      }
4275    };
4276    if (json.has("group"))
4277      res.setGroupElement(parseString(json.get("group").getAsString()));
4278    if (json.has("_group"))
4279      parseElementProperties(json.getAsJsonObject("_group"), res.getGroupElement());
4280    if (json.has("plan"))
4281      res.setPlanElement(parseString(json.get("plan").getAsString()));
4282    if (json.has("_plan"))
4283      parseElementProperties(json.getAsJsonObject("_plan"), res.getPlanElement());
4284    if (json.has("subPlan"))
4285      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
4286    if (json.has("_subPlan"))
4287      parseElementProperties(json.getAsJsonObject("_subPlan"), res.getSubPlanElement());
4288    if (json.has("dependent"))
4289      res.setDependentElement(parsePositiveInt(json.get("dependent").getAsString()));
4290    if (json.has("_dependent"))
4291      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
4292    if (json.has("sequence"))
4293      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4294    if (json.has("_sequence"))
4295      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4296    if (json.has("subscriber"))
4297      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
4298    if (json.has("network"))
4299      res.setNetwork(parseIdentifier(json.getAsJsonObject("network")));
4300    if (json.has("contract")) {
4301      JsonArray array = json.getAsJsonArray("contract");
4302      for (int i = 0; i < array.size(); i++) {
4303        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
4304      }
4305    };
4306    return res;
4307  }
4308
4309  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
4310    DataElement res = new DataElement();
4311    parseDomainResourceProperties(json, res);
4312    if (json.has("url"))
4313      res.setUrlElement(parseUri(json.get("url").getAsString()));
4314    if (json.has("_url"))
4315      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4316    if (json.has("identifier")) {
4317      JsonArray array = json.getAsJsonArray("identifier");
4318      for (int i = 0; i < array.size(); i++) {
4319        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4320      }
4321    };
4322    if (json.has("version"))
4323      res.setVersionElement(parseString(json.get("version").getAsString()));
4324    if (json.has("_version"))
4325      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4326    if (json.has("name"))
4327      res.setNameElement(parseString(json.get("name").getAsString()));
4328    if (json.has("_name"))
4329      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4330    if (json.has("status"))
4331      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
4332    if (json.has("_status"))
4333      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4334    if (json.has("experimental"))
4335      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4336    if (json.has("_experimental"))
4337      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4338    if (json.has("publisher"))
4339      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4340    if (json.has("_publisher"))
4341      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4342    if (json.has("contact")) {
4343      JsonArray array = json.getAsJsonArray("contact");
4344      for (int i = 0; i < array.size(); i++) {
4345        res.getContact().add(parseDataElementDataElementContactComponent(array.get(i).getAsJsonObject(), res));
4346      }
4347    };
4348    if (json.has("date"))
4349      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4350    if (json.has("_date"))
4351      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4352    if (json.has("useContext")) {
4353      JsonArray array = json.getAsJsonArray("useContext");
4354      for (int i = 0; i < array.size(); i++) {
4355        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4356      }
4357    };
4358    if (json.has("copyright"))
4359      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
4360    if (json.has("_copyright"))
4361      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4362    if (json.has("stringency"))
4363      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
4364    if (json.has("_stringency"))
4365      parseElementProperties(json.getAsJsonObject("_stringency"), res.getStringencyElement());
4366    if (json.has("mapping")) {
4367      JsonArray array = json.getAsJsonArray("mapping");
4368      for (int i = 0; i < array.size(); i++) {
4369        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
4370      }
4371    };
4372    if (json.has("element")) {
4373      JsonArray array = json.getAsJsonArray("element");
4374      for (int i = 0; i < array.size(); i++) {
4375        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
4376      }
4377    };
4378    return res;
4379  }
4380
4381  protected DataElement.DataElementContactComponent parseDataElementDataElementContactComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
4382    DataElement.DataElementContactComponent res = new DataElement.DataElementContactComponent();
4383    parseBackboneProperties(json, res);
4384    if (json.has("name"))
4385      res.setNameElement(parseString(json.get("name").getAsString()));
4386    if (json.has("_name"))
4387      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4388    if (json.has("telecom")) {
4389      JsonArray array = json.getAsJsonArray("telecom");
4390      for (int i = 0; i < array.size(); i++) {
4391        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4392      }
4393    };
4394    return res;
4395  }
4396
4397  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
4398    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
4399    parseBackboneProperties(json, res);
4400    if (json.has("identity"))
4401      res.setIdentityElement(parseId(json.get("identity").getAsString()));
4402    if (json.has("_identity"))
4403      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
4404    if (json.has("uri"))
4405      res.setUriElement(parseUri(json.get("uri").getAsString()));
4406    if (json.has("_uri"))
4407      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
4408    if (json.has("name"))
4409      res.setNameElement(parseString(json.get("name").getAsString()));
4410    if (json.has("_name"))
4411      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4412    if (json.has("comments"))
4413      res.setCommentsElement(parseString(json.get("comments").getAsString()));
4414    if (json.has("_comments"))
4415      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
4416    return res;
4417  }
4418
4419  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
4420    DetectedIssue res = new DetectedIssue();
4421    parseDomainResourceProperties(json, res);
4422    if (json.has("patient"))
4423      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4424    if (json.has("category"))
4425      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4426    if (json.has("severity"))
4427      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
4428    if (json.has("_severity"))
4429      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
4430    if (json.has("implicated")) {
4431      JsonArray array = json.getAsJsonArray("implicated");
4432      for (int i = 0; i < array.size(); i++) {
4433        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
4434      }
4435    };
4436    if (json.has("detail"))
4437      res.setDetailElement(parseString(json.get("detail").getAsString()));
4438    if (json.has("_detail"))
4439      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
4440    if (json.has("date"))
4441      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4442    if (json.has("_date"))
4443      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4444    if (json.has("author"))
4445      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4446    if (json.has("identifier"))
4447      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4448    if (json.has("reference"))
4449      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
4450    if (json.has("_reference"))
4451      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
4452    if (json.has("mitigation")) {
4453      JsonArray array = json.getAsJsonArray("mitigation");
4454      for (int i = 0; i < array.size(); i++) {
4455        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
4456      }
4457    };
4458    return res;
4459  }
4460
4461  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
4462    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
4463    parseBackboneProperties(json, res);
4464    if (json.has("action"))
4465      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
4466    if (json.has("date"))
4467      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4468    if (json.has("_date"))
4469      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4470    if (json.has("author"))
4471      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4472    return res;
4473  }
4474
4475  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
4476    Device res = new Device();
4477    parseDomainResourceProperties(json, res);
4478    if (json.has("identifier")) {
4479      JsonArray array = json.getAsJsonArray("identifier");
4480      for (int i = 0; i < array.size(); i++) {
4481        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4482      }
4483    };
4484    if (json.has("type"))
4485      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4486    if (json.has("note")) {
4487      JsonArray array = json.getAsJsonArray("note");
4488      for (int i = 0; i < array.size(); i++) {
4489        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4490      }
4491    };
4492    if (json.has("status"))
4493      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.DeviceStatus.NULL, new Device.DeviceStatusEnumFactory()));
4494    if (json.has("_status"))
4495      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4496    if (json.has("manufacturer"))
4497      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
4498    if (json.has("_manufacturer"))
4499      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
4500    if (json.has("model"))
4501      res.setModelElement(parseString(json.get("model").getAsString()));
4502    if (json.has("_model"))
4503      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
4504    if (json.has("version"))
4505      res.setVersionElement(parseString(json.get("version").getAsString()));
4506    if (json.has("_version"))
4507      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4508    if (json.has("manufactureDate"))
4509      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
4510    if (json.has("_manufactureDate"))
4511      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
4512    if (json.has("expiry"))
4513      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
4514    if (json.has("_expiry"))
4515      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
4516    if (json.has("udi"))
4517      res.setUdiElement(parseString(json.get("udi").getAsString()));
4518    if (json.has("_udi"))
4519      parseElementProperties(json.getAsJsonObject("_udi"), res.getUdiElement());
4520    if (json.has("lotNumber"))
4521      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
4522    if (json.has("_lotNumber"))
4523      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
4524    if (json.has("owner"))
4525      res.setOwner(parseReference(json.getAsJsonObject("owner")));
4526    if (json.has("location"))
4527      res.setLocation(parseReference(json.getAsJsonObject("location")));
4528    if (json.has("patient"))
4529      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4530    if (json.has("contact")) {
4531      JsonArray array = json.getAsJsonArray("contact");
4532      for (int i = 0; i < array.size(); i++) {
4533        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
4534      }
4535    };
4536    if (json.has("url"))
4537      res.setUrlElement(parseUri(json.get("url").getAsString()));
4538    if (json.has("_url"))
4539      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4540    return res;
4541  }
4542
4543  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
4544    DeviceComponent res = new DeviceComponent();
4545    parseDomainResourceProperties(json, res);
4546    if (json.has("type"))
4547      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4548    if (json.has("identifier"))
4549      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4550    if (json.has("lastSystemChange"))
4551      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
4552    if (json.has("_lastSystemChange"))
4553      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
4554    if (json.has("source"))
4555      res.setSource(parseReference(json.getAsJsonObject("source")));
4556    if (json.has("parent"))
4557      res.setParent(parseReference(json.getAsJsonObject("parent")));
4558    if (json.has("operationalStatus")) {
4559      JsonArray array = json.getAsJsonArray("operationalStatus");
4560      for (int i = 0; i < array.size(); i++) {
4561        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4562      }
4563    };
4564    if (json.has("parameterGroup"))
4565      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
4566    if (json.has("measurementPrinciple"))
4567      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
4568    if (json.has("_measurementPrinciple"))
4569      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
4570    if (json.has("productionSpecification")) {
4571      JsonArray array = json.getAsJsonArray("productionSpecification");
4572      for (int i = 0; i < array.size(); i++) {
4573        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
4574      }
4575    };
4576    if (json.has("languageCode"))
4577      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
4578    return res;
4579  }
4580
4581  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
4582    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
4583    parseBackboneProperties(json, res);
4584    if (json.has("specType"))
4585      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
4586    if (json.has("componentId"))
4587      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
4588    if (json.has("productionSpec"))
4589      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
4590    if (json.has("_productionSpec"))
4591      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
4592    return res;
4593  }
4594
4595  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
4596    DeviceMetric res = new DeviceMetric();
4597    parseDomainResourceProperties(json, res);
4598    if (json.has("type"))
4599      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4600    if (json.has("identifier"))
4601      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4602    if (json.has("unit"))
4603      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
4604    if (json.has("source"))
4605      res.setSource(parseReference(json.getAsJsonObject("source")));
4606    if (json.has("parent"))
4607      res.setParent(parseReference(json.getAsJsonObject("parent")));
4608    if (json.has("operationalStatus"))
4609      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
4610    if (json.has("_operationalStatus"))
4611      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
4612    if (json.has("color"))
4613      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
4614    if (json.has("_color"))
4615      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
4616    if (json.has("category"))
4617      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
4618    if (json.has("_category"))
4619      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
4620    if (json.has("measurementPeriod"))
4621      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
4622    if (json.has("calibration")) {
4623      JsonArray array = json.getAsJsonArray("calibration");
4624      for (int i = 0; i < array.size(); i++) {
4625        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
4626      }
4627    };
4628    return res;
4629  }
4630
4631  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
4632    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
4633    parseBackboneProperties(json, res);
4634    if (json.has("type"))
4635      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
4636    if (json.has("_type"))
4637      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4638    if (json.has("state"))
4639      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
4640    if (json.has("_state"))
4641      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
4642    if (json.has("time"))
4643      res.setTimeElement(parseInstant(json.get("time").getAsString()));
4644    if (json.has("_time"))
4645      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
4646    return res;
4647  }
4648
4649  protected DeviceUseRequest parseDeviceUseRequest(JsonObject json) throws IOException, FHIRFormatError {
4650    DeviceUseRequest res = new DeviceUseRequest();
4651    parseDomainResourceProperties(json, res);
4652    Type bodySite = parseType("bodySite", json);
4653    if (bodySite != null)
4654      res.setBodySite(bodySite);
4655    if (json.has("status"))
4656      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseRequest.DeviceUseRequestStatus.NULL, new DeviceUseRequest.DeviceUseRequestStatusEnumFactory()));
4657    if (json.has("_status"))
4658      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4659    if (json.has("device"))
4660      res.setDevice(parseReference(json.getAsJsonObject("device")));
4661    if (json.has("encounter"))
4662      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4663    if (json.has("identifier")) {
4664      JsonArray array = json.getAsJsonArray("identifier");
4665      for (int i = 0; i < array.size(); i++) {
4666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4667      }
4668    };
4669    if (json.has("indication")) {
4670      JsonArray array = json.getAsJsonArray("indication");
4671      for (int i = 0; i < array.size(); i++) {
4672        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4673      }
4674    };
4675    if (json.has("notes")) {
4676      JsonArray array = json.getAsJsonArray("notes");
4677      for (int i = 0; i < array.size(); i++) {
4678        res.getNotes().add(parseString(array.get(i).getAsString()));
4679      }
4680    };
4681    if (json.has("_notes")) {
4682      JsonArray array = json.getAsJsonArray("_notes");
4683      for (int i = 0; i < array.size(); i++) {
4684        if (i == res.getNotes().size())
4685          res.getNotes().add(parseString(null));
4686        if (array.get(i) instanceof JsonObject) 
4687          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
4688      }
4689    };
4690    if (json.has("prnReason")) {
4691      JsonArray array = json.getAsJsonArray("prnReason");
4692      for (int i = 0; i < array.size(); i++) {
4693        res.getPrnReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4694      }
4695    };
4696    if (json.has("orderedOn"))
4697      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
4698    if (json.has("_orderedOn"))
4699      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
4700    if (json.has("recordedOn"))
4701      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
4702    if (json.has("_recordedOn"))
4703      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
4704    if (json.has("subject"))
4705      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4706    Type timing = parseType("timing", json);
4707    if (timing != null)
4708      res.setTiming(timing);
4709    if (json.has("priority"))
4710      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceUseRequest.DeviceUseRequestPriority.NULL, new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory()));
4711    if (json.has("_priority"))
4712      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
4713    return res;
4714  }
4715
4716  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
4717    DeviceUseStatement res = new DeviceUseStatement();
4718    parseDomainResourceProperties(json, res);
4719    Type bodySite = parseType("bodySite", json);
4720    if (bodySite != null)
4721      res.setBodySite(bodySite);
4722    if (json.has("whenUsed"))
4723      res.setWhenUsed(parsePeriod(json.getAsJsonObject("whenUsed")));
4724    if (json.has("device"))
4725      res.setDevice(parseReference(json.getAsJsonObject("device")));
4726    if (json.has("identifier")) {
4727      JsonArray array = json.getAsJsonArray("identifier");
4728      for (int i = 0; i < array.size(); i++) {
4729        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4730      }
4731    };
4732    if (json.has("indication")) {
4733      JsonArray array = json.getAsJsonArray("indication");
4734      for (int i = 0; i < array.size(); i++) {
4735        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4736      }
4737    };
4738    if (json.has("notes")) {
4739      JsonArray array = json.getAsJsonArray("notes");
4740      for (int i = 0; i < array.size(); i++) {
4741        res.getNotes().add(parseString(array.get(i).getAsString()));
4742      }
4743    };
4744    if (json.has("_notes")) {
4745      JsonArray array = json.getAsJsonArray("_notes");
4746      for (int i = 0; i < array.size(); i++) {
4747        if (i == res.getNotes().size())
4748          res.getNotes().add(parseString(null));
4749        if (array.get(i) instanceof JsonObject) 
4750          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
4751      }
4752    };
4753    if (json.has("recordedOn"))
4754      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
4755    if (json.has("_recordedOn"))
4756      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
4757    if (json.has("subject"))
4758      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4759    Type timing = parseType("timing", json);
4760    if (timing != null)
4761      res.setTiming(timing);
4762    return res;
4763  }
4764
4765  protected DiagnosticOrder parseDiagnosticOrder(JsonObject json) throws IOException, FHIRFormatError {
4766    DiagnosticOrder res = new DiagnosticOrder();
4767    parseDomainResourceProperties(json, res);
4768    if (json.has("subject"))
4769      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4770    if (json.has("orderer"))
4771      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
4772    if (json.has("identifier")) {
4773      JsonArray array = json.getAsJsonArray("identifier");
4774      for (int i = 0; i < array.size(); i++) {
4775        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4776      }
4777    };
4778    if (json.has("encounter"))
4779      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4780    if (json.has("reason")) {
4781      JsonArray array = json.getAsJsonArray("reason");
4782      for (int i = 0; i < array.size(); i++) {
4783        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4784      }
4785    };
4786    if (json.has("supportingInformation")) {
4787      JsonArray array = json.getAsJsonArray("supportingInformation");
4788      for (int i = 0; i < array.size(); i++) {
4789        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4790      }
4791    };
4792    if (json.has("specimen")) {
4793      JsonArray array = json.getAsJsonArray("specimen");
4794      for (int i = 0; i < array.size(); i++) {
4795        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4796      }
4797    };
4798    if (json.has("status"))
4799      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4800    if (json.has("_status"))
4801      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4802    if (json.has("priority"))
4803      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DiagnosticOrder.DiagnosticOrderPriority.NULL, new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory()));
4804    if (json.has("_priority"))
4805      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
4806    if (json.has("event")) {
4807      JsonArray array = json.getAsJsonArray("event");
4808      for (int i = 0; i < array.size(); i++) {
4809        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), res));
4810      }
4811    };
4812    if (json.has("item")) {
4813      JsonArray array = json.getAsJsonArray("item");
4814      for (int i = 0; i < array.size(); i++) {
4815        res.getItem().add(parseDiagnosticOrderDiagnosticOrderItemComponent(array.get(i).getAsJsonObject(), res));
4816      }
4817    };
4818    if (json.has("note")) {
4819      JsonArray array = json.getAsJsonArray("note");
4820      for (int i = 0; i < array.size(); i++) {
4821        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4822      }
4823    };
4824    return res;
4825  }
4826
4827  protected DiagnosticOrder.DiagnosticOrderEventComponent parseDiagnosticOrderDiagnosticOrderEventComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
4828    DiagnosticOrder.DiagnosticOrderEventComponent res = new DiagnosticOrder.DiagnosticOrderEventComponent();
4829    parseBackboneProperties(json, res);
4830    if (json.has("status"))
4831      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4832    if (json.has("_status"))
4833      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4834    if (json.has("description"))
4835      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
4836    if (json.has("dateTime"))
4837      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
4838    if (json.has("_dateTime"))
4839      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
4840    if (json.has("actor"))
4841      res.setActor(parseReference(json.getAsJsonObject("actor")));
4842    return res;
4843  }
4844
4845  protected DiagnosticOrder.DiagnosticOrderItemComponent parseDiagnosticOrderDiagnosticOrderItemComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
4846    DiagnosticOrder.DiagnosticOrderItemComponent res = new DiagnosticOrder.DiagnosticOrderItemComponent();
4847    parseBackboneProperties(json, res);
4848    if (json.has("code"))
4849      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4850    if (json.has("specimen")) {
4851      JsonArray array = json.getAsJsonArray("specimen");
4852      for (int i = 0; i < array.size(); i++) {
4853        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4854      }
4855    };
4856    if (json.has("bodySite"))
4857      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
4858    if (json.has("status"))
4859      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4860    if (json.has("_status"))
4861      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4862    if (json.has("event")) {
4863      JsonArray array = json.getAsJsonArray("event");
4864      for (int i = 0; i < array.size(); i++) {
4865        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), owner));
4866      }
4867    };
4868    return res;
4869  }
4870
4871  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
4872    DiagnosticReport res = new DiagnosticReport();
4873    parseDomainResourceProperties(json, res);
4874    if (json.has("identifier")) {
4875      JsonArray array = json.getAsJsonArray("identifier");
4876      for (int i = 0; i < array.size(); i++) {
4877        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4878      }
4879    };
4880    if (json.has("status"))
4881      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
4882    if (json.has("_status"))
4883      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4884    if (json.has("category"))
4885      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4886    if (json.has("code"))
4887      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4888    if (json.has("subject"))
4889      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4890    if (json.has("encounter"))
4891      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4892    Type effective = parseType("effective", json);
4893    if (effective != null)
4894      res.setEffective(effective);
4895    if (json.has("issued"))
4896      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
4897    if (json.has("_issued"))
4898      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
4899    if (json.has("performer"))
4900      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
4901    if (json.has("request")) {
4902      JsonArray array = json.getAsJsonArray("request");
4903      for (int i = 0; i < array.size(); i++) {
4904        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
4905      }
4906    };
4907    if (json.has("specimen")) {
4908      JsonArray array = json.getAsJsonArray("specimen");
4909      for (int i = 0; i < array.size(); i++) {
4910        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4911      }
4912    };
4913    if (json.has("result")) {
4914      JsonArray array = json.getAsJsonArray("result");
4915      for (int i = 0; i < array.size(); i++) {
4916        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
4917      }
4918    };
4919    if (json.has("imagingStudy")) {
4920      JsonArray array = json.getAsJsonArray("imagingStudy");
4921      for (int i = 0; i < array.size(); i++) {
4922        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
4923      }
4924    };
4925    if (json.has("image")) {
4926      JsonArray array = json.getAsJsonArray("image");
4927      for (int i = 0; i < array.size(); i++) {
4928        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
4929      }
4930    };
4931    if (json.has("conclusion"))
4932      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
4933    if (json.has("_conclusion"))
4934      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
4935    if (json.has("codedDiagnosis")) {
4936      JsonArray array = json.getAsJsonArray("codedDiagnosis");
4937      for (int i = 0; i < array.size(); i++) {
4938        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4939      }
4940    };
4941    if (json.has("presentedForm")) {
4942      JsonArray array = json.getAsJsonArray("presentedForm");
4943      for (int i = 0; i < array.size(); i++) {
4944        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
4945      }
4946    };
4947    return res;
4948  }
4949
4950  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
4951    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
4952    parseBackboneProperties(json, res);
4953    if (json.has("comment"))
4954      res.setCommentElement(parseString(json.get("comment").getAsString()));
4955    if (json.has("_comment"))
4956      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
4957    if (json.has("link"))
4958      res.setLink(parseReference(json.getAsJsonObject("link")));
4959    return res;
4960  }
4961
4962  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
4963    DocumentManifest res = new DocumentManifest();
4964    parseDomainResourceProperties(json, res);
4965    if (json.has("masterIdentifier"))
4966      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
4967    if (json.has("identifier")) {
4968      JsonArray array = json.getAsJsonArray("identifier");
4969      for (int i = 0; i < array.size(); i++) {
4970        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4971      }
4972    };
4973    if (json.has("subject"))
4974      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4975    if (json.has("recipient")) {
4976      JsonArray array = json.getAsJsonArray("recipient");
4977      for (int i = 0; i < array.size(); i++) {
4978        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
4979      }
4980    };
4981    if (json.has("type"))
4982      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4983    if (json.has("author")) {
4984      JsonArray array = json.getAsJsonArray("author");
4985      for (int i = 0; i < array.size(); i++) {
4986        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
4987      }
4988    };
4989    if (json.has("created"))
4990      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4991    if (json.has("_created"))
4992      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4993    if (json.has("source"))
4994      res.setSourceElement(parseUri(json.get("source").getAsString()));
4995    if (json.has("_source"))
4996      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
4997    if (json.has("status"))
4998      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
4999    if (json.has("_status"))
5000      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5001    if (json.has("description"))
5002      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5003    if (json.has("_description"))
5004      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5005    if (json.has("content")) {
5006      JsonArray array = json.getAsJsonArray("content");
5007      for (int i = 0; i < array.size(); i++) {
5008        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
5009      }
5010    };
5011    if (json.has("related")) {
5012      JsonArray array = json.getAsJsonArray("related");
5013      for (int i = 0; i < array.size(); i++) {
5014        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
5015      }
5016    };
5017    return res;
5018  }
5019
5020  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
5021    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
5022    parseBackboneProperties(json, res);
5023    Type p = parseType("p", json);
5024    if (p != null)
5025      res.setP(p);
5026    return res;
5027  }
5028
5029  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
5030    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
5031    parseBackboneProperties(json, res);
5032    if (json.has("identifier"))
5033      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5034    if (json.has("ref"))
5035      res.setRef(parseReference(json.getAsJsonObject("ref")));
5036    return res;
5037  }
5038
5039  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
5040    DocumentReference res = new DocumentReference();
5041    parseDomainResourceProperties(json, res);
5042    if (json.has("masterIdentifier"))
5043      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
5044    if (json.has("identifier")) {
5045      JsonArray array = json.getAsJsonArray("identifier");
5046      for (int i = 0; i < array.size(); i++) {
5047        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5048      }
5049    };
5050    if (json.has("subject"))
5051      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5052    if (json.has("type"))
5053      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5054    if (json.has("class"))
5055      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
5056    if (json.has("author")) {
5057      JsonArray array = json.getAsJsonArray("author");
5058      for (int i = 0; i < array.size(); i++) {
5059        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5060      }
5061    };
5062    if (json.has("custodian"))
5063      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
5064    if (json.has("authenticator"))
5065      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
5066    if (json.has("created"))
5067      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5068    if (json.has("_created"))
5069      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5070    if (json.has("indexed"))
5071      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
5072    if (json.has("_indexed"))
5073      parseElementProperties(json.getAsJsonObject("_indexed"), res.getIndexedElement());
5074    if (json.has("status"))
5075      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
5076    if (json.has("_status"))
5077      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5078    if (json.has("docStatus"))
5079      res.setDocStatus(parseCodeableConcept(json.getAsJsonObject("docStatus")));
5080    if (json.has("relatesTo")) {
5081      JsonArray array = json.getAsJsonArray("relatesTo");
5082      for (int i = 0; i < array.size(); i++) {
5083        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
5084      }
5085    };
5086    if (json.has("description"))
5087      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5088    if (json.has("_description"))
5089      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5090    if (json.has("securityLabel")) {
5091      JsonArray array = json.getAsJsonArray("securityLabel");
5092      for (int i = 0; i < array.size(); i++) {
5093        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5094      }
5095    };
5096    if (json.has("content")) {
5097      JsonArray array = json.getAsJsonArray("content");
5098      for (int i = 0; i < array.size(); i++) {
5099        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
5100      }
5101    };
5102    if (json.has("context"))
5103      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
5104    return res;
5105  }
5106
5107  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5108    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
5109    parseBackboneProperties(json, res);
5110    if (json.has("code"))
5111      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
5112    if (json.has("_code"))
5113      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5114    if (json.has("target"))
5115      res.setTarget(parseReference(json.getAsJsonObject("target")));
5116    return res;
5117  }
5118
5119  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5120    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
5121    parseBackboneProperties(json, res);
5122    if (json.has("attachment"))
5123      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
5124    if (json.has("format")) {
5125      JsonArray array = json.getAsJsonArray("format");
5126      for (int i = 0; i < array.size(); i++) {
5127        res.getFormat().add(parseCoding(array.get(i).getAsJsonObject()));
5128      }
5129    };
5130    return res;
5131  }
5132
5133  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5134    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
5135    parseBackboneProperties(json, res);
5136    if (json.has("encounter"))
5137      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5138    if (json.has("event")) {
5139      JsonArray array = json.getAsJsonArray("event");
5140      for (int i = 0; i < array.size(); i++) {
5141        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5142      }
5143    };
5144    if (json.has("period"))
5145      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5146    if (json.has("facilityType"))
5147      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
5148    if (json.has("practiceSetting"))
5149      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
5150    if (json.has("sourcePatientInfo"))
5151      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
5152    if (json.has("related")) {
5153      JsonArray array = json.getAsJsonArray("related");
5154      for (int i = 0; i < array.size(); i++) {
5155        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
5156      }
5157    };
5158    return res;
5159  }
5160
5161  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5162    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
5163    parseBackboneProperties(json, res);
5164    if (json.has("identifier"))
5165      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5166    if (json.has("ref"))
5167      res.setRef(parseReference(json.getAsJsonObject("ref")));
5168    return res;
5169  }
5170
5171  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
5172    EligibilityRequest res = new EligibilityRequest();
5173    parseDomainResourceProperties(json, res);
5174    if (json.has("identifier")) {
5175      JsonArray array = json.getAsJsonArray("identifier");
5176      for (int i = 0; i < array.size(); i++) {
5177        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5178      }
5179    };
5180    if (json.has("ruleset"))
5181      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5182    if (json.has("originalRuleset"))
5183      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5184    if (json.has("created"))
5185      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5186    if (json.has("_created"))
5187      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5188    if (json.has("target"))
5189      res.setTarget(parseReference(json.getAsJsonObject("target")));
5190    if (json.has("provider"))
5191      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5192    if (json.has("organization"))
5193      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5194    return res;
5195  }
5196
5197  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
5198    EligibilityResponse res = new EligibilityResponse();
5199    parseDomainResourceProperties(json, res);
5200    if (json.has("identifier")) {
5201      JsonArray array = json.getAsJsonArray("identifier");
5202      for (int i = 0; i < array.size(); i++) {
5203        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5204      }
5205    };
5206    if (json.has("request"))
5207      res.setRequest(parseReference(json.getAsJsonObject("request")));
5208    if (json.has("outcome"))
5209      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5210    if (json.has("_outcome"))
5211      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5212    if (json.has("disposition"))
5213      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5214    if (json.has("_disposition"))
5215      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5216    if (json.has("ruleset"))
5217      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5218    if (json.has("originalRuleset"))
5219      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5220    if (json.has("created"))
5221      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5222    if (json.has("_created"))
5223      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5224    if (json.has("organization"))
5225      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5226    if (json.has("requestProvider"))
5227      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5228    if (json.has("requestOrganization"))
5229      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5230    return res;
5231  }
5232
5233  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
5234    Encounter res = new Encounter();
5235    parseDomainResourceProperties(json, res);
5236    if (json.has("identifier")) {
5237      JsonArray array = json.getAsJsonArray("identifier");
5238      for (int i = 0; i < array.size(); i++) {
5239        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5240      }
5241    };
5242    if (json.has("status"))
5243      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
5244    if (json.has("_status"))
5245      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5246    if (json.has("statusHistory")) {
5247      JsonArray array = json.getAsJsonArray("statusHistory");
5248      for (int i = 0; i < array.size(); i++) {
5249        res.getStatusHistory().add(parseEncounterEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
5250      }
5251    };
5252    if (json.has("class"))
5253      res.setClass_Element(parseEnumeration(json.get("class").getAsString(), Encounter.EncounterClass.NULL, new Encounter.EncounterClassEnumFactory()));
5254    if (json.has("_class"))
5255      parseElementProperties(json.getAsJsonObject("_class"), res.getClass_Element());
5256    if (json.has("type")) {
5257      JsonArray array = json.getAsJsonArray("type");
5258      for (int i = 0; i < array.size(); i++) {
5259        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5260      }
5261    };
5262    if (json.has("priority"))
5263      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5264    if (json.has("patient"))
5265      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5266    if (json.has("episodeOfCare")) {
5267      JsonArray array = json.getAsJsonArray("episodeOfCare");
5268      for (int i = 0; i < array.size(); i++) {
5269        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
5270      }
5271    };
5272    if (json.has("incomingReferral")) {
5273      JsonArray array = json.getAsJsonArray("incomingReferral");
5274      for (int i = 0; i < array.size(); i++) {
5275        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
5276      }
5277    };
5278    if (json.has("participant")) {
5279      JsonArray array = json.getAsJsonArray("participant");
5280      for (int i = 0; i < array.size(); i++) {
5281        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
5282      }
5283    };
5284    if (json.has("appointment"))
5285      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
5286    if (json.has("period"))
5287      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5288    if (json.has("length"))
5289      res.setLength(parseDuration(json.getAsJsonObject("length")));
5290    if (json.has("reason")) {
5291      JsonArray array = json.getAsJsonArray("reason");
5292      for (int i = 0; i < array.size(); i++) {
5293        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5294      }
5295    };
5296    if (json.has("indication")) {
5297      JsonArray array = json.getAsJsonArray("indication");
5298      for (int i = 0; i < array.size(); i++) {
5299        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
5300      }
5301    };
5302    if (json.has("hospitalization"))
5303      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
5304    if (json.has("location")) {
5305      JsonArray array = json.getAsJsonArray("location");
5306      for (int i = 0; i < array.size(); i++) {
5307        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
5308      }
5309    };
5310    if (json.has("serviceProvider"))
5311      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
5312    if (json.has("partOf"))
5313      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
5314    return res;
5315  }
5316
5317  protected Encounter.EncounterStatusHistoryComponent parseEncounterEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5318    Encounter.EncounterStatusHistoryComponent res = new Encounter.EncounterStatusHistoryComponent();
5319    parseBackboneProperties(json, res);
5320    if (json.has("status"))
5321      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
5322    if (json.has("_status"))
5323      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5324    if (json.has("period"))
5325      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5326    return res;
5327  }
5328
5329  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5330    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
5331    parseBackboneProperties(json, res);
5332    if (json.has("type")) {
5333      JsonArray array = json.getAsJsonArray("type");
5334      for (int i = 0; i < array.size(); i++) {
5335        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5336      }
5337    };
5338    if (json.has("period"))
5339      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5340    if (json.has("individual"))
5341      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
5342    return res;
5343  }
5344
5345  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5346    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
5347    parseBackboneProperties(json, res);
5348    if (json.has("preAdmissionIdentifier"))
5349      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
5350    if (json.has("origin"))
5351      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
5352    if (json.has("admitSource"))
5353      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
5354    if (json.has("admittingDiagnosis")) {
5355      JsonArray array = json.getAsJsonArray("admittingDiagnosis");
5356      for (int i = 0; i < array.size(); i++) {
5357        res.getAdmittingDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
5358      }
5359    };
5360    if (json.has("reAdmission"))
5361      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
5362    if (json.has("dietPreference")) {
5363      JsonArray array = json.getAsJsonArray("dietPreference");
5364      for (int i = 0; i < array.size(); i++) {
5365        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5366      }
5367    };
5368    if (json.has("specialCourtesy")) {
5369      JsonArray array = json.getAsJsonArray("specialCourtesy");
5370      for (int i = 0; i < array.size(); i++) {
5371        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5372      }
5373    };
5374    if (json.has("specialArrangement")) {
5375      JsonArray array = json.getAsJsonArray("specialArrangement");
5376      for (int i = 0; i < array.size(); i++) {
5377        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5378      }
5379    };
5380    if (json.has("destination"))
5381      res.setDestination(parseReference(json.getAsJsonObject("destination")));
5382    if (json.has("dischargeDisposition"))
5383      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
5384    if (json.has("dischargeDiagnosis")) {
5385      JsonArray array = json.getAsJsonArray("dischargeDiagnosis");
5386      for (int i = 0; i < array.size(); i++) {
5387        res.getDischargeDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
5388      }
5389    };
5390    return res;
5391  }
5392
5393  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5394    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
5395    parseBackboneProperties(json, res);
5396    if (json.has("location"))
5397      res.setLocation(parseReference(json.getAsJsonObject("location")));
5398    if (json.has("status"))
5399      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
5400    if (json.has("_status"))
5401      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5402    if (json.has("period"))
5403      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5404    return res;
5405  }
5406
5407  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
5408    EnrollmentRequest res = new EnrollmentRequest();
5409    parseDomainResourceProperties(json, res);
5410    if (json.has("identifier")) {
5411      JsonArray array = json.getAsJsonArray("identifier");
5412      for (int i = 0; i < array.size(); i++) {
5413        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5414      }
5415    };
5416    if (json.has("ruleset"))
5417      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5418    if (json.has("originalRuleset"))
5419      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5420    if (json.has("created"))
5421      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5422    if (json.has("_created"))
5423      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5424    if (json.has("target"))
5425      res.setTarget(parseReference(json.getAsJsonObject("target")));
5426    if (json.has("provider"))
5427      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5428    if (json.has("organization"))
5429      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5430    if (json.has("subject"))
5431      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5432    if (json.has("coverage"))
5433      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5434    if (json.has("relationship"))
5435      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
5436    return res;
5437  }
5438
5439  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
5440    EnrollmentResponse res = new EnrollmentResponse();
5441    parseDomainResourceProperties(json, res);
5442    if (json.has("identifier")) {
5443      JsonArray array = json.getAsJsonArray("identifier");
5444      for (int i = 0; i < array.size(); i++) {
5445        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5446      }
5447    };
5448    if (json.has("request"))
5449      res.setRequest(parseReference(json.getAsJsonObject("request")));
5450    if (json.has("outcome"))
5451      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5452    if (json.has("_outcome"))
5453      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5454    if (json.has("disposition"))
5455      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5456    if (json.has("_disposition"))
5457      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5458    if (json.has("ruleset"))
5459      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5460    if (json.has("originalRuleset"))
5461      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5462    if (json.has("created"))
5463      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5464    if (json.has("_created"))
5465      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5466    if (json.has("organization"))
5467      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5468    if (json.has("requestProvider"))
5469      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5470    if (json.has("requestOrganization"))
5471      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5472    return res;
5473  }
5474
5475  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
5476    EpisodeOfCare res = new EpisodeOfCare();
5477    parseDomainResourceProperties(json, res);
5478    if (json.has("identifier")) {
5479      JsonArray array = json.getAsJsonArray("identifier");
5480      for (int i = 0; i < array.size(); i++) {
5481        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5482      }
5483    };
5484    if (json.has("status"))
5485      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
5486    if (json.has("_status"))
5487      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5488    if (json.has("statusHistory")) {
5489      JsonArray array = json.getAsJsonArray("statusHistory");
5490      for (int i = 0; i < array.size(); i++) {
5491        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
5492      }
5493    };
5494    if (json.has("type")) {
5495      JsonArray array = json.getAsJsonArray("type");
5496      for (int i = 0; i < array.size(); i++) {
5497        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5498      }
5499    };
5500    if (json.has("condition")) {
5501      JsonArray array = json.getAsJsonArray("condition");
5502      for (int i = 0; i < array.size(); i++) {
5503        res.getCondition().add(parseReference(array.get(i).getAsJsonObject()));
5504      }
5505    };
5506    if (json.has("patient"))
5507      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5508    if (json.has("managingOrganization"))
5509      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
5510    if (json.has("period"))
5511      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5512    if (json.has("referralRequest")) {
5513      JsonArray array = json.getAsJsonArray("referralRequest");
5514      for (int i = 0; i < array.size(); i++) {
5515        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
5516      }
5517    };
5518    if (json.has("careManager"))
5519      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
5520    if (json.has("careTeam")) {
5521      JsonArray array = json.getAsJsonArray("careTeam");
5522      for (int i = 0; i < array.size(); i++) {
5523        res.getCareTeam().add(parseEpisodeOfCareEpisodeOfCareCareTeamComponent(array.get(i).getAsJsonObject(), res));
5524      }
5525    };
5526    return res;
5527  }
5528
5529  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
5530    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
5531    parseBackboneProperties(json, res);
5532    if (json.has("status"))
5533      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
5534    if (json.has("_status"))
5535      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5536    if (json.has("period"))
5537      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5538    return res;
5539  }
5540
5541  protected EpisodeOfCare.EpisodeOfCareCareTeamComponent parseEpisodeOfCareEpisodeOfCareCareTeamComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
5542    EpisodeOfCare.EpisodeOfCareCareTeamComponent res = new EpisodeOfCare.EpisodeOfCareCareTeamComponent();
5543    parseBackboneProperties(json, res);
5544    if (json.has("role")) {
5545      JsonArray array = json.getAsJsonArray("role");
5546      for (int i = 0; i < array.size(); i++) {
5547        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5548      }
5549    };
5550    if (json.has("period"))
5551      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5552    if (json.has("member"))
5553      res.setMember(parseReference(json.getAsJsonObject("member")));
5554    return res;
5555  }
5556
5557  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
5558    ExplanationOfBenefit res = new ExplanationOfBenefit();
5559    parseDomainResourceProperties(json, res);
5560    if (json.has("identifier")) {
5561      JsonArray array = json.getAsJsonArray("identifier");
5562      for (int i = 0; i < array.size(); i++) {
5563        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5564      }
5565    };
5566    if (json.has("request"))
5567      res.setRequest(parseReference(json.getAsJsonObject("request")));
5568    if (json.has("outcome"))
5569      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5570    if (json.has("_outcome"))
5571      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5572    if (json.has("disposition"))
5573      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5574    if (json.has("_disposition"))
5575      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5576    if (json.has("ruleset"))
5577      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5578    if (json.has("originalRuleset"))
5579      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5580    if (json.has("created"))
5581      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5582    if (json.has("_created"))
5583      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5584    if (json.has("organization"))
5585      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5586    if (json.has("requestProvider"))
5587      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5588    if (json.has("requestOrganization"))
5589      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5590    return res;
5591  }
5592
5593  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
5594    FamilyMemberHistory res = new FamilyMemberHistory();
5595    parseDomainResourceProperties(json, res);
5596    if (json.has("identifier")) {
5597      JsonArray array = json.getAsJsonArray("identifier");
5598      for (int i = 0; i < array.size(); i++) {
5599        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5600      }
5601    };
5602    if (json.has("patient"))
5603      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5604    if (json.has("date"))
5605      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5606    if (json.has("_date"))
5607      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5608    if (json.has("status"))
5609      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
5610    if (json.has("_status"))
5611      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5612    if (json.has("name"))
5613      res.setNameElement(parseString(json.get("name").getAsString()));
5614    if (json.has("_name"))
5615      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5616    if (json.has("relationship"))
5617      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
5618    if (json.has("gender"))
5619      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
5620    if (json.has("_gender"))
5621      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
5622    Type born = parseType("born", json);
5623    if (born != null)
5624      res.setBorn(born);
5625    Type age = parseType("age", json);
5626    if (age != null)
5627      res.setAge(age);
5628    Type deceased = parseType("deceased", json);
5629    if (deceased != null)
5630      res.setDeceased(deceased);
5631    if (json.has("note"))
5632      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
5633    if (json.has("condition")) {
5634      JsonArray array = json.getAsJsonArray("condition");
5635      for (int i = 0; i < array.size(); i++) {
5636        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
5637      }
5638    };
5639    return res;
5640  }
5641
5642  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
5643    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
5644    parseBackboneProperties(json, res);
5645    if (json.has("code"))
5646      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5647    if (json.has("outcome"))
5648      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
5649    Type onset = parseType("onset", json);
5650    if (onset != null)
5651      res.setOnset(onset);
5652    if (json.has("note"))
5653      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
5654    return res;
5655  }
5656
5657  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
5658    Flag res = new Flag();
5659    parseDomainResourceProperties(json, res);
5660    if (json.has("identifier")) {
5661      JsonArray array = json.getAsJsonArray("identifier");
5662      for (int i = 0; i < array.size(); i++) {
5663        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5664      }
5665    };
5666    if (json.has("category"))
5667      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5668    if (json.has("status"))
5669      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
5670    if (json.has("_status"))
5671      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5672    if (json.has("period"))
5673      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5674    if (json.has("subject"))
5675      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5676    if (json.has("encounter"))
5677      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5678    if (json.has("author"))
5679      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5680    if (json.has("code"))
5681      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5682    return res;
5683  }
5684
5685  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
5686    Goal res = new Goal();
5687    parseDomainResourceProperties(json, res);
5688    if (json.has("identifier")) {
5689      JsonArray array = json.getAsJsonArray("identifier");
5690      for (int i = 0; i < array.size(); i++) {
5691        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5692      }
5693    };
5694    if (json.has("subject"))
5695      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5696    Type start = parseType("start", json);
5697    if (start != null)
5698      res.setStart(start);
5699    Type target = parseType("target", json);
5700    if (target != null)
5701      res.setTarget(target);
5702    if (json.has("category")) {
5703      JsonArray array = json.getAsJsonArray("category");
5704      for (int i = 0; i < array.size(); i++) {
5705        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5706      }
5707    };
5708    if (json.has("description"))
5709      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5710    if (json.has("_description"))
5711      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5712    if (json.has("status"))
5713      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
5714    if (json.has("_status"))
5715      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5716    if (json.has("statusDate"))
5717      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
5718    if (json.has("_statusDate"))
5719      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
5720    if (json.has("statusReason"))
5721      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5722    if (json.has("author"))
5723      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5724    if (json.has("priority"))
5725      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5726    if (json.has("addresses")) {
5727      JsonArray array = json.getAsJsonArray("addresses");
5728      for (int i = 0; i < array.size(); i++) {
5729        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
5730      }
5731    };
5732    if (json.has("note")) {
5733      JsonArray array = json.getAsJsonArray("note");
5734      for (int i = 0; i < array.size(); i++) {
5735        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5736      }
5737    };
5738    if (json.has("outcome")) {
5739      JsonArray array = json.getAsJsonArray("outcome");
5740      for (int i = 0; i < array.size(); i++) {
5741        res.getOutcome().add(parseGoalGoalOutcomeComponent(array.get(i).getAsJsonObject(), res));
5742      }
5743    };
5744    return res;
5745  }
5746
5747  protected Goal.GoalOutcomeComponent parseGoalGoalOutcomeComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
5748    Goal.GoalOutcomeComponent res = new Goal.GoalOutcomeComponent();
5749    parseBackboneProperties(json, res);
5750    Type result = parseType("result", json);
5751    if (result != null)
5752      res.setResult(result);
5753    return res;
5754  }
5755
5756  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
5757    Group res = new Group();
5758    parseDomainResourceProperties(json, res);
5759    if (json.has("identifier")) {
5760      JsonArray array = json.getAsJsonArray("identifier");
5761      for (int i = 0; i < array.size(); i++) {
5762        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5763      }
5764    };
5765    if (json.has("type"))
5766      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
5767    if (json.has("_type"))
5768      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5769    if (json.has("actual"))
5770      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5771    if (json.has("_actual"))
5772      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
5773    if (json.has("code"))
5774      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5775    if (json.has("name"))
5776      res.setNameElement(parseString(json.get("name").getAsString()));
5777    if (json.has("_name"))
5778      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5779    if (json.has("quantity"))
5780      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
5781    if (json.has("_quantity"))
5782      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
5783    if (json.has("characteristic")) {
5784      JsonArray array = json.getAsJsonArray("characteristic");
5785      for (int i = 0; i < array.size(); i++) {
5786        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
5787      }
5788    };
5789    if (json.has("member")) {
5790      JsonArray array = json.getAsJsonArray("member");
5791      for (int i = 0; i < array.size(); i++) {
5792        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
5793      }
5794    };
5795    return res;
5796  }
5797
5798  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
5799    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
5800    parseBackboneProperties(json, res);
5801    if (json.has("code"))
5802      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5803    Type value = parseType("value", json);
5804    if (value != null)
5805      res.setValue(value);
5806    if (json.has("exclude"))
5807      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
5808    if (json.has("_exclude"))
5809      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
5810    if (json.has("period"))
5811      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5812    return res;
5813  }
5814
5815  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
5816    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
5817    parseBackboneProperties(json, res);
5818    if (json.has("entity"))
5819      res.setEntity(parseReference(json.getAsJsonObject("entity")));
5820    if (json.has("period"))
5821      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5822    if (json.has("inactive"))
5823      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
5824    if (json.has("_inactive"))
5825      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
5826    return res;
5827  }
5828
5829  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
5830    HealthcareService res = new HealthcareService();
5831    parseDomainResourceProperties(json, res);
5832    if (json.has("identifier")) {
5833      JsonArray array = json.getAsJsonArray("identifier");
5834      for (int i = 0; i < array.size(); i++) {
5835        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5836      }
5837    };
5838    if (json.has("providedBy"))
5839      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
5840    if (json.has("serviceCategory"))
5841      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
5842    if (json.has("serviceType")) {
5843      JsonArray array = json.getAsJsonArray("serviceType");
5844      for (int i = 0; i < array.size(); i++) {
5845        res.getServiceType().add(parseHealthcareServiceServiceTypeComponent(array.get(i).getAsJsonObject(), res));
5846      }
5847    };
5848    if (json.has("location"))
5849      res.setLocation(parseReference(json.getAsJsonObject("location")));
5850    if (json.has("serviceName"))
5851      res.setServiceNameElement(parseString(json.get("serviceName").getAsString()));
5852    if (json.has("_serviceName"))
5853      parseElementProperties(json.getAsJsonObject("_serviceName"), res.getServiceNameElement());
5854    if (json.has("comment"))
5855      res.setCommentElement(parseString(json.get("comment").getAsString()));
5856    if (json.has("_comment"))
5857      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
5858    if (json.has("extraDetails"))
5859      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
5860    if (json.has("_extraDetails"))
5861      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
5862    if (json.has("photo"))
5863      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
5864    if (json.has("telecom")) {
5865      JsonArray array = json.getAsJsonArray("telecom");
5866      for (int i = 0; i < array.size(); i++) {
5867        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5868      }
5869    };
5870    if (json.has("coverageArea")) {
5871      JsonArray array = json.getAsJsonArray("coverageArea");
5872      for (int i = 0; i < array.size(); i++) {
5873        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
5874      }
5875    };
5876    if (json.has("serviceProvisionCode")) {
5877      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
5878      for (int i = 0; i < array.size(); i++) {
5879        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5880      }
5881    };
5882    if (json.has("eligibility"))
5883      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
5884    if (json.has("eligibilityNote"))
5885      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
5886    if (json.has("_eligibilityNote"))
5887      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
5888    if (json.has("programName")) {
5889      JsonArray array = json.getAsJsonArray("programName");
5890      for (int i = 0; i < array.size(); i++) {
5891        res.getProgramName().add(parseString(array.get(i).getAsString()));
5892      }
5893    };
5894    if (json.has("_programName")) {
5895      JsonArray array = json.getAsJsonArray("_programName");
5896      for (int i = 0; i < array.size(); i++) {
5897        if (i == res.getProgramName().size())
5898          res.getProgramName().add(parseString(null));
5899        if (array.get(i) instanceof JsonObject) 
5900          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
5901      }
5902    };
5903    if (json.has("characteristic")) {
5904      JsonArray array = json.getAsJsonArray("characteristic");
5905      for (int i = 0; i < array.size(); i++) {
5906        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5907      }
5908    };
5909    if (json.has("referralMethod")) {
5910      JsonArray array = json.getAsJsonArray("referralMethod");
5911      for (int i = 0; i < array.size(); i++) {
5912        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5913      }
5914    };
5915    if (json.has("publicKey"))
5916      res.setPublicKeyElement(parseString(json.get("publicKey").getAsString()));
5917    if (json.has("_publicKey"))
5918      parseElementProperties(json.getAsJsonObject("_publicKey"), res.getPublicKeyElement());
5919    if (json.has("appointmentRequired"))
5920      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
5921    if (json.has("_appointmentRequired"))
5922      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
5923    if (json.has("availableTime")) {
5924      JsonArray array = json.getAsJsonArray("availableTime");
5925      for (int i = 0; i < array.size(); i++) {
5926        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
5927      }
5928    };
5929    if (json.has("notAvailable")) {
5930      JsonArray array = json.getAsJsonArray("notAvailable");
5931      for (int i = 0; i < array.size(); i++) {
5932        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
5933      }
5934    };
5935    if (json.has("availabilityExceptions"))
5936      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
5937    if (json.has("_availabilityExceptions"))
5938      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
5939    return res;
5940  }
5941
5942  protected HealthcareService.ServiceTypeComponent parseHealthcareServiceServiceTypeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
5943    HealthcareService.ServiceTypeComponent res = new HealthcareService.ServiceTypeComponent();
5944    parseBackboneProperties(json, res);
5945    if (json.has("type"))
5946      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5947    if (json.has("specialty")) {
5948      JsonArray array = json.getAsJsonArray("specialty");
5949      for (int i = 0; i < array.size(); i++) {
5950        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5951      }
5952    };
5953    return res;
5954  }
5955
5956  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
5957    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
5958    parseBackboneProperties(json, res);
5959    if (json.has("daysOfWeek")) {
5960      JsonArray array = json.getAsJsonArray("daysOfWeek");
5961      for (int i = 0; i < array.size(); i++) {
5962        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
5963      }
5964    };
5965    if (json.has("_daysOfWeek")) {
5966      JsonArray array = json.getAsJsonArray("_daysOfWeek");
5967      for (int i = 0; i < array.size(); i++) {
5968        if (i == res.getDaysOfWeek().size())
5969          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
5970        if (array.get(i) instanceof JsonObject) 
5971          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
5972      }
5973    };
5974    if (json.has("allDay"))
5975      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
5976    if (json.has("_allDay"))
5977      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
5978    if (json.has("availableStartTime"))
5979      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
5980    if (json.has("_availableStartTime"))
5981      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
5982    if (json.has("availableEndTime"))
5983      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
5984    if (json.has("_availableEndTime"))
5985      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
5986    return res;
5987  }
5988
5989  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
5990    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
5991    parseBackboneProperties(json, res);
5992    if (json.has("description"))
5993      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5994    if (json.has("_description"))
5995      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5996    if (json.has("during"))
5997      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
5998    return res;
5999  }
6000
6001  protected ImagingObjectSelection parseImagingObjectSelection(JsonObject json) throws IOException, FHIRFormatError {
6002    ImagingObjectSelection res = new ImagingObjectSelection();
6003    parseDomainResourceProperties(json, res);
6004    if (json.has("uid"))
6005      res.setUidElement(parseOid(json.get("uid").getAsString()));
6006    if (json.has("_uid"))
6007      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6008    if (json.has("patient"))
6009      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6010    if (json.has("title"))
6011      res.setTitle(parseCodeableConcept(json.getAsJsonObject("title")));
6012    if (json.has("description"))
6013      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6014    if (json.has("_description"))
6015      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6016    if (json.has("author"))
6017      res.setAuthor(parseReference(json.getAsJsonObject("author")));
6018    if (json.has("authoringTime"))
6019      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
6020    if (json.has("_authoringTime"))
6021      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
6022    if (json.has("study")) {
6023      JsonArray array = json.getAsJsonArray("study");
6024      for (int i = 0; i < array.size(); i++) {
6025        res.getStudy().add(parseImagingObjectSelectionStudyComponent(array.get(i).getAsJsonObject(), res));
6026      }
6027    };
6028    return res;
6029  }
6030
6031  protected ImagingObjectSelection.StudyComponent parseImagingObjectSelectionStudyComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6032    ImagingObjectSelection.StudyComponent res = new ImagingObjectSelection.StudyComponent();
6033    parseBackboneProperties(json, res);
6034    if (json.has("uid"))
6035      res.setUidElement(parseOid(json.get("uid").getAsString()));
6036    if (json.has("_uid"))
6037      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6038    if (json.has("url"))
6039      res.setUrlElement(parseUri(json.get("url").getAsString()));
6040    if (json.has("_url"))
6041      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6042    if (json.has("imagingStudy"))
6043      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
6044    if (json.has("series")) {
6045      JsonArray array = json.getAsJsonArray("series");
6046      for (int i = 0; i < array.size(); i++) {
6047        res.getSeries().add(parseImagingObjectSelectionSeriesComponent(array.get(i).getAsJsonObject(), owner));
6048      }
6049    };
6050    return res;
6051  }
6052
6053  protected ImagingObjectSelection.SeriesComponent parseImagingObjectSelectionSeriesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6054    ImagingObjectSelection.SeriesComponent res = new ImagingObjectSelection.SeriesComponent();
6055    parseBackboneProperties(json, res);
6056    if (json.has("uid"))
6057      res.setUidElement(parseOid(json.get("uid").getAsString()));
6058    if (json.has("_uid"))
6059      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6060    if (json.has("url"))
6061      res.setUrlElement(parseUri(json.get("url").getAsString()));
6062    if (json.has("_url"))
6063      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6064    if (json.has("instance")) {
6065      JsonArray array = json.getAsJsonArray("instance");
6066      for (int i = 0; i < array.size(); i++) {
6067        res.getInstance().add(parseImagingObjectSelectionInstanceComponent(array.get(i).getAsJsonObject(), owner));
6068      }
6069    };
6070    return res;
6071  }
6072
6073  protected ImagingObjectSelection.InstanceComponent parseImagingObjectSelectionInstanceComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6074    ImagingObjectSelection.InstanceComponent res = new ImagingObjectSelection.InstanceComponent();
6075    parseBackboneProperties(json, res);
6076    if (json.has("sopClass"))
6077      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
6078    if (json.has("_sopClass"))
6079      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
6080    if (json.has("uid"))
6081      res.setUidElement(parseOid(json.get("uid").getAsString()));
6082    if (json.has("_uid"))
6083      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6084    if (json.has("url"))
6085      res.setUrlElement(parseUri(json.get("url").getAsString()));
6086    if (json.has("_url"))
6087      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6088    if (json.has("frames")) {
6089      JsonArray array = json.getAsJsonArray("frames");
6090      for (int i = 0; i < array.size(); i++) {
6091        res.getFrames().add(parseImagingObjectSelectionFramesComponent(array.get(i).getAsJsonObject(), owner));
6092      }
6093    };
6094    return res;
6095  }
6096
6097  protected ImagingObjectSelection.FramesComponent parseImagingObjectSelectionFramesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6098    ImagingObjectSelection.FramesComponent res = new ImagingObjectSelection.FramesComponent();
6099    parseBackboneProperties(json, res);
6100    if (json.has("frameNumbers")) {
6101      JsonArray array = json.getAsJsonArray("frameNumbers");
6102      for (int i = 0; i < array.size(); i++) {
6103        res.getFrameNumbers().add(parseUnsignedInt(array.get(i).getAsString()));
6104      }
6105    };
6106    if (json.has("_frameNumbers")) {
6107      JsonArray array = json.getAsJsonArray("_frameNumbers");
6108      for (int i = 0; i < array.size(); i++) {
6109        if (i == res.getFrameNumbers().size())
6110          res.getFrameNumbers().add(parseUnsignedInt(null));
6111        if (array.get(i) instanceof JsonObject) 
6112          parseElementProperties(array.get(i).getAsJsonObject(), res.getFrameNumbers().get(i));
6113      }
6114    };
6115    if (json.has("url"))
6116      res.setUrlElement(parseUri(json.get("url").getAsString()));
6117    if (json.has("_url"))
6118      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6119    return res;
6120  }
6121
6122  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
6123    ImagingStudy res = new ImagingStudy();
6124    parseDomainResourceProperties(json, res);
6125    if (json.has("started"))
6126      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
6127    if (json.has("_started"))
6128      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
6129    if (json.has("patient"))
6130      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6131    if (json.has("uid"))
6132      res.setUidElement(parseOid(json.get("uid").getAsString()));
6133    if (json.has("_uid"))
6134      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6135    if (json.has("accession"))
6136      res.setAccession(parseIdentifier(json.getAsJsonObject("accession")));
6137    if (json.has("identifier")) {
6138      JsonArray array = json.getAsJsonArray("identifier");
6139      for (int i = 0; i < array.size(); i++) {
6140        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6141      }
6142    };
6143    if (json.has("order")) {
6144      JsonArray array = json.getAsJsonArray("order");
6145      for (int i = 0; i < array.size(); i++) {
6146        res.getOrder().add(parseReference(array.get(i).getAsJsonObject()));
6147      }
6148    };
6149    if (json.has("modalityList")) {
6150      JsonArray array = json.getAsJsonArray("modalityList");
6151      for (int i = 0; i < array.size(); i++) {
6152        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
6153      }
6154    };
6155    if (json.has("referrer"))
6156      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
6157    if (json.has("availability"))
6158      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
6159    if (json.has("_availability"))
6160      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
6161    if (json.has("url"))
6162      res.setUrlElement(parseUri(json.get("url").getAsString()));
6163    if (json.has("_url"))
6164      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6165    if (json.has("numberOfSeries"))
6166      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
6167    if (json.has("_numberOfSeries"))
6168      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
6169    if (json.has("numberOfInstances"))
6170      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
6171    if (json.has("_numberOfInstances"))
6172      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
6173    if (json.has("procedure")) {
6174      JsonArray array = json.getAsJsonArray("procedure");
6175      for (int i = 0; i < array.size(); i++) {
6176        res.getProcedure().add(parseReference(array.get(i).getAsJsonObject()));
6177      }
6178    };
6179    if (json.has("interpreter"))
6180      res.setInterpreter(parseReference(json.getAsJsonObject("interpreter")));
6181    if (json.has("description"))
6182      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6183    if (json.has("_description"))
6184      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6185    if (json.has("series")) {
6186      JsonArray array = json.getAsJsonArray("series");
6187      for (int i = 0; i < array.size(); i++) {
6188        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
6189      }
6190    };
6191    return res;
6192  }
6193
6194  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
6195    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
6196    parseBackboneProperties(json, res);
6197    if (json.has("number"))
6198      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
6199    if (json.has("_number"))
6200      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6201    if (json.has("modality"))
6202      res.setModality(parseCoding(json.getAsJsonObject("modality")));
6203    if (json.has("uid"))
6204      res.setUidElement(parseOid(json.get("uid").getAsString()));
6205    if (json.has("_uid"))
6206      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6207    if (json.has("description"))
6208      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6209    if (json.has("_description"))
6210      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6211    if (json.has("numberOfInstances"))
6212      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
6213    if (json.has("_numberOfInstances"))
6214      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
6215    if (json.has("availability"))
6216      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
6217    if (json.has("_availability"))
6218      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
6219    if (json.has("url"))
6220      res.setUrlElement(parseUri(json.get("url").getAsString()));
6221    if (json.has("_url"))
6222      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6223    if (json.has("bodySite"))
6224      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
6225    if (json.has("laterality"))
6226      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
6227    if (json.has("started"))
6228      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
6229    if (json.has("_started"))
6230      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
6231    if (json.has("instance")) {
6232      JsonArray array = json.getAsJsonArray("instance");
6233      for (int i = 0; i < array.size(); i++) {
6234        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
6235      }
6236    };
6237    return res;
6238  }
6239
6240  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
6241    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
6242    parseBackboneProperties(json, res);
6243    if (json.has("number"))
6244      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
6245    if (json.has("_number"))
6246      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6247    if (json.has("uid"))
6248      res.setUidElement(parseOid(json.get("uid").getAsString()));
6249    if (json.has("_uid"))
6250      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6251    if (json.has("sopClass"))
6252      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
6253    if (json.has("_sopClass"))
6254      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
6255    if (json.has("type"))
6256      res.setTypeElement(parseString(json.get("type").getAsString()));
6257    if (json.has("_type"))
6258      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6259    if (json.has("title"))
6260      res.setTitleElement(parseString(json.get("title").getAsString()));
6261    if (json.has("_title"))
6262      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6263    if (json.has("content")) {
6264      JsonArray array = json.getAsJsonArray("content");
6265      for (int i = 0; i < array.size(); i++) {
6266        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
6267      }
6268    };
6269    return res;
6270  }
6271
6272  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
6273    Immunization res = new Immunization();
6274    parseDomainResourceProperties(json, res);
6275    if (json.has("identifier")) {
6276      JsonArray array = json.getAsJsonArray("identifier");
6277      for (int i = 0; i < array.size(); i++) {
6278        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6279      }
6280    };
6281    if (json.has("status"))
6282      res.setStatusElement(parseCode(json.get("status").getAsString()));
6283    if (json.has("_status"))
6284      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6285    if (json.has("date"))
6286      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6287    if (json.has("_date"))
6288      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6289    if (json.has("vaccineCode"))
6290      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
6291    if (json.has("patient"))
6292      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6293    if (json.has("wasNotGiven"))
6294      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
6295    if (json.has("_wasNotGiven"))
6296      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
6297    if (json.has("reported"))
6298      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
6299    if (json.has("_reported"))
6300      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
6301    if (json.has("performer"))
6302      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
6303    if (json.has("requester"))
6304      res.setRequester(parseReference(json.getAsJsonObject("requester")));
6305    if (json.has("encounter"))
6306      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6307    if (json.has("manufacturer"))
6308      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
6309    if (json.has("location"))
6310      res.setLocation(parseReference(json.getAsJsonObject("location")));
6311    if (json.has("lotNumber"))
6312      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
6313    if (json.has("_lotNumber"))
6314      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
6315    if (json.has("expirationDate"))
6316      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
6317    if (json.has("_expirationDate"))
6318      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
6319    if (json.has("site"))
6320      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
6321    if (json.has("route"))
6322      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
6323    if (json.has("doseQuantity"))
6324      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
6325    if (json.has("note")) {
6326      JsonArray array = json.getAsJsonArray("note");
6327      for (int i = 0; i < array.size(); i++) {
6328        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6329      }
6330    };
6331    if (json.has("explanation"))
6332      res.setExplanation(parseImmunizationImmunizationExplanationComponent(json.getAsJsonObject("explanation"), res));
6333    if (json.has("reaction")) {
6334      JsonArray array = json.getAsJsonArray("reaction");
6335      for (int i = 0; i < array.size(); i++) {
6336        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
6337      }
6338    };
6339    if (json.has("vaccinationProtocol")) {
6340      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
6341      for (int i = 0; i < array.size(); i++) {
6342        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
6343      }
6344    };
6345    return res;
6346  }
6347
6348  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6349    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
6350    parseBackboneProperties(json, res);
6351    if (json.has("reason")) {
6352      JsonArray array = json.getAsJsonArray("reason");
6353      for (int i = 0; i < array.size(); i++) {
6354        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6355      }
6356    };
6357    if (json.has("reasonNotGiven")) {
6358      JsonArray array = json.getAsJsonArray("reasonNotGiven");
6359      for (int i = 0; i < array.size(); i++) {
6360        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6361      }
6362    };
6363    return res;
6364  }
6365
6366  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6367    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
6368    parseBackboneProperties(json, res);
6369    if (json.has("date"))
6370      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6371    if (json.has("_date"))
6372      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6373    if (json.has("detail"))
6374      res.setDetail(parseReference(json.getAsJsonObject("detail")));
6375    if (json.has("reported"))
6376      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
6377    if (json.has("_reported"))
6378      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
6379    return res;
6380  }
6381
6382  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6383    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
6384    parseBackboneProperties(json, res);
6385    if (json.has("doseSequence"))
6386      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
6387    if (json.has("_doseSequence"))
6388      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
6389    if (json.has("description"))
6390      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6391    if (json.has("_description"))
6392      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6393    if (json.has("authority"))
6394      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
6395    if (json.has("series"))
6396      res.setSeriesElement(parseString(json.get("series").getAsString()));
6397    if (json.has("_series"))
6398      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
6399    if (json.has("seriesDoses"))
6400      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
6401    if (json.has("_seriesDoses"))
6402      parseElementProperties(json.getAsJsonObject("_seriesDoses"), res.getSeriesDosesElement());
6403    if (json.has("targetDisease")) {
6404      JsonArray array = json.getAsJsonArray("targetDisease");
6405      for (int i = 0; i < array.size(); i++) {
6406        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6407      }
6408    };
6409    if (json.has("doseStatus"))
6410      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
6411    if (json.has("doseStatusReason"))
6412      res.setDoseStatusReason(parseCodeableConcept(json.getAsJsonObject("doseStatusReason")));
6413    return res;
6414  }
6415
6416  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
6417    ImmunizationRecommendation res = new ImmunizationRecommendation();
6418    parseDomainResourceProperties(json, res);
6419    if (json.has("identifier")) {
6420      JsonArray array = json.getAsJsonArray("identifier");
6421      for (int i = 0; i < array.size(); i++) {
6422        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6423      }
6424    };
6425    if (json.has("patient"))
6426      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6427    if (json.has("recommendation")) {
6428      JsonArray array = json.getAsJsonArray("recommendation");
6429      for (int i = 0; i < array.size(); i++) {
6430        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
6431      }
6432    };
6433    return res;
6434  }
6435
6436  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6437    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
6438    parseBackboneProperties(json, res);
6439    if (json.has("date"))
6440      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6441    if (json.has("_date"))
6442      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6443    if (json.has("vaccineCode"))
6444      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
6445    if (json.has("doseNumber"))
6446      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
6447    if (json.has("_doseNumber"))
6448      parseElementProperties(json.getAsJsonObject("_doseNumber"), res.getDoseNumberElement());
6449    if (json.has("forecastStatus"))
6450      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
6451    if (json.has("dateCriterion")) {
6452      JsonArray array = json.getAsJsonArray("dateCriterion");
6453      for (int i = 0; i < array.size(); i++) {
6454        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
6455      }
6456    };
6457    if (json.has("protocol"))
6458      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(json.getAsJsonObject("protocol"), owner));
6459    if (json.has("supportingImmunization")) {
6460      JsonArray array = json.getAsJsonArray("supportingImmunization");
6461      for (int i = 0; i < array.size(); i++) {
6462        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
6463      }
6464    };
6465    if (json.has("supportingPatientInformation")) {
6466      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
6467      for (int i = 0; i < array.size(); i++) {
6468        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
6469      }
6470    };
6471    return res;
6472  }
6473
6474  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6475    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
6476    parseBackboneProperties(json, res);
6477    if (json.has("code"))
6478      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6479    if (json.has("value"))
6480      res.setValueElement(parseDateTime(json.get("value").getAsString()));
6481    if (json.has("_value"))
6482      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6483    return res;
6484  }
6485
6486  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6487    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
6488    parseBackboneProperties(json, res);
6489    if (json.has("doseSequence"))
6490      res.setDoseSequenceElement(parseInteger(json.get("doseSequence").getAsLong()));
6491    if (json.has("_doseSequence"))
6492      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
6493    if (json.has("description"))
6494      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6495    if (json.has("_description"))
6496      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6497    if (json.has("authority"))
6498      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
6499    if (json.has("series"))
6500      res.setSeriesElement(parseString(json.get("series").getAsString()));
6501    if (json.has("_series"))
6502      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
6503    return res;
6504  }
6505
6506  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
6507    ImplementationGuide res = new ImplementationGuide();
6508    parseDomainResourceProperties(json, res);
6509    if (json.has("url"))
6510      res.setUrlElement(parseUri(json.get("url").getAsString()));
6511    if (json.has("_url"))
6512      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6513    if (json.has("version"))
6514      res.setVersionElement(parseString(json.get("version").getAsString()));
6515    if (json.has("_version"))
6516      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6517    if (json.has("name"))
6518      res.setNameElement(parseString(json.get("name").getAsString()));
6519    if (json.has("_name"))
6520      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6521    if (json.has("status"))
6522      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
6523    if (json.has("_status"))
6524      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6525    if (json.has("experimental"))
6526      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6527    if (json.has("_experimental"))
6528      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6529    if (json.has("publisher"))
6530      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6531    if (json.has("_publisher"))
6532      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6533    if (json.has("contact")) {
6534      JsonArray array = json.getAsJsonArray("contact");
6535      for (int i = 0; i < array.size(); i++) {
6536        res.getContact().add(parseImplementationGuideImplementationGuideContactComponent(array.get(i).getAsJsonObject(), res));
6537      }
6538    };
6539    if (json.has("date"))
6540      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6541    if (json.has("_date"))
6542      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6543    if (json.has("description"))
6544      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6545    if (json.has("_description"))
6546      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6547    if (json.has("useContext")) {
6548      JsonArray array = json.getAsJsonArray("useContext");
6549      for (int i = 0; i < array.size(); i++) {
6550        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6551      }
6552    };
6553    if (json.has("copyright"))
6554      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
6555    if (json.has("_copyright"))
6556      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6557    if (json.has("fhirVersion"))
6558      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
6559    if (json.has("_fhirVersion"))
6560      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
6561    if (json.has("dependency")) {
6562      JsonArray array = json.getAsJsonArray("dependency");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
6565      }
6566    };
6567    if (json.has("package")) {
6568      JsonArray array = json.getAsJsonArray("package");
6569      for (int i = 0; i < array.size(); i++) {
6570        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
6571      }
6572    };
6573    if (json.has("global")) {
6574      JsonArray array = json.getAsJsonArray("global");
6575      for (int i = 0; i < array.size(); i++) {
6576        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
6577      }
6578    };
6579    if (json.has("binary")) {
6580      JsonArray array = json.getAsJsonArray("binary");
6581      for (int i = 0; i < array.size(); i++) {
6582        res.getBinary().add(parseUri(array.get(i).getAsString()));
6583      }
6584    };
6585    if (json.has("_binary")) {
6586      JsonArray array = json.getAsJsonArray("_binary");
6587      for (int i = 0; i < array.size(); i++) {
6588        if (i == res.getBinary().size())
6589          res.getBinary().add(parseUri(null));
6590        if (array.get(i) instanceof JsonObject) 
6591          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
6592      }
6593    };
6594    if (json.has("page"))
6595      res.setPage(parseImplementationGuideImplementationGuidePageComponent(json.getAsJsonObject("page"), res));
6596    return res;
6597  }
6598
6599  protected ImplementationGuide.ImplementationGuideContactComponent parseImplementationGuideImplementationGuideContactComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6600    ImplementationGuide.ImplementationGuideContactComponent res = new ImplementationGuide.ImplementationGuideContactComponent();
6601    parseBackboneProperties(json, res);
6602    if (json.has("name"))
6603      res.setNameElement(parseString(json.get("name").getAsString()));
6604    if (json.has("_name"))
6605      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6606    if (json.has("telecom")) {
6607      JsonArray array = json.getAsJsonArray("telecom");
6608      for (int i = 0; i < array.size(); i++) {
6609        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6610      }
6611    };
6612    return res;
6613  }
6614
6615  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6616    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
6617    parseBackboneProperties(json, res);
6618    if (json.has("type"))
6619      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
6620    if (json.has("_type"))
6621      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6622    if (json.has("uri"))
6623      res.setUriElement(parseUri(json.get("uri").getAsString()));
6624    if (json.has("_uri"))
6625      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6626    return res;
6627  }
6628
6629  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6630    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
6631    parseBackboneProperties(json, res);
6632    if (json.has("name"))
6633      res.setNameElement(parseString(json.get("name").getAsString()));
6634    if (json.has("_name"))
6635      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6636    if (json.has("description"))
6637      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6638    if (json.has("_description"))
6639      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6640    if (json.has("resource")) {
6641      JsonArray array = json.getAsJsonArray("resource");
6642      for (int i = 0; i < array.size(); i++) {
6643        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
6644      }
6645    };
6646    return res;
6647  }
6648
6649  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6650    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
6651    parseBackboneProperties(json, res);
6652    if (json.has("purpose"))
6653      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ImplementationGuide.GuideResourcePurpose.NULL, new ImplementationGuide.GuideResourcePurposeEnumFactory()));
6654    if (json.has("_purpose"))
6655      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6656    if (json.has("name"))
6657      res.setNameElement(parseString(json.get("name").getAsString()));
6658    if (json.has("_name"))
6659      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6660    if (json.has("description"))
6661      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6662    if (json.has("_description"))
6663      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6664    if (json.has("acronym"))
6665      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
6666    if (json.has("_acronym"))
6667      parseElementProperties(json.getAsJsonObject("_acronym"), res.getAcronymElement());
6668    Type source = parseType("source", json);
6669    if (source != null)
6670      res.setSource(source);
6671    if (json.has("exampleFor"))
6672      res.setExampleFor(parseReference(json.getAsJsonObject("exampleFor")));
6673    return res;
6674  }
6675
6676  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6677    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
6678    parseBackboneProperties(json, res);
6679    if (json.has("type"))
6680      res.setTypeElement(parseCode(json.get("type").getAsString()));
6681    if (json.has("_type"))
6682      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6683    if (json.has("profile"))
6684      res.setProfile(parseReference(json.getAsJsonObject("profile")));
6685    return res;
6686  }
6687
6688  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6689    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
6690    parseBackboneProperties(json, res);
6691    if (json.has("source"))
6692      res.setSourceElement(parseUri(json.get("source").getAsString()));
6693    if (json.has("_source"))
6694      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6695    if (json.has("name"))
6696      res.setNameElement(parseString(json.get("name").getAsString()));
6697    if (json.has("_name"))
6698      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6699    if (json.has("kind"))
6700      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
6701    if (json.has("_kind"))
6702      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
6703    if (json.has("type")) {
6704      JsonArray array = json.getAsJsonArray("type");
6705      for (int i = 0; i < array.size(); i++) {
6706        res.getType().add(parseCode(array.get(i).getAsString()));
6707      }
6708    };
6709    if (json.has("_type")) {
6710      JsonArray array = json.getAsJsonArray("_type");
6711      for (int i = 0; i < array.size(); i++) {
6712        if (i == res.getType().size())
6713          res.getType().add(parseCode(null));
6714        if (array.get(i) instanceof JsonObject) 
6715          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
6716      }
6717    };
6718    if (json.has("package")) {
6719      JsonArray array = json.getAsJsonArray("package");
6720      for (int i = 0; i < array.size(); i++) {
6721        res.getPackage().add(parseString(array.get(i).getAsString()));
6722      }
6723    };
6724    if (json.has("_package")) {
6725      JsonArray array = json.getAsJsonArray("_package");
6726      for (int i = 0; i < array.size(); i++) {
6727        if (i == res.getPackage().size())
6728          res.getPackage().add(parseString(null));
6729        if (array.get(i) instanceof JsonObject) 
6730          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
6731      }
6732    };
6733    if (json.has("format"))
6734      res.setFormatElement(parseCode(json.get("format").getAsString()));
6735    if (json.has("_format"))
6736      parseElementProperties(json.getAsJsonObject("_format"), res.getFormatElement());
6737    if (json.has("page")) {
6738      JsonArray array = json.getAsJsonArray("page");
6739      for (int i = 0; i < array.size(); i++) {
6740        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
6741      }
6742    };
6743    return res;
6744  }
6745
6746  protected List_ parseList_(JsonObject json) throws IOException, FHIRFormatError {
6747    List_ res = new List_();
6748    parseDomainResourceProperties(json, res);
6749    if (json.has("identifier")) {
6750      JsonArray array = json.getAsJsonArray("identifier");
6751      for (int i = 0; i < array.size(); i++) {
6752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6753      }
6754    };
6755    if (json.has("title"))
6756      res.setTitleElement(parseString(json.get("title").getAsString()));
6757    if (json.has("_title"))
6758      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6759    if (json.has("code"))
6760      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6761    if (json.has("subject"))
6762      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6763    if (json.has("source"))
6764      res.setSource(parseReference(json.getAsJsonObject("source")));
6765    if (json.has("encounter"))
6766      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6767    if (json.has("status"))
6768      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), List_.ListStatus.NULL, new List_.ListStatusEnumFactory()));
6769    if (json.has("_status"))
6770      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6771    if (json.has("date"))
6772      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6773    if (json.has("_date"))
6774      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6775    if (json.has("orderedBy"))
6776      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6777    if (json.has("mode"))
6778      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), List_.ListMode.NULL, new List_.ListModeEnumFactory()));
6779    if (json.has("_mode"))
6780      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6781    if (json.has("note"))
6782      res.setNoteElement(parseString(json.get("note").getAsString()));
6783    if (json.has("_note"))
6784      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
6785    if (json.has("entry")) {
6786      JsonArray array = json.getAsJsonArray("entry");
6787      for (int i = 0; i < array.size(); i++) {
6788        res.getEntry().add(parseList_ListEntryComponent(array.get(i).getAsJsonObject(), res));
6789      }
6790    };
6791    if (json.has("emptyReason"))
6792      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6793    return res;
6794  }
6795
6796  protected List_.ListEntryComponent parseList_ListEntryComponent(JsonObject json, List_ owner) throws IOException, FHIRFormatError {
6797    List_.ListEntryComponent res = new List_.ListEntryComponent();
6798    parseBackboneProperties(json, res);
6799    if (json.has("flag"))
6800      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
6801    if (json.has("deleted"))
6802      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
6803    if (json.has("_deleted"))
6804      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
6805    if (json.has("date"))
6806      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6807    if (json.has("_date"))
6808      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6809    if (json.has("item"))
6810      res.setItem(parseReference(json.getAsJsonObject("item")));
6811    return res;
6812  }
6813
6814  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
6815    Location res = new Location();
6816    parseDomainResourceProperties(json, res);
6817    if (json.has("identifier")) {
6818      JsonArray array = json.getAsJsonArray("identifier");
6819      for (int i = 0; i < array.size(); i++) {
6820        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6821      }
6822    };
6823    if (json.has("status"))
6824      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
6825    if (json.has("_status"))
6826      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6827    if (json.has("name"))
6828      res.setNameElement(parseString(json.get("name").getAsString()));
6829    if (json.has("_name"))
6830      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6831    if (json.has("description"))
6832      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6833    if (json.has("_description"))
6834      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6835    if (json.has("mode"))
6836      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
6837    if (json.has("_mode"))
6838      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6839    if (json.has("type"))
6840      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6841    if (json.has("telecom")) {
6842      JsonArray array = json.getAsJsonArray("telecom");
6843      for (int i = 0; i < array.size(); i++) {
6844        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6845      }
6846    };
6847    if (json.has("address"))
6848      res.setAddress(parseAddress(json.getAsJsonObject("address")));
6849    if (json.has("physicalType"))
6850      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
6851    if (json.has("position"))
6852      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
6853    if (json.has("managingOrganization"))
6854      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
6855    if (json.has("partOf"))
6856      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
6857    return res;
6858  }
6859
6860  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
6861    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
6862    parseBackboneProperties(json, res);
6863    if (json.has("longitude"))
6864      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
6865    if (json.has("_longitude"))
6866      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
6867    if (json.has("latitude"))
6868      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
6869    if (json.has("_latitude"))
6870      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
6871    if (json.has("altitude"))
6872      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
6873    if (json.has("_altitude"))
6874      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
6875    return res;
6876  }
6877
6878  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
6879    Media res = new Media();
6880    parseDomainResourceProperties(json, res);
6881    if (json.has("type"))
6882      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
6883    if (json.has("_type"))
6884      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6885    if (json.has("subtype"))
6886      res.setSubtype(parseCodeableConcept(json.getAsJsonObject("subtype")));
6887    if (json.has("identifier")) {
6888      JsonArray array = json.getAsJsonArray("identifier");
6889      for (int i = 0; i < array.size(); i++) {
6890        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6891      }
6892    };
6893    if (json.has("subject"))
6894      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6895    if (json.has("operator"))
6896      res.setOperator(parseReference(json.getAsJsonObject("operator")));
6897    if (json.has("view"))
6898      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
6899    if (json.has("deviceName"))
6900      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
6901    if (json.has("_deviceName"))
6902      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
6903    if (json.has("height"))
6904      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
6905    if (json.has("_height"))
6906      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
6907    if (json.has("width"))
6908      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
6909    if (json.has("_width"))
6910      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
6911    if (json.has("frames"))
6912      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
6913    if (json.has("_frames"))
6914      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
6915    if (json.has("duration"))
6916      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
6917    if (json.has("_duration"))
6918      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
6919    if (json.has("content"))
6920      res.setContent(parseAttachment(json.getAsJsonObject("content")));
6921    return res;
6922  }
6923
6924  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
6925    Medication res = new Medication();
6926    parseDomainResourceProperties(json, res);
6927    if (json.has("code"))
6928      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6929    if (json.has("isBrand"))
6930      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
6931    if (json.has("_isBrand"))
6932      parseElementProperties(json.getAsJsonObject("_isBrand"), res.getIsBrandElement());
6933    if (json.has("manufacturer"))
6934      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
6935    if (json.has("product"))
6936      res.setProduct(parseMedicationMedicationProductComponent(json.getAsJsonObject("product"), res));
6937    if (json.has("package"))
6938      res.setPackage(parseMedicationMedicationPackageComponent(json.getAsJsonObject("package"), res));
6939    return res;
6940  }
6941
6942  protected Medication.MedicationProductComponent parseMedicationMedicationProductComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6943    Medication.MedicationProductComponent res = new Medication.MedicationProductComponent();
6944    parseBackboneProperties(json, res);
6945    if (json.has("form"))
6946      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
6947    if (json.has("ingredient")) {
6948      JsonArray array = json.getAsJsonArray("ingredient");
6949      for (int i = 0; i < array.size(); i++) {
6950        res.getIngredient().add(parseMedicationMedicationProductIngredientComponent(array.get(i).getAsJsonObject(), owner));
6951      }
6952    };
6953    if (json.has("batch")) {
6954      JsonArray array = json.getAsJsonArray("batch");
6955      for (int i = 0; i < array.size(); i++) {
6956        res.getBatch().add(parseMedicationMedicationProductBatchComponent(array.get(i).getAsJsonObject(), owner));
6957      }
6958    };
6959    return res;
6960  }
6961
6962  protected Medication.MedicationProductIngredientComponent parseMedicationMedicationProductIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6963    Medication.MedicationProductIngredientComponent res = new Medication.MedicationProductIngredientComponent();
6964    parseBackboneProperties(json, res);
6965    if (json.has("item"))
6966      res.setItem(parseReference(json.getAsJsonObject("item")));
6967    if (json.has("amount"))
6968      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
6969    return res;
6970  }
6971
6972  protected Medication.MedicationProductBatchComponent parseMedicationMedicationProductBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6973    Medication.MedicationProductBatchComponent res = new Medication.MedicationProductBatchComponent();
6974    parseBackboneProperties(json, res);
6975    if (json.has("lotNumber"))
6976      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
6977    if (json.has("_lotNumber"))
6978      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
6979    if (json.has("expirationDate"))
6980      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
6981    if (json.has("_expirationDate"))
6982      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
6983    return res;
6984  }
6985
6986  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6987    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
6988    parseBackboneProperties(json, res);
6989    if (json.has("container"))
6990      res.setContainer(parseCodeableConcept(json.getAsJsonObject("container")));
6991    if (json.has("content")) {
6992      JsonArray array = json.getAsJsonArray("content");
6993      for (int i = 0; i < array.size(); i++) {
6994        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
6995      }
6996    };
6997    return res;
6998  }
6999
7000  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
7001    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
7002    parseBackboneProperties(json, res);
7003    if (json.has("item"))
7004      res.setItem(parseReference(json.getAsJsonObject("item")));
7005    if (json.has("amount"))
7006      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
7007    return res;
7008  }
7009
7010  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
7011    MedicationAdministration res = new MedicationAdministration();
7012    parseDomainResourceProperties(json, res);
7013    if (json.has("identifier")) {
7014      JsonArray array = json.getAsJsonArray("identifier");
7015      for (int i = 0; i < array.size(); i++) {
7016        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7017      }
7018    };
7019    if (json.has("status"))
7020      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
7021    if (json.has("_status"))
7022      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7023    if (json.has("patient"))
7024      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7025    if (json.has("practitioner"))
7026      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
7027    if (json.has("encounter"))
7028      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7029    if (json.has("prescription"))
7030      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
7031    if (json.has("wasNotGiven"))
7032      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
7033    if (json.has("_wasNotGiven"))
7034      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
7035    if (json.has("reasonNotGiven")) {
7036      JsonArray array = json.getAsJsonArray("reasonNotGiven");
7037      for (int i = 0; i < array.size(); i++) {
7038        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7039      }
7040    };
7041    if (json.has("reasonGiven")) {
7042      JsonArray array = json.getAsJsonArray("reasonGiven");
7043      for (int i = 0; i < array.size(); i++) {
7044        res.getReasonGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7045      }
7046    };
7047    Type effectiveTime = parseType("effectiveTime", json);
7048    if (effectiveTime != null)
7049      res.setEffectiveTime(effectiveTime);
7050    Type medication = parseType("medication", json);
7051    if (medication != null)
7052      res.setMedication(medication);
7053    if (json.has("device")) {
7054      JsonArray array = json.getAsJsonArray("device");
7055      for (int i = 0; i < array.size(); i++) {
7056        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
7057      }
7058    };
7059    if (json.has("note"))
7060      res.setNoteElement(parseString(json.get("note").getAsString()));
7061    if (json.has("_note"))
7062      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7063    if (json.has("dosage"))
7064      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
7065    return res;
7066  }
7067
7068  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
7069    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
7070    parseBackboneProperties(json, res);
7071    if (json.has("text"))
7072      res.setTextElement(parseString(json.get("text").getAsString()));
7073    if (json.has("_text"))
7074      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7075    Type site = parseType("site", json);
7076    if (site != null)
7077      res.setSite(site);
7078    if (json.has("route"))
7079      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7080    if (json.has("method"))
7081      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7082    if (json.has("quantity"))
7083      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7084    Type rate = parseType("rate", json);
7085    if (rate != null)
7086      res.setRate(rate);
7087    return res;
7088  }
7089
7090  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
7091    MedicationDispense res = new MedicationDispense();
7092    parseDomainResourceProperties(json, res);
7093    if (json.has("identifier"))
7094      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7095    if (json.has("status"))
7096      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
7097    if (json.has("_status"))
7098      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7099    if (json.has("patient"))
7100      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7101    if (json.has("dispenser"))
7102      res.setDispenser(parseReference(json.getAsJsonObject("dispenser")));
7103    if (json.has("authorizingPrescription")) {
7104      JsonArray array = json.getAsJsonArray("authorizingPrescription");
7105      for (int i = 0; i < array.size(); i++) {
7106        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
7107      }
7108    };
7109    if (json.has("type"))
7110      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7111    if (json.has("quantity"))
7112      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7113    if (json.has("daysSupply"))
7114      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
7115    Type medication = parseType("medication", json);
7116    if (medication != null)
7117      res.setMedication(medication);
7118    if (json.has("whenPrepared"))
7119      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
7120    if (json.has("_whenPrepared"))
7121      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
7122    if (json.has("whenHandedOver"))
7123      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
7124    if (json.has("_whenHandedOver"))
7125      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
7126    if (json.has("destination"))
7127      res.setDestination(parseReference(json.getAsJsonObject("destination")));
7128    if (json.has("receiver")) {
7129      JsonArray array = json.getAsJsonArray("receiver");
7130      for (int i = 0; i < array.size(); i++) {
7131        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
7132      }
7133    };
7134    if (json.has("note"))
7135      res.setNoteElement(parseString(json.get("note").getAsString()));
7136    if (json.has("_note"))
7137      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7138    if (json.has("dosageInstruction")) {
7139      JsonArray array = json.getAsJsonArray("dosageInstruction");
7140      for (int i = 0; i < array.size(); i++) {
7141        res.getDosageInstruction().add(parseMedicationDispenseMedicationDispenseDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
7142      }
7143    };
7144    if (json.has("substitution"))
7145      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
7146    return res;
7147  }
7148
7149  protected MedicationDispense.MedicationDispenseDosageInstructionComponent parseMedicationDispenseMedicationDispenseDosageInstructionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
7150    MedicationDispense.MedicationDispenseDosageInstructionComponent res = new MedicationDispense.MedicationDispenseDosageInstructionComponent();
7151    parseBackboneProperties(json, res);
7152    if (json.has("text"))
7153      res.setTextElement(parseString(json.get("text").getAsString()));
7154    if (json.has("_text"))
7155      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7156    if (json.has("additionalInstructions"))
7157      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
7158    if (json.has("timing"))
7159      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7160    Type asNeeded = parseType("asNeeded", json);
7161    if (asNeeded != null)
7162      res.setAsNeeded(asNeeded);
7163    Type site = parseType("site", json);
7164    if (site != null)
7165      res.setSite(site);
7166    if (json.has("route"))
7167      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7168    if (json.has("method"))
7169      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7170    Type dose = parseType("dose", json);
7171    if (dose != null)
7172      res.setDose(dose);
7173    Type rate = parseType("rate", json);
7174    if (rate != null)
7175      res.setRate(rate);
7176    if (json.has("maxDosePerPeriod"))
7177      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7178    return res;
7179  }
7180
7181  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
7182    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
7183    parseBackboneProperties(json, res);
7184    if (json.has("type"))
7185      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7186    if (json.has("reason")) {
7187      JsonArray array = json.getAsJsonArray("reason");
7188      for (int i = 0; i < array.size(); i++) {
7189        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7190      }
7191    };
7192    if (json.has("responsibleParty")) {
7193      JsonArray array = json.getAsJsonArray("responsibleParty");
7194      for (int i = 0; i < array.size(); i++) {
7195        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
7196      }
7197    };
7198    return res;
7199  }
7200
7201  protected MedicationOrder parseMedicationOrder(JsonObject json) throws IOException, FHIRFormatError {
7202    MedicationOrder res = new MedicationOrder();
7203    parseDomainResourceProperties(json, res);
7204    if (json.has("identifier")) {
7205      JsonArray array = json.getAsJsonArray("identifier");
7206      for (int i = 0; i < array.size(); i++) {
7207        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7208      }
7209    };
7210    if (json.has("dateWritten"))
7211      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
7212    if (json.has("_dateWritten"))
7213      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
7214    if (json.has("status"))
7215      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationOrder.MedicationOrderStatus.NULL, new MedicationOrder.MedicationOrderStatusEnumFactory()));
7216    if (json.has("_status"))
7217      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7218    if (json.has("dateEnded"))
7219      res.setDateEndedElement(parseDateTime(json.get("dateEnded").getAsString()));
7220    if (json.has("_dateEnded"))
7221      parseElementProperties(json.getAsJsonObject("_dateEnded"), res.getDateEndedElement());
7222    if (json.has("reasonEnded"))
7223      res.setReasonEnded(parseCodeableConcept(json.getAsJsonObject("reasonEnded")));
7224    if (json.has("patient"))
7225      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7226    if (json.has("prescriber"))
7227      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
7228    if (json.has("encounter"))
7229      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7230    Type reason = parseType("reason", json);
7231    if (reason != null)
7232      res.setReason(reason);
7233    if (json.has("note"))
7234      res.setNoteElement(parseString(json.get("note").getAsString()));
7235    if (json.has("_note"))
7236      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7237    Type medication = parseType("medication", json);
7238    if (medication != null)
7239      res.setMedication(medication);
7240    if (json.has("dosageInstruction")) {
7241      JsonArray array = json.getAsJsonArray("dosageInstruction");
7242      for (int i = 0; i < array.size(); i++) {
7243        res.getDosageInstruction().add(parseMedicationOrderMedicationOrderDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
7244      }
7245    };
7246    if (json.has("dispenseRequest"))
7247      res.setDispenseRequest(parseMedicationOrderMedicationOrderDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
7248    if (json.has("substitution"))
7249      res.setSubstitution(parseMedicationOrderMedicationOrderSubstitutionComponent(json.getAsJsonObject("substitution"), res));
7250    if (json.has("priorPrescription"))
7251      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
7252    return res;
7253  }
7254
7255  protected MedicationOrder.MedicationOrderDosageInstructionComponent parseMedicationOrderMedicationOrderDosageInstructionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7256    MedicationOrder.MedicationOrderDosageInstructionComponent res = new MedicationOrder.MedicationOrderDosageInstructionComponent();
7257    parseBackboneProperties(json, res);
7258    if (json.has("text"))
7259      res.setTextElement(parseString(json.get("text").getAsString()));
7260    if (json.has("_text"))
7261      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7262    if (json.has("additionalInstructions"))
7263      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
7264    if (json.has("timing"))
7265      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7266    Type asNeeded = parseType("asNeeded", json);
7267    if (asNeeded != null)
7268      res.setAsNeeded(asNeeded);
7269    Type site = parseType("site", json);
7270    if (site != null)
7271      res.setSite(site);
7272    if (json.has("route"))
7273      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7274    if (json.has("method"))
7275      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7276    Type dose = parseType("dose", json);
7277    if (dose != null)
7278      res.setDose(dose);
7279    Type rate = parseType("rate", json);
7280    if (rate != null)
7281      res.setRate(rate);
7282    if (json.has("maxDosePerPeriod"))
7283      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7284    return res;
7285  }
7286
7287  protected MedicationOrder.MedicationOrderDispenseRequestComponent parseMedicationOrderMedicationOrderDispenseRequestComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7288    MedicationOrder.MedicationOrderDispenseRequestComponent res = new MedicationOrder.MedicationOrderDispenseRequestComponent();
7289    parseBackboneProperties(json, res);
7290    Type medication = parseType("medication", json);
7291    if (medication != null)
7292      res.setMedication(medication);
7293    if (json.has("validityPeriod"))
7294      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
7295    if (json.has("numberOfRepeatsAllowed"))
7296      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
7297    if (json.has("_numberOfRepeatsAllowed"))
7298      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
7299    if (json.has("quantity"))
7300      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7301    if (json.has("expectedSupplyDuration"))
7302      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
7303    return res;
7304  }
7305
7306  protected MedicationOrder.MedicationOrderSubstitutionComponent parseMedicationOrderMedicationOrderSubstitutionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7307    MedicationOrder.MedicationOrderSubstitutionComponent res = new MedicationOrder.MedicationOrderSubstitutionComponent();
7308    parseBackboneProperties(json, res);
7309    if (json.has("type"))
7310      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7311    if (json.has("reason"))
7312      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
7313    return res;
7314  }
7315
7316  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
7317    MedicationStatement res = new MedicationStatement();
7318    parseDomainResourceProperties(json, res);
7319    if (json.has("identifier")) {
7320      JsonArray array = json.getAsJsonArray("identifier");
7321      for (int i = 0; i < array.size(); i++) {
7322        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7323      }
7324    };
7325    if (json.has("patient"))
7326      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7327    if (json.has("informationSource"))
7328      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
7329    if (json.has("dateAsserted"))
7330      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
7331    if (json.has("_dateAsserted"))
7332      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
7333    if (json.has("status"))
7334      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
7335    if (json.has("_status"))
7336      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7337    if (json.has("wasNotTaken"))
7338      res.setWasNotTakenElement(parseBoolean(json.get("wasNotTaken").getAsBoolean()));
7339    if (json.has("_wasNotTaken"))
7340      parseElementProperties(json.getAsJsonObject("_wasNotTaken"), res.getWasNotTakenElement());
7341    if (json.has("reasonNotTaken")) {
7342      JsonArray array = json.getAsJsonArray("reasonNotTaken");
7343      for (int i = 0; i < array.size(); i++) {
7344        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7345      }
7346    };
7347    Type reasonForUse = parseType("reasonForUse", json);
7348    if (reasonForUse != null)
7349      res.setReasonForUse(reasonForUse);
7350    Type effective = parseType("effective", json);
7351    if (effective != null)
7352      res.setEffective(effective);
7353    if (json.has("note"))
7354      res.setNoteElement(parseString(json.get("note").getAsString()));
7355    if (json.has("_note"))
7356      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7357    if (json.has("supportingInformation")) {
7358      JsonArray array = json.getAsJsonArray("supportingInformation");
7359      for (int i = 0; i < array.size(); i++) {
7360        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
7361      }
7362    };
7363    Type medication = parseType("medication", json);
7364    if (medication != null)
7365      res.setMedication(medication);
7366    if (json.has("dosage")) {
7367      JsonArray array = json.getAsJsonArray("dosage");
7368      for (int i = 0; i < array.size(); i++) {
7369        res.getDosage().add(parseMedicationStatementMedicationStatementDosageComponent(array.get(i).getAsJsonObject(), res));
7370      }
7371    };
7372    return res;
7373  }
7374
7375  protected MedicationStatement.MedicationStatementDosageComponent parseMedicationStatementMedicationStatementDosageComponent(JsonObject json, MedicationStatement owner) throws IOException, FHIRFormatError {
7376    MedicationStatement.MedicationStatementDosageComponent res = new MedicationStatement.MedicationStatementDosageComponent();
7377    parseBackboneProperties(json, res);
7378    if (json.has("text"))
7379      res.setTextElement(parseString(json.get("text").getAsString()));
7380    if (json.has("_text"))
7381      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7382    if (json.has("timing"))
7383      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7384    Type asNeeded = parseType("asNeeded", json);
7385    if (asNeeded != null)
7386      res.setAsNeeded(asNeeded);
7387    Type site = parseType("site", json);
7388    if (site != null)
7389      res.setSite(site);
7390    if (json.has("route"))
7391      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7392    if (json.has("method"))
7393      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7394    Type quantity = parseType("quantity", json);
7395    if (quantity != null)
7396      res.setQuantity(quantity);
7397    Type rate = parseType("rate", json);
7398    if (rate != null)
7399      res.setRate(rate);
7400    if (json.has("maxDosePerPeriod"))
7401      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7402    return res;
7403  }
7404
7405  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
7406    MessageHeader res = new MessageHeader();
7407    parseDomainResourceProperties(json, res);
7408    if (json.has("timestamp"))
7409      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
7410    if (json.has("_timestamp"))
7411      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
7412    if (json.has("event"))
7413      res.setEvent(parseCoding(json.getAsJsonObject("event")));
7414    if (json.has("response"))
7415      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
7416    if (json.has("source"))
7417      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
7418    if (json.has("destination")) {
7419      JsonArray array = json.getAsJsonArray("destination");
7420      for (int i = 0; i < array.size(); i++) {
7421        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
7422      }
7423    };
7424    if (json.has("enterer"))
7425      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
7426    if (json.has("author"))
7427      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7428    if (json.has("receiver"))
7429      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
7430    if (json.has("responsible"))
7431      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
7432    if (json.has("reason"))
7433      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
7434    if (json.has("data")) {
7435      JsonArray array = json.getAsJsonArray("data");
7436      for (int i = 0; i < array.size(); i++) {
7437        res.getData().add(parseReference(array.get(i).getAsJsonObject()));
7438      }
7439    };
7440    return res;
7441  }
7442
7443  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7444    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
7445    parseBackboneProperties(json, res);
7446    if (json.has("identifier"))
7447      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
7448    if (json.has("_identifier"))
7449      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
7450    if (json.has("code"))
7451      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
7452    if (json.has("_code"))
7453      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7454    if (json.has("details"))
7455      res.setDetails(parseReference(json.getAsJsonObject("details")));
7456    return res;
7457  }
7458
7459  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7460    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
7461    parseBackboneProperties(json, res);
7462    if (json.has("name"))
7463      res.setNameElement(parseString(json.get("name").getAsString()));
7464    if (json.has("_name"))
7465      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7466    if (json.has("software"))
7467      res.setSoftwareElement(parseString(json.get("software").getAsString()));
7468    if (json.has("_software"))
7469      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
7470    if (json.has("version"))
7471      res.setVersionElement(parseString(json.get("version").getAsString()));
7472    if (json.has("_version"))
7473      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7474    if (json.has("contact"))
7475      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
7476    if (json.has("endpoint"))
7477      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
7478    if (json.has("_endpoint"))
7479      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
7480    return res;
7481  }
7482
7483  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7484    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
7485    parseBackboneProperties(json, res);
7486    if (json.has("name"))
7487      res.setNameElement(parseString(json.get("name").getAsString()));
7488    if (json.has("_name"))
7489      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7490    if (json.has("target"))
7491      res.setTarget(parseReference(json.getAsJsonObject("target")));
7492    if (json.has("endpoint"))
7493      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
7494    if (json.has("_endpoint"))
7495      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
7496    return res;
7497  }
7498
7499  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
7500    NamingSystem res = new NamingSystem();
7501    parseDomainResourceProperties(json, res);
7502    if (json.has("name"))
7503      res.setNameElement(parseString(json.get("name").getAsString()));
7504    if (json.has("_name"))
7505      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7506    if (json.has("status"))
7507      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
7508    if (json.has("_status"))
7509      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7510    if (json.has("kind"))
7511      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
7512    if (json.has("_kind"))
7513      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
7514    if (json.has("publisher"))
7515      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7516    if (json.has("_publisher"))
7517      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7518    if (json.has("contact")) {
7519      JsonArray array = json.getAsJsonArray("contact");
7520      for (int i = 0; i < array.size(); i++) {
7521        res.getContact().add(parseNamingSystemNamingSystemContactComponent(array.get(i).getAsJsonObject(), res));
7522      }
7523    };
7524    if (json.has("responsible"))
7525      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
7526    if (json.has("_responsible"))
7527      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
7528    if (json.has("date"))
7529      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7530    if (json.has("_date"))
7531      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7532    if (json.has("type"))
7533      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7534    if (json.has("description"))
7535      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7536    if (json.has("_description"))
7537      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7538    if (json.has("useContext")) {
7539      JsonArray array = json.getAsJsonArray("useContext");
7540      for (int i = 0; i < array.size(); i++) {
7541        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7542      }
7543    };
7544    if (json.has("usage"))
7545      res.setUsageElement(parseString(json.get("usage").getAsString()));
7546    if (json.has("_usage"))
7547      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
7548    if (json.has("uniqueId")) {
7549      JsonArray array = json.getAsJsonArray("uniqueId");
7550      for (int i = 0; i < array.size(); i++) {
7551        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
7552      }
7553    };
7554    if (json.has("replacedBy"))
7555      res.setReplacedBy(parseReference(json.getAsJsonObject("replacedBy")));
7556    return res;
7557  }
7558
7559  protected NamingSystem.NamingSystemContactComponent parseNamingSystemNamingSystemContactComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
7560    NamingSystem.NamingSystemContactComponent res = new NamingSystem.NamingSystemContactComponent();
7561    parseBackboneProperties(json, res);
7562    if (json.has("name"))
7563      res.setNameElement(parseString(json.get("name").getAsString()));
7564    if (json.has("_name"))
7565      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7566    if (json.has("telecom")) {
7567      JsonArray array = json.getAsJsonArray("telecom");
7568      for (int i = 0; i < array.size(); i++) {
7569        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
7570      }
7571    };
7572    return res;
7573  }
7574
7575  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
7576    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
7577    parseBackboneProperties(json, res);
7578    if (json.has("type"))
7579      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
7580    if (json.has("_type"))
7581      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7582    if (json.has("value"))
7583      res.setValueElement(parseString(json.get("value").getAsString()));
7584    if (json.has("_value"))
7585      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7586    if (json.has("preferred"))
7587      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
7588    if (json.has("_preferred"))
7589      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
7590    if (json.has("period"))
7591      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7592    return res;
7593  }
7594
7595  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
7596    NutritionOrder res = new NutritionOrder();
7597    parseDomainResourceProperties(json, res);
7598    if (json.has("patient"))
7599      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7600    if (json.has("orderer"))
7601      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
7602    if (json.has("identifier")) {
7603      JsonArray array = json.getAsJsonArray("identifier");
7604      for (int i = 0; i < array.size(); i++) {
7605        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7606      }
7607    };
7608    if (json.has("encounter"))
7609      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7610    if (json.has("dateTime"))
7611      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7612    if (json.has("_dateTime"))
7613      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
7614    if (json.has("status"))
7615      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
7616    if (json.has("_status"))
7617      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7618    if (json.has("allergyIntolerance")) {
7619      JsonArray array = json.getAsJsonArray("allergyIntolerance");
7620      for (int i = 0; i < array.size(); i++) {
7621        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
7622      }
7623    };
7624    if (json.has("foodPreferenceModifier")) {
7625      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
7626      for (int i = 0; i < array.size(); i++) {
7627        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7628      }
7629    };
7630    if (json.has("excludeFoodModifier")) {
7631      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
7632      for (int i = 0; i < array.size(); i++) {
7633        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7634      }
7635    };
7636    if (json.has("oralDiet"))
7637      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
7638    if (json.has("supplement")) {
7639      JsonArray array = json.getAsJsonArray("supplement");
7640      for (int i = 0; i < array.size(); i++) {
7641        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
7642      }
7643    };
7644    if (json.has("enteralFormula"))
7645      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
7646    return res;
7647  }
7648
7649  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7650    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
7651    parseBackboneProperties(json, res);
7652    if (json.has("type")) {
7653      JsonArray array = json.getAsJsonArray("type");
7654      for (int i = 0; i < array.size(); i++) {
7655        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7656      }
7657    };
7658    if (json.has("schedule")) {
7659      JsonArray array = json.getAsJsonArray("schedule");
7660      for (int i = 0; i < array.size(); i++) {
7661        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
7662      }
7663    };
7664    if (json.has("nutrient")) {
7665      JsonArray array = json.getAsJsonArray("nutrient");
7666      for (int i = 0; i < array.size(); i++) {
7667        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
7668      }
7669    };
7670    if (json.has("texture")) {
7671      JsonArray array = json.getAsJsonArray("texture");
7672      for (int i = 0; i < array.size(); i++) {
7673        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
7674      }
7675    };
7676    if (json.has("fluidConsistencyType")) {
7677      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
7678      for (int i = 0; i < array.size(); i++) {
7679        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7680      }
7681    };
7682    if (json.has("instruction"))
7683      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
7684    if (json.has("_instruction"))
7685      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
7686    return res;
7687  }
7688
7689  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7690    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
7691    parseBackboneProperties(json, res);
7692    if (json.has("modifier"))
7693      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
7694    if (json.has("amount"))
7695      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
7696    return res;
7697  }
7698
7699  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7700    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
7701    parseBackboneProperties(json, res);
7702    if (json.has("modifier"))
7703      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
7704    if (json.has("foodType"))
7705      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
7706    return res;
7707  }
7708
7709  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7710    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
7711    parseBackboneProperties(json, res);
7712    if (json.has("type"))
7713      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7714    if (json.has("productName"))
7715      res.setProductNameElement(parseString(json.get("productName").getAsString()));
7716    if (json.has("_productName"))
7717      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
7718    if (json.has("schedule")) {
7719      JsonArray array = json.getAsJsonArray("schedule");
7720      for (int i = 0; i < array.size(); i++) {
7721        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
7722      }
7723    };
7724    if (json.has("quantity"))
7725      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7726    if (json.has("instruction"))
7727      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
7728    if (json.has("_instruction"))
7729      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
7730    return res;
7731  }
7732
7733  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7734    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
7735    parseBackboneProperties(json, res);
7736    if (json.has("baseFormulaType"))
7737      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
7738    if (json.has("baseFormulaProductName"))
7739      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
7740    if (json.has("_baseFormulaProductName"))
7741      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
7742    if (json.has("additiveType"))
7743      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
7744    if (json.has("additiveProductName"))
7745      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
7746    if (json.has("_additiveProductName"))
7747      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
7748    if (json.has("caloricDensity"))
7749      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
7750    if (json.has("routeofAdministration"))
7751      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
7752    if (json.has("administration")) {
7753      JsonArray array = json.getAsJsonArray("administration");
7754      for (int i = 0; i < array.size(); i++) {
7755        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
7756      }
7757    };
7758    if (json.has("maxVolumeToDeliver"))
7759      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
7760    if (json.has("administrationInstruction"))
7761      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
7762    if (json.has("_administrationInstruction"))
7763      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
7764    return res;
7765  }
7766
7767  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7768    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
7769    parseBackboneProperties(json, res);
7770    if (json.has("schedule"))
7771      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
7772    if (json.has("quantity"))
7773      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7774    Type rate = parseType("rate", json);
7775    if (rate != null)
7776      res.setRate(rate);
7777    return res;
7778  }
7779
7780  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
7781    Observation res = new Observation();
7782    parseDomainResourceProperties(json, res);
7783    if (json.has("identifier")) {
7784      JsonArray array = json.getAsJsonArray("identifier");
7785      for (int i = 0; i < array.size(); i++) {
7786        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7787      }
7788    };
7789    if (json.has("status"))
7790      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
7791    if (json.has("_status"))
7792      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7793    if (json.has("category"))
7794      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7795    if (json.has("code"))
7796      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7797    if (json.has("subject"))
7798      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7799    if (json.has("encounter"))
7800      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7801    Type effective = parseType("effective", json);
7802    if (effective != null)
7803      res.setEffective(effective);
7804    if (json.has("issued"))
7805      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7806    if (json.has("_issued"))
7807      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7808    if (json.has("performer")) {
7809      JsonArray array = json.getAsJsonArray("performer");
7810      for (int i = 0; i < array.size(); i++) {
7811        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7812      }
7813    };
7814    Type value = parseType("value", json);
7815    if (value != null)
7816      res.setValue(value);
7817    if (json.has("dataAbsentReason"))
7818      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
7819    if (json.has("interpretation"))
7820      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
7821    if (json.has("comments"))
7822      res.setCommentsElement(parseString(json.get("comments").getAsString()));
7823    if (json.has("_comments"))
7824      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
7825    if (json.has("bodySite"))
7826      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
7827    if (json.has("method"))
7828      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7829    if (json.has("specimen"))
7830      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
7831    if (json.has("device"))
7832      res.setDevice(parseReference(json.getAsJsonObject("device")));
7833    if (json.has("referenceRange")) {
7834      JsonArray array = json.getAsJsonArray("referenceRange");
7835      for (int i = 0; i < array.size(); i++) {
7836        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
7837      }
7838    };
7839    if (json.has("related")) {
7840      JsonArray array = json.getAsJsonArray("related");
7841      for (int i = 0; i < array.size(); i++) {
7842        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
7843      }
7844    };
7845    if (json.has("component")) {
7846      JsonArray array = json.getAsJsonArray("component");
7847      for (int i = 0; i < array.size(); i++) {
7848        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
7849      }
7850    };
7851    return res;
7852  }
7853
7854  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7855    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
7856    parseBackboneProperties(json, res);
7857    if (json.has("low"))
7858      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
7859    if (json.has("high"))
7860      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
7861    if (json.has("meaning"))
7862      res.setMeaning(parseCodeableConcept(json.getAsJsonObject("meaning")));
7863    if (json.has("age"))
7864      res.setAge(parseRange(json.getAsJsonObject("age")));
7865    if (json.has("text"))
7866      res.setTextElement(parseString(json.get("text").getAsString()));
7867    if (json.has("_text"))
7868      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7869    return res;
7870  }
7871
7872  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7873    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
7874    parseBackboneProperties(json, res);
7875    if (json.has("type"))
7876      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
7877    if (json.has("_type"))
7878      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7879    if (json.has("target"))
7880      res.setTarget(parseReference(json.getAsJsonObject("target")));
7881    return res;
7882  }
7883
7884  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7885    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
7886    parseBackboneProperties(json, res);
7887    if (json.has("code"))
7888      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7889    Type value = parseType("value", json);
7890    if (value != null)
7891      res.setValue(value);
7892    if (json.has("dataAbsentReason"))
7893      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
7894    if (json.has("referenceRange")) {
7895      JsonArray array = json.getAsJsonArray("referenceRange");
7896      for (int i = 0; i < array.size(); i++) {
7897        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
7898      }
7899    };
7900    return res;
7901  }
7902
7903  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
7904    OperationDefinition res = new OperationDefinition();
7905    parseDomainResourceProperties(json, res);
7906    if (json.has("url"))
7907      res.setUrlElement(parseUri(json.get("url").getAsString()));
7908    if (json.has("_url"))
7909      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7910    if (json.has("version"))
7911      res.setVersionElement(parseString(json.get("version").getAsString()));
7912    if (json.has("_version"))
7913      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7914    if (json.has("name"))
7915      res.setNameElement(parseString(json.get("name").getAsString()));
7916    if (json.has("_name"))
7917      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7918    if (json.has("status"))
7919      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
7920    if (json.has("_status"))
7921      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7922    if (json.has("kind"))
7923      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
7924    if (json.has("_kind"))
7925      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
7926    if (json.has("experimental"))
7927      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7928    if (json.has("_experimental"))
7929      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7930    if (json.has("publisher"))
7931      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7932    if (json.has("_publisher"))
7933      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7934    if (json.has("contact")) {
7935      JsonArray array = json.getAsJsonArray("contact");
7936      for (int i = 0; i < array.size(); i++) {
7937        res.getContact().add(parseOperationDefinitionOperationDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
7938      }
7939    };
7940    if (json.has("date"))
7941      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7942    if (json.has("_date"))
7943      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7944    if (json.has("description"))
7945      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7946    if (json.has("_description"))
7947      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7948    if (json.has("requirements"))
7949      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
7950    if (json.has("_requirements"))
7951      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
7952    if (json.has("idempotent"))
7953      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
7954    if (json.has("_idempotent"))
7955      parseElementProperties(json.getAsJsonObject("_idempotent"), res.getIdempotentElement());
7956    if (json.has("code"))
7957      res.setCodeElement(parseCode(json.get("code").getAsString()));
7958    if (json.has("_code"))
7959      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7960    if (json.has("notes"))
7961      res.setNotesElement(parseString(json.get("notes").getAsString()));
7962    if (json.has("_notes"))
7963      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
7964    if (json.has("base"))
7965      res.setBase(parseReference(json.getAsJsonObject("base")));
7966    if (json.has("system"))
7967      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
7968    if (json.has("_system"))
7969      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
7970    if (json.has("type")) {
7971      JsonArray array = json.getAsJsonArray("type");
7972      for (int i = 0; i < array.size(); i++) {
7973        res.getType().add(parseCode(array.get(i).getAsString()));
7974      }
7975    };
7976    if (json.has("_type")) {
7977      JsonArray array = json.getAsJsonArray("_type");
7978      for (int i = 0; i < array.size(); i++) {
7979        if (i == res.getType().size())
7980          res.getType().add(parseCode(null));
7981        if (array.get(i) instanceof JsonObject) 
7982          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
7983      }
7984    };
7985    if (json.has("instance"))
7986      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
7987    if (json.has("_instance"))
7988      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
7989    if (json.has("parameter")) {
7990      JsonArray array = json.getAsJsonArray("parameter");
7991      for (int i = 0; i < array.size(); i++) {
7992        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
7993      }
7994    };
7995    return res;
7996  }
7997
7998  protected OperationDefinition.OperationDefinitionContactComponent parseOperationDefinitionOperationDefinitionContactComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
7999    OperationDefinition.OperationDefinitionContactComponent res = new OperationDefinition.OperationDefinitionContactComponent();
8000    parseBackboneProperties(json, res);
8001    if (json.has("name"))
8002      res.setNameElement(parseString(json.get("name").getAsString()));
8003    if (json.has("_name"))
8004      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8005    if (json.has("telecom")) {
8006      JsonArray array = json.getAsJsonArray("telecom");
8007      for (int i = 0; i < array.size(); i++) {
8008        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8009      }
8010    };
8011    return res;
8012  }
8013
8014  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
8015    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
8016    parseBackboneProperties(json, res);
8017    if (json.has("name"))
8018      res.setNameElement(parseCode(json.get("name").getAsString()));
8019    if (json.has("_name"))
8020      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8021    if (json.has("use"))
8022      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
8023    if (json.has("_use"))
8024      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
8025    if (json.has("min"))
8026      res.setMinElement(parseInteger(json.get("min").getAsLong()));
8027    if (json.has("_min"))
8028      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
8029    if (json.has("max"))
8030      res.setMaxElement(parseString(json.get("max").getAsString()));
8031    if (json.has("_max"))
8032      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
8033    if (json.has("documentation"))
8034      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
8035    if (json.has("_documentation"))
8036      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
8037    if (json.has("type"))
8038      res.setTypeElement(parseCode(json.get("type").getAsString()));
8039    if (json.has("_type"))
8040      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8041    if (json.has("profile"))
8042      res.setProfile(parseReference(json.getAsJsonObject("profile")));
8043    if (json.has("binding"))
8044      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
8045    if (json.has("part")) {
8046      JsonArray array = json.getAsJsonArray("part");
8047      for (int i = 0; i < array.size(); i++) {
8048        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
8049      }
8050    };
8051    return res;
8052  }
8053
8054  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
8055    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
8056    parseBackboneProperties(json, res);
8057    if (json.has("strength"))
8058      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
8059    if (json.has("_strength"))
8060      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
8061    Type valueSet = parseType("valueSet", json);
8062    if (valueSet != null)
8063      res.setValueSet(valueSet);
8064    return res;
8065  }
8066
8067  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
8068    OperationOutcome res = new OperationOutcome();
8069    parseDomainResourceProperties(json, res);
8070    if (json.has("issue")) {
8071      JsonArray array = json.getAsJsonArray("issue");
8072      for (int i = 0; i < array.size(); i++) {
8073        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
8074      }
8075    };
8076    return res;
8077  }
8078
8079  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
8080    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
8081    parseBackboneProperties(json, res);
8082    if (json.has("severity"))
8083      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
8084    if (json.has("_severity"))
8085      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
8086    if (json.has("code"))
8087      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
8088    if (json.has("_code"))
8089      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8090    if (json.has("details"))
8091      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
8092    if (json.has("diagnostics"))
8093      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
8094    if (json.has("_diagnostics"))
8095      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
8096    if (json.has("location")) {
8097      JsonArray array = json.getAsJsonArray("location");
8098      for (int i = 0; i < array.size(); i++) {
8099        res.getLocation().add(parseString(array.get(i).getAsString()));
8100      }
8101    };
8102    if (json.has("_location")) {
8103      JsonArray array = json.getAsJsonArray("_location");
8104      for (int i = 0; i < array.size(); i++) {
8105        if (i == res.getLocation().size())
8106          res.getLocation().add(parseString(null));
8107        if (array.get(i) instanceof JsonObject) 
8108          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
8109      }
8110    };
8111    return res;
8112  }
8113
8114  protected Order parseOrder(JsonObject json) throws IOException, FHIRFormatError {
8115    Order res = new Order();
8116    parseDomainResourceProperties(json, res);
8117    if (json.has("identifier")) {
8118      JsonArray array = json.getAsJsonArray("identifier");
8119      for (int i = 0; i < array.size(); i++) {
8120        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8121      }
8122    };
8123    if (json.has("date"))
8124      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8125    if (json.has("_date"))
8126      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8127    if (json.has("subject"))
8128      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8129    if (json.has("source"))
8130      res.setSource(parseReference(json.getAsJsonObject("source")));
8131    if (json.has("target"))
8132      res.setTarget(parseReference(json.getAsJsonObject("target")));
8133    Type reason = parseType("reason", json);
8134    if (reason != null)
8135      res.setReason(reason);
8136    if (json.has("when"))
8137      res.setWhen(parseOrderOrderWhenComponent(json.getAsJsonObject("when"), res));
8138    if (json.has("detail")) {
8139      JsonArray array = json.getAsJsonArray("detail");
8140      for (int i = 0; i < array.size(); i++) {
8141        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8142      }
8143    };
8144    return res;
8145  }
8146
8147  protected Order.OrderWhenComponent parseOrderOrderWhenComponent(JsonObject json, Order owner) throws IOException, FHIRFormatError {
8148    Order.OrderWhenComponent res = new Order.OrderWhenComponent();
8149    parseBackboneProperties(json, res);
8150    if (json.has("code"))
8151      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8152    if (json.has("schedule"))
8153      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
8154    return res;
8155  }
8156
8157  protected OrderResponse parseOrderResponse(JsonObject json) throws IOException, FHIRFormatError {
8158    OrderResponse res = new OrderResponse();
8159    parseDomainResourceProperties(json, res);
8160    if (json.has("identifier")) {
8161      JsonArray array = json.getAsJsonArray("identifier");
8162      for (int i = 0; i < array.size(); i++) {
8163        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8164      }
8165    };
8166    if (json.has("request"))
8167      res.setRequest(parseReference(json.getAsJsonObject("request")));
8168    if (json.has("date"))
8169      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8170    if (json.has("_date"))
8171      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8172    if (json.has("who"))
8173      res.setWho(parseReference(json.getAsJsonObject("who")));
8174    if (json.has("orderStatus"))
8175      res.setOrderStatusElement(parseEnumeration(json.get("orderStatus").getAsString(), OrderResponse.OrderStatus.NULL, new OrderResponse.OrderStatusEnumFactory()));
8176    if (json.has("_orderStatus"))
8177      parseElementProperties(json.getAsJsonObject("_orderStatus"), res.getOrderStatusElement());
8178    if (json.has("description"))
8179      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8180    if (json.has("_description"))
8181      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8182    if (json.has("fulfillment")) {
8183      JsonArray array = json.getAsJsonArray("fulfillment");
8184      for (int i = 0; i < array.size(); i++) {
8185        res.getFulfillment().add(parseReference(array.get(i).getAsJsonObject()));
8186      }
8187    };
8188    return res;
8189  }
8190
8191  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
8192    Organization res = new Organization();
8193    parseDomainResourceProperties(json, res);
8194    if (json.has("identifier")) {
8195      JsonArray array = json.getAsJsonArray("identifier");
8196      for (int i = 0; i < array.size(); i++) {
8197        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8198      }
8199    };
8200    if (json.has("active"))
8201      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8202    if (json.has("_active"))
8203      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8204    if (json.has("type"))
8205      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8206    if (json.has("name"))
8207      res.setNameElement(parseString(json.get("name").getAsString()));
8208    if (json.has("_name"))
8209      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8210    if (json.has("telecom")) {
8211      JsonArray array = json.getAsJsonArray("telecom");
8212      for (int i = 0; i < array.size(); i++) {
8213        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8214      }
8215    };
8216    if (json.has("address")) {
8217      JsonArray array = json.getAsJsonArray("address");
8218      for (int i = 0; i < array.size(); i++) {
8219        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8220      }
8221    };
8222    if (json.has("partOf"))
8223      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
8224    if (json.has("contact")) {
8225      JsonArray array = json.getAsJsonArray("contact");
8226      for (int i = 0; i < array.size(); i++) {
8227        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
8228      }
8229    };
8230    return res;
8231  }
8232
8233  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
8234    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
8235    parseBackboneProperties(json, res);
8236    if (json.has("purpose"))
8237      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
8238    if (json.has("name"))
8239      res.setName(parseHumanName(json.getAsJsonObject("name")));
8240    if (json.has("telecom")) {
8241      JsonArray array = json.getAsJsonArray("telecom");
8242      for (int i = 0; i < array.size(); i++) {
8243        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8244      }
8245    };
8246    if (json.has("address"))
8247      res.setAddress(parseAddress(json.getAsJsonObject("address")));
8248    return res;
8249  }
8250
8251  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
8252    Patient res = new Patient();
8253    parseDomainResourceProperties(json, res);
8254    if (json.has("identifier")) {
8255      JsonArray array = json.getAsJsonArray("identifier");
8256      for (int i = 0; i < array.size(); i++) {
8257        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8258      }
8259    };
8260    if (json.has("active"))
8261      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8262    if (json.has("_active"))
8263      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8264    if (json.has("name")) {
8265      JsonArray array = json.getAsJsonArray("name");
8266      for (int i = 0; i < array.size(); i++) {
8267        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
8268      }
8269    };
8270    if (json.has("telecom")) {
8271      JsonArray array = json.getAsJsonArray("telecom");
8272      for (int i = 0; i < array.size(); i++) {
8273        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8274      }
8275    };
8276    if (json.has("gender"))
8277      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8278    if (json.has("_gender"))
8279      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8280    if (json.has("birthDate"))
8281      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8282    if (json.has("_birthDate"))
8283      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8284    Type deceased = parseType("deceased", json);
8285    if (deceased != null)
8286      res.setDeceased(deceased);
8287    if (json.has("address")) {
8288      JsonArray array = json.getAsJsonArray("address");
8289      for (int i = 0; i < array.size(); i++) {
8290        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8291      }
8292    };
8293    if (json.has("maritalStatus"))
8294      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
8295    Type multipleBirth = parseType("multipleBirth", json);
8296    if (multipleBirth != null)
8297      res.setMultipleBirth(multipleBirth);
8298    if (json.has("photo")) {
8299      JsonArray array = json.getAsJsonArray("photo");
8300      for (int i = 0; i < array.size(); i++) {
8301        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
8302      }
8303    };
8304    if (json.has("contact")) {
8305      JsonArray array = json.getAsJsonArray("contact");
8306      for (int i = 0; i < array.size(); i++) {
8307        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
8308      }
8309    };
8310    if (json.has("animal"))
8311      res.setAnimal(parsePatientAnimalComponent(json.getAsJsonObject("animal"), res));
8312    if (json.has("communication")) {
8313      JsonArray array = json.getAsJsonArray("communication");
8314      for (int i = 0; i < array.size(); i++) {
8315        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
8316      }
8317    };
8318    if (json.has("careProvider")) {
8319      JsonArray array = json.getAsJsonArray("careProvider");
8320      for (int i = 0; i < array.size(); i++) {
8321        res.getCareProvider().add(parseReference(array.get(i).getAsJsonObject()));
8322      }
8323    };
8324    if (json.has("managingOrganization"))
8325      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8326    if (json.has("link")) {
8327      JsonArray array = json.getAsJsonArray("link");
8328      for (int i = 0; i < array.size(); i++) {
8329        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
8330      }
8331    };
8332    return res;
8333  }
8334
8335  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8336    Patient.ContactComponent res = new Patient.ContactComponent();
8337    parseBackboneProperties(json, res);
8338    if (json.has("relationship")) {
8339      JsonArray array = json.getAsJsonArray("relationship");
8340      for (int i = 0; i < array.size(); i++) {
8341        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8342      }
8343    };
8344    if (json.has("name"))
8345      res.setName(parseHumanName(json.getAsJsonObject("name")));
8346    if (json.has("telecom")) {
8347      JsonArray array = json.getAsJsonArray("telecom");
8348      for (int i = 0; i < array.size(); i++) {
8349        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8350      }
8351    };
8352    if (json.has("address"))
8353      res.setAddress(parseAddress(json.getAsJsonObject("address")));
8354    if (json.has("gender"))
8355      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8356    if (json.has("_gender"))
8357      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8358    if (json.has("organization"))
8359      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8360    if (json.has("period"))
8361      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8362    return res;
8363  }
8364
8365  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8366    Patient.AnimalComponent res = new Patient.AnimalComponent();
8367    parseBackboneProperties(json, res);
8368    if (json.has("species"))
8369      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
8370    if (json.has("breed"))
8371      res.setBreed(parseCodeableConcept(json.getAsJsonObject("breed")));
8372    if (json.has("genderStatus"))
8373      res.setGenderStatus(parseCodeableConcept(json.getAsJsonObject("genderStatus")));
8374    return res;
8375  }
8376
8377  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8378    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
8379    parseBackboneProperties(json, res);
8380    if (json.has("language"))
8381      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
8382    if (json.has("preferred"))
8383      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
8384    if (json.has("_preferred"))
8385      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
8386    return res;
8387  }
8388
8389  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8390    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
8391    parseBackboneProperties(json, res);
8392    if (json.has("other"))
8393      res.setOther(parseReference(json.getAsJsonObject("other")));
8394    if (json.has("type"))
8395      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
8396    if (json.has("_type"))
8397      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8398    return res;
8399  }
8400
8401  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
8402    PaymentNotice res = new PaymentNotice();
8403    parseDomainResourceProperties(json, res);
8404    if (json.has("identifier")) {
8405      JsonArray array = json.getAsJsonArray("identifier");
8406      for (int i = 0; i < array.size(); i++) {
8407        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8408      }
8409    };
8410    if (json.has("ruleset"))
8411      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8412    if (json.has("originalRuleset"))
8413      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8414    if (json.has("created"))
8415      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8416    if (json.has("_created"))
8417      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8418    if (json.has("target"))
8419      res.setTarget(parseReference(json.getAsJsonObject("target")));
8420    if (json.has("provider"))
8421      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8422    if (json.has("organization"))
8423      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8424    if (json.has("request"))
8425      res.setRequest(parseReference(json.getAsJsonObject("request")));
8426    if (json.has("response"))
8427      res.setResponse(parseReference(json.getAsJsonObject("response")));
8428    if (json.has("paymentStatus"))
8429      res.setPaymentStatus(parseCoding(json.getAsJsonObject("paymentStatus")));
8430    return res;
8431  }
8432
8433  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
8434    PaymentReconciliation res = new PaymentReconciliation();
8435    parseDomainResourceProperties(json, res);
8436    if (json.has("identifier")) {
8437      JsonArray array = json.getAsJsonArray("identifier");
8438      for (int i = 0; i < array.size(); i++) {
8439        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8440      }
8441    };
8442    if (json.has("request"))
8443      res.setRequest(parseReference(json.getAsJsonObject("request")));
8444    if (json.has("outcome"))
8445      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8446    if (json.has("_outcome"))
8447      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8448    if (json.has("disposition"))
8449      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8450    if (json.has("_disposition"))
8451      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8452    if (json.has("ruleset"))
8453      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8454    if (json.has("originalRuleset"))
8455      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8456    if (json.has("created"))
8457      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8458    if (json.has("_created"))
8459      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8460    if (json.has("period"))
8461      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8462    if (json.has("organization"))
8463      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8464    if (json.has("requestProvider"))
8465      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8466    if (json.has("requestOrganization"))
8467      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
8468    if (json.has("detail")) {
8469      JsonArray array = json.getAsJsonArray("detail");
8470      for (int i = 0; i < array.size(); i++) {
8471        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
8472      }
8473    };
8474    if (json.has("form"))
8475      res.setForm(parseCoding(json.getAsJsonObject("form")));
8476    if (json.has("total"))
8477      res.setTotal(parseMoney(json.getAsJsonObject("total")));
8478    if (json.has("note")) {
8479      JsonArray array = json.getAsJsonArray("note");
8480      for (int i = 0; i < array.size(); i++) {
8481        res.getNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
8482      }
8483    };
8484    return res;
8485  }
8486
8487  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
8488    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
8489    parseBackboneProperties(json, res);
8490    if (json.has("type"))
8491      res.setType(parseCoding(json.getAsJsonObject("type")));
8492    if (json.has("request"))
8493      res.setRequest(parseReference(json.getAsJsonObject("request")));
8494    if (json.has("responce"))
8495      res.setResponce(parseReference(json.getAsJsonObject("responce")));
8496    if (json.has("submitter"))
8497      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
8498    if (json.has("payee"))
8499      res.setPayee(parseReference(json.getAsJsonObject("payee")));
8500    if (json.has("date"))
8501      res.setDateElement(parseDate(json.get("date").getAsString()));
8502    if (json.has("_date"))
8503      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8504    if (json.has("amount"))
8505      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
8506    return res;
8507  }
8508
8509  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
8510    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
8511    parseBackboneProperties(json, res);
8512    if (json.has("type"))
8513      res.setType(parseCoding(json.getAsJsonObject("type")));
8514    if (json.has("text"))
8515      res.setTextElement(parseString(json.get("text").getAsString()));
8516    if (json.has("_text"))
8517      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
8518    return res;
8519  }
8520
8521  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
8522    Person res = new Person();
8523    parseDomainResourceProperties(json, res);
8524    if (json.has("identifier")) {
8525      JsonArray array = json.getAsJsonArray("identifier");
8526      for (int i = 0; i < array.size(); i++) {
8527        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8528      }
8529    };
8530    if (json.has("name")) {
8531      JsonArray array = json.getAsJsonArray("name");
8532      for (int i = 0; i < array.size(); i++) {
8533        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
8534      }
8535    };
8536    if (json.has("telecom")) {
8537      JsonArray array = json.getAsJsonArray("telecom");
8538      for (int i = 0; i < array.size(); i++) {
8539        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8540      }
8541    };
8542    if (json.has("gender"))
8543      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8544    if (json.has("_gender"))
8545      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8546    if (json.has("birthDate"))
8547      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8548    if (json.has("_birthDate"))
8549      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8550    if (json.has("address")) {
8551      JsonArray array = json.getAsJsonArray("address");
8552      for (int i = 0; i < array.size(); i++) {
8553        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8554      }
8555    };
8556    if (json.has("photo"))
8557      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
8558    if (json.has("managingOrganization"))
8559      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8560    if (json.has("active"))
8561      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8562    if (json.has("_active"))
8563      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8564    if (json.has("link")) {
8565      JsonArray array = json.getAsJsonArray("link");
8566      for (int i = 0; i < array.size(); i++) {
8567        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
8568      }
8569    };
8570    return res;
8571  }
8572
8573  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
8574    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
8575    parseBackboneProperties(json, res);
8576    if (json.has("target"))
8577      res.setTarget(parseReference(json.getAsJsonObject("target")));
8578    if (json.has("assurance"))
8579      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
8580    if (json.has("_assurance"))
8581      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
8582    return res;
8583  }
8584
8585  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
8586    Practitioner res = new Practitioner();
8587    parseDomainResourceProperties(json, res);
8588    if (json.has("identifier")) {
8589      JsonArray array = json.getAsJsonArray("identifier");
8590      for (int i = 0; i < array.size(); i++) {
8591        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8592      }
8593    };
8594    if (json.has("active"))
8595      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8596    if (json.has("_active"))
8597      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8598    if (json.has("name"))
8599      res.setName(parseHumanName(json.getAsJsonObject("name")));
8600    if (json.has("telecom")) {
8601      JsonArray array = json.getAsJsonArray("telecom");
8602      for (int i = 0; i < array.size(); i++) {
8603        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8604      }
8605    };
8606    if (json.has("address")) {
8607      JsonArray array = json.getAsJsonArray("address");
8608      for (int i = 0; i < array.size(); i++) {
8609        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8610      }
8611    };
8612    if (json.has("gender"))
8613      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8614    if (json.has("_gender"))
8615      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8616    if (json.has("birthDate"))
8617      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8618    if (json.has("_birthDate"))
8619      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8620    if (json.has("photo")) {
8621      JsonArray array = json.getAsJsonArray("photo");
8622      for (int i = 0; i < array.size(); i++) {
8623        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
8624      }
8625    };
8626    if (json.has("practitionerRole")) {
8627      JsonArray array = json.getAsJsonArray("practitionerRole");
8628      for (int i = 0; i < array.size(); i++) {
8629        res.getPractitionerRole().add(parsePractitionerPractitionerPractitionerRoleComponent(array.get(i).getAsJsonObject(), res));
8630      }
8631    };
8632    if (json.has("qualification")) {
8633      JsonArray array = json.getAsJsonArray("qualification");
8634      for (int i = 0; i < array.size(); i++) {
8635        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
8636      }
8637    };
8638    if (json.has("communication")) {
8639      JsonArray array = json.getAsJsonArray("communication");
8640      for (int i = 0; i < array.size(); i++) {
8641        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8642      }
8643    };
8644    return res;
8645  }
8646
8647  protected Practitioner.PractitionerPractitionerRoleComponent parsePractitionerPractitionerPractitionerRoleComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
8648    Practitioner.PractitionerPractitionerRoleComponent res = new Practitioner.PractitionerPractitionerRoleComponent();
8649    parseBackboneProperties(json, res);
8650    if (json.has("managingOrganization"))
8651      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8652    if (json.has("role"))
8653      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8654    if (json.has("specialty")) {
8655      JsonArray array = json.getAsJsonArray("specialty");
8656      for (int i = 0; i < array.size(); i++) {
8657        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8658      }
8659    };
8660    if (json.has("period"))
8661      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8662    if (json.has("location")) {
8663      JsonArray array = json.getAsJsonArray("location");
8664      for (int i = 0; i < array.size(); i++) {
8665        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
8666      }
8667    };
8668    if (json.has("healthcareService")) {
8669      JsonArray array = json.getAsJsonArray("healthcareService");
8670      for (int i = 0; i < array.size(); i++) {
8671        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
8672      }
8673    };
8674    return res;
8675  }
8676
8677  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
8678    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
8679    parseBackboneProperties(json, res);
8680    if (json.has("identifier")) {
8681      JsonArray array = json.getAsJsonArray("identifier");
8682      for (int i = 0; i < array.size(); i++) {
8683        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8684      }
8685    };
8686    if (json.has("code"))
8687      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8688    if (json.has("period"))
8689      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8690    if (json.has("issuer"))
8691      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
8692    return res;
8693  }
8694
8695  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
8696    Procedure res = new Procedure();
8697    parseDomainResourceProperties(json, res);
8698    if (json.has("identifier")) {
8699      JsonArray array = json.getAsJsonArray("identifier");
8700      for (int i = 0; i < array.size(); i++) {
8701        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8702      }
8703    };
8704    if (json.has("subject"))
8705      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8706    if (json.has("status"))
8707      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
8708    if (json.has("_status"))
8709      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8710    if (json.has("category"))
8711      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8712    if (json.has("code"))
8713      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8714    if (json.has("notPerformed"))
8715      res.setNotPerformedElement(parseBoolean(json.get("notPerformed").getAsBoolean()));
8716    if (json.has("_notPerformed"))
8717      parseElementProperties(json.getAsJsonObject("_notPerformed"), res.getNotPerformedElement());
8718    if (json.has("reasonNotPerformed")) {
8719      JsonArray array = json.getAsJsonArray("reasonNotPerformed");
8720      for (int i = 0; i < array.size(); i++) {
8721        res.getReasonNotPerformed().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8722      }
8723    };
8724    if (json.has("bodySite")) {
8725      JsonArray array = json.getAsJsonArray("bodySite");
8726      for (int i = 0; i < array.size(); i++) {
8727        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8728      }
8729    };
8730    Type reason = parseType("reason", json);
8731    if (reason != null)
8732      res.setReason(reason);
8733    if (json.has("performer")) {
8734      JsonArray array = json.getAsJsonArray("performer");
8735      for (int i = 0; i < array.size(); i++) {
8736        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
8737      }
8738    };
8739    Type performed = parseType("performed", json);
8740    if (performed != null)
8741      res.setPerformed(performed);
8742    if (json.has("encounter"))
8743      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8744    if (json.has("location"))
8745      res.setLocation(parseReference(json.getAsJsonObject("location")));
8746    if (json.has("outcome"))
8747      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8748    if (json.has("report")) {
8749      JsonArray array = json.getAsJsonArray("report");
8750      for (int i = 0; i < array.size(); i++) {
8751        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
8752      }
8753    };
8754    if (json.has("complication")) {
8755      JsonArray array = json.getAsJsonArray("complication");
8756      for (int i = 0; i < array.size(); i++) {
8757        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8758      }
8759    };
8760    if (json.has("followUp")) {
8761      JsonArray array = json.getAsJsonArray("followUp");
8762      for (int i = 0; i < array.size(); i++) {
8763        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8764      }
8765    };
8766    if (json.has("request"))
8767      res.setRequest(parseReference(json.getAsJsonObject("request")));
8768    if (json.has("notes")) {
8769      JsonArray array = json.getAsJsonArray("notes");
8770      for (int i = 0; i < array.size(); i++) {
8771        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
8772      }
8773    };
8774    if (json.has("focalDevice")) {
8775      JsonArray array = json.getAsJsonArray("focalDevice");
8776      for (int i = 0; i < array.size(); i++) {
8777        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
8778      }
8779    };
8780    if (json.has("used")) {
8781      JsonArray array = json.getAsJsonArray("used");
8782      for (int i = 0; i < array.size(); i++) {
8783        res.getUsed().add(parseReference(array.get(i).getAsJsonObject()));
8784      }
8785    };
8786    return res;
8787  }
8788
8789  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
8790    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
8791    parseBackboneProperties(json, res);
8792    if (json.has("actor"))
8793      res.setActor(parseReference(json.getAsJsonObject("actor")));
8794    if (json.has("role"))
8795      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8796    return res;
8797  }
8798
8799  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
8800    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
8801    parseBackboneProperties(json, res);
8802    if (json.has("action"))
8803      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
8804    if (json.has("manipulated"))
8805      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
8806    return res;
8807  }
8808
8809  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
8810    ProcedureRequest res = new ProcedureRequest();
8811    parseDomainResourceProperties(json, res);
8812    if (json.has("identifier")) {
8813      JsonArray array = json.getAsJsonArray("identifier");
8814      for (int i = 0; i < array.size(); i++) {
8815        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8816      }
8817    };
8818    if (json.has("subject"))
8819      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8820    if (json.has("code"))
8821      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8822    if (json.has("bodySite")) {
8823      JsonArray array = json.getAsJsonArray("bodySite");
8824      for (int i = 0; i < array.size(); i++) {
8825        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8826      }
8827    };
8828    Type reason = parseType("reason", json);
8829    if (reason != null)
8830      res.setReason(reason);
8831    Type scheduled = parseType("scheduled", json);
8832    if (scheduled != null)
8833      res.setScheduled(scheduled);
8834    if (json.has("encounter"))
8835      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8836    if (json.has("performer"))
8837      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8838    if (json.has("status"))
8839      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
8840    if (json.has("_status"))
8841      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8842    if (json.has("notes")) {
8843      JsonArray array = json.getAsJsonArray("notes");
8844      for (int i = 0; i < array.size(); i++) {
8845        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
8846      }
8847    };
8848    Type asNeeded = parseType("asNeeded", json);
8849    if (asNeeded != null)
8850      res.setAsNeeded(asNeeded);
8851    if (json.has("orderedOn"))
8852      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
8853    if (json.has("_orderedOn"))
8854      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
8855    if (json.has("orderer"))
8856      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
8857    if (json.has("priority"))
8858      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
8859    if (json.has("_priority"))
8860      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
8861    return res;
8862  }
8863
8864  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
8865    ProcessRequest res = new ProcessRequest();
8866    parseDomainResourceProperties(json, res);
8867    if (json.has("action"))
8868      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
8869    if (json.has("_action"))
8870      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
8871    if (json.has("identifier")) {
8872      JsonArray array = json.getAsJsonArray("identifier");
8873      for (int i = 0; i < array.size(); i++) {
8874        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8875      }
8876    };
8877    if (json.has("ruleset"))
8878      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8879    if (json.has("originalRuleset"))
8880      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8881    if (json.has("created"))
8882      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8883    if (json.has("_created"))
8884      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8885    if (json.has("target"))
8886      res.setTarget(parseReference(json.getAsJsonObject("target")));
8887    if (json.has("provider"))
8888      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8889    if (json.has("organization"))
8890      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8891    if (json.has("request"))
8892      res.setRequest(parseReference(json.getAsJsonObject("request")));
8893    if (json.has("response"))
8894      res.setResponse(parseReference(json.getAsJsonObject("response")));
8895    if (json.has("nullify"))
8896      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
8897    if (json.has("_nullify"))
8898      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
8899    if (json.has("reference"))
8900      res.setReferenceElement(parseString(json.get("reference").getAsString()));
8901    if (json.has("_reference"))
8902      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
8903    if (json.has("item")) {
8904      JsonArray array = json.getAsJsonArray("item");
8905      for (int i = 0; i < array.size(); i++) {
8906        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
8907      }
8908    };
8909    if (json.has("include")) {
8910      JsonArray array = json.getAsJsonArray("include");
8911      for (int i = 0; i < array.size(); i++) {
8912        res.getInclude().add(parseString(array.get(i).getAsString()));
8913      }
8914    };
8915    if (json.has("_include")) {
8916      JsonArray array = json.getAsJsonArray("_include");
8917      for (int i = 0; i < array.size(); i++) {
8918        if (i == res.getInclude().size())
8919          res.getInclude().add(parseString(null));
8920        if (array.get(i) instanceof JsonObject) 
8921          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
8922      }
8923    };
8924    if (json.has("exclude")) {
8925      JsonArray array = json.getAsJsonArray("exclude");
8926      for (int i = 0; i < array.size(); i++) {
8927        res.getExclude().add(parseString(array.get(i).getAsString()));
8928      }
8929    };
8930    if (json.has("_exclude")) {
8931      JsonArray array = json.getAsJsonArray("_exclude");
8932      for (int i = 0; i < array.size(); i++) {
8933        if (i == res.getExclude().size())
8934          res.getExclude().add(parseString(null));
8935        if (array.get(i) instanceof JsonObject) 
8936          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
8937      }
8938    };
8939    if (json.has("period"))
8940      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8941    return res;
8942  }
8943
8944  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
8945    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
8946    parseBackboneProperties(json, res);
8947    if (json.has("sequenceLinkId"))
8948      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
8949    if (json.has("_sequenceLinkId"))
8950      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
8951    return res;
8952  }
8953
8954  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
8955    ProcessResponse res = new ProcessResponse();
8956    parseDomainResourceProperties(json, res);
8957    if (json.has("identifier")) {
8958      JsonArray array = json.getAsJsonArray("identifier");
8959      for (int i = 0; i < array.size(); i++) {
8960        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8961      }
8962    };
8963    if (json.has("request"))
8964      res.setRequest(parseReference(json.getAsJsonObject("request")));
8965    if (json.has("outcome"))
8966      res.setOutcome(parseCoding(json.getAsJsonObject("outcome")));
8967    if (json.has("disposition"))
8968      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8969    if (json.has("_disposition"))
8970      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8971    if (json.has("ruleset"))
8972      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8973    if (json.has("originalRuleset"))
8974      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8975    if (json.has("created"))
8976      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8977    if (json.has("_created"))
8978      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8979    if (json.has("organization"))
8980      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8981    if (json.has("requestProvider"))
8982      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8983    if (json.has("requestOrganization"))
8984      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
8985    if (json.has("form"))
8986      res.setForm(parseCoding(json.getAsJsonObject("form")));
8987    if (json.has("notes")) {
8988      JsonArray array = json.getAsJsonArray("notes");
8989      for (int i = 0; i < array.size(); i++) {
8990        res.getNotes().add(parseProcessResponseProcessResponseNotesComponent(array.get(i).getAsJsonObject(), res));
8991      }
8992    };
8993    if (json.has("error")) {
8994      JsonArray array = json.getAsJsonArray("error");
8995      for (int i = 0; i < array.size(); i++) {
8996        res.getError().add(parseCoding(array.get(i).getAsJsonObject()));
8997      }
8998    };
8999    return res;
9000  }
9001
9002  protected ProcessResponse.ProcessResponseNotesComponent parseProcessResponseProcessResponseNotesComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
9003    ProcessResponse.ProcessResponseNotesComponent res = new ProcessResponse.ProcessResponseNotesComponent();
9004    parseBackboneProperties(json, res);
9005    if (json.has("type"))
9006      res.setType(parseCoding(json.getAsJsonObject("type")));
9007    if (json.has("text"))
9008      res.setTextElement(parseString(json.get("text").getAsString()));
9009    if (json.has("_text"))
9010      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9011    return res;
9012  }
9013
9014  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
9015    Provenance res = new Provenance();
9016    parseDomainResourceProperties(json, res);
9017    if (json.has("target")) {
9018      JsonArray array = json.getAsJsonArray("target");
9019      for (int i = 0; i < array.size(); i++) {
9020        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
9021      }
9022    };
9023    if (json.has("period"))
9024      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9025    if (json.has("recorded"))
9026      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
9027    if (json.has("_recorded"))
9028      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
9029    if (json.has("reason")) {
9030      JsonArray array = json.getAsJsonArray("reason");
9031      for (int i = 0; i < array.size(); i++) {
9032        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9033      }
9034    };
9035    if (json.has("activity"))
9036      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
9037    if (json.has("location"))
9038      res.setLocation(parseReference(json.getAsJsonObject("location")));
9039    if (json.has("policy")) {
9040      JsonArray array = json.getAsJsonArray("policy");
9041      for (int i = 0; i < array.size(); i++) {
9042        res.getPolicy().add(parseUri(array.get(i).getAsString()));
9043      }
9044    };
9045    if (json.has("_policy")) {
9046      JsonArray array = json.getAsJsonArray("_policy");
9047      for (int i = 0; i < array.size(); i++) {
9048        if (i == res.getPolicy().size())
9049          res.getPolicy().add(parseUri(null));
9050        if (array.get(i) instanceof JsonObject) 
9051          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
9052      }
9053    };
9054    if (json.has("agent")) {
9055      JsonArray array = json.getAsJsonArray("agent");
9056      for (int i = 0; i < array.size(); i++) {
9057        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
9058      }
9059    };
9060    if (json.has("entity")) {
9061      JsonArray array = json.getAsJsonArray("entity");
9062      for (int i = 0; i < array.size(); i++) {
9063        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
9064      }
9065    };
9066    if (json.has("signature")) {
9067      JsonArray array = json.getAsJsonArray("signature");
9068      for (int i = 0; i < array.size(); i++) {
9069        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9070      }
9071    };
9072    return res;
9073  }
9074
9075  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9076    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
9077    parseBackboneProperties(json, res);
9078    if (json.has("role"))
9079      res.setRole(parseCoding(json.getAsJsonObject("role")));
9080    if (json.has("actor"))
9081      res.setActor(parseReference(json.getAsJsonObject("actor")));
9082    if (json.has("userId"))
9083      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
9084    if (json.has("relatedAgent")) {
9085      JsonArray array = json.getAsJsonArray("relatedAgent");
9086      for (int i = 0; i < array.size(); i++) {
9087        res.getRelatedAgent().add(parseProvenanceProvenanceAgentRelatedAgentComponent(array.get(i).getAsJsonObject(), owner));
9088      }
9089    };
9090    return res;
9091  }
9092
9093  protected Provenance.ProvenanceAgentRelatedAgentComponent parseProvenanceProvenanceAgentRelatedAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9094    Provenance.ProvenanceAgentRelatedAgentComponent res = new Provenance.ProvenanceAgentRelatedAgentComponent();
9095    parseBackboneProperties(json, res);
9096    if (json.has("type"))
9097      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9098    if (json.has("target"))
9099      res.setTargetElement(parseUri(json.get("target").getAsString()));
9100    if (json.has("_target"))
9101      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
9102    return res;
9103  }
9104
9105  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9106    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
9107    parseBackboneProperties(json, res);
9108    if (json.has("role"))
9109      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
9110    if (json.has("_role"))
9111      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
9112    if (json.has("type"))
9113      res.setType(parseCoding(json.getAsJsonObject("type")));
9114    if (json.has("reference"))
9115      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
9116    if (json.has("_reference"))
9117      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
9118    if (json.has("display"))
9119      res.setDisplayElement(parseString(json.get("display").getAsString()));
9120    if (json.has("_display"))
9121      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
9122    if (json.has("agent"))
9123      res.setAgent(parseProvenanceProvenanceAgentComponent(json.getAsJsonObject("agent"), owner));
9124    return res;
9125  }
9126
9127  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
9128    Questionnaire res = new Questionnaire();
9129    parseDomainResourceProperties(json, res);
9130    if (json.has("identifier")) {
9131      JsonArray array = json.getAsJsonArray("identifier");
9132      for (int i = 0; i < array.size(); i++) {
9133        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9134      }
9135    };
9136    if (json.has("version"))
9137      res.setVersionElement(parseString(json.get("version").getAsString()));
9138    if (json.has("_version"))
9139      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9140    if (json.has("status"))
9141      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Questionnaire.QuestionnaireStatus.NULL, new Questionnaire.QuestionnaireStatusEnumFactory()));
9142    if (json.has("_status"))
9143      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9144    if (json.has("date"))
9145      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9146    if (json.has("_date"))
9147      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9148    if (json.has("publisher"))
9149      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9150    if (json.has("_publisher"))
9151      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9152    if (json.has("telecom")) {
9153      JsonArray array = json.getAsJsonArray("telecom");
9154      for (int i = 0; i < array.size(); i++) {
9155        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9156      }
9157    };
9158    if (json.has("subjectType")) {
9159      JsonArray array = json.getAsJsonArray("subjectType");
9160      for (int i = 0; i < array.size(); i++) {
9161        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
9162      }
9163    };
9164    if (json.has("_subjectType")) {
9165      JsonArray array = json.getAsJsonArray("_subjectType");
9166      for (int i = 0; i < array.size(); i++) {
9167        if (i == res.getSubjectType().size())
9168          res.getSubjectType().add(parseCode(null));
9169        if (array.get(i) instanceof JsonObject) 
9170          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
9171      }
9172    };
9173    if (json.has("group"))
9174      res.setGroup(parseQuestionnaireGroupComponent(json.getAsJsonObject("group"), res));
9175    return res;
9176  }
9177
9178  protected Questionnaire.GroupComponent parseQuestionnaireGroupComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
9179    Questionnaire.GroupComponent res = new Questionnaire.GroupComponent();
9180    parseBackboneProperties(json, res);
9181    if (json.has("linkId"))
9182      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9183    if (json.has("_linkId"))
9184      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9185    if (json.has("title"))
9186      res.setTitleElement(parseString(json.get("title").getAsString()));
9187    if (json.has("_title"))
9188      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9189    if (json.has("concept")) {
9190      JsonArray array = json.getAsJsonArray("concept");
9191      for (int i = 0; i < array.size(); i++) {
9192        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
9193      }
9194    };
9195    if (json.has("text"))
9196      res.setTextElement(parseString(json.get("text").getAsString()));
9197    if (json.has("_text"))
9198      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9199    if (json.has("required"))
9200      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
9201    if (json.has("_required"))
9202      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
9203    if (json.has("repeats"))
9204      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
9205    if (json.has("_repeats"))
9206      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
9207    if (json.has("group")) {
9208      JsonArray array = json.getAsJsonArray("group");
9209      for (int i = 0; i < array.size(); i++) {
9210        res.getGroup().add(parseQuestionnaireGroupComponent(array.get(i).getAsJsonObject(), owner));
9211      }
9212    };
9213    if (json.has("question")) {
9214      JsonArray array = json.getAsJsonArray("question");
9215      for (int i = 0; i < array.size(); i++) {
9216        res.getQuestion().add(parseQuestionnaireQuestionComponent(array.get(i).getAsJsonObject(), owner));
9217      }
9218    };
9219    return res;
9220  }
9221
9222  protected Questionnaire.QuestionComponent parseQuestionnaireQuestionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
9223    Questionnaire.QuestionComponent res = new Questionnaire.QuestionComponent();
9224    parseBackboneProperties(json, res);
9225    if (json.has("linkId"))
9226      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9227    if (json.has("_linkId"))
9228      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9229    if (json.has("concept")) {
9230      JsonArray array = json.getAsJsonArray("concept");
9231      for (int i = 0; i < array.size(); i++) {
9232        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
9233      }
9234    };
9235    if (json.has("text"))
9236      res.setTextElement(parseString(json.get("text").getAsString()));
9237    if (json.has("_text"))
9238      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9239    if (json.has("type"))
9240      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.AnswerFormat.NULL, new Questionnaire.AnswerFormatEnumFactory()));
9241    if (json.has("_type"))
9242      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9243    if (json.has("required"))
9244      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
9245    if (json.has("_required"))
9246      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
9247    if (json.has("repeats"))
9248      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
9249    if (json.has("_repeats"))
9250      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
9251    if (json.has("options"))
9252      res.setOptions(parseReference(json.getAsJsonObject("options")));
9253    if (json.has("option")) {
9254      JsonArray array = json.getAsJsonArray("option");
9255      for (int i = 0; i < array.size(); i++) {
9256        res.getOption().add(parseCoding(array.get(i).getAsJsonObject()));
9257      }
9258    };
9259    if (json.has("group")) {
9260      JsonArray array = json.getAsJsonArray("group");
9261      for (int i = 0; i < array.size(); i++) {
9262        res.getGroup().add(parseQuestionnaireGroupComponent(array.get(i).getAsJsonObject(), owner));
9263      }
9264    };
9265    return res;
9266  }
9267
9268  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
9269    QuestionnaireResponse res = new QuestionnaireResponse();
9270    parseDomainResourceProperties(json, res);
9271    if (json.has("identifier"))
9272      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9273    if (json.has("questionnaire"))
9274      res.setQuestionnaire(parseReference(json.getAsJsonObject("questionnaire")));
9275    if (json.has("status"))
9276      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
9277    if (json.has("_status"))
9278      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9279    if (json.has("subject"))
9280      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9281    if (json.has("author"))
9282      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9283    if (json.has("authored"))
9284      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
9285    if (json.has("_authored"))
9286      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
9287    if (json.has("source"))
9288      res.setSource(parseReference(json.getAsJsonObject("source")));
9289    if (json.has("encounter"))
9290      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9291    if (json.has("group"))
9292      res.setGroup(parseQuestionnaireResponseGroupComponent(json.getAsJsonObject("group"), res));
9293    return res;
9294  }
9295
9296  protected QuestionnaireResponse.GroupComponent parseQuestionnaireResponseGroupComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9297    QuestionnaireResponse.GroupComponent res = new QuestionnaireResponse.GroupComponent();
9298    parseBackboneProperties(json, res);
9299    if (json.has("linkId"))
9300      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9301    if (json.has("_linkId"))
9302      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9303    if (json.has("title"))
9304      res.setTitleElement(parseString(json.get("title").getAsString()));
9305    if (json.has("_title"))
9306      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9307    if (json.has("text"))
9308      res.setTextElement(parseString(json.get("text").getAsString()));
9309    if (json.has("_text"))
9310      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9311    if (json.has("subject"))
9312      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9313    if (json.has("group")) {
9314      JsonArray array = json.getAsJsonArray("group");
9315      for (int i = 0; i < array.size(); i++) {
9316        res.getGroup().add(parseQuestionnaireResponseGroupComponent(array.get(i).getAsJsonObject(), owner));
9317      }
9318    };
9319    if (json.has("question")) {
9320      JsonArray array = json.getAsJsonArray("question");
9321      for (int i = 0; i < array.size(); i++) {
9322        res.getQuestion().add(parseQuestionnaireResponseQuestionComponent(array.get(i).getAsJsonObject(), owner));
9323      }
9324    };
9325    return res;
9326  }
9327
9328  protected QuestionnaireResponse.QuestionComponent parseQuestionnaireResponseQuestionComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9329    QuestionnaireResponse.QuestionComponent res = new QuestionnaireResponse.QuestionComponent();
9330    parseBackboneProperties(json, res);
9331    if (json.has("linkId"))
9332      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9333    if (json.has("_linkId"))
9334      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9335    if (json.has("text"))
9336      res.setTextElement(parseString(json.get("text").getAsString()));
9337    if (json.has("_text"))
9338      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9339    if (json.has("answer")) {
9340      JsonArray array = json.getAsJsonArray("answer");
9341      for (int i = 0; i < array.size(); i++) {
9342        res.getAnswer().add(parseQuestionnaireResponseQuestionAnswerComponent(array.get(i).getAsJsonObject(), owner));
9343      }
9344    };
9345    return res;
9346  }
9347
9348  protected QuestionnaireResponse.QuestionAnswerComponent parseQuestionnaireResponseQuestionAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9349    QuestionnaireResponse.QuestionAnswerComponent res = new QuestionnaireResponse.QuestionAnswerComponent();
9350    parseBackboneProperties(json, res);
9351    Type value = parseType("value", json);
9352    if (value != null)
9353      res.setValue(value);
9354    if (json.has("group")) {
9355      JsonArray array = json.getAsJsonArray("group");
9356      for (int i = 0; i < array.size(); i++) {
9357        res.getGroup().add(parseQuestionnaireResponseGroupComponent(array.get(i).getAsJsonObject(), owner));
9358      }
9359    };
9360    return res;
9361  }
9362
9363  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
9364    ReferralRequest res = new ReferralRequest();
9365    parseDomainResourceProperties(json, res);
9366    if (json.has("status"))
9367      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralStatus.NULL, new ReferralRequest.ReferralStatusEnumFactory()));
9368    if (json.has("_status"))
9369      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9370    if (json.has("identifier")) {
9371      JsonArray array = json.getAsJsonArray("identifier");
9372      for (int i = 0; i < array.size(); i++) {
9373        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9374      }
9375    };
9376    if (json.has("date"))
9377      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9378    if (json.has("_date"))
9379      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9380    if (json.has("type"))
9381      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9382    if (json.has("specialty"))
9383      res.setSpecialty(parseCodeableConcept(json.getAsJsonObject("specialty")));
9384    if (json.has("priority"))
9385      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9386    if (json.has("patient"))
9387      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9388    if (json.has("requester"))
9389      res.setRequester(parseReference(json.getAsJsonObject("requester")));
9390    if (json.has("recipient")) {
9391      JsonArray array = json.getAsJsonArray("recipient");
9392      for (int i = 0; i < array.size(); i++) {
9393        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9394      }
9395    };
9396    if (json.has("encounter"))
9397      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9398    if (json.has("dateSent"))
9399      res.setDateSentElement(parseDateTime(json.get("dateSent").getAsString()));
9400    if (json.has("_dateSent"))
9401      parseElementProperties(json.getAsJsonObject("_dateSent"), res.getDateSentElement());
9402    if (json.has("reason"))
9403      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
9404    if (json.has("description"))
9405      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9406    if (json.has("_description"))
9407      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9408    if (json.has("serviceRequested")) {
9409      JsonArray array = json.getAsJsonArray("serviceRequested");
9410      for (int i = 0; i < array.size(); i++) {
9411        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9412      }
9413    };
9414    if (json.has("supportingInformation")) {
9415      JsonArray array = json.getAsJsonArray("supportingInformation");
9416      for (int i = 0; i < array.size(); i++) {
9417        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
9418      }
9419    };
9420    if (json.has("fulfillmentTime"))
9421      res.setFulfillmentTime(parsePeriod(json.getAsJsonObject("fulfillmentTime")));
9422    return res;
9423  }
9424
9425  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
9426    RelatedPerson res = new RelatedPerson();
9427    parseDomainResourceProperties(json, res);
9428    if (json.has("identifier")) {
9429      JsonArray array = json.getAsJsonArray("identifier");
9430      for (int i = 0; i < array.size(); i++) {
9431        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9432      }
9433    };
9434    if (json.has("patient"))
9435      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9436    if (json.has("relationship"))
9437      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9438    if (json.has("name"))
9439      res.setName(parseHumanName(json.getAsJsonObject("name")));
9440    if (json.has("telecom")) {
9441      JsonArray array = json.getAsJsonArray("telecom");
9442      for (int i = 0; i < array.size(); i++) {
9443        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9444      }
9445    };
9446    if (json.has("gender"))
9447      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
9448    if (json.has("_gender"))
9449      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
9450    if (json.has("birthDate"))
9451      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
9452    if (json.has("_birthDate"))
9453      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
9454    if (json.has("address")) {
9455      JsonArray array = json.getAsJsonArray("address");
9456      for (int i = 0; i < array.size(); i++) {
9457        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
9458      }
9459    };
9460    if (json.has("photo")) {
9461      JsonArray array = json.getAsJsonArray("photo");
9462      for (int i = 0; i < array.size(); i++) {
9463        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
9464      }
9465    };
9466    if (json.has("period"))
9467      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9468    return res;
9469  }
9470
9471  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
9472    RiskAssessment res = new RiskAssessment();
9473    parseDomainResourceProperties(json, res);
9474    if (json.has("subject"))
9475      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9476    if (json.has("date"))
9477      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9478    if (json.has("_date"))
9479      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9480    if (json.has("condition"))
9481      res.setCondition(parseReference(json.getAsJsonObject("condition")));
9482    if (json.has("encounter"))
9483      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9484    if (json.has("performer"))
9485      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9486    if (json.has("identifier"))
9487      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9488    if (json.has("method"))
9489      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
9490    if (json.has("basis")) {
9491      JsonArray array = json.getAsJsonArray("basis");
9492      for (int i = 0; i < array.size(); i++) {
9493        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
9494      }
9495    };
9496    if (json.has("prediction")) {
9497      JsonArray array = json.getAsJsonArray("prediction");
9498      for (int i = 0; i < array.size(); i++) {
9499        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
9500      }
9501    };
9502    if (json.has("mitigation"))
9503      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
9504    if (json.has("_mitigation"))
9505      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
9506    return res;
9507  }
9508
9509  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
9510    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
9511    parseBackboneProperties(json, res);
9512    if (json.has("outcome"))
9513      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
9514    Type probability = parseType("probability", json);
9515    if (probability != null)
9516      res.setProbability(probability);
9517    if (json.has("relativeRisk"))
9518      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
9519    if (json.has("_relativeRisk"))
9520      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
9521    Type when = parseType("when", json);
9522    if (when != null)
9523      res.setWhen(when);
9524    if (json.has("rationale"))
9525      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
9526    if (json.has("_rationale"))
9527      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
9528    return res;
9529  }
9530
9531  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
9532    Schedule res = new Schedule();
9533    parseDomainResourceProperties(json, res);
9534    if (json.has("identifier")) {
9535      JsonArray array = json.getAsJsonArray("identifier");
9536      for (int i = 0; i < array.size(); i++) {
9537        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9538      }
9539    };
9540    if (json.has("type")) {
9541      JsonArray array = json.getAsJsonArray("type");
9542      for (int i = 0; i < array.size(); i++) {
9543        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9544      }
9545    };
9546    if (json.has("actor"))
9547      res.setActor(parseReference(json.getAsJsonObject("actor")));
9548    if (json.has("planningHorizon"))
9549      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
9550    if (json.has("comment"))
9551      res.setCommentElement(parseString(json.get("comment").getAsString()));
9552    if (json.has("_comment"))
9553      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9554    return res;
9555  }
9556
9557  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
9558    SearchParameter res = new SearchParameter();
9559    parseDomainResourceProperties(json, res);
9560    if (json.has("url"))
9561      res.setUrlElement(parseUri(json.get("url").getAsString()));
9562    if (json.has("_url"))
9563      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9564    if (json.has("name"))
9565      res.setNameElement(parseString(json.get("name").getAsString()));
9566    if (json.has("_name"))
9567      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9568    if (json.has("status"))
9569      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
9570    if (json.has("_status"))
9571      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9572    if (json.has("experimental"))
9573      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9574    if (json.has("_experimental"))
9575      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9576    if (json.has("publisher"))
9577      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9578    if (json.has("_publisher"))
9579      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9580    if (json.has("contact")) {
9581      JsonArray array = json.getAsJsonArray("contact");
9582      for (int i = 0; i < array.size(); i++) {
9583        res.getContact().add(parseSearchParameterSearchParameterContactComponent(array.get(i).getAsJsonObject(), res));
9584      }
9585    };
9586    if (json.has("date"))
9587      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9588    if (json.has("_date"))
9589      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9590    if (json.has("requirements"))
9591      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
9592    if (json.has("_requirements"))
9593      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
9594    if (json.has("code"))
9595      res.setCodeElement(parseCode(json.get("code").getAsString()));
9596    if (json.has("_code"))
9597      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9598    if (json.has("base"))
9599      res.setBaseElement(parseCode(json.get("base").getAsString()));
9600    if (json.has("_base"))
9601      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
9602    if (json.has("type"))
9603      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
9604    if (json.has("_type"))
9605      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9606    if (json.has("description"))
9607      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9608    if (json.has("_description"))
9609      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9610    if (json.has("xpath"))
9611      res.setXpathElement(parseString(json.get("xpath").getAsString()));
9612    if (json.has("_xpath"))
9613      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
9614    if (json.has("xpathUsage"))
9615      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
9616    if (json.has("_xpathUsage"))
9617      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
9618    if (json.has("target")) {
9619      JsonArray array = json.getAsJsonArray("target");
9620      for (int i = 0; i < array.size(); i++) {
9621        res.getTarget().add(parseCode(array.get(i).getAsString()));
9622      }
9623    };
9624    if (json.has("_target")) {
9625      JsonArray array = json.getAsJsonArray("_target");
9626      for (int i = 0; i < array.size(); i++) {
9627        if (i == res.getTarget().size())
9628          res.getTarget().add(parseCode(null));
9629        if (array.get(i) instanceof JsonObject) 
9630          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
9631      }
9632    };
9633    return res;
9634  }
9635
9636  protected SearchParameter.SearchParameterContactComponent parseSearchParameterSearchParameterContactComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
9637    SearchParameter.SearchParameterContactComponent res = new SearchParameter.SearchParameterContactComponent();
9638    parseBackboneProperties(json, res);
9639    if (json.has("name"))
9640      res.setNameElement(parseString(json.get("name").getAsString()));
9641    if (json.has("_name"))
9642      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9643    if (json.has("telecom")) {
9644      JsonArray array = json.getAsJsonArray("telecom");
9645      for (int i = 0; i < array.size(); i++) {
9646        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9647      }
9648    };
9649    return res;
9650  }
9651
9652  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
9653    Slot res = new Slot();
9654    parseDomainResourceProperties(json, res);
9655    if (json.has("identifier")) {
9656      JsonArray array = json.getAsJsonArray("identifier");
9657      for (int i = 0; i < array.size(); i++) {
9658        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9659      }
9660    };
9661    if (json.has("type"))
9662      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9663    if (json.has("schedule"))
9664      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
9665    if (json.has("freeBusyType"))
9666      res.setFreeBusyTypeElement(parseEnumeration(json.get("freeBusyType").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
9667    if (json.has("_freeBusyType"))
9668      parseElementProperties(json.getAsJsonObject("_freeBusyType"), res.getFreeBusyTypeElement());
9669    if (json.has("start"))
9670      res.setStartElement(parseInstant(json.get("start").getAsString()));
9671    if (json.has("_start"))
9672      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
9673    if (json.has("end"))
9674      res.setEndElement(parseInstant(json.get("end").getAsString()));
9675    if (json.has("_end"))
9676      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
9677    if (json.has("overbooked"))
9678      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
9679    if (json.has("_overbooked"))
9680      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
9681    if (json.has("comment"))
9682      res.setCommentElement(parseString(json.get("comment").getAsString()));
9683    if (json.has("_comment"))
9684      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9685    return res;
9686  }
9687
9688  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
9689    Specimen res = new Specimen();
9690    parseDomainResourceProperties(json, res);
9691    if (json.has("identifier")) {
9692      JsonArray array = json.getAsJsonArray("identifier");
9693      for (int i = 0; i < array.size(); i++) {
9694        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9695      }
9696    };
9697    if (json.has("status"))
9698      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
9699    if (json.has("_status"))
9700      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9701    if (json.has("type"))
9702      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9703    if (json.has("parent")) {
9704      JsonArray array = json.getAsJsonArray("parent");
9705      for (int i = 0; i < array.size(); i++) {
9706        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
9707      }
9708    };
9709    if (json.has("subject"))
9710      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9711    if (json.has("accessionIdentifier"))
9712      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
9713    if (json.has("receivedTime"))
9714      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
9715    if (json.has("_receivedTime"))
9716      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
9717    if (json.has("collection"))
9718      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
9719    if (json.has("treatment")) {
9720      JsonArray array = json.getAsJsonArray("treatment");
9721      for (int i = 0; i < array.size(); i++) {
9722        res.getTreatment().add(parseSpecimenSpecimenTreatmentComponent(array.get(i).getAsJsonObject(), res));
9723      }
9724    };
9725    if (json.has("container")) {
9726      JsonArray array = json.getAsJsonArray("container");
9727      for (int i = 0; i < array.size(); i++) {
9728        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
9729      }
9730    };
9731    return res;
9732  }
9733
9734  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9735    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
9736    parseBackboneProperties(json, res);
9737    if (json.has("collector"))
9738      res.setCollector(parseReference(json.getAsJsonObject("collector")));
9739    if (json.has("comment")) {
9740      JsonArray array = json.getAsJsonArray("comment");
9741      for (int i = 0; i < array.size(); i++) {
9742        res.getComment().add(parseString(array.get(i).getAsString()));
9743      }
9744    };
9745    if (json.has("_comment")) {
9746      JsonArray array = json.getAsJsonArray("_comment");
9747      for (int i = 0; i < array.size(); i++) {
9748        if (i == res.getComment().size())
9749          res.getComment().add(parseString(null));
9750        if (array.get(i) instanceof JsonObject) 
9751          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
9752      }
9753    };
9754    Type collected = parseType("collected", json);
9755    if (collected != null)
9756      res.setCollected(collected);
9757    if (json.has("quantity"))
9758      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9759    if (json.has("method"))
9760      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
9761    if (json.has("bodySite"))
9762      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9763    return res;
9764  }
9765
9766  protected Specimen.SpecimenTreatmentComponent parseSpecimenSpecimenTreatmentComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9767    Specimen.SpecimenTreatmentComponent res = new Specimen.SpecimenTreatmentComponent();
9768    parseBackboneProperties(json, res);
9769    if (json.has("description"))
9770      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9771    if (json.has("_description"))
9772      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9773    if (json.has("procedure"))
9774      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
9775    if (json.has("additive")) {
9776      JsonArray array = json.getAsJsonArray("additive");
9777      for (int i = 0; i < array.size(); i++) {
9778        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
9779      }
9780    };
9781    return res;
9782  }
9783
9784  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9785    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
9786    parseBackboneProperties(json, res);
9787    if (json.has("identifier")) {
9788      JsonArray array = json.getAsJsonArray("identifier");
9789      for (int i = 0; i < array.size(); i++) {
9790        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9791      }
9792    };
9793    if (json.has("description"))
9794      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9795    if (json.has("_description"))
9796      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9797    if (json.has("type"))
9798      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9799    if (json.has("capacity"))
9800      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
9801    if (json.has("specimenQuantity"))
9802      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
9803    Type additive = parseType("additive", json);
9804    if (additive != null)
9805      res.setAdditive(additive);
9806    return res;
9807  }
9808
9809  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
9810    StructureDefinition res = new StructureDefinition();
9811    parseDomainResourceProperties(json, res);
9812    if (json.has("url"))
9813      res.setUrlElement(parseUri(json.get("url").getAsString()));
9814    if (json.has("_url"))
9815      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9816    if (json.has("identifier")) {
9817      JsonArray array = json.getAsJsonArray("identifier");
9818      for (int i = 0; i < array.size(); i++) {
9819        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9820      }
9821    };
9822    if (json.has("version"))
9823      res.setVersionElement(parseString(json.get("version").getAsString()));
9824    if (json.has("_version"))
9825      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9826    if (json.has("name"))
9827      res.setNameElement(parseString(json.get("name").getAsString()));
9828    if (json.has("_name"))
9829      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9830    if (json.has("display"))
9831      res.setDisplayElement(parseString(json.get("display").getAsString()));
9832    if (json.has("_display"))
9833      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
9834    if (json.has("status"))
9835      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
9836    if (json.has("_status"))
9837      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9838    if (json.has("experimental"))
9839      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9840    if (json.has("_experimental"))
9841      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9842    if (json.has("publisher"))
9843      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9844    if (json.has("_publisher"))
9845      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9846    if (json.has("contact")) {
9847      JsonArray array = json.getAsJsonArray("contact");
9848      for (int i = 0; i < array.size(); i++) {
9849        res.getContact().add(parseStructureDefinitionStructureDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
9850      }
9851    };
9852    if (json.has("date"))
9853      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9854    if (json.has("_date"))
9855      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9856    if (json.has("description"))
9857      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9858    if (json.has("_description"))
9859      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9860    if (json.has("useContext")) {
9861      JsonArray array = json.getAsJsonArray("useContext");
9862      for (int i = 0; i < array.size(); i++) {
9863        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9864      }
9865    };
9866    if (json.has("requirements"))
9867      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
9868    if (json.has("_requirements"))
9869      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
9870    if (json.has("copyright"))
9871      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
9872    if (json.has("_copyright"))
9873      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
9874    if (json.has("code")) {
9875      JsonArray array = json.getAsJsonArray("code");
9876      for (int i = 0; i < array.size(); i++) {
9877        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
9878      }
9879    };
9880    if (json.has("fhirVersion"))
9881      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
9882    if (json.has("_fhirVersion"))
9883      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
9884    if (json.has("mapping")) {
9885      JsonArray array = json.getAsJsonArray("mapping");
9886      for (int i = 0; i < array.size(); i++) {
9887        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
9888      }
9889    };
9890    if (json.has("kind"))
9891      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
9892    if (json.has("_kind"))
9893      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
9894    if (json.has("constrainedType"))
9895      res.setConstrainedTypeElement(parseCode(json.get("constrainedType").getAsString()));
9896    if (json.has("_constrainedType"))
9897      parseElementProperties(json.getAsJsonObject("_constrainedType"), res.getConstrainedTypeElement());
9898    if (json.has("abstract"))
9899      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
9900    if (json.has("_abstract"))
9901      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
9902    if (json.has("contextType"))
9903      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
9904    if (json.has("_contextType"))
9905      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
9906    if (json.has("context")) {
9907      JsonArray array = json.getAsJsonArray("context");
9908      for (int i = 0; i < array.size(); i++) {
9909        res.getContext().add(parseString(array.get(i).getAsString()));
9910      }
9911    };
9912    if (json.has("_context")) {
9913      JsonArray array = json.getAsJsonArray("_context");
9914      for (int i = 0; i < array.size(); i++) {
9915        if (i == res.getContext().size())
9916          res.getContext().add(parseString(null));
9917        if (array.get(i) instanceof JsonObject) 
9918          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
9919      }
9920    };
9921    if (json.has("base"))
9922      res.setBaseElement(parseUri(json.get("base").getAsString()));
9923    if (json.has("_base"))
9924      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
9925    if (json.has("snapshot"))
9926      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
9927    if (json.has("differential"))
9928      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
9929    return res;
9930  }
9931
9932  protected StructureDefinition.StructureDefinitionContactComponent parseStructureDefinitionStructureDefinitionContactComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9933    StructureDefinition.StructureDefinitionContactComponent res = new StructureDefinition.StructureDefinitionContactComponent();
9934    parseBackboneProperties(json, res);
9935    if (json.has("name"))
9936      res.setNameElement(parseString(json.get("name").getAsString()));
9937    if (json.has("_name"))
9938      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9939    if (json.has("telecom")) {
9940      JsonArray array = json.getAsJsonArray("telecom");
9941      for (int i = 0; i < array.size(); i++) {
9942        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9943      }
9944    };
9945    return res;
9946  }
9947
9948  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9949    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
9950    parseBackboneProperties(json, res);
9951    if (json.has("identity"))
9952      res.setIdentityElement(parseId(json.get("identity").getAsString()));
9953    if (json.has("_identity"))
9954      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
9955    if (json.has("uri"))
9956      res.setUriElement(parseUri(json.get("uri").getAsString()));
9957    if (json.has("_uri"))
9958      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
9959    if (json.has("name"))
9960      res.setNameElement(parseString(json.get("name").getAsString()));
9961    if (json.has("_name"))
9962      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9963    if (json.has("comments"))
9964      res.setCommentsElement(parseString(json.get("comments").getAsString()));
9965    if (json.has("_comments"))
9966      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
9967    return res;
9968  }
9969
9970  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9971    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
9972    parseBackboneProperties(json, res);
9973    if (json.has("element")) {
9974      JsonArray array = json.getAsJsonArray("element");
9975      for (int i = 0; i < array.size(); i++) {
9976        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
9977      }
9978    };
9979    return res;
9980  }
9981
9982  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9983    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
9984    parseBackboneProperties(json, res);
9985    if (json.has("element")) {
9986      JsonArray array = json.getAsJsonArray("element");
9987      for (int i = 0; i < array.size(); i++) {
9988        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
9989      }
9990    };
9991    return res;
9992  }
9993
9994  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
9995    Subscription res = new Subscription();
9996    parseDomainResourceProperties(json, res);
9997    if (json.has("criteria"))
9998      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
9999    if (json.has("_criteria"))
10000      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
10001    if (json.has("contact")) {
10002      JsonArray array = json.getAsJsonArray("contact");
10003      for (int i = 0; i < array.size(); i++) {
10004        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10005      }
10006    };
10007    if (json.has("reason"))
10008      res.setReasonElement(parseString(json.get("reason").getAsString()));
10009    if (json.has("_reason"))
10010      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
10011    if (json.has("status"))
10012      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
10013    if (json.has("_status"))
10014      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10015    if (json.has("error"))
10016      res.setErrorElement(parseString(json.get("error").getAsString()));
10017    if (json.has("_error"))
10018      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
10019    if (json.has("channel"))
10020      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
10021    if (json.has("end"))
10022      res.setEndElement(parseInstant(json.get("end").getAsString()));
10023    if (json.has("_end"))
10024      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
10025    if (json.has("tag")) {
10026      JsonArray array = json.getAsJsonArray("tag");
10027      for (int i = 0; i < array.size(); i++) {
10028        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
10029      }
10030    };
10031    return res;
10032  }
10033
10034  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
10035    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
10036    parseBackboneProperties(json, res);
10037    if (json.has("type"))
10038      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
10039    if (json.has("_type"))
10040      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10041    if (json.has("endpoint"))
10042      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
10043    if (json.has("_endpoint"))
10044      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
10045    if (json.has("payload"))
10046      res.setPayloadElement(parseString(json.get("payload").getAsString()));
10047    if (json.has("_payload"))
10048      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
10049    if (json.has("header"))
10050      res.setHeaderElement(parseString(json.get("header").getAsString()));
10051    if (json.has("_header"))
10052      parseElementProperties(json.getAsJsonObject("_header"), res.getHeaderElement());
10053    return res;
10054  }
10055
10056  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
10057    Substance res = new Substance();
10058    parseDomainResourceProperties(json, res);
10059    if (json.has("identifier")) {
10060      JsonArray array = json.getAsJsonArray("identifier");
10061      for (int i = 0; i < array.size(); i++) {
10062        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10063      }
10064    };
10065    if (json.has("category")) {
10066      JsonArray array = json.getAsJsonArray("category");
10067      for (int i = 0; i < array.size(); i++) {
10068        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10069      }
10070    };
10071    if (json.has("code"))
10072      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10073    if (json.has("description"))
10074      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10075    if (json.has("_description"))
10076      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10077    if (json.has("instance")) {
10078      JsonArray array = json.getAsJsonArray("instance");
10079      for (int i = 0; i < array.size(); i++) {
10080        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
10081      }
10082    };
10083    if (json.has("ingredient")) {
10084      JsonArray array = json.getAsJsonArray("ingredient");
10085      for (int i = 0; i < array.size(); i++) {
10086        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
10087      }
10088    };
10089    return res;
10090  }
10091
10092  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
10093    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
10094    parseBackboneProperties(json, res);
10095    if (json.has("identifier"))
10096      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10097    if (json.has("expiry"))
10098      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
10099    if (json.has("_expiry"))
10100      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
10101    if (json.has("quantity"))
10102      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10103    return res;
10104  }
10105
10106  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
10107    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
10108    parseBackboneProperties(json, res);
10109    if (json.has("quantity"))
10110      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
10111    if (json.has("substance"))
10112      res.setSubstance(parseReference(json.getAsJsonObject("substance")));
10113    return res;
10114  }
10115
10116  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
10117    SupplyDelivery res = new SupplyDelivery();
10118    parseDomainResourceProperties(json, res);
10119    if (json.has("identifier"))
10120      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10121    if (json.has("status"))
10122      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
10123    if (json.has("_status"))
10124      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10125    if (json.has("patient"))
10126      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10127    if (json.has("type"))
10128      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10129    if (json.has("quantity"))
10130      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10131    if (json.has("suppliedItem"))
10132      res.setSuppliedItem(parseReference(json.getAsJsonObject("suppliedItem")));
10133    if (json.has("supplier"))
10134      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
10135    if (json.has("whenPrepared"))
10136      res.setWhenPrepared(parsePeriod(json.getAsJsonObject("whenPrepared")));
10137    if (json.has("time"))
10138      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
10139    if (json.has("_time"))
10140      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
10141    if (json.has("destination"))
10142      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10143    if (json.has("receiver")) {
10144      JsonArray array = json.getAsJsonArray("receiver");
10145      for (int i = 0; i < array.size(); i++) {
10146        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
10147      }
10148    };
10149    return res;
10150  }
10151
10152  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
10153    SupplyRequest res = new SupplyRequest();
10154    parseDomainResourceProperties(json, res);
10155    if (json.has("patient"))
10156      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10157    if (json.has("source"))
10158      res.setSource(parseReference(json.getAsJsonObject("source")));
10159    if (json.has("date"))
10160      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10161    if (json.has("_date"))
10162      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10163    if (json.has("identifier"))
10164      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10165    if (json.has("status"))
10166      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
10167    if (json.has("_status"))
10168      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10169    if (json.has("kind"))
10170      res.setKind(parseCodeableConcept(json.getAsJsonObject("kind")));
10171    if (json.has("orderedItem"))
10172      res.setOrderedItem(parseReference(json.getAsJsonObject("orderedItem")));
10173    if (json.has("supplier")) {
10174      JsonArray array = json.getAsJsonArray("supplier");
10175      for (int i = 0; i < array.size(); i++) {
10176        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
10177      }
10178    };
10179    Type reason = parseType("reason", json);
10180    if (reason != null)
10181      res.setReason(reason);
10182    if (json.has("when"))
10183      res.setWhen(parseSupplyRequestSupplyRequestWhenComponent(json.getAsJsonObject("when"), res));
10184    return res;
10185  }
10186
10187  protected SupplyRequest.SupplyRequestWhenComponent parseSupplyRequestSupplyRequestWhenComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
10188    SupplyRequest.SupplyRequestWhenComponent res = new SupplyRequest.SupplyRequestWhenComponent();
10189    parseBackboneProperties(json, res);
10190    if (json.has("code"))
10191      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10192    if (json.has("schedule"))
10193      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
10194    return res;
10195  }
10196
10197  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
10198    TestScript res = new TestScript();
10199    parseDomainResourceProperties(json, res);
10200    if (json.has("url"))
10201      res.setUrlElement(parseUri(json.get("url").getAsString()));
10202    if (json.has("_url"))
10203      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10204    if (json.has("version"))
10205      res.setVersionElement(parseString(json.get("version").getAsString()));
10206    if (json.has("_version"))
10207      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10208    if (json.has("name"))
10209      res.setNameElement(parseString(json.get("name").getAsString()));
10210    if (json.has("_name"))
10211      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10212    if (json.has("status"))
10213      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
10214    if (json.has("_status"))
10215      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10216    if (json.has("identifier"))
10217      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10218    if (json.has("experimental"))
10219      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10220    if (json.has("_experimental"))
10221      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10222    if (json.has("publisher"))
10223      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10224    if (json.has("_publisher"))
10225      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10226    if (json.has("contact")) {
10227      JsonArray array = json.getAsJsonArray("contact");
10228      for (int i = 0; i < array.size(); i++) {
10229        res.getContact().add(parseTestScriptTestScriptContactComponent(array.get(i).getAsJsonObject(), res));
10230      }
10231    };
10232    if (json.has("date"))
10233      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10234    if (json.has("_date"))
10235      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10236    if (json.has("description"))
10237      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10238    if (json.has("_description"))
10239      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10240    if (json.has("useContext")) {
10241      JsonArray array = json.getAsJsonArray("useContext");
10242      for (int i = 0; i < array.size(); i++) {
10243        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10244      }
10245    };
10246    if (json.has("requirements"))
10247      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
10248    if (json.has("_requirements"))
10249      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
10250    if (json.has("copyright"))
10251      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
10252    if (json.has("_copyright"))
10253      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10254    if (json.has("metadata"))
10255      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
10256    if (json.has("multiserver"))
10257      res.setMultiserverElement(parseBoolean(json.get("multiserver").getAsBoolean()));
10258    if (json.has("_multiserver"))
10259      parseElementProperties(json.getAsJsonObject("_multiserver"), res.getMultiserverElement());
10260    if (json.has("fixture")) {
10261      JsonArray array = json.getAsJsonArray("fixture");
10262      for (int i = 0; i < array.size(); i++) {
10263        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
10264      }
10265    };
10266    if (json.has("profile")) {
10267      JsonArray array = json.getAsJsonArray("profile");
10268      for (int i = 0; i < array.size(); i++) {
10269        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
10270      }
10271    };
10272    if (json.has("variable")) {
10273      JsonArray array = json.getAsJsonArray("variable");
10274      for (int i = 0; i < array.size(); i++) {
10275        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
10276      }
10277    };
10278    if (json.has("setup"))
10279      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
10280    if (json.has("test")) {
10281      JsonArray array = json.getAsJsonArray("test");
10282      for (int i = 0; i < array.size(); i++) {
10283        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
10284      }
10285    };
10286    if (json.has("teardown"))
10287      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
10288    return res;
10289  }
10290
10291  protected TestScript.TestScriptContactComponent parseTestScriptTestScriptContactComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10292    TestScript.TestScriptContactComponent res = new TestScript.TestScriptContactComponent();
10293    parseBackboneProperties(json, res);
10294    if (json.has("name"))
10295      res.setNameElement(parseString(json.get("name").getAsString()));
10296    if (json.has("_name"))
10297      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10298    if (json.has("telecom")) {
10299      JsonArray array = json.getAsJsonArray("telecom");
10300      for (int i = 0; i < array.size(); i++) {
10301        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10302      }
10303    };
10304    return res;
10305  }
10306
10307  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10308    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
10309    parseBackboneProperties(json, res);
10310    if (json.has("link")) {
10311      JsonArray array = json.getAsJsonArray("link");
10312      for (int i = 0; i < array.size(); i++) {
10313        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
10314      }
10315    };
10316    if (json.has("capability")) {
10317      JsonArray array = json.getAsJsonArray("capability");
10318      for (int i = 0; i < array.size(); i++) {
10319        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
10320      }
10321    };
10322    return res;
10323  }
10324
10325  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10326    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
10327    parseBackboneProperties(json, res);
10328    if (json.has("url"))
10329      res.setUrlElement(parseUri(json.get("url").getAsString()));
10330    if (json.has("_url"))
10331      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10332    if (json.has("description"))
10333      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10334    if (json.has("_description"))
10335      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10336    return res;
10337  }
10338
10339  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10340    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
10341    parseBackboneProperties(json, res);
10342    if (json.has("required"))
10343      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
10344    if (json.has("_required"))
10345      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
10346    if (json.has("validated"))
10347      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
10348    if (json.has("_validated"))
10349      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
10350    if (json.has("description"))
10351      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10352    if (json.has("_description"))
10353      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10354    if (json.has("destination"))
10355      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
10356    if (json.has("_destination"))
10357      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
10358    if (json.has("link")) {
10359      JsonArray array = json.getAsJsonArray("link");
10360      for (int i = 0; i < array.size(); i++) {
10361        res.getLink().add(parseUri(array.get(i).getAsString()));
10362      }
10363    };
10364    if (json.has("_link")) {
10365      JsonArray array = json.getAsJsonArray("_link");
10366      for (int i = 0; i < array.size(); i++) {
10367        if (i == res.getLink().size())
10368          res.getLink().add(parseUri(null));
10369        if (array.get(i) instanceof JsonObject) 
10370          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
10371      }
10372    };
10373    if (json.has("conformance"))
10374      res.setConformance(parseReference(json.getAsJsonObject("conformance")));
10375    return res;
10376  }
10377
10378  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10379    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
10380    parseBackboneProperties(json, res);
10381    if (json.has("autocreate"))
10382      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
10383    if (json.has("_autocreate"))
10384      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
10385    if (json.has("autodelete"))
10386      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
10387    if (json.has("_autodelete"))
10388      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
10389    if (json.has("resource"))
10390      res.setResource(parseReference(json.getAsJsonObject("resource")));
10391    return res;
10392  }
10393
10394  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10395    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
10396    parseBackboneProperties(json, res);
10397    if (json.has("name"))
10398      res.setNameElement(parseString(json.get("name").getAsString()));
10399    if (json.has("_name"))
10400      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10401    if (json.has("headerField"))
10402      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
10403    if (json.has("_headerField"))
10404      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
10405    if (json.has("path"))
10406      res.setPathElement(parseString(json.get("path").getAsString()));
10407    if (json.has("_path"))
10408      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10409    if (json.has("sourceId"))
10410      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10411    if (json.has("_sourceId"))
10412      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10413    return res;
10414  }
10415
10416  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10417    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
10418    parseBackboneProperties(json, res);
10419    if (json.has("metadata"))
10420      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
10421    if (json.has("action")) {
10422      JsonArray array = json.getAsJsonArray("action");
10423      for (int i = 0; i < array.size(); i++) {
10424        res.getAction().add(parseTestScriptTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
10425      }
10426    };
10427    return res;
10428  }
10429
10430  protected TestScript.TestScriptSetupActionComponent parseTestScriptTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10431    TestScript.TestScriptSetupActionComponent res = new TestScript.TestScriptSetupActionComponent();
10432    parseBackboneProperties(json, res);
10433    if (json.has("operation"))
10434      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10435    if (json.has("assert"))
10436      res.setAssert(parseTestScriptTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
10437    return res;
10438  }
10439
10440  protected TestScript.TestScriptSetupActionOperationComponent parseTestScriptTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10441    TestScript.TestScriptSetupActionOperationComponent res = new TestScript.TestScriptSetupActionOperationComponent();
10442    parseBackboneProperties(json, res);
10443    if (json.has("type"))
10444      res.setType(parseCoding(json.getAsJsonObject("type")));
10445    if (json.has("resource"))
10446      res.setResourceElement(parseCode(json.get("resource").getAsString()));
10447    if (json.has("_resource"))
10448      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
10449    if (json.has("label"))
10450      res.setLabelElement(parseString(json.get("label").getAsString()));
10451    if (json.has("_label"))
10452      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
10453    if (json.has("description"))
10454      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10455    if (json.has("_description"))
10456      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10457    if (json.has("accept"))
10458      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10459    if (json.has("_accept"))
10460      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
10461    if (json.has("contentType"))
10462      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10463    if (json.has("_contentType"))
10464      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
10465    if (json.has("destination"))
10466      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
10467    if (json.has("_destination"))
10468      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
10469    if (json.has("encodeRequestUrl"))
10470      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
10471    if (json.has("_encodeRequestUrl"))
10472      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
10473    if (json.has("params"))
10474      res.setParamsElement(parseString(json.get("params").getAsString()));
10475    if (json.has("_params"))
10476      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
10477    if (json.has("requestHeader")) {
10478      JsonArray array = json.getAsJsonArray("requestHeader");
10479      for (int i = 0; i < array.size(); i++) {
10480        res.getRequestHeader().add(parseTestScriptTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
10481      }
10482    };
10483    if (json.has("responseId"))
10484      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
10485    if (json.has("_responseId"))
10486      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
10487    if (json.has("sourceId"))
10488      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10489    if (json.has("_sourceId"))
10490      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10491    if (json.has("targetId"))
10492      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
10493    if (json.has("_targetId"))
10494      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
10495    if (json.has("url"))
10496      res.setUrlElement(parseString(json.get("url").getAsString()));
10497    if (json.has("_url"))
10498      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10499    return res;
10500  }
10501
10502  protected TestScript.TestScriptSetupActionOperationRequestHeaderComponent parseTestScriptTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10503    TestScript.TestScriptSetupActionOperationRequestHeaderComponent res = new TestScript.TestScriptSetupActionOperationRequestHeaderComponent();
10504    parseBackboneProperties(json, res);
10505    if (json.has("field"))
10506      res.setFieldElement(parseString(json.get("field").getAsString()));
10507    if (json.has("_field"))
10508      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
10509    if (json.has("value"))
10510      res.setValueElement(parseString(json.get("value").getAsString()));
10511    if (json.has("_value"))
10512      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10513    return res;
10514  }
10515
10516  protected TestScript.TestScriptSetupActionAssertComponent parseTestScriptTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10517    TestScript.TestScriptSetupActionAssertComponent res = new TestScript.TestScriptSetupActionAssertComponent();
10518    parseBackboneProperties(json, res);
10519    if (json.has("label"))
10520      res.setLabelElement(parseString(json.get("label").getAsString()));
10521    if (json.has("_label"))
10522      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
10523    if (json.has("description"))
10524      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10525    if (json.has("_description"))
10526      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10527    if (json.has("direction"))
10528      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
10529    if (json.has("_direction"))
10530      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
10531    if (json.has("compareToSourceId"))
10532      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
10533    if (json.has("_compareToSourceId"))
10534      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
10535    if (json.has("compareToSourcePath"))
10536      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
10537    if (json.has("_compareToSourcePath"))
10538      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
10539    if (json.has("contentType"))
10540      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10541    if (json.has("_contentType"))
10542      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
10543    if (json.has("headerField"))
10544      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
10545    if (json.has("_headerField"))
10546      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
10547    if (json.has("minimumId"))
10548      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
10549    if (json.has("_minimumId"))
10550      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
10551    if (json.has("navigationLinks"))
10552      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
10553    if (json.has("_navigationLinks"))
10554      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
10555    if (json.has("operator"))
10556      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
10557    if (json.has("_operator"))
10558      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
10559    if (json.has("path"))
10560      res.setPathElement(parseString(json.get("path").getAsString()));
10561    if (json.has("_path"))
10562      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10563    if (json.has("resource"))
10564      res.setResourceElement(parseCode(json.get("resource").getAsString()));
10565    if (json.has("_resource"))
10566      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
10567    if (json.has("response"))
10568      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
10569    if (json.has("_response"))
10570      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
10571    if (json.has("responseCode"))
10572      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
10573    if (json.has("_responseCode"))
10574      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
10575    if (json.has("sourceId"))
10576      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10577    if (json.has("_sourceId"))
10578      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10579    if (json.has("validateProfileId"))
10580      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
10581    if (json.has("_validateProfileId"))
10582      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
10583    if (json.has("value"))
10584      res.setValueElement(parseString(json.get("value").getAsString()));
10585    if (json.has("_value"))
10586      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10587    if (json.has("warningOnly"))
10588      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
10589    if (json.has("_warningOnly"))
10590      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
10591    return res;
10592  }
10593
10594  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10595    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
10596    parseBackboneProperties(json, res);
10597    if (json.has("name"))
10598      res.setNameElement(parseString(json.get("name").getAsString()));
10599    if (json.has("_name"))
10600      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10601    if (json.has("description"))
10602      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10603    if (json.has("_description"))
10604      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10605    if (json.has("metadata"))
10606      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
10607    if (json.has("action")) {
10608      JsonArray array = json.getAsJsonArray("action");
10609      for (int i = 0; i < array.size(); i++) {
10610        res.getAction().add(parseTestScriptTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
10611      }
10612    };
10613    return res;
10614  }
10615
10616  protected TestScript.TestScriptTestActionComponent parseTestScriptTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10617    TestScript.TestScriptTestActionComponent res = new TestScript.TestScriptTestActionComponent();
10618    parseBackboneProperties(json, res);
10619    if (json.has("operation"))
10620      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10621    if (json.has("assert"))
10622      res.setAssert(parseTestScriptTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
10623    return res;
10624  }
10625
10626  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10627    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
10628    parseBackboneProperties(json, res);
10629    if (json.has("action")) {
10630      JsonArray array = json.getAsJsonArray("action");
10631      for (int i = 0; i < array.size(); i++) {
10632        res.getAction().add(parseTestScriptTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
10633      }
10634    };
10635    return res;
10636  }
10637
10638  protected TestScript.TestScriptTeardownActionComponent parseTestScriptTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10639    TestScript.TestScriptTeardownActionComponent res = new TestScript.TestScriptTeardownActionComponent();
10640    parseBackboneProperties(json, res);
10641    if (json.has("operation"))
10642      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10643    return res;
10644  }
10645
10646  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
10647    ValueSet res = new ValueSet();
10648    parseDomainResourceProperties(json, res);
10649    if (json.has("url"))
10650      res.setUrlElement(parseUri(json.get("url").getAsString()));
10651    if (json.has("_url"))
10652      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10653    if (json.has("identifier"))
10654      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10655    if (json.has("version"))
10656      res.setVersionElement(parseString(json.get("version").getAsString()));
10657    if (json.has("_version"))
10658      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10659    if (json.has("name"))
10660      res.setNameElement(parseString(json.get("name").getAsString()));
10661    if (json.has("_name"))
10662      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10663    if (json.has("status"))
10664      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
10665    if (json.has("_status"))
10666      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10667    if (json.has("experimental"))
10668      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10669    if (json.has("_experimental"))
10670      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10671    if (json.has("publisher"))
10672      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10673    if (json.has("_publisher"))
10674      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10675    if (json.has("contact")) {
10676      JsonArray array = json.getAsJsonArray("contact");
10677      for (int i = 0; i < array.size(); i++) {
10678        res.getContact().add(parseValueSetValueSetContactComponent(array.get(i).getAsJsonObject(), res));
10679      }
10680    };
10681    if (json.has("date"))
10682      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10683    if (json.has("_date"))
10684      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10685    if (json.has("lockedDate"))
10686      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
10687    if (json.has("_lockedDate"))
10688      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
10689    if (json.has("description"))
10690      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10691    if (json.has("_description"))
10692      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10693    if (json.has("useContext")) {
10694      JsonArray array = json.getAsJsonArray("useContext");
10695      for (int i = 0; i < array.size(); i++) {
10696        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10697      }
10698    };
10699    if (json.has("immutable"))
10700      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
10701    if (json.has("_immutable"))
10702      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
10703    if (json.has("requirements"))
10704      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
10705    if (json.has("_requirements"))
10706      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
10707    if (json.has("copyright"))
10708      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
10709    if (json.has("_copyright"))
10710      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10711    if (json.has("extensible"))
10712      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
10713    if (json.has("_extensible"))
10714      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
10715    if (json.has("codeSystem"))
10716      res.setCodeSystem(parseValueSetValueSetCodeSystemComponent(json.getAsJsonObject("codeSystem"), res));
10717    if (json.has("compose"))
10718      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
10719    if (json.has("expansion"))
10720      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
10721    return res;
10722  }
10723
10724  protected ValueSet.ValueSetContactComponent parseValueSetValueSetContactComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10725    ValueSet.ValueSetContactComponent res = new ValueSet.ValueSetContactComponent();
10726    parseBackboneProperties(json, res);
10727    if (json.has("name"))
10728      res.setNameElement(parseString(json.get("name").getAsString()));
10729    if (json.has("_name"))
10730      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10731    if (json.has("telecom")) {
10732      JsonArray array = json.getAsJsonArray("telecom");
10733      for (int i = 0; i < array.size(); i++) {
10734        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10735      }
10736    };
10737    return res;
10738  }
10739
10740  protected ValueSet.ValueSetCodeSystemComponent parseValueSetValueSetCodeSystemComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10741    ValueSet.ValueSetCodeSystemComponent res = new ValueSet.ValueSetCodeSystemComponent();
10742    parseBackboneProperties(json, res);
10743    if (json.has("system"))
10744      res.setSystemElement(parseUri(json.get("system").getAsString()));
10745    if (json.has("_system"))
10746      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10747    if (json.has("version"))
10748      res.setVersionElement(parseString(json.get("version").getAsString()));
10749    if (json.has("_version"))
10750      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10751    if (json.has("caseSensitive"))
10752      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
10753    if (json.has("_caseSensitive"))
10754      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
10755    if (json.has("concept")) {
10756      JsonArray array = json.getAsJsonArray("concept");
10757      for (int i = 0; i < array.size(); i++) {
10758        res.getConcept().add(parseValueSetConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
10759      }
10760    };
10761    return res;
10762  }
10763
10764  protected ValueSet.ConceptDefinitionComponent parseValueSetConceptDefinitionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10765    ValueSet.ConceptDefinitionComponent res = new ValueSet.ConceptDefinitionComponent();
10766    parseBackboneProperties(json, res);
10767    if (json.has("code"))
10768      res.setCodeElement(parseCode(json.get("code").getAsString()));
10769    if (json.has("_code"))
10770      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10771    if (json.has("abstract"))
10772      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
10773    if (json.has("_abstract"))
10774      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
10775    if (json.has("display"))
10776      res.setDisplayElement(parseString(json.get("display").getAsString()));
10777    if (json.has("_display"))
10778      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10779    if (json.has("definition"))
10780      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
10781    if (json.has("_definition"))
10782      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
10783    if (json.has("designation")) {
10784      JsonArray array = json.getAsJsonArray("designation");
10785      for (int i = 0; i < array.size(); i++) {
10786        res.getDesignation().add(parseValueSetConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
10787      }
10788    };
10789    if (json.has("concept")) {
10790      JsonArray array = json.getAsJsonArray("concept");
10791      for (int i = 0; i < array.size(); i++) {
10792        res.getConcept().add(parseValueSetConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
10793      }
10794    };
10795    return res;
10796  }
10797
10798  protected ValueSet.ConceptDefinitionDesignationComponent parseValueSetConceptDefinitionDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10799    ValueSet.ConceptDefinitionDesignationComponent res = new ValueSet.ConceptDefinitionDesignationComponent();
10800    parseBackboneProperties(json, res);
10801    if (json.has("language"))
10802      res.setLanguageElement(parseCode(json.get("language").getAsString()));
10803    if (json.has("_language"))
10804      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
10805    if (json.has("use"))
10806      res.setUse(parseCoding(json.getAsJsonObject("use")));
10807    if (json.has("value"))
10808      res.setValueElement(parseString(json.get("value").getAsString()));
10809    if (json.has("_value"))
10810      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10811    return res;
10812  }
10813
10814  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10815    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
10816    parseBackboneProperties(json, res);
10817    if (json.has("import")) {
10818      JsonArray array = json.getAsJsonArray("import");
10819      for (int i = 0; i < array.size(); i++) {
10820        res.getImport().add(parseUri(array.get(i).getAsString()));
10821      }
10822    };
10823    if (json.has("_import")) {
10824      JsonArray array = json.getAsJsonArray("_import");
10825      for (int i = 0; i < array.size(); i++) {
10826        if (i == res.getImport().size())
10827          res.getImport().add(parseUri(null));
10828        if (array.get(i) instanceof JsonObject) 
10829          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
10830      }
10831    };
10832    if (json.has("include")) {
10833      JsonArray array = json.getAsJsonArray("include");
10834      for (int i = 0; i < array.size(); i++) {
10835        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10836      }
10837    };
10838    if (json.has("exclude")) {
10839      JsonArray array = json.getAsJsonArray("exclude");
10840      for (int i = 0; i < array.size(); i++) {
10841        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10842      }
10843    };
10844    return res;
10845  }
10846
10847  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10848    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
10849    parseBackboneProperties(json, res);
10850    if (json.has("system"))
10851      res.setSystemElement(parseUri(json.get("system").getAsString()));
10852    if (json.has("_system"))
10853      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10854    if (json.has("version"))
10855      res.setVersionElement(parseString(json.get("version").getAsString()));
10856    if (json.has("_version"))
10857      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10858    if (json.has("concept")) {
10859      JsonArray array = json.getAsJsonArray("concept");
10860      for (int i = 0; i < array.size(); i++) {
10861        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
10862      }
10863    };
10864    if (json.has("filter")) {
10865      JsonArray array = json.getAsJsonArray("filter");
10866      for (int i = 0; i < array.size(); i++) {
10867        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
10868      }
10869    };
10870    return res;
10871  }
10872
10873  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10874    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
10875    parseBackboneProperties(json, res);
10876    if (json.has("code"))
10877      res.setCodeElement(parseCode(json.get("code").getAsString()));
10878    if (json.has("_code"))
10879      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10880    if (json.has("display"))
10881      res.setDisplayElement(parseString(json.get("display").getAsString()));
10882    if (json.has("_display"))
10883      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10884    if (json.has("designation")) {
10885      JsonArray array = json.getAsJsonArray("designation");
10886      for (int i = 0; i < array.size(); i++) {
10887        res.getDesignation().add(parseValueSetConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
10888      }
10889    };
10890    return res;
10891  }
10892
10893  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10894    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
10895    parseBackboneProperties(json, res);
10896    if (json.has("property"))
10897      res.setPropertyElement(parseCode(json.get("property").getAsString()));
10898    if (json.has("_property"))
10899      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
10900    if (json.has("op"))
10901      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
10902    if (json.has("_op"))
10903      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
10904    if (json.has("value"))
10905      res.setValueElement(parseCode(json.get("value").getAsString()));
10906    if (json.has("_value"))
10907      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10908    return res;
10909  }
10910
10911  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10912    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
10913    parseBackboneProperties(json, res);
10914    if (json.has("identifier"))
10915      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
10916    if (json.has("_identifier"))
10917      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10918    if (json.has("timestamp"))
10919      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
10920    if (json.has("_timestamp"))
10921      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
10922    if (json.has("total"))
10923      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
10924    if (json.has("_total"))
10925      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
10926    if (json.has("offset"))
10927      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
10928    if (json.has("_offset"))
10929      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
10930    if (json.has("parameter")) {
10931      JsonArray array = json.getAsJsonArray("parameter");
10932      for (int i = 0; i < array.size(); i++) {
10933        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
10934      }
10935    };
10936    if (json.has("contains")) {
10937      JsonArray array = json.getAsJsonArray("contains");
10938      for (int i = 0; i < array.size(); i++) {
10939        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
10940      }
10941    };
10942    return res;
10943  }
10944
10945  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10946    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
10947    parseBackboneProperties(json, res);
10948    if (json.has("name"))
10949      res.setNameElement(parseString(json.get("name").getAsString()));
10950    if (json.has("_name"))
10951      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10952    Type value = parseType("value", json);
10953    if (value != null)
10954      res.setValue(value);
10955    return res;
10956  }
10957
10958  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10959    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
10960    parseBackboneProperties(json, res);
10961    if (json.has("system"))
10962      res.setSystemElement(parseUri(json.get("system").getAsString()));
10963    if (json.has("_system"))
10964      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10965    if (json.has("abstract"))
10966      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
10967    if (json.has("_abstract"))
10968      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
10969    if (json.has("version"))
10970      res.setVersionElement(parseString(json.get("version").getAsString()));
10971    if (json.has("_version"))
10972      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10973    if (json.has("code"))
10974      res.setCodeElement(parseCode(json.get("code").getAsString()));
10975    if (json.has("_code"))
10976      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10977    if (json.has("display"))
10978      res.setDisplayElement(parseString(json.get("display").getAsString()));
10979    if (json.has("_display"))
10980      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10981    if (json.has("contains")) {
10982      JsonArray array = json.getAsJsonArray("contains");
10983      for (int i = 0; i < array.size(); i++) {
10984        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
10985      }
10986    };
10987    return res;
10988  }
10989
10990  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
10991    VisionPrescription res = new VisionPrescription();
10992    parseDomainResourceProperties(json, res);
10993    if (json.has("identifier")) {
10994      JsonArray array = json.getAsJsonArray("identifier");
10995      for (int i = 0; i < array.size(); i++) {
10996        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10997      }
10998    };
10999    if (json.has("dateWritten"))
11000      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
11001    if (json.has("_dateWritten"))
11002      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
11003    if (json.has("patient"))
11004      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11005    if (json.has("prescriber"))
11006      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
11007    if (json.has("encounter"))
11008      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11009    Type reason = parseType("reason", json);
11010    if (reason != null)
11011      res.setReason(reason);
11012    if (json.has("dispense")) {
11013      JsonArray array = json.getAsJsonArray("dispense");
11014      for (int i = 0; i < array.size(); i++) {
11015        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
11016      }
11017    };
11018    return res;
11019  }
11020
11021  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
11022    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
11023    parseBackboneProperties(json, res);
11024    if (json.has("product"))
11025      res.setProduct(parseCoding(json.getAsJsonObject("product")));
11026    if (json.has("eye"))
11027      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
11028    if (json.has("_eye"))
11029      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
11030    if (json.has("sphere"))
11031      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
11032    if (json.has("_sphere"))
11033      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
11034    if (json.has("cylinder"))
11035      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
11036    if (json.has("_cylinder"))
11037      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
11038    if (json.has("axis"))
11039      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
11040    if (json.has("_axis"))
11041      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
11042    if (json.has("prism"))
11043      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
11044    if (json.has("_prism"))
11045      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
11046    if (json.has("base"))
11047      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
11048    if (json.has("_base"))
11049      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
11050    if (json.has("add"))
11051      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
11052    if (json.has("_add"))
11053      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
11054    if (json.has("power"))
11055      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
11056    if (json.has("_power"))
11057      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
11058    if (json.has("backCurve"))
11059      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
11060    if (json.has("_backCurve"))
11061      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
11062    if (json.has("diameter"))
11063      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
11064    if (json.has("_diameter"))
11065      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
11066    if (json.has("duration"))
11067      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
11068    if (json.has("color"))
11069      res.setColorElement(parseString(json.get("color").getAsString()));
11070    if (json.has("_color"))
11071      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
11072    if (json.has("brand"))
11073      res.setBrandElement(parseString(json.get("brand").getAsString()));
11074    if (json.has("_brand"))
11075      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
11076    if (json.has("notes"))
11077      res.setNotesElement(parseString(json.get("notes").getAsString()));
11078    if (json.has("_notes"))
11079      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
11080    return res;
11081  }
11082
11083  @Override
11084  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
11085    if (!json.has("resourceType")) {
11086      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11087    }
11088    String t = json.get("resourceType").getAsString();
11089    if (Utilities.noString(t))
11090      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11091    if (t.equals("Parameters"))
11092      return parseParameters(json);
11093    else if (t.equals("Account"))
11094      return parseAccount(json);
11095    else if (t.equals("AllergyIntolerance"))
11096      return parseAllergyIntolerance(json);
11097    else if (t.equals("Appointment"))
11098      return parseAppointment(json);
11099    else if (t.equals("AppointmentResponse"))
11100      return parseAppointmentResponse(json);
11101    else if (t.equals("AuditEvent"))
11102      return parseAuditEvent(json);
11103    else if (t.equals("Basic"))
11104      return parseBasic(json);
11105    else if (t.equals("Binary"))
11106      return parseBinary(json);
11107    else if (t.equals("BodySite"))
11108      return parseBodySite(json);
11109    else if (t.equals("Bundle"))
11110      return parseBundle(json);
11111    else if (t.equals("CarePlan"))
11112      return parseCarePlan(json);
11113    else if (t.equals("Claim"))
11114      return parseClaim(json);
11115    else if (t.equals("ClaimResponse"))
11116      return parseClaimResponse(json);
11117    else if (t.equals("ClinicalImpression"))
11118      return parseClinicalImpression(json);
11119    else if (t.equals("Communication"))
11120      return parseCommunication(json);
11121    else if (t.equals("CommunicationRequest"))
11122      return parseCommunicationRequest(json);
11123    else if (t.equals("Composition"))
11124      return parseComposition(json);
11125    else if (t.equals("ConceptMap"))
11126      return parseConceptMap(json);
11127    else if (t.equals("Condition"))
11128      return parseCondition(json);
11129    else if (t.equals("Conformance"))
11130      return parseConformance(json);
11131    else if (t.equals("Contract"))
11132      return parseContract(json);
11133    else if (t.equals("Coverage"))
11134      return parseCoverage(json);
11135    else if (t.equals("DataElement"))
11136      return parseDataElement(json);
11137    else if (t.equals("DetectedIssue"))
11138      return parseDetectedIssue(json);
11139    else if (t.equals("Device"))
11140      return parseDevice(json);
11141    else if (t.equals("DeviceComponent"))
11142      return parseDeviceComponent(json);
11143    else if (t.equals("DeviceMetric"))
11144      return parseDeviceMetric(json);
11145    else if (t.equals("DeviceUseRequest"))
11146      return parseDeviceUseRequest(json);
11147    else if (t.equals("DeviceUseStatement"))
11148      return parseDeviceUseStatement(json);
11149    else if (t.equals("DiagnosticOrder"))
11150      return parseDiagnosticOrder(json);
11151    else if (t.equals("DiagnosticReport"))
11152      return parseDiagnosticReport(json);
11153    else if (t.equals("DocumentManifest"))
11154      return parseDocumentManifest(json);
11155    else if (t.equals("DocumentReference"))
11156      return parseDocumentReference(json);
11157    else if (t.equals("EligibilityRequest"))
11158      return parseEligibilityRequest(json);
11159    else if (t.equals("EligibilityResponse"))
11160      return parseEligibilityResponse(json);
11161    else if (t.equals("Encounter"))
11162      return parseEncounter(json);
11163    else if (t.equals("EnrollmentRequest"))
11164      return parseEnrollmentRequest(json);
11165    else if (t.equals("EnrollmentResponse"))
11166      return parseEnrollmentResponse(json);
11167    else if (t.equals("EpisodeOfCare"))
11168      return parseEpisodeOfCare(json);
11169    else if (t.equals("ExplanationOfBenefit"))
11170      return parseExplanationOfBenefit(json);
11171    else if (t.equals("FamilyMemberHistory"))
11172      return parseFamilyMemberHistory(json);
11173    else if (t.equals("Flag"))
11174      return parseFlag(json);
11175    else if (t.equals("Goal"))
11176      return parseGoal(json);
11177    else if (t.equals("Group"))
11178      return parseGroup(json);
11179    else if (t.equals("HealthcareService"))
11180      return parseHealthcareService(json);
11181    else if (t.equals("ImagingObjectSelection"))
11182      return parseImagingObjectSelection(json);
11183    else if (t.equals("ImagingStudy"))
11184      return parseImagingStudy(json);
11185    else if (t.equals("Immunization"))
11186      return parseImmunization(json);
11187    else if (t.equals("ImmunizationRecommendation"))
11188      return parseImmunizationRecommendation(json);
11189    else if (t.equals("ImplementationGuide"))
11190      return parseImplementationGuide(json);
11191    else if (t.equals("List"))
11192      return parseList_(json);
11193    else if (t.equals("Location"))
11194      return parseLocation(json);
11195    else if (t.equals("Media"))
11196      return parseMedia(json);
11197    else if (t.equals("Medication"))
11198      return parseMedication(json);
11199    else if (t.equals("MedicationAdministration"))
11200      return parseMedicationAdministration(json);
11201    else if (t.equals("MedicationDispense"))
11202      return parseMedicationDispense(json);
11203    else if (t.equals("MedicationOrder"))
11204      return parseMedicationOrder(json);
11205    else if (t.equals("MedicationStatement"))
11206      return parseMedicationStatement(json);
11207    else if (t.equals("MessageHeader"))
11208      return parseMessageHeader(json);
11209    else if (t.equals("NamingSystem"))
11210      return parseNamingSystem(json);
11211    else if (t.equals("NutritionOrder"))
11212      return parseNutritionOrder(json);
11213    else if (t.equals("Observation"))
11214      return parseObservation(json);
11215    else if (t.equals("OperationDefinition"))
11216      return parseOperationDefinition(json);
11217    else if (t.equals("OperationOutcome"))
11218      return parseOperationOutcome(json);
11219    else if (t.equals("Order"))
11220      return parseOrder(json);
11221    else if (t.equals("OrderResponse"))
11222      return parseOrderResponse(json);
11223    else if (t.equals("Organization"))
11224      return parseOrganization(json);
11225    else if (t.equals("Patient"))
11226      return parsePatient(json);
11227    else if (t.equals("PaymentNotice"))
11228      return parsePaymentNotice(json);
11229    else if (t.equals("PaymentReconciliation"))
11230      return parsePaymentReconciliation(json);
11231    else if (t.equals("Person"))
11232      return parsePerson(json);
11233    else if (t.equals("Practitioner"))
11234      return parsePractitioner(json);
11235    else if (t.equals("Procedure"))
11236      return parseProcedure(json);
11237    else if (t.equals("ProcedureRequest"))
11238      return parseProcedureRequest(json);
11239    else if (t.equals("ProcessRequest"))
11240      return parseProcessRequest(json);
11241    else if (t.equals("ProcessResponse"))
11242      return parseProcessResponse(json);
11243    else if (t.equals("Provenance"))
11244      return parseProvenance(json);
11245    else if (t.equals("Questionnaire"))
11246      return parseQuestionnaire(json);
11247    else if (t.equals("QuestionnaireResponse"))
11248      return parseQuestionnaireResponse(json);
11249    else if (t.equals("ReferralRequest"))
11250      return parseReferralRequest(json);
11251    else if (t.equals("RelatedPerson"))
11252      return parseRelatedPerson(json);
11253    else if (t.equals("RiskAssessment"))
11254      return parseRiskAssessment(json);
11255    else if (t.equals("Schedule"))
11256      return parseSchedule(json);
11257    else if (t.equals("SearchParameter"))
11258      return parseSearchParameter(json);
11259    else if (t.equals("Slot"))
11260      return parseSlot(json);
11261    else if (t.equals("Specimen"))
11262      return parseSpecimen(json);
11263    else if (t.equals("StructureDefinition"))
11264      return parseStructureDefinition(json);
11265    else if (t.equals("Subscription"))
11266      return parseSubscription(json);
11267    else if (t.equals("Substance"))
11268      return parseSubstance(json);
11269    else if (t.equals("SupplyDelivery"))
11270      return parseSupplyDelivery(json);
11271    else if (t.equals("SupplyRequest"))
11272      return parseSupplyRequest(json);
11273    else if (t.equals("TestScript"))
11274      return parseTestScript(json);
11275    else if (t.equals("ValueSet"))
11276      return parseValueSet(json);
11277    else if (t.equals("VisionPrescription"))
11278      return parseVisionPrescription(json);
11279    else if (t.equals("Binary"))
11280      return parseBinary(json);
11281    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
11282  }
11283
11284  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
11285    if (json.has(prefix+"Identifier"))
11286      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
11287    else if (json.has(prefix+"Coding"))
11288      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
11289    else if (json.has(prefix+"Reference"))
11290      return parseReference(json.getAsJsonObject(prefix+"Reference"));
11291    else if (json.has(prefix+"Signature"))
11292      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
11293    else if (json.has(prefix+"SampledData"))
11294      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
11295    else if (json.has(prefix+"Quantity"))
11296      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
11297    else if (json.has(prefix+"Period"))
11298      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
11299    else if (json.has(prefix+"Attachment"))
11300      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
11301    else if (json.has(prefix+"Ratio"))
11302      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
11303    else if (json.has(prefix+"Range"))
11304      return parseRange(json.getAsJsonObject(prefix+"Range"));
11305    else if (json.has(prefix+"Annotation"))
11306      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
11307    else if (json.has(prefix+"CodeableConcept"))
11308      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
11309    else if (json.has(prefix+"Money"))
11310      return parseMoney(json.getAsJsonObject(prefix+"Money"));
11311    else if (json.has(prefix+"SimpleQuantity"))
11312      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
11313    else if (json.has(prefix+"Duration"))
11314      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
11315    else if (json.has(prefix+"Count"))
11316      return parseCount(json.getAsJsonObject(prefix+"Count"));
11317    else if (json.has(prefix+"Distance"))
11318      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
11319    else if (json.has(prefix+"Age"))
11320      return parseAge(json.getAsJsonObject(prefix+"Age"));
11321    else if (json.has(prefix+"HumanName"))
11322      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
11323    else if (json.has(prefix+"ContactPoint"))
11324      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
11325    else if (json.has(prefix+"Meta"))
11326      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
11327    else if (json.has(prefix+"Address"))
11328      return parseAddress(json.getAsJsonObject(prefix+"Address"));
11329    else if (json.has(prefix+"Timing"))
11330      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
11331    else if (json.has(prefix+"ElementDefinition"))
11332      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
11333    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
11334      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
11335      if (json.has("_"+prefix+"Date"))
11336        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
11337      return t;
11338    }
11339    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
11340      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
11341      if (json.has("_"+prefix+"DateTime"))
11342        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
11343      return t;
11344    }
11345    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
11346      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
11347      if (json.has("_"+prefix+"Code"))
11348        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
11349      return t;
11350    }
11351    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
11352      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
11353      if (json.has("_"+prefix+"String"))
11354        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
11355      return t;
11356    }
11357    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
11358      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
11359      if (json.has("_"+prefix+"Integer"))
11360        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
11361      return t;
11362    }
11363    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
11364      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
11365      if (json.has("_"+prefix+"Oid"))
11366        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
11367      return t;
11368    }
11369    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
11370      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
11371      if (json.has("_"+prefix+"Uri"))
11372        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
11373      return t;
11374    }
11375    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
11376      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
11377      if (json.has("_"+prefix+"Uuid"))
11378        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
11379      return t;
11380    }
11381    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
11382      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
11383      if (json.has("_"+prefix+"Instant"))
11384        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
11385      return t;
11386    }
11387    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
11388      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
11389      if (json.has("_"+prefix+"Boolean"))
11390        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
11391      return t;
11392    }
11393    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
11394      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
11395      if (json.has("_"+prefix+"Base64Binary"))
11396        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
11397      return t;
11398    }
11399    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
11400      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
11401      if (json.has("_"+prefix+"UnsignedInt"))
11402        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
11403      return t;
11404    }
11405    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
11406      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
11407      if (json.has("_"+prefix+"Markdown"))
11408        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
11409      return t;
11410    }
11411    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
11412      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
11413      if (json.has("_"+prefix+"Time"))
11414        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
11415      return t;
11416    }
11417    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
11418      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
11419      if (json.has("_"+prefix+"Id"))
11420        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
11421      return t;
11422    }
11423    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
11424      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
11425      if (json.has("_"+prefix+"PositiveInt"))
11426        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
11427      return t;
11428    }
11429    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
11430      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
11431      if (json.has("_"+prefix+"Decimal"))
11432        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
11433      return t;
11434    }
11435    return null;
11436  }
11437
11438  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
11439    if (type.equals("Identifier"))
11440      return parseIdentifier(json);
11441    else if (type.equals("Coding"))
11442      return parseCoding(json);
11443    else if (type.equals("Reference"))
11444      return parseReference(json);
11445    else if (type.equals("Signature"))
11446      return parseSignature(json);
11447    else if (type.equals("SampledData"))
11448      return parseSampledData(json);
11449    else if (type.equals("Quantity"))
11450      return parseQuantity(json);
11451    else if (type.equals("Period"))
11452      return parsePeriod(json);
11453    else if (type.equals("Attachment"))
11454      return parseAttachment(json);
11455    else if (type.equals("Ratio"))
11456      return parseRatio(json);
11457    else if (type.equals("Range"))
11458      return parseRange(json);
11459    else if (type.equals("Annotation"))
11460      return parseAnnotation(json);
11461    else if (type.equals("CodeableConcept"))
11462      return parseCodeableConcept(json);
11463    else if (type.equals("Money"))
11464      return parseMoney(json);
11465    else if (type.equals("SimpleQuantity"))
11466      return parseSimpleQuantity(json);
11467    else if (type.equals("Duration"))
11468      return parseDuration(json);
11469    else if (type.equals("Count"))
11470      return parseCount(json);
11471    else if (type.equals("Distance"))
11472      return parseDistance(json);
11473    else if (type.equals("Age"))
11474      return parseAge(json);
11475    else if (type.equals("HumanName"))
11476      return parseHumanName(json);
11477    else if (type.equals("ContactPoint"))
11478      return parseContactPoint(json);
11479    else if (type.equals("Meta"))
11480      return parseMeta(json);
11481    else if (type.equals("Address"))
11482      return parseAddress(json);
11483    else if (type.equals("Timing"))
11484      return parseTiming(json);
11485    else if (type.equals("ElementDefinition"))
11486      return parseElementDefinition(json);
11487    throw new FHIRFormatError("Unknown Type "+type);
11488  }
11489
11490  protected boolean hasTypeName(JsonObject json, String prefix) {
11491        if (json.has(prefix+"Identifier"))
11492      return true;
11493    if (json.has(prefix+"Coding"))
11494      return true;
11495    if (json.has(prefix+"Reference"))
11496      return true;
11497    if (json.has(prefix+"Signature"))
11498      return true;
11499    if (json.has(prefix+"SampledData"))
11500      return true;
11501    if (json.has(prefix+"Quantity"))
11502      return true;
11503    if (json.has(prefix+"Period"))
11504      return true;
11505    if (json.has(prefix+"Attachment"))
11506      return true;
11507    if (json.has(prefix+"Ratio"))
11508      return true;
11509    if (json.has(prefix+"Range"))
11510      return true;
11511    if (json.has(prefix+"Annotation"))
11512      return true;
11513    if (json.has(prefix+"CodeableConcept"))
11514      return true;
11515    if (json.has(prefix+"Money"))
11516      return true;
11517    if (json.has(prefix+"SimpleQuantity"))
11518      return true;
11519    if (json.has(prefix+"Duration"))
11520      return true;
11521    if (json.has(prefix+"Count"))
11522      return true;
11523    if (json.has(prefix+"Distance"))
11524      return true;
11525    if (json.has(prefix+"Age"))
11526      return true;
11527    if (json.has(prefix+"HumanName"))
11528      return true;
11529    if (json.has(prefix+"ContactPoint"))
11530      return true;
11531    if (json.has(prefix+"Meta"))
11532      return true;
11533    if (json.has(prefix+"Address"))
11534      return true;
11535    if (json.has(prefix+"Timing"))
11536      return true;
11537    if (json.has(prefix+"ElementDefinition"))
11538      return true;
11539    if (json.has(prefix+"Parameters"))
11540      return true;
11541    if (json.has(prefix+"Account"))
11542      return true;
11543    if (json.has(prefix+"AllergyIntolerance"))
11544      return true;
11545    if (json.has(prefix+"Appointment"))
11546      return true;
11547    if (json.has(prefix+"AppointmentResponse"))
11548      return true;
11549    if (json.has(prefix+"AuditEvent"))
11550      return true;
11551    if (json.has(prefix+"Basic"))
11552      return true;
11553    if (json.has(prefix+"Binary"))
11554      return true;
11555    if (json.has(prefix+"BodySite"))
11556      return true;
11557    if (json.has(prefix+"Bundle"))
11558      return true;
11559    if (json.has(prefix+"CarePlan"))
11560      return true;
11561    if (json.has(prefix+"Claim"))
11562      return true;
11563    if (json.has(prefix+"ClaimResponse"))
11564      return true;
11565    if (json.has(prefix+"ClinicalImpression"))
11566      return true;
11567    if (json.has(prefix+"Communication"))
11568      return true;
11569    if (json.has(prefix+"CommunicationRequest"))
11570      return true;
11571    if (json.has(prefix+"Composition"))
11572      return true;
11573    if (json.has(prefix+"ConceptMap"))
11574      return true;
11575    if (json.has(prefix+"Condition"))
11576      return true;
11577    if (json.has(prefix+"Conformance"))
11578      return true;
11579    if (json.has(prefix+"Contract"))
11580      return true;
11581    if (json.has(prefix+"Coverage"))
11582      return true;
11583    if (json.has(prefix+"DataElement"))
11584      return true;
11585    if (json.has(prefix+"DetectedIssue"))
11586      return true;
11587    if (json.has(prefix+"Device"))
11588      return true;
11589    if (json.has(prefix+"DeviceComponent"))
11590      return true;
11591    if (json.has(prefix+"DeviceMetric"))
11592      return true;
11593    if (json.has(prefix+"DeviceUseRequest"))
11594      return true;
11595    if (json.has(prefix+"DeviceUseStatement"))
11596      return true;
11597    if (json.has(prefix+"DiagnosticOrder"))
11598      return true;
11599    if (json.has(prefix+"DiagnosticReport"))
11600      return true;
11601    if (json.has(prefix+"DocumentManifest"))
11602      return true;
11603    if (json.has(prefix+"DocumentReference"))
11604      return true;
11605    if (json.has(prefix+"EligibilityRequest"))
11606      return true;
11607    if (json.has(prefix+"EligibilityResponse"))
11608      return true;
11609    if (json.has(prefix+"Encounter"))
11610      return true;
11611    if (json.has(prefix+"EnrollmentRequest"))
11612      return true;
11613    if (json.has(prefix+"EnrollmentResponse"))
11614      return true;
11615    if (json.has(prefix+"EpisodeOfCare"))
11616      return true;
11617    if (json.has(prefix+"ExplanationOfBenefit"))
11618      return true;
11619    if (json.has(prefix+"FamilyMemberHistory"))
11620      return true;
11621    if (json.has(prefix+"Flag"))
11622      return true;
11623    if (json.has(prefix+"Goal"))
11624      return true;
11625    if (json.has(prefix+"Group"))
11626      return true;
11627    if (json.has(prefix+"HealthcareService"))
11628      return true;
11629    if (json.has(prefix+"ImagingObjectSelection"))
11630      return true;
11631    if (json.has(prefix+"ImagingStudy"))
11632      return true;
11633    if (json.has(prefix+"Immunization"))
11634      return true;
11635    if (json.has(prefix+"ImmunizationRecommendation"))
11636      return true;
11637    if (json.has(prefix+"ImplementationGuide"))
11638      return true;
11639    if (json.has(prefix+"List"))
11640      return true;
11641    if (json.has(prefix+"Location"))
11642      return true;
11643    if (json.has(prefix+"Media"))
11644      return true;
11645    if (json.has(prefix+"Medication"))
11646      return true;
11647    if (json.has(prefix+"MedicationAdministration"))
11648      return true;
11649    if (json.has(prefix+"MedicationDispense"))
11650      return true;
11651    if (json.has(prefix+"MedicationOrder"))
11652      return true;
11653    if (json.has(prefix+"MedicationStatement"))
11654      return true;
11655    if (json.has(prefix+"MessageHeader"))
11656      return true;
11657    if (json.has(prefix+"NamingSystem"))
11658      return true;
11659    if (json.has(prefix+"NutritionOrder"))
11660      return true;
11661    if (json.has(prefix+"Observation"))
11662      return true;
11663    if (json.has(prefix+"OperationDefinition"))
11664      return true;
11665    if (json.has(prefix+"OperationOutcome"))
11666      return true;
11667    if (json.has(prefix+"Order"))
11668      return true;
11669    if (json.has(prefix+"OrderResponse"))
11670      return true;
11671    if (json.has(prefix+"Organization"))
11672      return true;
11673    if (json.has(prefix+"Patient"))
11674      return true;
11675    if (json.has(prefix+"PaymentNotice"))
11676      return true;
11677    if (json.has(prefix+"PaymentReconciliation"))
11678      return true;
11679    if (json.has(prefix+"Person"))
11680      return true;
11681    if (json.has(prefix+"Practitioner"))
11682      return true;
11683    if (json.has(prefix+"Procedure"))
11684      return true;
11685    if (json.has(prefix+"ProcedureRequest"))
11686      return true;
11687    if (json.has(prefix+"ProcessRequest"))
11688      return true;
11689    if (json.has(prefix+"ProcessResponse"))
11690      return true;
11691    if (json.has(prefix+"Provenance"))
11692      return true;
11693    if (json.has(prefix+"Questionnaire"))
11694      return true;
11695    if (json.has(prefix+"QuestionnaireResponse"))
11696      return true;
11697    if (json.has(prefix+"ReferralRequest"))
11698      return true;
11699    if (json.has(prefix+"RelatedPerson"))
11700      return true;
11701    if (json.has(prefix+"RiskAssessment"))
11702      return true;
11703    if (json.has(prefix+"Schedule"))
11704      return true;
11705    if (json.has(prefix+"SearchParameter"))
11706      return true;
11707    if (json.has(prefix+"Slot"))
11708      return true;
11709    if (json.has(prefix+"Specimen"))
11710      return true;
11711    if (json.has(prefix+"StructureDefinition"))
11712      return true;
11713    if (json.has(prefix+"Subscription"))
11714      return true;
11715    if (json.has(prefix+"Substance"))
11716      return true;
11717    if (json.has(prefix+"SupplyDelivery"))
11718      return true;
11719    if (json.has(prefix+"SupplyRequest"))
11720      return true;
11721    if (json.has(prefix+"TestScript"))
11722      return true;
11723    if (json.has(prefix+"ValueSet"))
11724      return true;
11725    if (json.has(prefix+"VisionPrescription"))
11726      return true;
11727    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
11728      return true;
11729    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
11730      return true;
11731    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
11732      return true;
11733    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
11734      return true;
11735    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
11736      return true;
11737    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
11738      return true;
11739    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
11740      return true;
11741    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
11742      return true;
11743    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
11744      return true;
11745    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
11746      return true;
11747    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
11748      return true;
11749    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
11750      return true;
11751    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
11752      return true;
11753    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
11754      return true;
11755    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
11756      return true;
11757    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
11758      return true;
11759    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
11760      return true;
11761    return false;
11762  }
11763  protected void composeElement(Element element) throws IOException {
11764    if (element.hasId())
11765      prop("id", element.getId());
11766      if (makeComments(element)) {
11767        openArray("fhir_comments");
11768        for (String s : element.getFormatCommentsPre())
11769          prop(null,  s);
11770        for (String s : element.getFormatCommentsPost())
11771          prop(null,  s);
11772         closeArray();
11773      }
11774    if (element.hasExtension()) {
11775      openArray("extension");
11776      for (Extension e : element.getExtension())
11777        composeExtension(null, e);
11778      closeArray();
11779    }
11780  }
11781
11782  protected void composeBackbone(BackboneElement element) throws IOException {
11783    composeElement(element);
11784    if (element.hasModifierExtension()) {
11785      openArray("modifierExtension");
11786      for (Extension e : element.getModifierExtension())
11787        composeExtension(null, e);
11788      closeArray();
11789    }
11790  }
11791
11792  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11793    if (value != null && value.getValue() != null) {
11794      prop(name, e.toCode(value.getValue()));
11795    } else if (inArray)   
11796      writeNull(name);
11797  }    
11798
11799  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11800    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11801      open(inArray ? null : "_"+name);
11802      composeElement(value);
11803      close();
11804    } else if (inArray)   
11805      writeNull(name);
11806  }    
11807
11808  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
11809    if (value != null && value.hasValue()) {
11810        prop(name, value.asStringValue());
11811    }    
11812    else if (inArray) 
11813      writeNull(name); 
11814  }    
11815
11816  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
11817    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11818      open(inArray ? null : "_"+name);
11819      composeElement(value);
11820      close();
11821    }
11822    else if (inArray) 
11823      writeNull(name); 
11824  }
11825
11826  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
11827    if (value != null && value.hasValue()) {
11828        prop(name, value.asStringValue());
11829    }    
11830    else if (inArray) 
11831      writeNull(name); 
11832  }    
11833
11834  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
11835    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11836      open(inArray ? null : "_"+name);
11837      composeElement(value);
11838      close();
11839    }
11840    else if (inArray) 
11841      writeNull(name); 
11842  }
11843
11844  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
11845    if (value != null && value.hasValue()) {
11846        prop(name, toString(value.getValue()));
11847    }    
11848    else if (inArray) 
11849      writeNull(name); 
11850  }    
11851
11852  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
11853    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11854      open(inArray ? null : "_"+name);
11855      composeElement(value);
11856      close();
11857    }
11858    else if (inArray) 
11859      writeNull(name); 
11860  }
11861
11862  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
11863    if (value != null && value.hasValue()) {
11864        prop(name, toString(value.getValue()));
11865    }    
11866    else if (inArray) 
11867      writeNull(name); 
11868  }    
11869
11870  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
11871    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11872      open(inArray ? null : "_"+name);
11873      composeElement(value);
11874      close();
11875    }
11876    else if (inArray) 
11877      writeNull(name); 
11878  }
11879
11880  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
11881    if (value != null && value.hasValue()) {
11882        prop(name, Integer.valueOf(value.getValue()));
11883    }    
11884    else if (inArray) 
11885      writeNull(name); 
11886  }    
11887
11888  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
11889    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11890      open(inArray ? null : "_"+name);
11891      composeElement(value);
11892      close();
11893    }
11894    else if (inArray) 
11895      writeNull(name); 
11896  }
11897
11898  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
11899    if (value != null && value.hasValue()) {
11900        prop(name, toString(value.getValue()));
11901    }    
11902    else if (inArray) 
11903      writeNull(name); 
11904  }    
11905
11906  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
11907    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11908      open(inArray ? null : "_"+name);
11909      composeElement(value);
11910      close();
11911    }
11912    else if (inArray) 
11913      writeNull(name); 
11914  }
11915
11916  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
11917    if (value != null && value.hasValue()) {
11918        prop(name, toString(value.getValue()));
11919    }    
11920    else if (inArray) 
11921      writeNull(name); 
11922  }    
11923
11924  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
11925    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11926      open(inArray ? null : "_"+name);
11927      composeElement(value);
11928      close();
11929    }
11930    else if (inArray) 
11931      writeNull(name); 
11932  }
11933
11934  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
11935    if (value != null && value.hasValue()) {
11936        prop(name, toString(value.getValue()));
11937    }    
11938    else if (inArray) 
11939      writeNull(name); 
11940  }    
11941
11942  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
11943    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11944      open(inArray ? null : "_"+name);
11945      composeElement(value);
11946      close();
11947    }
11948    else if (inArray) 
11949      writeNull(name); 
11950  }
11951
11952  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
11953    if (value != null && value.hasValue()) {
11954        prop(name, value.asStringValue());
11955    }    
11956    else if (inArray) 
11957      writeNull(name); 
11958  }    
11959
11960  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
11961    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11962      open(inArray ? null : "_"+name);
11963      composeElement(value);
11964      close();
11965    }
11966    else if (inArray) 
11967      writeNull(name); 
11968  }
11969
11970  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
11971    if (value != null && value.hasValue()) {
11972        prop(name, value.getValue());
11973    }    
11974    else if (inArray) 
11975      writeNull(name); 
11976  }    
11977
11978  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
11979    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11980      open(inArray ? null : "_"+name);
11981      composeElement(value);
11982      close();
11983    }
11984    else if (inArray) 
11985      writeNull(name); 
11986  }
11987
11988  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
11989    if (value != null && value.hasValue()) {
11990        prop(name, toString(value.getValue()));
11991    }    
11992    else if (inArray) 
11993      writeNull(name); 
11994  }    
11995
11996  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
11997    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11998      open(inArray ? null : "_"+name);
11999      composeElement(value);
12000      close();
12001    }
12002    else if (inArray) 
12003      writeNull(name); 
12004  }
12005
12006  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
12007    if (value != null && value.hasValue()) {
12008        prop(name, Integer.valueOf(value.getValue()));
12009    }    
12010    else if (inArray) 
12011      writeNull(name); 
12012  }    
12013
12014  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
12015    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12016      open(inArray ? null : "_"+name);
12017      composeElement(value);
12018      close();
12019    }
12020    else if (inArray) 
12021      writeNull(name); 
12022  }
12023
12024  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
12025    if (value != null && value.hasValue()) {
12026        prop(name, toString(value.getValue()));
12027    }    
12028    else if (inArray) 
12029      writeNull(name); 
12030  }    
12031
12032  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
12033    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12034      open(inArray ? null : "_"+name);
12035      composeElement(value);
12036      close();
12037    }
12038    else if (inArray) 
12039      writeNull(name); 
12040  }
12041
12042  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
12043    if (value != null && value.hasValue()) {
12044        prop(name, value.asStringValue());
12045    }    
12046    else if (inArray) 
12047      writeNull(name); 
12048  }    
12049
12050  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
12051    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12052      open(inArray ? null : "_"+name);
12053      composeElement(value);
12054      close();
12055    }
12056    else if (inArray) 
12057      writeNull(name); 
12058  }
12059
12060  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
12061    if (value != null && value.hasValue()) {
12062        prop(name, toString(value.getValue()));
12063    }    
12064    else if (inArray) 
12065      writeNull(name); 
12066  }    
12067
12068  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
12069    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12070      open(inArray ? null : "_"+name);
12071      composeElement(value);
12072      close();
12073    }
12074    else if (inArray) 
12075      writeNull(name); 
12076  }
12077
12078  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
12079    if (value != null && value.hasValue()) {
12080        prop(name, Integer.valueOf(value.getValue()));
12081    }    
12082    else if (inArray) 
12083      writeNull(name); 
12084  }    
12085
12086  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
12087    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12088      open(inArray ? null : "_"+name);
12089      composeElement(value);
12090      close();
12091    }
12092    else if (inArray) 
12093      writeNull(name); 
12094  }
12095
12096  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
12097    if (value != null && value.hasValue()) {
12098        prop(name, value.getValue());
12099    }    
12100    else if (inArray) 
12101      writeNull(name); 
12102  }    
12103
12104  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
12105    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12106      open(inArray ? null : "_"+name);
12107      composeElement(value);
12108      close();
12109    }
12110    else if (inArray) 
12111      writeNull(name); 
12112  }
12113
12114  protected void composeExtension(String name, Extension element) throws IOException {
12115    if (element != null) {
12116      open(name);
12117      composeExtensionInner(element);
12118      close();
12119    }
12120  }
12121
12122  protected void composeExtensionInner(Extension element) throws IOException {
12123      composeElement(element);
12124      if (element.hasUrlElement()) {
12125        composeUriCore("url", element.getUrlElement(), false);
12126        composeUriExtras("url", element.getUrlElement(), false);
12127      }
12128      if (element.hasValue()) {
12129        composeType("value", element.getValue());
12130      }
12131  }
12132
12133  protected void composeNarrative(String name, Narrative element) throws IOException {
12134    if (element != null) {
12135      open(name);
12136      composeNarrativeInner(element);
12137      close();
12138    }
12139  }
12140
12141  protected void composeNarrativeInner(Narrative element) throws IOException {
12142      composeElement(element);
12143      if (element.hasStatusElement()) {
12144        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12145        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12146      }
12147      if (element.hasDiv()) {
12148        composeXhtml("div", element.getDiv());
12149      }
12150  }
12151
12152  protected void composeIdentifier(String name, Identifier element) throws IOException {
12153    if (element != null) {
12154      open(name);
12155      composeIdentifierInner(element);
12156      close();
12157    }
12158  }
12159
12160  protected void composeIdentifierInner(Identifier element) throws IOException {
12161      composeElement(element);
12162      if (element.hasUseElement()) {
12163        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12164        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12165      }
12166      if (element.hasType()) {
12167        composeCodeableConcept("type", element.getType());
12168      }
12169      if (element.hasSystemElement()) {
12170        composeUriCore("system", element.getSystemElement(), false);
12171        composeUriExtras("system", element.getSystemElement(), false);
12172      }
12173      if (element.hasValueElement()) {
12174        composeStringCore("value", element.getValueElement(), false);
12175        composeStringExtras("value", element.getValueElement(), false);
12176      }
12177      if (element.hasPeriod()) {
12178        composePeriod("period", element.getPeriod());
12179      }
12180      if (element.hasAssigner()) {
12181        composeReference("assigner", element.getAssigner());
12182      }
12183  }
12184
12185  protected void composeCoding(String name, Coding element) throws IOException {
12186    if (element != null) {
12187      open(name);
12188      composeCodingInner(element);
12189      close();
12190    }
12191  }
12192
12193  protected void composeCodingInner(Coding element) throws IOException {
12194      composeElement(element);
12195      if (element.hasSystemElement()) {
12196        composeUriCore("system", element.getSystemElement(), false);
12197        composeUriExtras("system", element.getSystemElement(), false);
12198      }
12199      if (element.hasVersionElement()) {
12200        composeStringCore("version", element.getVersionElement(), false);
12201        composeStringExtras("version", element.getVersionElement(), false);
12202      }
12203      if (element.hasCodeElement()) {
12204        composeCodeCore("code", element.getCodeElement(), false);
12205        composeCodeExtras("code", element.getCodeElement(), false);
12206      }
12207      if (element.hasDisplayElement()) {
12208        composeStringCore("display", element.getDisplayElement(), false);
12209        composeStringExtras("display", element.getDisplayElement(), false);
12210      }
12211      if (element.hasUserSelectedElement()) {
12212        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
12213        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
12214      }
12215  }
12216
12217  protected void composeReference(String name, Reference element) throws IOException {
12218    if (element != null) {
12219      open(name);
12220      composeReferenceInner(element);
12221      close();
12222    }
12223  }
12224
12225  protected void composeReferenceInner(Reference element) throws IOException {
12226      composeElement(element);
12227      if (element.hasReferenceElement()) {
12228        composeStringCore("reference", element.getReferenceElement(), false);
12229        composeStringExtras("reference", element.getReferenceElement(), false);
12230      }
12231      if (element.hasDisplayElement()) {
12232        composeStringCore("display", element.getDisplayElement(), false);
12233        composeStringExtras("display", element.getDisplayElement(), false);
12234      }
12235  }
12236
12237  protected void composeSignature(String name, Signature element) throws IOException {
12238    if (element != null) {
12239      open(name);
12240      composeSignatureInner(element);
12241      close();
12242    }
12243  }
12244
12245  protected void composeSignatureInner(Signature element) throws IOException {
12246      composeElement(element);
12247      if (element.hasType()) {
12248        openArray("type");
12249        for (Coding e : element.getType()) 
12250          composeCoding(null, e);
12251        closeArray();
12252      };
12253      if (element.hasWhenElement()) {
12254        composeInstantCore("when", element.getWhenElement(), false);
12255        composeInstantExtras("when", element.getWhenElement(), false);
12256      }
12257      if (element.hasWho()) {
12258        composeType("who", element.getWho());
12259      }
12260      if (element.hasContentTypeElement()) {
12261        composeCodeCore("contentType", element.getContentTypeElement(), false);
12262        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12263      }
12264      if (element.hasBlobElement()) {
12265        composeBase64BinaryCore("blob", element.getBlobElement(), false);
12266        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
12267      }
12268  }
12269
12270  protected void composeSampledData(String name, SampledData element) throws IOException {
12271    if (element != null) {
12272      open(name);
12273      composeSampledDataInner(element);
12274      close();
12275    }
12276  }
12277
12278  protected void composeSampledDataInner(SampledData element) throws IOException {
12279      composeElement(element);
12280      if (element.hasOrigin()) {
12281        composeSimpleQuantity("origin", element.getOrigin());
12282      }
12283      if (element.hasPeriodElement()) {
12284        composeDecimalCore("period", element.getPeriodElement(), false);
12285        composeDecimalExtras("period", element.getPeriodElement(), false);
12286      }
12287      if (element.hasFactorElement()) {
12288        composeDecimalCore("factor", element.getFactorElement(), false);
12289        composeDecimalExtras("factor", element.getFactorElement(), false);
12290      }
12291      if (element.hasLowerLimitElement()) {
12292        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
12293        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
12294      }
12295      if (element.hasUpperLimitElement()) {
12296        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
12297        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
12298      }
12299      if (element.hasDimensionsElement()) {
12300        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
12301        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
12302      }
12303      if (element.hasDataElement()) {
12304        composeStringCore("data", element.getDataElement(), false);
12305        composeStringExtras("data", element.getDataElement(), false);
12306      }
12307  }
12308
12309  protected void composeQuantity(String name, Quantity element) throws IOException {
12310    if (element != null) {
12311      open(name);
12312      composeQuantityInner(element);
12313      close();
12314    }
12315  }
12316
12317  protected void composeQuantityInner(Quantity element) throws IOException {
12318      composeElement(element);
12319      if (element.hasValueElement()) {
12320        composeDecimalCore("value", element.getValueElement(), false);
12321        composeDecimalExtras("value", element.getValueElement(), false);
12322      }
12323      if (element.hasComparatorElement()) {
12324        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12325        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12326      }
12327      if (element.hasUnitElement()) {
12328        composeStringCore("unit", element.getUnitElement(), false);
12329        composeStringExtras("unit", element.getUnitElement(), false);
12330      }
12331      if (element.hasSystemElement()) {
12332        composeUriCore("system", element.getSystemElement(), false);
12333        composeUriExtras("system", element.getSystemElement(), false);
12334      }
12335      if (element.hasCodeElement()) {
12336        composeCodeCore("code", element.getCodeElement(), false);
12337        composeCodeExtras("code", element.getCodeElement(), false);
12338      }
12339  }
12340
12341  protected void composePeriod(String name, Period element) throws IOException {
12342    if (element != null) {
12343      open(name);
12344      composePeriodInner(element);
12345      close();
12346    }
12347  }
12348
12349  protected void composePeriodInner(Period element) throws IOException {
12350      composeElement(element);
12351      if (element.hasStartElement()) {
12352        composeDateTimeCore("start", element.getStartElement(), false);
12353        composeDateTimeExtras("start", element.getStartElement(), false);
12354      }
12355      if (element.hasEndElement()) {
12356        composeDateTimeCore("end", element.getEndElement(), false);
12357        composeDateTimeExtras("end", element.getEndElement(), false);
12358      }
12359  }
12360
12361  protected void composeAttachment(String name, Attachment element) throws IOException {
12362    if (element != null) {
12363      open(name);
12364      composeAttachmentInner(element);
12365      close();
12366    }
12367  }
12368
12369  protected void composeAttachmentInner(Attachment element) throws IOException {
12370      composeElement(element);
12371      if (element.hasContentTypeElement()) {
12372        composeCodeCore("contentType", element.getContentTypeElement(), false);
12373        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12374      }
12375      if (element.hasLanguageElement()) {
12376        composeCodeCore("language", element.getLanguageElement(), false);
12377        composeCodeExtras("language", element.getLanguageElement(), false);
12378      }
12379      if (element.hasDataElement()) {
12380        composeBase64BinaryCore("data", element.getDataElement(), false);
12381        composeBase64BinaryExtras("data", element.getDataElement(), false);
12382      }
12383      if (element.hasUrlElement()) {
12384        composeUriCore("url", element.getUrlElement(), false);
12385        composeUriExtras("url", element.getUrlElement(), false);
12386      }
12387      if (element.hasSizeElement()) {
12388        composeUnsignedIntCore("size", element.getSizeElement(), false);
12389        composeUnsignedIntExtras("size", element.getSizeElement(), false);
12390      }
12391      if (element.hasHashElement()) {
12392        composeBase64BinaryCore("hash", element.getHashElement(), false);
12393        composeBase64BinaryExtras("hash", element.getHashElement(), false);
12394      }
12395      if (element.hasTitleElement()) {
12396        composeStringCore("title", element.getTitleElement(), false);
12397        composeStringExtras("title", element.getTitleElement(), false);
12398      }
12399      if (element.hasCreationElement()) {
12400        composeDateTimeCore("creation", element.getCreationElement(), false);
12401        composeDateTimeExtras("creation", element.getCreationElement(), false);
12402      }
12403  }
12404
12405  protected void composeRatio(String name, Ratio element) throws IOException {
12406    if (element != null) {
12407      open(name);
12408      composeRatioInner(element);
12409      close();
12410    }
12411  }
12412
12413  protected void composeRatioInner(Ratio element) throws IOException {
12414      composeElement(element);
12415      if (element.hasNumerator()) {
12416        composeQuantity("numerator", element.getNumerator());
12417      }
12418      if (element.hasDenominator()) {
12419        composeQuantity("denominator", element.getDenominator());
12420      }
12421  }
12422
12423  protected void composeRange(String name, Range element) throws IOException {
12424    if (element != null) {
12425      open(name);
12426      composeRangeInner(element);
12427      close();
12428    }
12429  }
12430
12431  protected void composeRangeInner(Range element) throws IOException {
12432      composeElement(element);
12433      if (element.hasLow()) {
12434        composeSimpleQuantity("low", element.getLow());
12435      }
12436      if (element.hasHigh()) {
12437        composeSimpleQuantity("high", element.getHigh());
12438      }
12439  }
12440
12441  protected void composeAnnotation(String name, Annotation element) throws IOException {
12442    if (element != null) {
12443      open(name);
12444      composeAnnotationInner(element);
12445      close();
12446    }
12447  }
12448
12449  protected void composeAnnotationInner(Annotation element) throws IOException {
12450      composeElement(element);
12451      if (element.hasAuthor()) {
12452        composeType("author", element.getAuthor());
12453      }
12454      if (element.hasTimeElement()) {
12455        composeDateTimeCore("time", element.getTimeElement(), false);
12456        composeDateTimeExtras("time", element.getTimeElement(), false);
12457      }
12458      if (element.hasTextElement()) {
12459        composeStringCore("text", element.getTextElement(), false);
12460        composeStringExtras("text", element.getTextElement(), false);
12461      }
12462  }
12463
12464  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
12465    if (element != null) {
12466      open(name);
12467      composeCodeableConceptInner(element);
12468      close();
12469    }
12470  }
12471
12472  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
12473      composeElement(element);
12474      if (element.hasCoding()) {
12475        openArray("coding");
12476        for (Coding e : element.getCoding()) 
12477          composeCoding(null, e);
12478        closeArray();
12479      };
12480      if (element.hasTextElement()) {
12481        composeStringCore("text", element.getTextElement(), false);
12482        composeStringExtras("text", element.getTextElement(), false);
12483      }
12484  }
12485
12486  protected void composeMoney(String name, Money element) throws IOException {
12487    if (element != null) {
12488      open(name);
12489      composeMoneyInner(element);
12490      close();
12491    }
12492  }
12493
12494  protected void composeMoneyInner(Money element) throws IOException {
12495      composeElement(element);
12496      if (element.hasValueElement()) {
12497        composeDecimalCore("value", element.getValueElement(), false);
12498        composeDecimalExtras("value", element.getValueElement(), false);
12499      }
12500      if (element.hasComparatorElement()) {
12501        composeEnumerationCore("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12502        composeEnumerationExtras("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12503      }
12504      if (element.hasUnitElement()) {
12505        composeStringCore("unit", element.getUnitElement(), false);
12506        composeStringExtras("unit", element.getUnitElement(), false);
12507      }
12508      if (element.hasSystemElement()) {
12509        composeUriCore("system", element.getSystemElement(), false);
12510        composeUriExtras("system", element.getSystemElement(), false);
12511      }
12512      if (element.hasCodeElement()) {
12513        composeCodeCore("code", element.getCodeElement(), false);
12514        composeCodeExtras("code", element.getCodeElement(), false);
12515      }
12516  }
12517
12518  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
12519    if (element != null) {
12520      open(name);
12521      composeSimpleQuantityInner(element);
12522      close();
12523    }
12524  }
12525
12526  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
12527      composeElement(element);
12528      if (element.hasValueElement()) {
12529        composeDecimalCore("value", element.getValueElement(), false);
12530        composeDecimalExtras("value", element.getValueElement(), false);
12531      }
12532      if (element.hasComparatorElement()) {
12533        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12534        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12535      }
12536      if (element.hasUnitElement()) {
12537        composeStringCore("unit", element.getUnitElement(), false);
12538        composeStringExtras("unit", element.getUnitElement(), false);
12539      }
12540      if (element.hasSystemElement()) {
12541        composeUriCore("system", element.getSystemElement(), false);
12542        composeUriExtras("system", element.getSystemElement(), false);
12543      }
12544      if (element.hasCodeElement()) {
12545        composeCodeCore("code", element.getCodeElement(), false);
12546        composeCodeExtras("code", element.getCodeElement(), false);
12547      }
12548  }
12549
12550  protected void composeDuration(String name, Duration element) throws IOException {
12551    if (element != null) {
12552      open(name);
12553      composeDurationInner(element);
12554      close();
12555    }
12556  }
12557
12558  protected void composeDurationInner(Duration element) throws IOException {
12559      composeElement(element);
12560      if (element.hasValueElement()) {
12561        composeDecimalCore("value", element.getValueElement(), false);
12562        composeDecimalExtras("value", element.getValueElement(), false);
12563      }
12564      if (element.hasComparatorElement()) {
12565        composeEnumerationCore("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12566        composeEnumerationExtras("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12567      }
12568      if (element.hasUnitElement()) {
12569        composeStringCore("unit", element.getUnitElement(), false);
12570        composeStringExtras("unit", element.getUnitElement(), false);
12571      }
12572      if (element.hasSystemElement()) {
12573        composeUriCore("system", element.getSystemElement(), false);
12574        composeUriExtras("system", element.getSystemElement(), false);
12575      }
12576      if (element.hasCodeElement()) {
12577        composeCodeCore("code", element.getCodeElement(), false);
12578        composeCodeExtras("code", element.getCodeElement(), false);
12579      }
12580  }
12581
12582  protected void composeCount(String name, Count element) throws IOException {
12583    if (element != null) {
12584      open(name);
12585      composeCountInner(element);
12586      close();
12587    }
12588  }
12589
12590  protected void composeCountInner(Count element) throws IOException {
12591      composeElement(element);
12592      if (element.hasValueElement()) {
12593        composeDecimalCore("value", element.getValueElement(), false);
12594        composeDecimalExtras("value", element.getValueElement(), false);
12595      }
12596      if (element.hasComparatorElement()) {
12597        composeEnumerationCore("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12598        composeEnumerationExtras("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12599      }
12600      if (element.hasUnitElement()) {
12601        composeStringCore("unit", element.getUnitElement(), false);
12602        composeStringExtras("unit", element.getUnitElement(), false);
12603      }
12604      if (element.hasSystemElement()) {
12605        composeUriCore("system", element.getSystemElement(), false);
12606        composeUriExtras("system", element.getSystemElement(), false);
12607      }
12608      if (element.hasCodeElement()) {
12609        composeCodeCore("code", element.getCodeElement(), false);
12610        composeCodeExtras("code", element.getCodeElement(), false);
12611      }
12612  }
12613
12614  protected void composeDistance(String name, Distance element) throws IOException {
12615    if (element != null) {
12616      open(name);
12617      composeDistanceInner(element);
12618      close();
12619    }
12620  }
12621
12622  protected void composeDistanceInner(Distance element) throws IOException {
12623      composeElement(element);
12624      if (element.hasValueElement()) {
12625        composeDecimalCore("value", element.getValueElement(), false);
12626        composeDecimalExtras("value", element.getValueElement(), false);
12627      }
12628      if (element.hasComparatorElement()) {
12629        composeEnumerationCore("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12630        composeEnumerationExtras("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12631      }
12632      if (element.hasUnitElement()) {
12633        composeStringCore("unit", element.getUnitElement(), false);
12634        composeStringExtras("unit", element.getUnitElement(), false);
12635      }
12636      if (element.hasSystemElement()) {
12637        composeUriCore("system", element.getSystemElement(), false);
12638        composeUriExtras("system", element.getSystemElement(), false);
12639      }
12640      if (element.hasCodeElement()) {
12641        composeCodeCore("code", element.getCodeElement(), false);
12642        composeCodeExtras("code", element.getCodeElement(), false);
12643      }
12644  }
12645
12646  protected void composeAge(String name, Age element) throws IOException {
12647    if (element != null) {
12648      open(name);
12649      composeAgeInner(element);
12650      close();
12651    }
12652  }
12653
12654  protected void composeAgeInner(Age element) throws IOException {
12655      composeElement(element);
12656      if (element.hasValueElement()) {
12657        composeDecimalCore("value", element.getValueElement(), false);
12658        composeDecimalExtras("value", element.getValueElement(), false);
12659      }
12660      if (element.hasComparatorElement()) {
12661        composeEnumerationCore("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12662        composeEnumerationExtras("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12663      }
12664      if (element.hasUnitElement()) {
12665        composeStringCore("unit", element.getUnitElement(), false);
12666        composeStringExtras("unit", element.getUnitElement(), false);
12667      }
12668      if (element.hasSystemElement()) {
12669        composeUriCore("system", element.getSystemElement(), false);
12670        composeUriExtras("system", element.getSystemElement(), false);
12671      }
12672      if (element.hasCodeElement()) {
12673        composeCodeCore("code", element.getCodeElement(), false);
12674        composeCodeExtras("code", element.getCodeElement(), false);
12675      }
12676  }
12677
12678  protected void composeHumanName(String name, HumanName element) throws IOException {
12679    if (element != null) {
12680      open(name);
12681      composeHumanNameInner(element);
12682      close();
12683    }
12684  }
12685
12686  protected void composeHumanNameInner(HumanName element) throws IOException {
12687      composeElement(element);
12688      if (element.hasUseElement()) {
12689        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12690        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12691      }
12692      if (element.hasTextElement()) {
12693        composeStringCore("text", element.getTextElement(), false);
12694        composeStringExtras("text", element.getTextElement(), false);
12695      }
12696      if (element.hasFamily()) {
12697        openArray("family");
12698        for (StringType e : element.getFamily()) 
12699          composeStringCore(null, e, true);
12700        closeArray();
12701        if (anyHasExtras(element.getFamily())) {
12702          openArray("_family");
12703          for (StringType e : element.getFamily()) 
12704            composeStringExtras(null, e, true);
12705          closeArray();
12706        }
12707      };
12708      if (element.hasGiven()) {
12709        openArray("given");
12710        for (StringType e : element.getGiven()) 
12711          composeStringCore(null, e, true);
12712        closeArray();
12713        if (anyHasExtras(element.getGiven())) {
12714          openArray("_given");
12715          for (StringType e : element.getGiven()) 
12716            composeStringExtras(null, e, true);
12717          closeArray();
12718        }
12719      };
12720      if (element.hasPrefix()) {
12721        openArray("prefix");
12722        for (StringType e : element.getPrefix()) 
12723          composeStringCore(null, e, true);
12724        closeArray();
12725        if (anyHasExtras(element.getPrefix())) {
12726          openArray("_prefix");
12727          for (StringType e : element.getPrefix()) 
12728            composeStringExtras(null, e, true);
12729          closeArray();
12730        }
12731      };
12732      if (element.hasSuffix()) {
12733        openArray("suffix");
12734        for (StringType e : element.getSuffix()) 
12735          composeStringCore(null, e, true);
12736        closeArray();
12737        if (anyHasExtras(element.getSuffix())) {
12738          openArray("_suffix");
12739          for (StringType e : element.getSuffix()) 
12740            composeStringExtras(null, e, true);
12741          closeArray();
12742        }
12743      };
12744      if (element.hasPeriod()) {
12745        composePeriod("period", element.getPeriod());
12746      }
12747  }
12748
12749  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
12750    if (element != null) {
12751      open(name);
12752      composeContactPointInner(element);
12753      close();
12754    }
12755  }
12756
12757  protected void composeContactPointInner(ContactPoint element) throws IOException {
12758      composeElement(element);
12759      if (element.hasSystemElement()) {
12760        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12761        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12762      }
12763      if (element.hasValueElement()) {
12764        composeStringCore("value", element.getValueElement(), false);
12765        composeStringExtras("value", element.getValueElement(), false);
12766      }
12767      if (element.hasUseElement()) {
12768        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12769        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12770      }
12771      if (element.hasRankElement()) {
12772        composePositiveIntCore("rank", element.getRankElement(), false);
12773        composePositiveIntExtras("rank", element.getRankElement(), false);
12774      }
12775      if (element.hasPeriod()) {
12776        composePeriod("period", element.getPeriod());
12777      }
12778  }
12779
12780  protected void composeMeta(String name, Meta element) throws IOException {
12781    if (element != null) {
12782      open(name);
12783      composeMetaInner(element);
12784      close();
12785    }
12786  }
12787
12788  protected void composeMetaInner(Meta element) throws IOException {
12789      composeElement(element);
12790      if (element.hasVersionIdElement()) {
12791        composeIdCore("versionId", element.getVersionIdElement(), false);
12792        composeIdExtras("versionId", element.getVersionIdElement(), false);
12793      }
12794      if (element.hasLastUpdatedElement()) {
12795        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
12796        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
12797      }
12798      if (element.hasProfile()) {
12799        openArray("profile");
12800        for (UriType e : element.getProfile()) 
12801          composeUriCore(null, e, true);
12802        closeArray();
12803        if (anyHasExtras(element.getProfile())) {
12804          openArray("_profile");
12805          for (UriType e : element.getProfile()) 
12806            composeUriExtras(null, e, true);
12807          closeArray();
12808        }
12809      };
12810      if (element.hasSecurity()) {
12811        openArray("security");
12812        for (Coding e : element.getSecurity()) 
12813          composeCoding(null, e);
12814        closeArray();
12815      };
12816      if (element.hasTag()) {
12817        openArray("tag");
12818        for (Coding e : element.getTag()) 
12819          composeCoding(null, e);
12820        closeArray();
12821      };
12822  }
12823
12824  protected void composeAddress(String name, Address element) throws IOException {
12825    if (element != null) {
12826      open(name);
12827      composeAddressInner(element);
12828      close();
12829    }
12830  }
12831
12832  protected void composeAddressInner(Address element) throws IOException {
12833      composeElement(element);
12834      if (element.hasUseElement()) {
12835        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12836        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12837      }
12838      if (element.hasTypeElement()) {
12839        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12840        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12841      }
12842      if (element.hasTextElement()) {
12843        composeStringCore("text", element.getTextElement(), false);
12844        composeStringExtras("text", element.getTextElement(), false);
12845      }
12846      if (element.hasLine()) {
12847        openArray("line");
12848        for (StringType e : element.getLine()) 
12849          composeStringCore(null, e, true);
12850        closeArray();
12851        if (anyHasExtras(element.getLine())) {
12852          openArray("_line");
12853          for (StringType e : element.getLine()) 
12854            composeStringExtras(null, e, true);
12855          closeArray();
12856        }
12857      };
12858      if (element.hasCityElement()) {
12859        composeStringCore("city", element.getCityElement(), false);
12860        composeStringExtras("city", element.getCityElement(), false);
12861      }
12862      if (element.hasDistrictElement()) {
12863        composeStringCore("district", element.getDistrictElement(), false);
12864        composeStringExtras("district", element.getDistrictElement(), false);
12865      }
12866      if (element.hasStateElement()) {
12867        composeStringCore("state", element.getStateElement(), false);
12868        composeStringExtras("state", element.getStateElement(), false);
12869      }
12870      if (element.hasPostalCodeElement()) {
12871        composeStringCore("postalCode", element.getPostalCodeElement(), false);
12872        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
12873      }
12874      if (element.hasCountryElement()) {
12875        composeStringCore("country", element.getCountryElement(), false);
12876        composeStringExtras("country", element.getCountryElement(), false);
12877      }
12878      if (element.hasPeriod()) {
12879        composePeriod("period", element.getPeriod());
12880      }
12881  }
12882
12883  protected void composeTiming(String name, Timing element) throws IOException {
12884    if (element != null) {
12885      open(name);
12886      composeTimingInner(element);
12887      close();
12888    }
12889  }
12890
12891  protected void composeTimingInner(Timing element) throws IOException {
12892      composeElement(element);
12893      if (element.hasEvent()) {
12894        openArray("event");
12895        for (DateTimeType e : element.getEvent()) 
12896          composeDateTimeCore(null, e, true);
12897        closeArray();
12898        if (anyHasExtras(element.getEvent())) {
12899          openArray("_event");
12900          for (DateTimeType e : element.getEvent()) 
12901            composeDateTimeExtras(null, e, true);
12902          closeArray();
12903        }
12904      };
12905      if (element.hasRepeat()) {
12906        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
12907      }
12908      if (element.hasCode()) {
12909        composeCodeableConcept("code", element.getCode());
12910      }
12911  }
12912
12913  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
12914    if (element != null) {
12915      open(name);
12916      composeTimingTimingRepeatComponentInner(element);
12917      close();
12918    }
12919  }
12920
12921  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
12922      composeElement(element);
12923      if (element.hasBounds()) {
12924        composeType("bounds", element.getBounds());
12925      }
12926      if (element.hasCountElement()) {
12927        composeIntegerCore("count", element.getCountElement(), false);
12928        composeIntegerExtras("count", element.getCountElement(), false);
12929      }
12930      if (element.hasDurationElement()) {
12931        composeDecimalCore("duration", element.getDurationElement(), false);
12932        composeDecimalExtras("duration", element.getDurationElement(), false);
12933      }
12934      if (element.hasDurationMaxElement()) {
12935        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
12936        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
12937      }
12938      if (element.hasDurationUnitsElement()) {
12939        composeEnumerationCore("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12940        composeEnumerationExtras("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12941      }
12942      if (element.hasFrequencyElement()) {
12943        composeIntegerCore("frequency", element.getFrequencyElement(), false);
12944        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
12945      }
12946      if (element.hasFrequencyMaxElement()) {
12947        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
12948        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
12949      }
12950      if (element.hasPeriodElement()) {
12951        composeDecimalCore("period", element.getPeriodElement(), false);
12952        composeDecimalExtras("period", element.getPeriodElement(), false);
12953      }
12954      if (element.hasPeriodMaxElement()) {
12955        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
12956        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
12957      }
12958      if (element.hasPeriodUnitsElement()) {
12959        composeEnumerationCore("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12960        composeEnumerationExtras("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12961      }
12962      if (element.hasWhenElement()) {
12963        composeEnumerationCore("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12964        composeEnumerationExtras("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12965      }
12966  }
12967
12968  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
12969    if (element != null) {
12970      open(name);
12971      composeElementDefinitionInner(element);
12972      close();
12973    }
12974  }
12975
12976  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
12977      composeElement(element);
12978      if (element.hasPathElement()) {
12979        composeStringCore("path", element.getPathElement(), false);
12980        composeStringExtras("path", element.getPathElement(), false);
12981      }
12982      if (element.hasRepresentation()) {
12983        openArray("representation");
12984        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
12985          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
12986        closeArray();
12987        if (anyHasExtras(element.getRepresentation())) {
12988          openArray("_representation");
12989          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
12990            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
12991          closeArray();
12992        }
12993      };
12994      if (element.hasNameElement()) {
12995        composeStringCore("name", element.getNameElement(), false);
12996        composeStringExtras("name", element.getNameElement(), false);
12997      }
12998      if (element.hasLabelElement()) {
12999        composeStringCore("label", element.getLabelElement(), false);
13000        composeStringExtras("label", element.getLabelElement(), false);
13001      }
13002      if (element.hasCode()) {
13003        openArray("code");
13004        for (Coding e : element.getCode()) 
13005          composeCoding(null, e);
13006        closeArray();
13007      };
13008      if (element.hasSlicing()) {
13009        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
13010      }
13011      if (element.hasShortElement()) {
13012        composeStringCore("short", element.getShortElement(), false);
13013        composeStringExtras("short", element.getShortElement(), false);
13014      }
13015      if (element.hasDefinitionElement()) {
13016        composeMarkdownCore("definition", element.getDefinitionElement(), false);
13017        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
13018      }
13019      if (element.hasCommentsElement()) {
13020        composeMarkdownCore("comments", element.getCommentsElement(), false);
13021        composeMarkdownExtras("comments", element.getCommentsElement(), false);
13022      }
13023      if (element.hasRequirementsElement()) {
13024        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
13025        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
13026      }
13027      if (element.hasAlias()) {
13028        openArray("alias");
13029        for (StringType e : element.getAlias()) 
13030          composeStringCore(null, e, true);
13031        closeArray();
13032        if (anyHasExtras(element.getAlias())) {
13033          openArray("_alias");
13034          for (StringType e : element.getAlias()) 
13035            composeStringExtras(null, e, true);
13036          closeArray();
13037        }
13038      };
13039      if (element.hasMinElement()) {
13040        composeIntegerCore("min", element.getMinElement(), false);
13041        composeIntegerExtras("min", element.getMinElement(), false);
13042      }
13043      if (element.hasMaxElement()) {
13044        composeStringCore("max", element.getMaxElement(), false);
13045        composeStringExtras("max", element.getMaxElement(), false);
13046      }
13047      if (element.hasBase()) {
13048        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
13049      }
13050      if (element.hasType()) {
13051        openArray("type");
13052        for (ElementDefinition.TypeRefComponent e : element.getType()) 
13053          composeElementDefinitionTypeRefComponent(null, e);
13054        closeArray();
13055      };
13056      if (element.hasNameReferenceElement()) {
13057        composeStringCore("nameReference", element.getNameReferenceElement(), false);
13058        composeStringExtras("nameReference", element.getNameReferenceElement(), false);
13059      }
13060      if (element.hasDefaultValue()) {
13061        composeType("defaultValue", element.getDefaultValue());
13062      }
13063      if (element.hasMeaningWhenMissingElement()) {
13064        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13065        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13066      }
13067      if (element.hasFixed()) {
13068        composeType("fixed", element.getFixed());
13069      }
13070      if (element.hasPattern()) {
13071        composeType("pattern", element.getPattern());
13072      }
13073      if (element.hasExample()) {
13074        composeType("example", element.getExample());
13075      }
13076      if (element.hasMinValue()) {
13077        composeType("minValue", element.getMinValue());
13078      }
13079      if (element.hasMaxValue()) {
13080        composeType("maxValue", element.getMaxValue());
13081      }
13082      if (element.hasMaxLengthElement()) {
13083        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
13084        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
13085      }
13086      if (element.hasCondition()) {
13087        openArray("condition");
13088        for (IdType e : element.getCondition()) 
13089          composeIdCore(null, e, true);
13090        closeArray();
13091        if (anyHasExtras(element.getCondition())) {
13092          openArray("_condition");
13093          for (IdType e : element.getCondition()) 
13094            composeIdExtras(null, e, true);
13095          closeArray();
13096        }
13097      };
13098      if (element.hasConstraint()) {
13099        openArray("constraint");
13100        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
13101          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
13102        closeArray();
13103      };
13104      if (element.hasMustSupportElement()) {
13105        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
13106        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
13107      }
13108      if (element.hasIsModifierElement()) {
13109        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
13110        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
13111      }
13112      if (element.hasIsSummaryElement()) {
13113        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
13114        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
13115      }
13116      if (element.hasBinding()) {
13117        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
13118      }
13119      if (element.hasMapping()) {
13120        openArray("mapping");
13121        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
13122          composeElementDefinitionElementDefinitionMappingComponent(null, e);
13123        closeArray();
13124      };
13125  }
13126
13127  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13128    if (element != null) {
13129      open(name);
13130      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
13131      close();
13132    }
13133  }
13134
13135  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13136      composeElement(element);
13137      if (element.hasDiscriminator()) {
13138        openArray("discriminator");
13139        for (StringType e : element.getDiscriminator()) 
13140          composeStringCore(null, e, true);
13141        closeArray();
13142        if (anyHasExtras(element.getDiscriminator())) {
13143          openArray("_discriminator");
13144          for (StringType e : element.getDiscriminator()) 
13145            composeStringExtras(null, e, true);
13146          closeArray();
13147        }
13148      };
13149      if (element.hasDescriptionElement()) {
13150        composeStringCore("description", element.getDescriptionElement(), false);
13151        composeStringExtras("description", element.getDescriptionElement(), false);
13152      }
13153      if (element.hasOrderedElement()) {
13154        composeBooleanCore("ordered", element.getOrderedElement(), false);
13155        composeBooleanExtras("ordered", element.getOrderedElement(), false);
13156      }
13157      if (element.hasRulesElement()) {
13158        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13159        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13160      }
13161  }
13162
13163  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13164    if (element != null) {
13165      open(name);
13166      composeElementDefinitionElementDefinitionBaseComponentInner(element);
13167      close();
13168    }
13169  }
13170
13171  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13172      composeElement(element);
13173      if (element.hasPathElement()) {
13174        composeStringCore("path", element.getPathElement(), false);
13175        composeStringExtras("path", element.getPathElement(), false);
13176      }
13177      if (element.hasMinElement()) {
13178        composeIntegerCore("min", element.getMinElement(), false);
13179        composeIntegerExtras("min", element.getMinElement(), false);
13180      }
13181      if (element.hasMaxElement()) {
13182        composeStringCore("max", element.getMaxElement(), false);
13183        composeStringExtras("max", element.getMaxElement(), false);
13184      }
13185  }
13186
13187  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
13188    if (element != null) {
13189      open(name);
13190      composeElementDefinitionTypeRefComponentInner(element);
13191      close();
13192    }
13193  }
13194
13195  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
13196      composeElement(element);
13197      if (element.hasCodeElement()) {
13198        composeCodeCore("code", element.getCodeElement(), false);
13199        composeCodeExtras("code", element.getCodeElement(), false);
13200      }
13201      if (element.hasProfile()) {
13202        openArray("profile");
13203        for (UriType e : element.getProfile()) 
13204          composeUriCore(null, e, true);
13205        closeArray();
13206        if (anyHasExtras(element.getProfile())) {
13207          openArray("_profile");
13208          for (UriType e : element.getProfile()) 
13209            composeUriExtras(null, e, true);
13210          closeArray();
13211        }
13212      };
13213      if (element.hasAggregation()) {
13214        openArray("aggregation");
13215        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13216          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13217        closeArray();
13218        if (anyHasExtras(element.getAggregation())) {
13219          openArray("_aggregation");
13220          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13221            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13222          closeArray();
13223        }
13224      };
13225  }
13226
13227  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13228    if (element != null) {
13229      open(name);
13230      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
13231      close();
13232    }
13233  }
13234
13235  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13236      composeElement(element);
13237      if (element.hasKeyElement()) {
13238        composeIdCore("key", element.getKeyElement(), false);
13239        composeIdExtras("key", element.getKeyElement(), false);
13240      }
13241      if (element.hasRequirementsElement()) {
13242        composeStringCore("requirements", element.getRequirementsElement(), false);
13243        composeStringExtras("requirements", element.getRequirementsElement(), false);
13244      }
13245      if (element.hasSeverityElement()) {
13246        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13247        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13248      }
13249      if (element.hasHumanElement()) {
13250        composeStringCore("human", element.getHumanElement(), false);
13251        composeStringExtras("human", element.getHumanElement(), false);
13252      }
13253      if (element.hasXpathElement()) {
13254        composeStringCore("xpath", element.getXpathElement(), false);
13255        composeStringExtras("xpath", element.getXpathElement(), false);
13256      }
13257  }
13258
13259  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13260    if (element != null) {
13261      open(name);
13262      composeElementDefinitionElementDefinitionBindingComponentInner(element);
13263      close();
13264    }
13265  }
13266
13267  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13268      composeElement(element);
13269      if (element.hasStrengthElement()) {
13270        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13271        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13272      }
13273      if (element.hasDescriptionElement()) {
13274        composeStringCore("description", element.getDescriptionElement(), false);
13275        composeStringExtras("description", element.getDescriptionElement(), false);
13276      }
13277      if (element.hasValueSet()) {
13278        composeType("valueSet", element.getValueSet());
13279      }
13280  }
13281
13282  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13283    if (element != null) {
13284      open(name);
13285      composeElementDefinitionElementDefinitionMappingComponentInner(element);
13286      close();
13287    }
13288  }
13289
13290  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13291      composeElement(element);
13292      if (element.hasIdentityElement()) {
13293        composeIdCore("identity", element.getIdentityElement(), false);
13294        composeIdExtras("identity", element.getIdentityElement(), false);
13295      }
13296      if (element.hasLanguageElement()) {
13297        composeCodeCore("language", element.getLanguageElement(), false);
13298        composeCodeExtras("language", element.getLanguageElement(), false);
13299      }
13300      if (element.hasMapElement()) {
13301        composeStringCore("map", element.getMapElement(), false);
13302        composeStringExtras("map", element.getMapElement(), false);
13303      }
13304  }
13305
13306  protected void composeDomainResourceElements(DomainResource element) throws IOException {
13307      composeResourceElements(element);
13308      if (element.hasText()) {
13309        composeNarrative("text", element.getText());
13310      }
13311      if (element.hasContained()) {
13312        openArray("contained");
13313        for (Resource e : element.getContained()) {
13314          open(null);
13315          composeResource(e);
13316          close();
13317        }
13318        closeArray();
13319      };
13320      if (element.hasExtension()) {
13321        openArray("extension");
13322        for (Extension e : element.getExtension()) 
13323          composeExtension(null, e);
13324        closeArray();
13325      };
13326      if (element.hasModifierExtension()) {
13327        openArray("modifierExtension");
13328        for (Extension e : element.getModifierExtension()) 
13329          composeExtension(null, e);
13330        closeArray();
13331      };
13332  }
13333
13334  protected void composeParameters(String name, Parameters element) throws IOException {
13335    if (element != null) {
13336      prop("resourceType", name);
13337      composeParametersInner(element);
13338    }
13339  }
13340
13341  protected void composeParametersInner(Parameters element) throws IOException {
13342      composeResourceElements(element);
13343      if (element.hasParameter()) {
13344        openArray("parameter");
13345        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
13346          composeParametersParametersParameterComponent(null, e);
13347        closeArray();
13348      };
13349  }
13350
13351  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
13352    if (element != null) {
13353      open(name);
13354      composeParametersParametersParameterComponentInner(element);
13355      close();
13356    }
13357  }
13358
13359  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
13360      composeBackbone(element);
13361      if (element.hasNameElement()) {
13362        composeStringCore("name", element.getNameElement(), false);
13363        composeStringExtras("name", element.getNameElement(), false);
13364      }
13365      if (element.hasValue()) {
13366        composeType("value", element.getValue());
13367      }
13368        if (element.hasResource()) {
13369          open("resource");
13370          composeResource(element.getResource());
13371          close();
13372        }
13373      if (element.hasPart()) {
13374        openArray("part");
13375        for (Parameters.ParametersParameterComponent e : element.getPart()) 
13376          composeParametersParametersParameterComponent(null, e);
13377        closeArray();
13378      };
13379  }
13380
13381  protected void composeResourceElements(Resource element) throws IOException {
13382      if (element.hasIdElement()) {
13383        composeIdCore("id", element.getIdElement(), false);
13384        composeIdExtras("id", element.getIdElement(), false);
13385      }
13386      if (element.hasMeta()) {
13387        composeMeta("meta", element.getMeta());
13388      }
13389      if (element.hasImplicitRulesElement()) {
13390        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
13391        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
13392      }
13393      if (element.hasLanguageElement()) {
13394        composeCodeCore("language", element.getLanguageElement(), false);
13395        composeCodeExtras("language", element.getLanguageElement(), false);
13396      }
13397  }
13398
13399  protected void composeAccount(String name, Account element) throws IOException {
13400    if (element != null) {
13401      prop("resourceType", name);
13402      composeAccountInner(element);
13403    }
13404  }
13405
13406  protected void composeAccountInner(Account element) throws IOException {
13407      composeDomainResourceElements(element);
13408      if (element.hasIdentifier()) {
13409        openArray("identifier");
13410        for (Identifier e : element.getIdentifier()) 
13411          composeIdentifier(null, e);
13412        closeArray();
13413      };
13414      if (element.hasNameElement()) {
13415        composeStringCore("name", element.getNameElement(), false);
13416        composeStringExtras("name", element.getNameElement(), false);
13417      }
13418      if (element.hasType()) {
13419        composeCodeableConcept("type", element.getType());
13420      }
13421      if (element.hasStatusElement()) {
13422        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13423        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13424      }
13425      if (element.hasActivePeriod()) {
13426        composePeriod("activePeriod", element.getActivePeriod());
13427      }
13428      if (element.hasCurrency()) {
13429        composeCoding("currency", element.getCurrency());
13430      }
13431      if (element.hasBalance()) {
13432        composeMoney("balance", element.getBalance());
13433      }
13434      if (element.hasCoveragePeriod()) {
13435        composePeriod("coveragePeriod", element.getCoveragePeriod());
13436      }
13437      if (element.hasSubject()) {
13438        composeReference("subject", element.getSubject());
13439      }
13440      if (element.hasOwner()) {
13441        composeReference("owner", element.getOwner());
13442      }
13443      if (element.hasDescriptionElement()) {
13444        composeStringCore("description", element.getDescriptionElement(), false);
13445        composeStringExtras("description", element.getDescriptionElement(), false);
13446      }
13447  }
13448
13449  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
13450    if (element != null) {
13451      prop("resourceType", name);
13452      composeAllergyIntoleranceInner(element);
13453    }
13454  }
13455
13456  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
13457      composeDomainResourceElements(element);
13458      if (element.hasIdentifier()) {
13459        openArray("identifier");
13460        for (Identifier e : element.getIdentifier()) 
13461          composeIdentifier(null, e);
13462        closeArray();
13463      };
13464      if (element.hasOnsetElement()) {
13465        composeDateTimeCore("onset", element.getOnsetElement(), false);
13466        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13467      }
13468      if (element.hasRecordedDateElement()) {
13469        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
13470        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
13471      }
13472      if (element.hasRecorder()) {
13473        composeReference("recorder", element.getRecorder());
13474      }
13475      if (element.hasPatient()) {
13476        composeReference("patient", element.getPatient());
13477      }
13478      if (element.hasReporter()) {
13479        composeReference("reporter", element.getReporter());
13480      }
13481      if (element.hasSubstance()) {
13482        composeCodeableConcept("substance", element.getSubstance());
13483      }
13484      if (element.hasStatusElement()) {
13485        composeEnumerationCore("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13486        composeEnumerationExtras("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13487      }
13488      if (element.hasCriticalityElement()) {
13489        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13490        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13491      }
13492      if (element.hasTypeElement()) {
13493        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13494        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13495      }
13496      if (element.hasCategoryElement()) {
13497        composeEnumerationCore("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13498        composeEnumerationExtras("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13499      }
13500      if (element.hasLastOccurenceElement()) {
13501        composeDateTimeCore("lastOccurence", element.getLastOccurenceElement(), false);
13502        composeDateTimeExtras("lastOccurence", element.getLastOccurenceElement(), false);
13503      }
13504      if (element.hasNote()) {
13505        composeAnnotation("note", element.getNote());
13506      }
13507      if (element.hasReaction()) {
13508        openArray("reaction");
13509        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
13510          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
13511        closeArray();
13512      };
13513  }
13514
13515  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13516    if (element != null) {
13517      open(name);
13518      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
13519      close();
13520    }
13521  }
13522
13523  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13524      composeBackbone(element);
13525      if (element.hasSubstance()) {
13526        composeCodeableConcept("substance", element.getSubstance());
13527      }
13528      if (element.hasCertaintyElement()) {
13529        composeEnumerationCore("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13530        composeEnumerationExtras("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13531      }
13532      if (element.hasManifestation()) {
13533        openArray("manifestation");
13534        for (CodeableConcept e : element.getManifestation()) 
13535          composeCodeableConcept(null, e);
13536        closeArray();
13537      };
13538      if (element.hasDescriptionElement()) {
13539        composeStringCore("description", element.getDescriptionElement(), false);
13540        composeStringExtras("description", element.getDescriptionElement(), false);
13541      }
13542      if (element.hasOnsetElement()) {
13543        composeDateTimeCore("onset", element.getOnsetElement(), false);
13544        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13545      }
13546      if (element.hasSeverityElement()) {
13547        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13548        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13549      }
13550      if (element.hasExposureRoute()) {
13551        composeCodeableConcept("exposureRoute", element.getExposureRoute());
13552      }
13553      if (element.hasNote()) {
13554        composeAnnotation("note", element.getNote());
13555      }
13556  }
13557
13558  protected void composeAppointment(String name, Appointment element) throws IOException {
13559    if (element != null) {
13560      prop("resourceType", name);
13561      composeAppointmentInner(element);
13562    }
13563  }
13564
13565  protected void composeAppointmentInner(Appointment element) throws IOException {
13566      composeDomainResourceElements(element);
13567      if (element.hasIdentifier()) {
13568        openArray("identifier");
13569        for (Identifier e : element.getIdentifier()) 
13570          composeIdentifier(null, e);
13571        closeArray();
13572      };
13573      if (element.hasStatusElement()) {
13574        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13575        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13576      }
13577      if (element.hasType()) {
13578        composeCodeableConcept("type", element.getType());
13579      }
13580      if (element.hasReason()) {
13581        composeCodeableConcept("reason", element.getReason());
13582      }
13583      if (element.hasPriorityElement()) {
13584        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
13585        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
13586      }
13587      if (element.hasDescriptionElement()) {
13588        composeStringCore("description", element.getDescriptionElement(), false);
13589        composeStringExtras("description", element.getDescriptionElement(), false);
13590      }
13591      if (element.hasStartElement()) {
13592        composeInstantCore("start", element.getStartElement(), false);
13593        composeInstantExtras("start", element.getStartElement(), false);
13594      }
13595      if (element.hasEndElement()) {
13596        composeInstantCore("end", element.getEndElement(), false);
13597        composeInstantExtras("end", element.getEndElement(), false);
13598      }
13599      if (element.hasMinutesDurationElement()) {
13600        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
13601        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
13602      }
13603      if (element.hasSlot()) {
13604        openArray("slot");
13605        for (Reference e : element.getSlot()) 
13606          composeReference(null, e);
13607        closeArray();
13608      };
13609      if (element.hasCommentElement()) {
13610        composeStringCore("comment", element.getCommentElement(), false);
13611        composeStringExtras("comment", element.getCommentElement(), false);
13612      }
13613      if (element.hasParticipant()) {
13614        openArray("participant");
13615        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
13616          composeAppointmentAppointmentParticipantComponent(null, e);
13617        closeArray();
13618      };
13619  }
13620
13621  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
13622    if (element != null) {
13623      open(name);
13624      composeAppointmentAppointmentParticipantComponentInner(element);
13625      close();
13626    }
13627  }
13628
13629  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
13630      composeBackbone(element);
13631      if (element.hasType()) {
13632        openArray("type");
13633        for (CodeableConcept e : element.getType()) 
13634          composeCodeableConcept(null, e);
13635        closeArray();
13636      };
13637      if (element.hasActor()) {
13638        composeReference("actor", element.getActor());
13639      }
13640      if (element.hasRequiredElement()) {
13641        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13642        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13643      }
13644      if (element.hasStatusElement()) {
13645        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13646        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13647      }
13648  }
13649
13650  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
13651    if (element != null) {
13652      prop("resourceType", name);
13653      composeAppointmentResponseInner(element);
13654    }
13655  }
13656
13657  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
13658      composeDomainResourceElements(element);
13659      if (element.hasIdentifier()) {
13660        openArray("identifier");
13661        for (Identifier e : element.getIdentifier()) 
13662          composeIdentifier(null, e);
13663        closeArray();
13664      };
13665      if (element.hasAppointment()) {
13666        composeReference("appointment", element.getAppointment());
13667      }
13668      if (element.hasStartElement()) {
13669        composeInstantCore("start", element.getStartElement(), false);
13670        composeInstantExtras("start", element.getStartElement(), false);
13671      }
13672      if (element.hasEndElement()) {
13673        composeInstantCore("end", element.getEndElement(), false);
13674        composeInstantExtras("end", element.getEndElement(), false);
13675      }
13676      if (element.hasParticipantType()) {
13677        openArray("participantType");
13678        for (CodeableConcept e : element.getParticipantType()) 
13679          composeCodeableConcept(null, e);
13680        closeArray();
13681      };
13682      if (element.hasActor()) {
13683        composeReference("actor", element.getActor());
13684      }
13685      if (element.hasParticipantStatusElement()) {
13686        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13687        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13688      }
13689      if (element.hasCommentElement()) {
13690        composeStringCore("comment", element.getCommentElement(), false);
13691        composeStringExtras("comment", element.getCommentElement(), false);
13692      }
13693  }
13694
13695  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
13696    if (element != null) {
13697      prop("resourceType", name);
13698      composeAuditEventInner(element);
13699    }
13700  }
13701
13702  protected void composeAuditEventInner(AuditEvent element) throws IOException {
13703      composeDomainResourceElements(element);
13704      if (element.hasEvent()) {
13705        composeAuditEventAuditEventEventComponent("event", element.getEvent());
13706      }
13707      if (element.hasParticipant()) {
13708        openArray("participant");
13709        for (AuditEvent.AuditEventParticipantComponent e : element.getParticipant()) 
13710          composeAuditEventAuditEventParticipantComponent(null, e);
13711        closeArray();
13712      };
13713      if (element.hasSource()) {
13714        composeAuditEventAuditEventSourceComponent("source", element.getSource());
13715      }
13716      if (element.hasObject()) {
13717        openArray("object");
13718        for (AuditEvent.AuditEventObjectComponent e : element.getObject()) 
13719          composeAuditEventAuditEventObjectComponent(null, e);
13720        closeArray();
13721      };
13722  }
13723
13724  protected void composeAuditEventAuditEventEventComponent(String name, AuditEvent.AuditEventEventComponent element) throws IOException {
13725    if (element != null) {
13726      open(name);
13727      composeAuditEventAuditEventEventComponentInner(element);
13728      close();
13729    }
13730  }
13731
13732  protected void composeAuditEventAuditEventEventComponentInner(AuditEvent.AuditEventEventComponent element) throws IOException {
13733      composeBackbone(element);
13734      if (element.hasType()) {
13735        composeCoding("type", element.getType());
13736      }
13737      if (element.hasSubtype()) {
13738        openArray("subtype");
13739        for (Coding e : element.getSubtype()) 
13740          composeCoding(null, e);
13741        closeArray();
13742      };
13743      if (element.hasActionElement()) {
13744        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13745        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13746      }
13747      if (element.hasDateTimeElement()) {
13748        composeInstantCore("dateTime", element.getDateTimeElement(), false);
13749        composeInstantExtras("dateTime", element.getDateTimeElement(), false);
13750      }
13751      if (element.hasOutcomeElement()) {
13752        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13753        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13754      }
13755      if (element.hasOutcomeDescElement()) {
13756        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
13757        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
13758      }
13759      if (element.hasPurposeOfEvent()) {
13760        openArray("purposeOfEvent");
13761        for (Coding e : element.getPurposeOfEvent()) 
13762          composeCoding(null, e);
13763        closeArray();
13764      };
13765  }
13766
13767  protected void composeAuditEventAuditEventParticipantComponent(String name, AuditEvent.AuditEventParticipantComponent element) throws IOException {
13768    if (element != null) {
13769      open(name);
13770      composeAuditEventAuditEventParticipantComponentInner(element);
13771      close();
13772    }
13773  }
13774
13775  protected void composeAuditEventAuditEventParticipantComponentInner(AuditEvent.AuditEventParticipantComponent element) throws IOException {
13776      composeBackbone(element);
13777      if (element.hasRole()) {
13778        openArray("role");
13779        for (CodeableConcept e : element.getRole()) 
13780          composeCodeableConcept(null, e);
13781        closeArray();
13782      };
13783      if (element.hasReference()) {
13784        composeReference("reference", element.getReference());
13785      }
13786      if (element.hasUserId()) {
13787        composeIdentifier("userId", element.getUserId());
13788      }
13789      if (element.hasAltIdElement()) {
13790        composeStringCore("altId", element.getAltIdElement(), false);
13791        composeStringExtras("altId", element.getAltIdElement(), false);
13792      }
13793      if (element.hasNameElement()) {
13794        composeStringCore("name", element.getNameElement(), false);
13795        composeStringExtras("name", element.getNameElement(), false);
13796      }
13797      if (element.hasRequestorElement()) {
13798        composeBooleanCore("requestor", element.getRequestorElement(), false);
13799        composeBooleanExtras("requestor", element.getRequestorElement(), false);
13800      }
13801      if (element.hasLocation()) {
13802        composeReference("location", element.getLocation());
13803      }
13804      if (element.hasPolicy()) {
13805        openArray("policy");
13806        for (UriType e : element.getPolicy()) 
13807          composeUriCore(null, e, true);
13808        closeArray();
13809        if (anyHasExtras(element.getPolicy())) {
13810          openArray("_policy");
13811          for (UriType e : element.getPolicy()) 
13812            composeUriExtras(null, e, true);
13813          closeArray();
13814        }
13815      };
13816      if (element.hasMedia()) {
13817        composeCoding("media", element.getMedia());
13818      }
13819      if (element.hasNetwork()) {
13820        composeAuditEventAuditEventParticipantNetworkComponent("network", element.getNetwork());
13821      }
13822      if (element.hasPurposeOfUse()) {
13823        openArray("purposeOfUse");
13824        for (Coding e : element.getPurposeOfUse()) 
13825          composeCoding(null, e);
13826        closeArray();
13827      };
13828  }
13829
13830  protected void composeAuditEventAuditEventParticipantNetworkComponent(String name, AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13831    if (element != null) {
13832      open(name);
13833      composeAuditEventAuditEventParticipantNetworkComponentInner(element);
13834      close();
13835    }
13836  }
13837
13838  protected void composeAuditEventAuditEventParticipantNetworkComponentInner(AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13839      composeBackbone(element);
13840      if (element.hasAddressElement()) {
13841        composeStringCore("address", element.getAddressElement(), false);
13842        composeStringExtras("address", element.getAddressElement(), false);
13843      }
13844      if (element.hasTypeElement()) {
13845        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13846        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13847      }
13848  }
13849
13850  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
13851    if (element != null) {
13852      open(name);
13853      composeAuditEventAuditEventSourceComponentInner(element);
13854      close();
13855    }
13856  }
13857
13858  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
13859      composeBackbone(element);
13860      if (element.hasSiteElement()) {
13861        composeStringCore("site", element.getSiteElement(), false);
13862        composeStringExtras("site", element.getSiteElement(), false);
13863      }
13864      if (element.hasIdentifier()) {
13865        composeIdentifier("identifier", element.getIdentifier());
13866      }
13867      if (element.hasType()) {
13868        openArray("type");
13869        for (Coding e : element.getType()) 
13870          composeCoding(null, e);
13871        closeArray();
13872      };
13873  }
13874
13875  protected void composeAuditEventAuditEventObjectComponent(String name, AuditEvent.AuditEventObjectComponent element) throws IOException {
13876    if (element != null) {
13877      open(name);
13878      composeAuditEventAuditEventObjectComponentInner(element);
13879      close();
13880    }
13881  }
13882
13883  protected void composeAuditEventAuditEventObjectComponentInner(AuditEvent.AuditEventObjectComponent element) throws IOException {
13884      composeBackbone(element);
13885      if (element.hasIdentifier()) {
13886        composeIdentifier("identifier", element.getIdentifier());
13887      }
13888      if (element.hasReference()) {
13889        composeReference("reference", element.getReference());
13890      }
13891      if (element.hasType()) {
13892        composeCoding("type", element.getType());
13893      }
13894      if (element.hasRole()) {
13895        composeCoding("role", element.getRole());
13896      }
13897      if (element.hasLifecycle()) {
13898        composeCoding("lifecycle", element.getLifecycle());
13899      }
13900      if (element.hasSecurityLabel()) {
13901        openArray("securityLabel");
13902        for (Coding e : element.getSecurityLabel()) 
13903          composeCoding(null, e);
13904        closeArray();
13905      };
13906      if (element.hasNameElement()) {
13907        composeStringCore("name", element.getNameElement(), false);
13908        composeStringExtras("name", element.getNameElement(), false);
13909      }
13910      if (element.hasDescriptionElement()) {
13911        composeStringCore("description", element.getDescriptionElement(), false);
13912        composeStringExtras("description", element.getDescriptionElement(), false);
13913      }
13914      if (element.hasQueryElement()) {
13915        composeBase64BinaryCore("query", element.getQueryElement(), false);
13916        composeBase64BinaryExtras("query", element.getQueryElement(), false);
13917      }
13918      if (element.hasDetail()) {
13919        openArray("detail");
13920        for (AuditEvent.AuditEventObjectDetailComponent e : element.getDetail()) 
13921          composeAuditEventAuditEventObjectDetailComponent(null, e);
13922        closeArray();
13923      };
13924  }
13925
13926  protected void composeAuditEventAuditEventObjectDetailComponent(String name, AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13927    if (element != null) {
13928      open(name);
13929      composeAuditEventAuditEventObjectDetailComponentInner(element);
13930      close();
13931    }
13932  }
13933
13934  protected void composeAuditEventAuditEventObjectDetailComponentInner(AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13935      composeBackbone(element);
13936      if (element.hasTypeElement()) {
13937        composeStringCore("type", element.getTypeElement(), false);
13938        composeStringExtras("type", element.getTypeElement(), false);
13939      }
13940      if (element.hasValueElement()) {
13941        composeBase64BinaryCore("value", element.getValueElement(), false);
13942        composeBase64BinaryExtras("value", element.getValueElement(), false);
13943      }
13944  }
13945
13946  protected void composeBasic(String name, Basic element) throws IOException {
13947    if (element != null) {
13948      prop("resourceType", name);
13949      composeBasicInner(element);
13950    }
13951  }
13952
13953  protected void composeBasicInner(Basic element) throws IOException {
13954      composeDomainResourceElements(element);
13955      if (element.hasIdentifier()) {
13956        openArray("identifier");
13957        for (Identifier e : element.getIdentifier()) 
13958          composeIdentifier(null, e);
13959        closeArray();
13960      };
13961      if (element.hasCode()) {
13962        composeCodeableConcept("code", element.getCode());
13963      }
13964      if (element.hasSubject()) {
13965        composeReference("subject", element.getSubject());
13966      }
13967      if (element.hasAuthor()) {
13968        composeReference("author", element.getAuthor());
13969      }
13970      if (element.hasCreatedElement()) {
13971        composeDateCore("created", element.getCreatedElement(), false);
13972        composeDateExtras("created", element.getCreatedElement(), false);
13973      }
13974  }
13975
13976  protected void composeBinary(String name, Binary element) throws IOException {
13977    if (element != null) {
13978      prop("resourceType", name);
13979      composeBinaryInner(element);
13980    }
13981  }
13982
13983  protected void composeBinaryInner(Binary element) throws IOException {
13984      composeResourceElements(element);
13985      if (element.hasContentTypeElement()) {
13986        composeCodeCore("contentType", element.getContentTypeElement(), false);
13987        composeCodeExtras("contentType", element.getContentTypeElement(), false);
13988      }
13989      if (element.hasContentElement()) {
13990        composeBase64BinaryCore("content", element.getContentElement(), false);
13991        composeBase64BinaryExtras("content", element.getContentElement(), false);
13992      }
13993  }
13994
13995  protected void composeBodySite(String name, BodySite element) throws IOException {
13996    if (element != null) {
13997      prop("resourceType", name);
13998      composeBodySiteInner(element);
13999    }
14000  }
14001
14002  protected void composeBodySiteInner(BodySite element) throws IOException {
14003      composeDomainResourceElements(element);
14004      if (element.hasPatient()) {
14005        composeReference("patient", element.getPatient());
14006      }
14007      if (element.hasIdentifier()) {
14008        openArray("identifier");
14009        for (Identifier e : element.getIdentifier()) 
14010          composeIdentifier(null, e);
14011        closeArray();
14012      };
14013      if (element.hasCode()) {
14014        composeCodeableConcept("code", element.getCode());
14015      }
14016      if (element.hasModifier()) {
14017        openArray("modifier");
14018        for (CodeableConcept e : element.getModifier()) 
14019          composeCodeableConcept(null, e);
14020        closeArray();
14021      };
14022      if (element.hasDescriptionElement()) {
14023        composeStringCore("description", element.getDescriptionElement(), false);
14024        composeStringExtras("description", element.getDescriptionElement(), false);
14025      }
14026      if (element.hasImage()) {
14027        openArray("image");
14028        for (Attachment e : element.getImage()) 
14029          composeAttachment(null, e);
14030        closeArray();
14031      };
14032  }
14033
14034  protected void composeBundle(String name, Bundle element) throws IOException {
14035    if (element != null) {
14036      prop("resourceType", name);
14037      composeBundleInner(element);
14038    }
14039  }
14040
14041  protected void composeBundleInner(Bundle element) throws IOException {
14042      composeResourceElements(element);
14043      if (element.hasTypeElement()) {
14044        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14045        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14046      }
14047      if (element.hasTotalElement()) {
14048        composeUnsignedIntCore("total", element.getTotalElement(), false);
14049        composeUnsignedIntExtras("total", element.getTotalElement(), false);
14050      }
14051      if (element.hasLink()) {
14052        openArray("link");
14053        for (Bundle.BundleLinkComponent e : element.getLink()) 
14054          composeBundleBundleLinkComponent(null, e);
14055        closeArray();
14056      };
14057      if (element.hasEntry()) {
14058        openArray("entry");
14059        for (Bundle.BundleEntryComponent e : element.getEntry()) 
14060          composeBundleBundleEntryComponent(null, e);
14061        closeArray();
14062      };
14063      if (element.hasSignature()) {
14064        composeSignature("signature", element.getSignature());
14065      }
14066  }
14067
14068  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
14069    if (element != null) {
14070      open(name);
14071      composeBundleBundleLinkComponentInner(element);
14072      close();
14073    }
14074  }
14075
14076  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
14077      composeBackbone(element);
14078      if (element.hasRelationElement()) {
14079        composeStringCore("relation", element.getRelationElement(), false);
14080        composeStringExtras("relation", element.getRelationElement(), false);
14081      }
14082      if (element.hasUrlElement()) {
14083        composeUriCore("url", element.getUrlElement(), false);
14084        composeUriExtras("url", element.getUrlElement(), false);
14085      }
14086  }
14087
14088  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
14089    if (element != null) {
14090      open(name);
14091      composeBundleBundleEntryComponentInner(element);
14092      close();
14093    }
14094  }
14095
14096  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
14097      composeBackbone(element);
14098      if (element.hasLink()) {
14099        openArray("link");
14100        for (Bundle.BundleLinkComponent e : element.getLink()) 
14101          composeBundleBundleLinkComponent(null, e);
14102        closeArray();
14103      };
14104      if (element.hasFullUrlElement()) {
14105        composeUriCore("fullUrl", element.getFullUrlElement(), false);
14106        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
14107      }
14108        if (element.hasResource()) {
14109          open("resource");
14110          composeResource(element.getResource());
14111          close();
14112        }
14113      if (element.hasSearch()) {
14114        composeBundleBundleEntrySearchComponent("search", element.getSearch());
14115      }
14116      if (element.hasRequest()) {
14117        composeBundleBundleEntryRequestComponent("request", element.getRequest());
14118      }
14119      if (element.hasResponse()) {
14120        composeBundleBundleEntryResponseComponent("response", element.getResponse());
14121      }
14122  }
14123
14124  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
14125    if (element != null) {
14126      open(name);
14127      composeBundleBundleEntrySearchComponentInner(element);
14128      close();
14129    }
14130  }
14131
14132  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
14133      composeBackbone(element);
14134      if (element.hasModeElement()) {
14135        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14136        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14137      }
14138      if (element.hasScoreElement()) {
14139        composeDecimalCore("score", element.getScoreElement(), false);
14140        composeDecimalExtras("score", element.getScoreElement(), false);
14141      }
14142  }
14143
14144  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
14145    if (element != null) {
14146      open(name);
14147      composeBundleBundleEntryRequestComponentInner(element);
14148      close();
14149    }
14150  }
14151
14152  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
14153      composeBackbone(element);
14154      if (element.hasMethodElement()) {
14155        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14156        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14157      }
14158      if (element.hasUrlElement()) {
14159        composeUriCore("url", element.getUrlElement(), false);
14160        composeUriExtras("url", element.getUrlElement(), false);
14161      }
14162      if (element.hasIfNoneMatchElement()) {
14163        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
14164        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
14165      }
14166      if (element.hasIfModifiedSinceElement()) {
14167        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14168        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14169      }
14170      if (element.hasIfMatchElement()) {
14171        composeStringCore("ifMatch", element.getIfMatchElement(), false);
14172        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
14173      }
14174      if (element.hasIfNoneExistElement()) {
14175        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
14176        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
14177      }
14178  }
14179
14180  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
14181    if (element != null) {
14182      open(name);
14183      composeBundleBundleEntryResponseComponentInner(element);
14184      close();
14185    }
14186  }
14187
14188  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
14189      composeBackbone(element);
14190      if (element.hasStatusElement()) {
14191        composeStringCore("status", element.getStatusElement(), false);
14192        composeStringExtras("status", element.getStatusElement(), false);
14193      }
14194      if (element.hasLocationElement()) {
14195        composeUriCore("location", element.getLocationElement(), false);
14196        composeUriExtras("location", element.getLocationElement(), false);
14197      }
14198      if (element.hasEtagElement()) {
14199        composeStringCore("etag", element.getEtagElement(), false);
14200        composeStringExtras("etag", element.getEtagElement(), false);
14201      }
14202      if (element.hasLastModifiedElement()) {
14203        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
14204        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
14205      }
14206  }
14207
14208  protected void composeCarePlan(String name, CarePlan element) throws IOException {
14209    if (element != null) {
14210      prop("resourceType", name);
14211      composeCarePlanInner(element);
14212    }
14213  }
14214
14215  protected void composeCarePlanInner(CarePlan element) throws IOException {
14216      composeDomainResourceElements(element);
14217      if (element.hasIdentifier()) {
14218        openArray("identifier");
14219        for (Identifier e : element.getIdentifier()) 
14220          composeIdentifier(null, e);
14221        closeArray();
14222      };
14223      if (element.hasSubject()) {
14224        composeReference("subject", element.getSubject());
14225      }
14226      if (element.hasStatusElement()) {
14227        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14228        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14229      }
14230      if (element.hasContext()) {
14231        composeReference("context", element.getContext());
14232      }
14233      if (element.hasPeriod()) {
14234        composePeriod("period", element.getPeriod());
14235      }
14236      if (element.hasAuthor()) {
14237        openArray("author");
14238        for (Reference e : element.getAuthor()) 
14239          composeReference(null, e);
14240        closeArray();
14241      };
14242      if (element.hasModifiedElement()) {
14243        composeDateTimeCore("modified", element.getModifiedElement(), false);
14244        composeDateTimeExtras("modified", element.getModifiedElement(), false);
14245      }
14246      if (element.hasCategory()) {
14247        openArray("category");
14248        for (CodeableConcept e : element.getCategory()) 
14249          composeCodeableConcept(null, e);
14250        closeArray();
14251      };
14252      if (element.hasDescriptionElement()) {
14253        composeStringCore("description", element.getDescriptionElement(), false);
14254        composeStringExtras("description", element.getDescriptionElement(), false);
14255      }
14256      if (element.hasAddresses()) {
14257        openArray("addresses");
14258        for (Reference e : element.getAddresses()) 
14259          composeReference(null, e);
14260        closeArray();
14261      };
14262      if (element.hasSupport()) {
14263        openArray("support");
14264        for (Reference e : element.getSupport()) 
14265          composeReference(null, e);
14266        closeArray();
14267      };
14268      if (element.hasRelatedPlan()) {
14269        openArray("relatedPlan");
14270        for (CarePlan.CarePlanRelatedPlanComponent e : element.getRelatedPlan()) 
14271          composeCarePlanCarePlanRelatedPlanComponent(null, e);
14272        closeArray();
14273      };
14274      if (element.hasParticipant()) {
14275        openArray("participant");
14276        for (CarePlan.CarePlanParticipantComponent e : element.getParticipant()) 
14277          composeCarePlanCarePlanParticipantComponent(null, e);
14278        closeArray();
14279      };
14280      if (element.hasGoal()) {
14281        openArray("goal");
14282        for (Reference e : element.getGoal()) 
14283          composeReference(null, e);
14284        closeArray();
14285      };
14286      if (element.hasActivity()) {
14287        openArray("activity");
14288        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
14289          composeCarePlanCarePlanActivityComponent(null, e);
14290        closeArray();
14291      };
14292      if (element.hasNote()) {
14293        composeAnnotation("note", element.getNote());
14294      }
14295  }
14296
14297  protected void composeCarePlanCarePlanRelatedPlanComponent(String name, CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14298    if (element != null) {
14299      open(name);
14300      composeCarePlanCarePlanRelatedPlanComponentInner(element);
14301      close();
14302    }
14303  }
14304
14305  protected void composeCarePlanCarePlanRelatedPlanComponentInner(CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14306      composeBackbone(element);
14307      if (element.hasCodeElement()) {
14308        composeEnumerationCore("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14309        composeEnumerationExtras("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14310      }
14311      if (element.hasPlan()) {
14312        composeReference("plan", element.getPlan());
14313      }
14314  }
14315
14316  protected void composeCarePlanCarePlanParticipantComponent(String name, CarePlan.CarePlanParticipantComponent element) throws IOException {
14317    if (element != null) {
14318      open(name);
14319      composeCarePlanCarePlanParticipantComponentInner(element);
14320      close();
14321    }
14322  }
14323
14324  protected void composeCarePlanCarePlanParticipantComponentInner(CarePlan.CarePlanParticipantComponent element) throws IOException {
14325      composeBackbone(element);
14326      if (element.hasRole()) {
14327        composeCodeableConcept("role", element.getRole());
14328      }
14329      if (element.hasMember()) {
14330        composeReference("member", element.getMember());
14331      }
14332  }
14333
14334  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
14335    if (element != null) {
14336      open(name);
14337      composeCarePlanCarePlanActivityComponentInner(element);
14338      close();
14339    }
14340  }
14341
14342  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
14343      composeBackbone(element);
14344      if (element.hasActionResulting()) {
14345        openArray("actionResulting");
14346        for (Reference e : element.getActionResulting()) 
14347          composeReference(null, e);
14348        closeArray();
14349      };
14350      if (element.hasProgress()) {
14351        openArray("progress");
14352        for (Annotation e : element.getProgress()) 
14353          composeAnnotation(null, e);
14354        closeArray();
14355      };
14356      if (element.hasReference()) {
14357        composeReference("reference", element.getReference());
14358      }
14359      if (element.hasDetail()) {
14360        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
14361      }
14362  }
14363
14364  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14365    if (element != null) {
14366      open(name);
14367      composeCarePlanCarePlanActivityDetailComponentInner(element);
14368      close();
14369    }
14370  }
14371
14372  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14373      composeBackbone(element);
14374      if (element.hasCategory()) {
14375        composeCodeableConcept("category", element.getCategory());
14376      }
14377      if (element.hasCode()) {
14378        composeCodeableConcept("code", element.getCode());
14379      }
14380      if (element.hasReasonCode()) {
14381        openArray("reasonCode");
14382        for (CodeableConcept e : element.getReasonCode()) 
14383          composeCodeableConcept(null, e);
14384        closeArray();
14385      };
14386      if (element.hasReasonReference()) {
14387        openArray("reasonReference");
14388        for (Reference e : element.getReasonReference()) 
14389          composeReference(null, e);
14390        closeArray();
14391      };
14392      if (element.hasGoal()) {
14393        openArray("goal");
14394        for (Reference e : element.getGoal()) 
14395          composeReference(null, e);
14396        closeArray();
14397      };
14398      if (element.hasStatusElement()) {
14399        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14400        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14401      }
14402      if (element.hasStatusReason()) {
14403        composeCodeableConcept("statusReason", element.getStatusReason());
14404      }
14405      if (element.hasProhibitedElement()) {
14406        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
14407        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
14408      }
14409      if (element.hasScheduled()) {
14410        composeType("scheduled", element.getScheduled());
14411      }
14412      if (element.hasLocation()) {
14413        composeReference("location", element.getLocation());
14414      }
14415      if (element.hasPerformer()) {
14416        openArray("performer");
14417        for (Reference e : element.getPerformer()) 
14418          composeReference(null, e);
14419        closeArray();
14420      };
14421      if (element.hasProduct()) {
14422        composeType("product", element.getProduct());
14423      }
14424      if (element.hasDailyAmount()) {
14425        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
14426      }
14427      if (element.hasQuantity()) {
14428        composeSimpleQuantity("quantity", element.getQuantity());
14429      }
14430      if (element.hasDescriptionElement()) {
14431        composeStringCore("description", element.getDescriptionElement(), false);
14432        composeStringExtras("description", element.getDescriptionElement(), false);
14433      }
14434  }
14435
14436  protected void composeClaim(String name, Claim element) throws IOException {
14437    if (element != null) {
14438      prop("resourceType", name);
14439      composeClaimInner(element);
14440    }
14441  }
14442
14443  protected void composeClaimInner(Claim element) throws IOException {
14444      composeDomainResourceElements(element);
14445      if (element.hasTypeElement()) {
14446        composeEnumerationCore("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14447        composeEnumerationExtras("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14448      }
14449      if (element.hasIdentifier()) {
14450        openArray("identifier");
14451        for (Identifier e : element.getIdentifier()) 
14452          composeIdentifier(null, e);
14453        closeArray();
14454      };
14455      if (element.hasRuleset()) {
14456        composeCoding("ruleset", element.getRuleset());
14457      }
14458      if (element.hasOriginalRuleset()) {
14459        composeCoding("originalRuleset", element.getOriginalRuleset());
14460      }
14461      if (element.hasCreatedElement()) {
14462        composeDateTimeCore("created", element.getCreatedElement(), false);
14463        composeDateTimeExtras("created", element.getCreatedElement(), false);
14464      }
14465      if (element.hasTarget()) {
14466        composeReference("target", element.getTarget());
14467      }
14468      if (element.hasProvider()) {
14469        composeReference("provider", element.getProvider());
14470      }
14471      if (element.hasOrganization()) {
14472        composeReference("organization", element.getOrganization());
14473      }
14474      if (element.hasUseElement()) {
14475        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14476        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14477      }
14478      if (element.hasPriority()) {
14479        composeCoding("priority", element.getPriority());
14480      }
14481      if (element.hasFundsReserve()) {
14482        composeCoding("fundsReserve", element.getFundsReserve());
14483      }
14484      if (element.hasEnterer()) {
14485        composeReference("enterer", element.getEnterer());
14486      }
14487      if (element.hasFacility()) {
14488        composeReference("facility", element.getFacility());
14489      }
14490      if (element.hasPrescription()) {
14491        composeReference("prescription", element.getPrescription());
14492      }
14493      if (element.hasOriginalPrescription()) {
14494        composeReference("originalPrescription", element.getOriginalPrescription());
14495      }
14496      if (element.hasPayee()) {
14497        composeClaimPayeeComponent("payee", element.getPayee());
14498      }
14499      if (element.hasReferral()) {
14500        composeReference("referral", element.getReferral());
14501      }
14502      if (element.hasDiagnosis()) {
14503        openArray("diagnosis");
14504        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
14505          composeClaimDiagnosisComponent(null, e);
14506        closeArray();
14507      };
14508      if (element.hasCondition()) {
14509        openArray("condition");
14510        for (Coding e : element.getCondition()) 
14511          composeCoding(null, e);
14512        closeArray();
14513      };
14514      if (element.hasPatient()) {
14515        composeReference("patient", element.getPatient());
14516      }
14517      if (element.hasCoverage()) {
14518        openArray("coverage");
14519        for (Claim.CoverageComponent e : element.getCoverage()) 
14520          composeClaimCoverageComponent(null, e);
14521        closeArray();
14522      };
14523      if (element.hasException()) {
14524        openArray("exception");
14525        for (Coding e : element.getException()) 
14526          composeCoding(null, e);
14527        closeArray();
14528      };
14529      if (element.hasSchoolElement()) {
14530        composeStringCore("school", element.getSchoolElement(), false);
14531        composeStringExtras("school", element.getSchoolElement(), false);
14532      }
14533      if (element.hasAccidentElement()) {
14534        composeDateCore("accident", element.getAccidentElement(), false);
14535        composeDateExtras("accident", element.getAccidentElement(), false);
14536      }
14537      if (element.hasAccidentType()) {
14538        composeCoding("accidentType", element.getAccidentType());
14539      }
14540      if (element.hasInterventionException()) {
14541        openArray("interventionException");
14542        for (Coding e : element.getInterventionException()) 
14543          composeCoding(null, e);
14544        closeArray();
14545      };
14546      if (element.hasItem()) {
14547        openArray("item");
14548        for (Claim.ItemsComponent e : element.getItem()) 
14549          composeClaimItemsComponent(null, e);
14550        closeArray();
14551      };
14552      if (element.hasAdditionalMaterials()) {
14553        openArray("additionalMaterials");
14554        for (Coding e : element.getAdditionalMaterials()) 
14555          composeCoding(null, e);
14556        closeArray();
14557      };
14558      if (element.hasMissingTeeth()) {
14559        openArray("missingTeeth");
14560        for (Claim.MissingTeethComponent e : element.getMissingTeeth()) 
14561          composeClaimMissingTeethComponent(null, e);
14562        closeArray();
14563      };
14564  }
14565
14566  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
14567    if (element != null) {
14568      open(name);
14569      composeClaimPayeeComponentInner(element);
14570      close();
14571    }
14572  }
14573
14574  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
14575      composeBackbone(element);
14576      if (element.hasType()) {
14577        composeCoding("type", element.getType());
14578      }
14579      if (element.hasProvider()) {
14580        composeReference("provider", element.getProvider());
14581      }
14582      if (element.hasOrganization()) {
14583        composeReference("organization", element.getOrganization());
14584      }
14585      if (element.hasPerson()) {
14586        composeReference("person", element.getPerson());
14587      }
14588  }
14589
14590  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
14591    if (element != null) {
14592      open(name);
14593      composeClaimDiagnosisComponentInner(element);
14594      close();
14595    }
14596  }
14597
14598  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
14599      composeBackbone(element);
14600      if (element.hasSequenceElement()) {
14601        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14602        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14603      }
14604      if (element.hasDiagnosis()) {
14605        composeCoding("diagnosis", element.getDiagnosis());
14606      }
14607  }
14608
14609  protected void composeClaimCoverageComponent(String name, Claim.CoverageComponent element) throws IOException {
14610    if (element != null) {
14611      open(name);
14612      composeClaimCoverageComponentInner(element);
14613      close();
14614    }
14615  }
14616
14617  protected void composeClaimCoverageComponentInner(Claim.CoverageComponent element) throws IOException {
14618      composeBackbone(element);
14619      if (element.hasSequenceElement()) {
14620        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14621        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14622      }
14623      if (element.hasFocalElement()) {
14624        composeBooleanCore("focal", element.getFocalElement(), false);
14625        composeBooleanExtras("focal", element.getFocalElement(), false);
14626      }
14627      if (element.hasCoverage()) {
14628        composeReference("coverage", element.getCoverage());
14629      }
14630      if (element.hasBusinessArrangementElement()) {
14631        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
14632        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
14633      }
14634      if (element.hasRelationship()) {
14635        composeCoding("relationship", element.getRelationship());
14636      }
14637      if (element.hasPreAuthRef()) {
14638        openArray("preAuthRef");
14639        for (StringType e : element.getPreAuthRef()) 
14640          composeStringCore(null, e, true);
14641        closeArray();
14642        if (anyHasExtras(element.getPreAuthRef())) {
14643          openArray("_preAuthRef");
14644          for (StringType e : element.getPreAuthRef()) 
14645            composeStringExtras(null, e, true);
14646          closeArray();
14647        }
14648      };
14649      if (element.hasClaimResponse()) {
14650        composeReference("claimResponse", element.getClaimResponse());
14651      }
14652      if (element.hasOriginalRuleset()) {
14653        composeCoding("originalRuleset", element.getOriginalRuleset());
14654      }
14655  }
14656
14657  protected void composeClaimItemsComponent(String name, Claim.ItemsComponent element) throws IOException {
14658    if (element != null) {
14659      open(name);
14660      composeClaimItemsComponentInner(element);
14661      close();
14662    }
14663  }
14664
14665  protected void composeClaimItemsComponentInner(Claim.ItemsComponent element) throws IOException {
14666      composeBackbone(element);
14667      if (element.hasSequenceElement()) {
14668        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14669        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14670      }
14671      if (element.hasType()) {
14672        composeCoding("type", element.getType());
14673      }
14674      if (element.hasProvider()) {
14675        composeReference("provider", element.getProvider());
14676      }
14677      if (element.hasDiagnosisLinkId()) {
14678        openArray("diagnosisLinkId");
14679        for (PositiveIntType e : element.getDiagnosisLinkId()) 
14680          composePositiveIntCore(null, e, true);
14681        closeArray();
14682        if (anyHasExtras(element.getDiagnosisLinkId())) {
14683          openArray("_diagnosisLinkId");
14684          for (PositiveIntType e : element.getDiagnosisLinkId()) 
14685            composePositiveIntExtras(null, e, true);
14686          closeArray();
14687        }
14688      };
14689      if (element.hasService()) {
14690        composeCoding("service", element.getService());
14691      }
14692      if (element.hasServiceDateElement()) {
14693        composeDateCore("serviceDate", element.getServiceDateElement(), false);
14694        composeDateExtras("serviceDate", element.getServiceDateElement(), false);
14695      }
14696      if (element.hasQuantity()) {
14697        composeSimpleQuantity("quantity", element.getQuantity());
14698      }
14699      if (element.hasUnitPrice()) {
14700        composeMoney("unitPrice", element.getUnitPrice());
14701      }
14702      if (element.hasFactorElement()) {
14703        composeDecimalCore("factor", element.getFactorElement(), false);
14704        composeDecimalExtras("factor", element.getFactorElement(), false);
14705      }
14706      if (element.hasPointsElement()) {
14707        composeDecimalCore("points", element.getPointsElement(), false);
14708        composeDecimalExtras("points", element.getPointsElement(), false);
14709      }
14710      if (element.hasNet()) {
14711        composeMoney("net", element.getNet());
14712      }
14713      if (element.hasUdi()) {
14714        composeCoding("udi", element.getUdi());
14715      }
14716      if (element.hasBodySite()) {
14717        composeCoding("bodySite", element.getBodySite());
14718      }
14719      if (element.hasSubSite()) {
14720        openArray("subSite");
14721        for (Coding e : element.getSubSite()) 
14722          composeCoding(null, e);
14723        closeArray();
14724      };
14725      if (element.hasModifier()) {
14726        openArray("modifier");
14727        for (Coding e : element.getModifier()) 
14728          composeCoding(null, e);
14729        closeArray();
14730      };
14731      if (element.hasDetail()) {
14732        openArray("detail");
14733        for (Claim.DetailComponent e : element.getDetail()) 
14734          composeClaimDetailComponent(null, e);
14735        closeArray();
14736      };
14737      if (element.hasProsthesis()) {
14738        composeClaimProsthesisComponent("prosthesis", element.getProsthesis());
14739      }
14740  }
14741
14742  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
14743    if (element != null) {
14744      open(name);
14745      composeClaimDetailComponentInner(element);
14746      close();
14747    }
14748  }
14749
14750  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
14751      composeBackbone(element);
14752      if (element.hasSequenceElement()) {
14753        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14754        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14755      }
14756      if (element.hasType()) {
14757        composeCoding("type", element.getType());
14758      }
14759      if (element.hasService()) {
14760        composeCoding("service", element.getService());
14761      }
14762      if (element.hasQuantity()) {
14763        composeSimpleQuantity("quantity", element.getQuantity());
14764      }
14765      if (element.hasUnitPrice()) {
14766        composeMoney("unitPrice", element.getUnitPrice());
14767      }
14768      if (element.hasFactorElement()) {
14769        composeDecimalCore("factor", element.getFactorElement(), false);
14770        composeDecimalExtras("factor", element.getFactorElement(), false);
14771      }
14772      if (element.hasPointsElement()) {
14773        composeDecimalCore("points", element.getPointsElement(), false);
14774        composeDecimalExtras("points", element.getPointsElement(), false);
14775      }
14776      if (element.hasNet()) {
14777        composeMoney("net", element.getNet());
14778      }
14779      if (element.hasUdi()) {
14780        composeCoding("udi", element.getUdi());
14781      }
14782      if (element.hasSubDetail()) {
14783        openArray("subDetail");
14784        for (Claim.SubDetailComponent e : element.getSubDetail()) 
14785          composeClaimSubDetailComponent(null, e);
14786        closeArray();
14787      };
14788  }
14789
14790  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
14791    if (element != null) {
14792      open(name);
14793      composeClaimSubDetailComponentInner(element);
14794      close();
14795    }
14796  }
14797
14798  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
14799      composeBackbone(element);
14800      if (element.hasSequenceElement()) {
14801        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14802        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14803      }
14804      if (element.hasType()) {
14805        composeCoding("type", element.getType());
14806      }
14807      if (element.hasService()) {
14808        composeCoding("service", element.getService());
14809      }
14810      if (element.hasQuantity()) {
14811        composeSimpleQuantity("quantity", element.getQuantity());
14812      }
14813      if (element.hasUnitPrice()) {
14814        composeMoney("unitPrice", element.getUnitPrice());
14815      }
14816      if (element.hasFactorElement()) {
14817        composeDecimalCore("factor", element.getFactorElement(), false);
14818        composeDecimalExtras("factor", element.getFactorElement(), false);
14819      }
14820      if (element.hasPointsElement()) {
14821        composeDecimalCore("points", element.getPointsElement(), false);
14822        composeDecimalExtras("points", element.getPointsElement(), false);
14823      }
14824      if (element.hasNet()) {
14825        composeMoney("net", element.getNet());
14826      }
14827      if (element.hasUdi()) {
14828        composeCoding("udi", element.getUdi());
14829      }
14830  }
14831
14832  protected void composeClaimProsthesisComponent(String name, Claim.ProsthesisComponent element) throws IOException {
14833    if (element != null) {
14834      open(name);
14835      composeClaimProsthesisComponentInner(element);
14836      close();
14837    }
14838  }
14839
14840  protected void composeClaimProsthesisComponentInner(Claim.ProsthesisComponent element) throws IOException {
14841      composeBackbone(element);
14842      if (element.hasInitialElement()) {
14843        composeBooleanCore("initial", element.getInitialElement(), false);
14844        composeBooleanExtras("initial", element.getInitialElement(), false);
14845      }
14846      if (element.hasPriorDateElement()) {
14847        composeDateCore("priorDate", element.getPriorDateElement(), false);
14848        composeDateExtras("priorDate", element.getPriorDateElement(), false);
14849      }
14850      if (element.hasPriorMaterial()) {
14851        composeCoding("priorMaterial", element.getPriorMaterial());
14852      }
14853  }
14854
14855  protected void composeClaimMissingTeethComponent(String name, Claim.MissingTeethComponent element) throws IOException {
14856    if (element != null) {
14857      open(name);
14858      composeClaimMissingTeethComponentInner(element);
14859      close();
14860    }
14861  }
14862
14863  protected void composeClaimMissingTeethComponentInner(Claim.MissingTeethComponent element) throws IOException {
14864      composeBackbone(element);
14865      if (element.hasTooth()) {
14866        composeCoding("tooth", element.getTooth());
14867      }
14868      if (element.hasReason()) {
14869        composeCoding("reason", element.getReason());
14870      }
14871      if (element.hasExtractionDateElement()) {
14872        composeDateCore("extractionDate", element.getExtractionDateElement(), false);
14873        composeDateExtras("extractionDate", element.getExtractionDateElement(), false);
14874      }
14875  }
14876
14877  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
14878    if (element != null) {
14879      prop("resourceType", name);
14880      composeClaimResponseInner(element);
14881    }
14882  }
14883
14884  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
14885      composeDomainResourceElements(element);
14886      if (element.hasIdentifier()) {
14887        openArray("identifier");
14888        for (Identifier e : element.getIdentifier()) 
14889          composeIdentifier(null, e);
14890        closeArray();
14891      };
14892      if (element.hasRequest()) {
14893        composeReference("request", element.getRequest());
14894      }
14895      if (element.hasRuleset()) {
14896        composeCoding("ruleset", element.getRuleset());
14897      }
14898      if (element.hasOriginalRuleset()) {
14899        composeCoding("originalRuleset", element.getOriginalRuleset());
14900      }
14901      if (element.hasCreatedElement()) {
14902        composeDateTimeCore("created", element.getCreatedElement(), false);
14903        composeDateTimeExtras("created", element.getCreatedElement(), false);
14904      }
14905      if (element.hasOrganization()) {
14906        composeReference("organization", element.getOrganization());
14907      }
14908      if (element.hasRequestProvider()) {
14909        composeReference("requestProvider", element.getRequestProvider());
14910      }
14911      if (element.hasRequestOrganization()) {
14912        composeReference("requestOrganization", element.getRequestOrganization());
14913      }
14914      if (element.hasOutcomeElement()) {
14915        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14916        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14917      }
14918      if (element.hasDispositionElement()) {
14919        composeStringCore("disposition", element.getDispositionElement(), false);
14920        composeStringExtras("disposition", element.getDispositionElement(), false);
14921      }
14922      if (element.hasPayeeType()) {
14923        composeCoding("payeeType", element.getPayeeType());
14924      }
14925      if (element.hasItem()) {
14926        openArray("item");
14927        for (ClaimResponse.ItemsComponent e : element.getItem()) 
14928          composeClaimResponseItemsComponent(null, e);
14929        closeArray();
14930      };
14931      if (element.hasAddItem()) {
14932        openArray("addItem");
14933        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
14934          composeClaimResponseAddedItemComponent(null, e);
14935        closeArray();
14936      };
14937      if (element.hasError()) {
14938        openArray("error");
14939        for (ClaimResponse.ErrorsComponent e : element.getError()) 
14940          composeClaimResponseErrorsComponent(null, e);
14941        closeArray();
14942      };
14943      if (element.hasTotalCost()) {
14944        composeMoney("totalCost", element.getTotalCost());
14945      }
14946      if (element.hasUnallocDeductable()) {
14947        composeMoney("unallocDeductable", element.getUnallocDeductable());
14948      }
14949      if (element.hasTotalBenefit()) {
14950        composeMoney("totalBenefit", element.getTotalBenefit());
14951      }
14952      if (element.hasPaymentAdjustment()) {
14953        composeMoney("paymentAdjustment", element.getPaymentAdjustment());
14954      }
14955      if (element.hasPaymentAdjustmentReason()) {
14956        composeCoding("paymentAdjustmentReason", element.getPaymentAdjustmentReason());
14957      }
14958      if (element.hasPaymentDateElement()) {
14959        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
14960        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
14961      }
14962      if (element.hasPaymentAmount()) {
14963        composeMoney("paymentAmount", element.getPaymentAmount());
14964      }
14965      if (element.hasPaymentRef()) {
14966        composeIdentifier("paymentRef", element.getPaymentRef());
14967      }
14968      if (element.hasReserved()) {
14969        composeCoding("reserved", element.getReserved());
14970      }
14971      if (element.hasForm()) {
14972        composeCoding("form", element.getForm());
14973      }
14974      if (element.hasNote()) {
14975        openArray("note");
14976        for (ClaimResponse.NotesComponent e : element.getNote()) 
14977          composeClaimResponseNotesComponent(null, e);
14978        closeArray();
14979      };
14980      if (element.hasCoverage()) {
14981        openArray("coverage");
14982        for (ClaimResponse.CoverageComponent e : element.getCoverage()) 
14983          composeClaimResponseCoverageComponent(null, e);
14984        closeArray();
14985      };
14986  }
14987
14988  protected void composeClaimResponseItemsComponent(String name, ClaimResponse.ItemsComponent element) throws IOException {
14989    if (element != null) {
14990      open(name);
14991      composeClaimResponseItemsComponentInner(element);
14992      close();
14993    }
14994  }
14995
14996  protected void composeClaimResponseItemsComponentInner(ClaimResponse.ItemsComponent element) throws IOException {
14997      composeBackbone(element);
14998      if (element.hasSequenceLinkIdElement()) {
14999        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15000        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15001      }
15002      if (element.hasNoteNumber()) {
15003        openArray("noteNumber");
15004        for (PositiveIntType e : element.getNoteNumber()) 
15005          composePositiveIntCore(null, e, true);
15006        closeArray();
15007        if (anyHasExtras(element.getNoteNumber())) {
15008          openArray("_noteNumber");
15009          for (PositiveIntType e : element.getNoteNumber()) 
15010            composePositiveIntExtras(null, e, true);
15011          closeArray();
15012        }
15013      };
15014      if (element.hasAdjudication()) {
15015        openArray("adjudication");
15016        for (ClaimResponse.ItemAdjudicationComponent e : element.getAdjudication()) 
15017          composeClaimResponseItemAdjudicationComponent(null, e);
15018        closeArray();
15019      };
15020      if (element.hasDetail()) {
15021        openArray("detail");
15022        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
15023          composeClaimResponseItemDetailComponent(null, e);
15024        closeArray();
15025      };
15026  }
15027
15028  protected void composeClaimResponseItemAdjudicationComponent(String name, ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15029    if (element != null) {
15030      open(name);
15031      composeClaimResponseItemAdjudicationComponentInner(element);
15032      close();
15033    }
15034  }
15035
15036  protected void composeClaimResponseItemAdjudicationComponentInner(ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15037      composeBackbone(element);
15038      if (element.hasCode()) {
15039        composeCoding("code", element.getCode());
15040      }
15041      if (element.hasAmount()) {
15042        composeMoney("amount", element.getAmount());
15043      }
15044      if (element.hasValueElement()) {
15045        composeDecimalCore("value", element.getValueElement(), false);
15046        composeDecimalExtras("value", element.getValueElement(), false);
15047      }
15048  }
15049
15050  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
15051    if (element != null) {
15052      open(name);
15053      composeClaimResponseItemDetailComponentInner(element);
15054      close();
15055    }
15056  }
15057
15058  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
15059      composeBackbone(element);
15060      if (element.hasSequenceLinkIdElement()) {
15061        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15062        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15063      }
15064      if (element.hasAdjudication()) {
15065        openArray("adjudication");
15066        for (ClaimResponse.DetailAdjudicationComponent e : element.getAdjudication()) 
15067          composeClaimResponseDetailAdjudicationComponent(null, e);
15068        closeArray();
15069      };
15070      if (element.hasSubDetail()) {
15071        openArray("subDetail");
15072        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
15073          composeClaimResponseSubDetailComponent(null, e);
15074        closeArray();
15075      };
15076  }
15077
15078  protected void composeClaimResponseDetailAdjudicationComponent(String name, ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15079    if (element != null) {
15080      open(name);
15081      composeClaimResponseDetailAdjudicationComponentInner(element);
15082      close();
15083    }
15084  }
15085
15086  protected void composeClaimResponseDetailAdjudicationComponentInner(ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15087      composeBackbone(element);
15088      if (element.hasCode()) {
15089        composeCoding("code", element.getCode());
15090      }
15091      if (element.hasAmount()) {
15092        composeMoney("amount", element.getAmount());
15093      }
15094      if (element.hasValueElement()) {
15095        composeDecimalCore("value", element.getValueElement(), false);
15096        composeDecimalExtras("value", element.getValueElement(), false);
15097      }
15098  }
15099
15100  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
15101    if (element != null) {
15102      open(name);
15103      composeClaimResponseSubDetailComponentInner(element);
15104      close();
15105    }
15106  }
15107
15108  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
15109      composeBackbone(element);
15110      if (element.hasSequenceLinkIdElement()) {
15111        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15112        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15113      }
15114      if (element.hasAdjudication()) {
15115        openArray("adjudication");
15116        for (ClaimResponse.SubdetailAdjudicationComponent e : element.getAdjudication()) 
15117          composeClaimResponseSubdetailAdjudicationComponent(null, e);
15118        closeArray();
15119      };
15120  }
15121
15122  protected void composeClaimResponseSubdetailAdjudicationComponent(String name, ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15123    if (element != null) {
15124      open(name);
15125      composeClaimResponseSubdetailAdjudicationComponentInner(element);
15126      close();
15127    }
15128  }
15129
15130  protected void composeClaimResponseSubdetailAdjudicationComponentInner(ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15131      composeBackbone(element);
15132      if (element.hasCode()) {
15133        composeCoding("code", element.getCode());
15134      }
15135      if (element.hasAmount()) {
15136        composeMoney("amount", element.getAmount());
15137      }
15138      if (element.hasValueElement()) {
15139        composeDecimalCore("value", element.getValueElement(), false);
15140        composeDecimalExtras("value", element.getValueElement(), false);
15141      }
15142  }
15143
15144  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
15145    if (element != null) {
15146      open(name);
15147      composeClaimResponseAddedItemComponentInner(element);
15148      close();
15149    }
15150  }
15151
15152  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
15153      composeBackbone(element);
15154      if (element.hasSequenceLinkId()) {
15155        openArray("sequenceLinkId");
15156        for (PositiveIntType e : element.getSequenceLinkId()) 
15157          composePositiveIntCore(null, e, true);
15158        closeArray();
15159        if (anyHasExtras(element.getSequenceLinkId())) {
15160          openArray("_sequenceLinkId");
15161          for (PositiveIntType e : element.getSequenceLinkId()) 
15162            composePositiveIntExtras(null, e, true);
15163          closeArray();
15164        }
15165      };
15166      if (element.hasService()) {
15167        composeCoding("service", element.getService());
15168      }
15169      if (element.hasFee()) {
15170        composeMoney("fee", element.getFee());
15171      }
15172      if (element.hasNoteNumberLinkId()) {
15173        openArray("noteNumberLinkId");
15174        for (PositiveIntType e : element.getNoteNumberLinkId()) 
15175          composePositiveIntCore(null, e, true);
15176        closeArray();
15177        if (anyHasExtras(element.getNoteNumberLinkId())) {
15178          openArray("_noteNumberLinkId");
15179          for (PositiveIntType e : element.getNoteNumberLinkId()) 
15180            composePositiveIntExtras(null, e, true);
15181          closeArray();
15182        }
15183      };
15184      if (element.hasAdjudication()) {
15185        openArray("adjudication");
15186        for (ClaimResponse.AddedItemAdjudicationComponent e : element.getAdjudication()) 
15187          composeClaimResponseAddedItemAdjudicationComponent(null, e);
15188        closeArray();
15189      };
15190      if (element.hasDetail()) {
15191        openArray("detail");
15192        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
15193          composeClaimResponseAddedItemsDetailComponent(null, e);
15194        closeArray();
15195      };
15196  }
15197
15198  protected void composeClaimResponseAddedItemAdjudicationComponent(String name, ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15199    if (element != null) {
15200      open(name);
15201      composeClaimResponseAddedItemAdjudicationComponentInner(element);
15202      close();
15203    }
15204  }
15205
15206  protected void composeClaimResponseAddedItemAdjudicationComponentInner(ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15207      composeBackbone(element);
15208      if (element.hasCode()) {
15209        composeCoding("code", element.getCode());
15210      }
15211      if (element.hasAmount()) {
15212        composeMoney("amount", element.getAmount());
15213      }
15214      if (element.hasValueElement()) {
15215        composeDecimalCore("value", element.getValueElement(), false);
15216        composeDecimalExtras("value", element.getValueElement(), false);
15217      }
15218  }
15219
15220  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15221    if (element != null) {
15222      open(name);
15223      composeClaimResponseAddedItemsDetailComponentInner(element);
15224      close();
15225    }
15226  }
15227
15228  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15229      composeBackbone(element);
15230      if (element.hasService()) {
15231        composeCoding("service", element.getService());
15232      }
15233      if (element.hasFee()) {
15234        composeMoney("fee", element.getFee());
15235      }
15236      if (element.hasAdjudication()) {
15237        openArray("adjudication");
15238        for (ClaimResponse.AddedItemDetailAdjudicationComponent e : element.getAdjudication()) 
15239          composeClaimResponseAddedItemDetailAdjudicationComponent(null, e);
15240        closeArray();
15241      };
15242  }
15243
15244  protected void composeClaimResponseAddedItemDetailAdjudicationComponent(String name, ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15245    if (element != null) {
15246      open(name);
15247      composeClaimResponseAddedItemDetailAdjudicationComponentInner(element);
15248      close();
15249    }
15250  }
15251
15252  protected void composeClaimResponseAddedItemDetailAdjudicationComponentInner(ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15253      composeBackbone(element);
15254      if (element.hasCode()) {
15255        composeCoding("code", element.getCode());
15256      }
15257      if (element.hasAmount()) {
15258        composeMoney("amount", element.getAmount());
15259      }
15260      if (element.hasValueElement()) {
15261        composeDecimalCore("value", element.getValueElement(), false);
15262        composeDecimalExtras("value", element.getValueElement(), false);
15263      }
15264  }
15265
15266  protected void composeClaimResponseErrorsComponent(String name, ClaimResponse.ErrorsComponent element) throws IOException {
15267    if (element != null) {
15268      open(name);
15269      composeClaimResponseErrorsComponentInner(element);
15270      close();
15271    }
15272  }
15273
15274  protected void composeClaimResponseErrorsComponentInner(ClaimResponse.ErrorsComponent element) throws IOException {
15275      composeBackbone(element);
15276      if (element.hasSequenceLinkIdElement()) {
15277        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15278        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15279      }
15280      if (element.hasDetailSequenceLinkIdElement()) {
15281        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15282        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15283      }
15284      if (element.hasSubdetailSequenceLinkIdElement()) {
15285        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15286        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15287      }
15288      if (element.hasCode()) {
15289        composeCoding("code", element.getCode());
15290      }
15291  }
15292
15293  protected void composeClaimResponseNotesComponent(String name, ClaimResponse.NotesComponent element) throws IOException {
15294    if (element != null) {
15295      open(name);
15296      composeClaimResponseNotesComponentInner(element);
15297      close();
15298    }
15299  }
15300
15301  protected void composeClaimResponseNotesComponentInner(ClaimResponse.NotesComponent element) throws IOException {
15302      composeBackbone(element);
15303      if (element.hasNumberElement()) {
15304        composePositiveIntCore("number", element.getNumberElement(), false);
15305        composePositiveIntExtras("number", element.getNumberElement(), false);
15306      }
15307      if (element.hasType()) {
15308        composeCoding("type", element.getType());
15309      }
15310      if (element.hasTextElement()) {
15311        composeStringCore("text", element.getTextElement(), false);
15312        composeStringExtras("text", element.getTextElement(), false);
15313      }
15314  }
15315
15316  protected void composeClaimResponseCoverageComponent(String name, ClaimResponse.CoverageComponent element) throws IOException {
15317    if (element != null) {
15318      open(name);
15319      composeClaimResponseCoverageComponentInner(element);
15320      close();
15321    }
15322  }
15323
15324  protected void composeClaimResponseCoverageComponentInner(ClaimResponse.CoverageComponent element) throws IOException {
15325      composeBackbone(element);
15326      if (element.hasSequenceElement()) {
15327        composePositiveIntCore("sequence", element.getSequenceElement(), false);
15328        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
15329      }
15330      if (element.hasFocalElement()) {
15331        composeBooleanCore("focal", element.getFocalElement(), false);
15332        composeBooleanExtras("focal", element.getFocalElement(), false);
15333      }
15334      if (element.hasCoverage()) {
15335        composeReference("coverage", element.getCoverage());
15336      }
15337      if (element.hasBusinessArrangementElement()) {
15338        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
15339        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
15340      }
15341      if (element.hasRelationship()) {
15342        composeCoding("relationship", element.getRelationship());
15343      }
15344      if (element.hasPreAuthRef()) {
15345        openArray("preAuthRef");
15346        for (StringType e : element.getPreAuthRef()) 
15347          composeStringCore(null, e, true);
15348        closeArray();
15349        if (anyHasExtras(element.getPreAuthRef())) {
15350          openArray("_preAuthRef");
15351          for (StringType e : element.getPreAuthRef()) 
15352            composeStringExtras(null, e, true);
15353          closeArray();
15354        }
15355      };
15356      if (element.hasClaimResponse()) {
15357        composeReference("claimResponse", element.getClaimResponse());
15358      }
15359      if (element.hasOriginalRuleset()) {
15360        composeCoding("originalRuleset", element.getOriginalRuleset());
15361      }
15362  }
15363
15364  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
15365    if (element != null) {
15366      prop("resourceType", name);
15367      composeClinicalImpressionInner(element);
15368    }
15369  }
15370
15371  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
15372      composeDomainResourceElements(element);
15373      if (element.hasPatient()) {
15374        composeReference("patient", element.getPatient());
15375      }
15376      if (element.hasAssessor()) {
15377        composeReference("assessor", element.getAssessor());
15378      }
15379      if (element.hasStatusElement()) {
15380        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15381        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15382      }
15383      if (element.hasDateElement()) {
15384        composeDateTimeCore("date", element.getDateElement(), false);
15385        composeDateTimeExtras("date", element.getDateElement(), false);
15386      }
15387      if (element.hasDescriptionElement()) {
15388        composeStringCore("description", element.getDescriptionElement(), false);
15389        composeStringExtras("description", element.getDescriptionElement(), false);
15390      }
15391      if (element.hasPrevious()) {
15392        composeReference("previous", element.getPrevious());
15393      }
15394      if (element.hasProblem()) {
15395        openArray("problem");
15396        for (Reference e : element.getProblem()) 
15397          composeReference(null, e);
15398        closeArray();
15399      };
15400      if (element.hasTrigger()) {
15401        composeType("trigger", element.getTrigger());
15402      }
15403      if (element.hasInvestigations()) {
15404        openArray("investigations");
15405        for (ClinicalImpression.ClinicalImpressionInvestigationsComponent e : element.getInvestigations()) 
15406          composeClinicalImpressionClinicalImpressionInvestigationsComponent(null, e);
15407        closeArray();
15408      };
15409      if (element.hasProtocolElement()) {
15410        composeUriCore("protocol", element.getProtocolElement(), false);
15411        composeUriExtras("protocol", element.getProtocolElement(), false);
15412      }
15413      if (element.hasSummaryElement()) {
15414        composeStringCore("summary", element.getSummaryElement(), false);
15415        composeStringExtras("summary", element.getSummaryElement(), false);
15416      }
15417      if (element.hasFinding()) {
15418        openArray("finding");
15419        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
15420          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
15421        closeArray();
15422      };
15423      if (element.hasResolved()) {
15424        openArray("resolved");
15425        for (CodeableConcept e : element.getResolved()) 
15426          composeCodeableConcept(null, e);
15427        closeArray();
15428      };
15429      if (element.hasRuledOut()) {
15430        openArray("ruledOut");
15431        for (ClinicalImpression.ClinicalImpressionRuledOutComponent e : element.getRuledOut()) 
15432          composeClinicalImpressionClinicalImpressionRuledOutComponent(null, e);
15433        closeArray();
15434      };
15435      if (element.hasPrognosisElement()) {
15436        composeStringCore("prognosis", element.getPrognosisElement(), false);
15437        composeStringExtras("prognosis", element.getPrognosisElement(), false);
15438      }
15439      if (element.hasPlan()) {
15440        openArray("plan");
15441        for (Reference e : element.getPlan()) 
15442          composeReference(null, e);
15443        closeArray();
15444      };
15445      if (element.hasAction()) {
15446        openArray("action");
15447        for (Reference e : element.getAction()) 
15448          composeReference(null, e);
15449        closeArray();
15450      };
15451  }
15452
15453  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15454    if (element != null) {
15455      open(name);
15456      composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(element);
15457      close();
15458    }
15459  }
15460
15461  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15462      composeBackbone(element);
15463      if (element.hasCode()) {
15464        composeCodeableConcept("code", element.getCode());
15465      }
15466      if (element.hasItem()) {
15467        openArray("item");
15468        for (Reference e : element.getItem()) 
15469          composeReference(null, e);
15470        closeArray();
15471      };
15472  }
15473
15474  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15475    if (element != null) {
15476      open(name);
15477      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
15478      close();
15479    }
15480  }
15481
15482  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15483      composeBackbone(element);
15484      if (element.hasItem()) {
15485        composeCodeableConcept("item", element.getItem());
15486      }
15487      if (element.hasCauseElement()) {
15488        composeStringCore("cause", element.getCauseElement(), false);
15489        composeStringExtras("cause", element.getCauseElement(), false);
15490      }
15491  }
15492
15493  protected void composeClinicalImpressionClinicalImpressionRuledOutComponent(String name, ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15494    if (element != null) {
15495      open(name);
15496      composeClinicalImpressionClinicalImpressionRuledOutComponentInner(element);
15497      close();
15498    }
15499  }
15500
15501  protected void composeClinicalImpressionClinicalImpressionRuledOutComponentInner(ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15502      composeBackbone(element);
15503      if (element.hasItem()) {
15504        composeCodeableConcept("item", element.getItem());
15505      }
15506      if (element.hasReasonElement()) {
15507        composeStringCore("reason", element.getReasonElement(), false);
15508        composeStringExtras("reason", element.getReasonElement(), false);
15509      }
15510  }
15511
15512  protected void composeCommunication(String name, Communication element) throws IOException {
15513    if (element != null) {
15514      prop("resourceType", name);
15515      composeCommunicationInner(element);
15516    }
15517  }
15518
15519  protected void composeCommunicationInner(Communication element) throws IOException {
15520      composeDomainResourceElements(element);
15521      if (element.hasIdentifier()) {
15522        openArray("identifier");
15523        for (Identifier e : element.getIdentifier()) 
15524          composeIdentifier(null, e);
15525        closeArray();
15526      };
15527      if (element.hasCategory()) {
15528        composeCodeableConcept("category", element.getCategory());
15529      }
15530      if (element.hasSender()) {
15531        composeReference("sender", element.getSender());
15532      }
15533      if (element.hasRecipient()) {
15534        openArray("recipient");
15535        for (Reference e : element.getRecipient()) 
15536          composeReference(null, e);
15537        closeArray();
15538      };
15539      if (element.hasPayload()) {
15540        openArray("payload");
15541        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
15542          composeCommunicationCommunicationPayloadComponent(null, e);
15543        closeArray();
15544      };
15545      if (element.hasMedium()) {
15546        openArray("medium");
15547        for (CodeableConcept e : element.getMedium()) 
15548          composeCodeableConcept(null, e);
15549        closeArray();
15550      };
15551      if (element.hasStatusElement()) {
15552        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15553        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15554      }
15555      if (element.hasEncounter()) {
15556        composeReference("encounter", element.getEncounter());
15557      }
15558      if (element.hasSentElement()) {
15559        composeDateTimeCore("sent", element.getSentElement(), false);
15560        composeDateTimeExtras("sent", element.getSentElement(), false);
15561      }
15562      if (element.hasReceivedElement()) {
15563        composeDateTimeCore("received", element.getReceivedElement(), false);
15564        composeDateTimeExtras("received", element.getReceivedElement(), false);
15565      }
15566      if (element.hasReason()) {
15567        openArray("reason");
15568        for (CodeableConcept e : element.getReason()) 
15569          composeCodeableConcept(null, e);
15570        closeArray();
15571      };
15572      if (element.hasSubject()) {
15573        composeReference("subject", element.getSubject());
15574      }
15575      if (element.hasRequestDetail()) {
15576        composeReference("requestDetail", element.getRequestDetail());
15577      }
15578  }
15579
15580  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
15581    if (element != null) {
15582      open(name);
15583      composeCommunicationCommunicationPayloadComponentInner(element);
15584      close();
15585    }
15586  }
15587
15588  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
15589      composeBackbone(element);
15590      if (element.hasContent()) {
15591        composeType("content", element.getContent());
15592      }
15593  }
15594
15595  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
15596    if (element != null) {
15597      prop("resourceType", name);
15598      composeCommunicationRequestInner(element);
15599    }
15600  }
15601
15602  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
15603      composeDomainResourceElements(element);
15604      if (element.hasIdentifier()) {
15605        openArray("identifier");
15606        for (Identifier e : element.getIdentifier()) 
15607          composeIdentifier(null, e);
15608        closeArray();
15609      };
15610      if (element.hasCategory()) {
15611        composeCodeableConcept("category", element.getCategory());
15612      }
15613      if (element.hasSender()) {
15614        composeReference("sender", element.getSender());
15615      }
15616      if (element.hasRecipient()) {
15617        openArray("recipient");
15618        for (Reference e : element.getRecipient()) 
15619          composeReference(null, e);
15620        closeArray();
15621      };
15622      if (element.hasPayload()) {
15623        openArray("payload");
15624        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
15625          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
15626        closeArray();
15627      };
15628      if (element.hasMedium()) {
15629        openArray("medium");
15630        for (CodeableConcept e : element.getMedium()) 
15631          composeCodeableConcept(null, e);
15632        closeArray();
15633      };
15634      if (element.hasRequester()) {
15635        composeReference("requester", element.getRequester());
15636      }
15637      if (element.hasStatusElement()) {
15638        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15639        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15640      }
15641      if (element.hasEncounter()) {
15642        composeReference("encounter", element.getEncounter());
15643      }
15644      if (element.hasScheduled()) {
15645        composeType("scheduled", element.getScheduled());
15646      }
15647      if (element.hasReason()) {
15648        openArray("reason");
15649        for (CodeableConcept e : element.getReason()) 
15650          composeCodeableConcept(null, e);
15651        closeArray();
15652      };
15653      if (element.hasRequestedOnElement()) {
15654        composeDateTimeCore("requestedOn", element.getRequestedOnElement(), false);
15655        composeDateTimeExtras("requestedOn", element.getRequestedOnElement(), false);
15656      }
15657      if (element.hasSubject()) {
15658        composeReference("subject", element.getSubject());
15659      }
15660      if (element.hasPriority()) {
15661        composeCodeableConcept("priority", element.getPriority());
15662      }
15663  }
15664
15665  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15666    if (element != null) {
15667      open(name);
15668      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
15669      close();
15670    }
15671  }
15672
15673  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15674      composeBackbone(element);
15675      if (element.hasContent()) {
15676        composeType("content", element.getContent());
15677      }
15678  }
15679
15680  protected void composeComposition(String name, Composition element) throws IOException {
15681    if (element != null) {
15682      prop("resourceType", name);
15683      composeCompositionInner(element);
15684    }
15685  }
15686
15687  protected void composeCompositionInner(Composition element) throws IOException {
15688      composeDomainResourceElements(element);
15689      if (element.hasIdentifier()) {
15690        composeIdentifier("identifier", element.getIdentifier());
15691      }
15692      if (element.hasDateElement()) {
15693        composeDateTimeCore("date", element.getDateElement(), false);
15694        composeDateTimeExtras("date", element.getDateElement(), false);
15695      }
15696      if (element.hasType()) {
15697        composeCodeableConcept("type", element.getType());
15698      }
15699      if (element.hasClass_()) {
15700        composeCodeableConcept("class", element.getClass_());
15701      }
15702      if (element.hasTitleElement()) {
15703        composeStringCore("title", element.getTitleElement(), false);
15704        composeStringExtras("title", element.getTitleElement(), false);
15705      }
15706      if (element.hasStatusElement()) {
15707        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15708        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15709      }
15710      if (element.hasConfidentialityElement()) {
15711        composeCodeCore("confidentiality", element.getConfidentialityElement(), false);
15712        composeCodeExtras("confidentiality", element.getConfidentialityElement(), false);
15713      }
15714      if (element.hasSubject()) {
15715        composeReference("subject", element.getSubject());
15716      }
15717      if (element.hasAuthor()) {
15718        openArray("author");
15719        for (Reference e : element.getAuthor()) 
15720          composeReference(null, e);
15721        closeArray();
15722      };
15723      if (element.hasAttester()) {
15724        openArray("attester");
15725        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
15726          composeCompositionCompositionAttesterComponent(null, e);
15727        closeArray();
15728      };
15729      if (element.hasCustodian()) {
15730        composeReference("custodian", element.getCustodian());
15731      }
15732      if (element.hasEvent()) {
15733        openArray("event");
15734        for (Composition.CompositionEventComponent e : element.getEvent()) 
15735          composeCompositionCompositionEventComponent(null, e);
15736        closeArray();
15737      };
15738      if (element.hasEncounter()) {
15739        composeReference("encounter", element.getEncounter());
15740      }
15741      if (element.hasSection()) {
15742        openArray("section");
15743        for (Composition.SectionComponent e : element.getSection()) 
15744          composeCompositionSectionComponent(null, e);
15745        closeArray();
15746      };
15747  }
15748
15749  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
15750    if (element != null) {
15751      open(name);
15752      composeCompositionCompositionAttesterComponentInner(element);
15753      close();
15754    }
15755  }
15756
15757  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
15758      composeBackbone(element);
15759      if (element.hasMode()) {
15760        openArray("mode");
15761        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15762          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15763        closeArray();
15764        if (anyHasExtras(element.getMode())) {
15765          openArray("_mode");
15766          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15767            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15768          closeArray();
15769        }
15770      };
15771      if (element.hasTimeElement()) {
15772        composeDateTimeCore("time", element.getTimeElement(), false);
15773        composeDateTimeExtras("time", element.getTimeElement(), false);
15774      }
15775      if (element.hasParty()) {
15776        composeReference("party", element.getParty());
15777      }
15778  }
15779
15780  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
15781    if (element != null) {
15782      open(name);
15783      composeCompositionCompositionEventComponentInner(element);
15784      close();
15785    }
15786  }
15787
15788  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
15789      composeBackbone(element);
15790      if (element.hasCode()) {
15791        openArray("code");
15792        for (CodeableConcept e : element.getCode()) 
15793          composeCodeableConcept(null, e);
15794        closeArray();
15795      };
15796      if (element.hasPeriod()) {
15797        composePeriod("period", element.getPeriod());
15798      }
15799      if (element.hasDetail()) {
15800        openArray("detail");
15801        for (Reference e : element.getDetail()) 
15802          composeReference(null, e);
15803        closeArray();
15804      };
15805  }
15806
15807  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
15808    if (element != null) {
15809      open(name);
15810      composeCompositionSectionComponentInner(element);
15811      close();
15812    }
15813  }
15814
15815  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
15816      composeBackbone(element);
15817      if (element.hasTitleElement()) {
15818        composeStringCore("title", element.getTitleElement(), false);
15819        composeStringExtras("title", element.getTitleElement(), false);
15820      }
15821      if (element.hasCode()) {
15822        composeCodeableConcept("code", element.getCode());
15823      }
15824      if (element.hasText()) {
15825        composeNarrative("text", element.getText());
15826      }
15827      if (element.hasModeElement()) {
15828        composeCodeCore("mode", element.getModeElement(), false);
15829        composeCodeExtras("mode", element.getModeElement(), false);
15830      }
15831      if (element.hasOrderedBy()) {
15832        composeCodeableConcept("orderedBy", element.getOrderedBy());
15833      }
15834      if (element.hasEntry()) {
15835        openArray("entry");
15836        for (Reference e : element.getEntry()) 
15837          composeReference(null, e);
15838        closeArray();
15839      };
15840      if (element.hasEmptyReason()) {
15841        composeCodeableConcept("emptyReason", element.getEmptyReason());
15842      }
15843      if (element.hasSection()) {
15844        openArray("section");
15845        for (Composition.SectionComponent e : element.getSection()) 
15846          composeCompositionSectionComponent(null, e);
15847        closeArray();
15848      };
15849  }
15850
15851  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
15852    if (element != null) {
15853      prop("resourceType", name);
15854      composeConceptMapInner(element);
15855    }
15856  }
15857
15858  protected void composeConceptMapInner(ConceptMap element) throws IOException {
15859      composeDomainResourceElements(element);
15860      if (element.hasUrlElement()) {
15861        composeUriCore("url", element.getUrlElement(), false);
15862        composeUriExtras("url", element.getUrlElement(), false);
15863      }
15864      if (element.hasIdentifier()) {
15865        composeIdentifier("identifier", element.getIdentifier());
15866      }
15867      if (element.hasVersionElement()) {
15868        composeStringCore("version", element.getVersionElement(), false);
15869        composeStringExtras("version", element.getVersionElement(), false);
15870      }
15871      if (element.hasNameElement()) {
15872        composeStringCore("name", element.getNameElement(), false);
15873        composeStringExtras("name", element.getNameElement(), false);
15874      }
15875      if (element.hasStatusElement()) {
15876        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15877        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15878      }
15879      if (element.hasExperimentalElement()) {
15880        composeBooleanCore("experimental", element.getExperimentalElement(), false);
15881        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
15882      }
15883      if (element.hasPublisherElement()) {
15884        composeStringCore("publisher", element.getPublisherElement(), false);
15885        composeStringExtras("publisher", element.getPublisherElement(), false);
15886      }
15887      if (element.hasContact()) {
15888        openArray("contact");
15889        for (ConceptMap.ConceptMapContactComponent e : element.getContact()) 
15890          composeConceptMapConceptMapContactComponent(null, e);
15891        closeArray();
15892      };
15893      if (element.hasDateElement()) {
15894        composeDateTimeCore("date", element.getDateElement(), false);
15895        composeDateTimeExtras("date", element.getDateElement(), false);
15896      }
15897      if (element.hasDescriptionElement()) {
15898        composeStringCore("description", element.getDescriptionElement(), false);
15899        composeStringExtras("description", element.getDescriptionElement(), false);
15900      }
15901      if (element.hasUseContext()) {
15902        openArray("useContext");
15903        for (CodeableConcept e : element.getUseContext()) 
15904          composeCodeableConcept(null, e);
15905        closeArray();
15906      };
15907      if (element.hasRequirementsElement()) {
15908        composeStringCore("requirements", element.getRequirementsElement(), false);
15909        composeStringExtras("requirements", element.getRequirementsElement(), false);
15910      }
15911      if (element.hasCopyrightElement()) {
15912        composeStringCore("copyright", element.getCopyrightElement(), false);
15913        composeStringExtras("copyright", element.getCopyrightElement(), false);
15914      }
15915      if (element.hasSource()) {
15916        composeType("source", element.getSource());
15917      }
15918      if (element.hasTarget()) {
15919        composeType("target", element.getTarget());
15920      }
15921      if (element.hasElement()) {
15922        openArray("element");
15923        for (ConceptMap.SourceElementComponent e : element.getElement()) 
15924          composeConceptMapSourceElementComponent(null, e);
15925        closeArray();
15926      };
15927  }
15928
15929  protected void composeConceptMapConceptMapContactComponent(String name, ConceptMap.ConceptMapContactComponent element) throws IOException {
15930    if (element != null) {
15931      open(name);
15932      composeConceptMapConceptMapContactComponentInner(element);
15933      close();
15934    }
15935  }
15936
15937  protected void composeConceptMapConceptMapContactComponentInner(ConceptMap.ConceptMapContactComponent element) throws IOException {
15938      composeBackbone(element);
15939      if (element.hasNameElement()) {
15940        composeStringCore("name", element.getNameElement(), false);
15941        composeStringExtras("name", element.getNameElement(), false);
15942      }
15943      if (element.hasTelecom()) {
15944        openArray("telecom");
15945        for (ContactPoint e : element.getTelecom()) 
15946          composeContactPoint(null, e);
15947        closeArray();
15948      };
15949  }
15950
15951  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
15952    if (element != null) {
15953      open(name);
15954      composeConceptMapSourceElementComponentInner(element);
15955      close();
15956    }
15957  }
15958
15959  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
15960      composeBackbone(element);
15961      if (element.hasCodeSystemElement()) {
15962        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
15963        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
15964      }
15965      if (element.hasCodeElement()) {
15966        composeCodeCore("code", element.getCodeElement(), false);
15967        composeCodeExtras("code", element.getCodeElement(), false);
15968      }
15969      if (element.hasTarget()) {
15970        openArray("target");
15971        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
15972          composeConceptMapTargetElementComponent(null, e);
15973        closeArray();
15974      };
15975  }
15976
15977  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
15978    if (element != null) {
15979      open(name);
15980      composeConceptMapTargetElementComponentInner(element);
15981      close();
15982    }
15983  }
15984
15985  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
15986      composeBackbone(element);
15987      if (element.hasCodeSystemElement()) {
15988        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
15989        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
15990      }
15991      if (element.hasCodeElement()) {
15992        composeCodeCore("code", element.getCodeElement(), false);
15993        composeCodeExtras("code", element.getCodeElement(), false);
15994      }
15995      if (element.hasEquivalenceElement()) {
15996        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
15997        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
15998      }
15999      if (element.hasCommentsElement()) {
16000        composeStringCore("comments", element.getCommentsElement(), false);
16001        composeStringExtras("comments", element.getCommentsElement(), false);
16002      }
16003      if (element.hasDependsOn()) {
16004        openArray("dependsOn");
16005        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
16006          composeConceptMapOtherElementComponent(null, e);
16007        closeArray();
16008      };
16009      if (element.hasProduct()) {
16010        openArray("product");
16011        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
16012          composeConceptMapOtherElementComponent(null, e);
16013        closeArray();
16014      };
16015  }
16016
16017  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
16018    if (element != null) {
16019      open(name);
16020      composeConceptMapOtherElementComponentInner(element);
16021      close();
16022    }
16023  }
16024
16025  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
16026      composeBackbone(element);
16027      if (element.hasElementElement()) {
16028        composeUriCore("element", element.getElementElement(), false);
16029        composeUriExtras("element", element.getElementElement(), false);
16030      }
16031      if (element.hasCodeSystemElement()) {
16032        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
16033        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
16034      }
16035      if (element.hasCodeElement()) {
16036        composeStringCore("code", element.getCodeElement(), false);
16037        composeStringExtras("code", element.getCodeElement(), false);
16038      }
16039  }
16040
16041  protected void composeCondition(String name, Condition element) throws IOException {
16042    if (element != null) {
16043      prop("resourceType", name);
16044      composeConditionInner(element);
16045    }
16046  }
16047
16048  protected void composeConditionInner(Condition element) throws IOException {
16049      composeDomainResourceElements(element);
16050      if (element.hasIdentifier()) {
16051        openArray("identifier");
16052        for (Identifier e : element.getIdentifier()) 
16053          composeIdentifier(null, e);
16054        closeArray();
16055      };
16056      if (element.hasPatient()) {
16057        composeReference("patient", element.getPatient());
16058      }
16059      if (element.hasEncounter()) {
16060        composeReference("encounter", element.getEncounter());
16061      }
16062      if (element.hasAsserter()) {
16063        composeReference("asserter", element.getAsserter());
16064      }
16065      if (element.hasDateRecordedElement()) {
16066        composeDateCore("dateRecorded", element.getDateRecordedElement(), false);
16067        composeDateExtras("dateRecorded", element.getDateRecordedElement(), false);
16068      }
16069      if (element.hasCode()) {
16070        composeCodeableConcept("code", element.getCode());
16071      }
16072      if (element.hasCategory()) {
16073        composeCodeableConcept("category", element.getCategory());
16074      }
16075      if (element.hasClinicalStatusElement()) {
16076        composeCodeCore("clinicalStatus", element.getClinicalStatusElement(), false);
16077        composeCodeExtras("clinicalStatus", element.getClinicalStatusElement(), false);
16078      }
16079      if (element.hasVerificationStatusElement()) {
16080        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16081        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16082      }
16083      if (element.hasSeverity()) {
16084        composeCodeableConcept("severity", element.getSeverity());
16085      }
16086      if (element.hasOnset()) {
16087        composeType("onset", element.getOnset());
16088      }
16089      if (element.hasAbatement()) {
16090        composeType("abatement", element.getAbatement());
16091      }
16092      if (element.hasStage()) {
16093        composeConditionConditionStageComponent("stage", element.getStage());
16094      }
16095      if (element.hasEvidence()) {
16096        openArray("evidence");
16097        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
16098          composeConditionConditionEvidenceComponent(null, e);
16099        closeArray();
16100      };
16101      if (element.hasBodySite()) {
16102        openArray("bodySite");
16103        for (CodeableConcept e : element.getBodySite()) 
16104          composeCodeableConcept(null, e);
16105        closeArray();
16106      };
16107      if (element.hasNotesElement()) {
16108        composeStringCore("notes", element.getNotesElement(), false);
16109        composeStringExtras("notes", element.getNotesElement(), false);
16110      }
16111  }
16112
16113  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
16114    if (element != null) {
16115      open(name);
16116      composeConditionConditionStageComponentInner(element);
16117      close();
16118    }
16119  }
16120
16121  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
16122      composeBackbone(element);
16123      if (element.hasSummary()) {
16124        composeCodeableConcept("summary", element.getSummary());
16125      }
16126      if (element.hasAssessment()) {
16127        openArray("assessment");
16128        for (Reference e : element.getAssessment()) 
16129          composeReference(null, e);
16130        closeArray();
16131      };
16132  }
16133
16134  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
16135    if (element != null) {
16136      open(name);
16137      composeConditionConditionEvidenceComponentInner(element);
16138      close();
16139    }
16140  }
16141
16142  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
16143      composeBackbone(element);
16144      if (element.hasCode()) {
16145        composeCodeableConcept("code", element.getCode());
16146      }
16147      if (element.hasDetail()) {
16148        openArray("detail");
16149        for (Reference e : element.getDetail()) 
16150          composeReference(null, e);
16151        closeArray();
16152      };
16153  }
16154
16155  protected void composeConformance(String name, Conformance element) throws IOException {
16156    if (element != null) {
16157      prop("resourceType", name);
16158      composeConformanceInner(element);
16159    }
16160  }
16161
16162  protected void composeConformanceInner(Conformance element) throws IOException {
16163      composeDomainResourceElements(element);
16164      if (element.hasUrlElement()) {
16165        composeUriCore("url", element.getUrlElement(), false);
16166        composeUriExtras("url", element.getUrlElement(), false);
16167      }
16168      if (element.hasVersionElement()) {
16169        composeStringCore("version", element.getVersionElement(), false);
16170        composeStringExtras("version", element.getVersionElement(), false);
16171      }
16172      if (element.hasNameElement()) {
16173        composeStringCore("name", element.getNameElement(), false);
16174        composeStringExtras("name", element.getNameElement(), false);
16175      }
16176      if (element.hasStatusElement()) {
16177        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16178        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16179      }
16180      if (element.hasExperimentalElement()) {
16181        composeBooleanCore("experimental", element.getExperimentalElement(), false);
16182        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
16183      }
16184      if (element.hasPublisherElement()) {
16185        composeStringCore("publisher", element.getPublisherElement(), false);
16186        composeStringExtras("publisher", element.getPublisherElement(), false);
16187      }
16188      if (element.hasContact()) {
16189        openArray("contact");
16190        for (Conformance.ConformanceContactComponent e : element.getContact()) 
16191          composeConformanceConformanceContactComponent(null, e);
16192        closeArray();
16193      };
16194      if (element.hasDateElement()) {
16195        composeDateTimeCore("date", element.getDateElement(), false);
16196        composeDateTimeExtras("date", element.getDateElement(), false);
16197      }
16198      if (element.hasDescriptionElement()) {
16199        composeStringCore("description", element.getDescriptionElement(), false);
16200        composeStringExtras("description", element.getDescriptionElement(), false);
16201      }
16202      if (element.hasRequirementsElement()) {
16203        composeStringCore("requirements", element.getRequirementsElement(), false);
16204        composeStringExtras("requirements", element.getRequirementsElement(), false);
16205      }
16206      if (element.hasCopyrightElement()) {
16207        composeStringCore("copyright", element.getCopyrightElement(), false);
16208        composeStringExtras("copyright", element.getCopyrightElement(), false);
16209      }
16210      if (element.hasKindElement()) {
16211        composeEnumerationCore("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16212        composeEnumerationExtras("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16213      }
16214      if (element.hasSoftware()) {
16215        composeConformanceConformanceSoftwareComponent("software", element.getSoftware());
16216      }
16217      if (element.hasImplementation()) {
16218        composeConformanceConformanceImplementationComponent("implementation", element.getImplementation());
16219      }
16220      if (element.hasFhirVersionElement()) {
16221        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
16222        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
16223      }
16224      if (element.hasAcceptUnknownElement()) {
16225        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16226        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16227      }
16228      if (element.hasFormat()) {
16229        openArray("format");
16230        for (CodeType e : element.getFormat()) 
16231          composeCodeCore(null, e, true);
16232        closeArray();
16233        if (anyHasExtras(element.getFormat())) {
16234          openArray("_format");
16235          for (CodeType e : element.getFormat()) 
16236            composeCodeExtras(null, e, true);
16237          closeArray();
16238        }
16239      };
16240      if (element.hasProfile()) {
16241        openArray("profile");
16242        for (Reference e : element.getProfile()) 
16243          composeReference(null, e);
16244        closeArray();
16245      };
16246      if (element.hasRest()) {
16247        openArray("rest");
16248        for (Conformance.ConformanceRestComponent e : element.getRest()) 
16249          composeConformanceConformanceRestComponent(null, e);
16250        closeArray();
16251      };
16252      if (element.hasMessaging()) {
16253        openArray("messaging");
16254        for (Conformance.ConformanceMessagingComponent e : element.getMessaging()) 
16255          composeConformanceConformanceMessagingComponent(null, e);
16256        closeArray();
16257      };
16258      if (element.hasDocument()) {
16259        openArray("document");
16260        for (Conformance.ConformanceDocumentComponent e : element.getDocument()) 
16261          composeConformanceConformanceDocumentComponent(null, e);
16262        closeArray();
16263      };
16264  }
16265
16266  protected void composeConformanceConformanceContactComponent(String name, Conformance.ConformanceContactComponent element) throws IOException {
16267    if (element != null) {
16268      open(name);
16269      composeConformanceConformanceContactComponentInner(element);
16270      close();
16271    }
16272  }
16273
16274  protected void composeConformanceConformanceContactComponentInner(Conformance.ConformanceContactComponent element) throws IOException {
16275      composeBackbone(element);
16276      if (element.hasNameElement()) {
16277        composeStringCore("name", element.getNameElement(), false);
16278        composeStringExtras("name", element.getNameElement(), false);
16279      }
16280      if (element.hasTelecom()) {
16281        openArray("telecom");
16282        for (ContactPoint e : element.getTelecom()) 
16283          composeContactPoint(null, e);
16284        closeArray();
16285      };
16286  }
16287
16288  protected void composeConformanceConformanceSoftwareComponent(String name, Conformance.ConformanceSoftwareComponent element) throws IOException {
16289    if (element != null) {
16290      open(name);
16291      composeConformanceConformanceSoftwareComponentInner(element);
16292      close();
16293    }
16294  }
16295
16296  protected void composeConformanceConformanceSoftwareComponentInner(Conformance.ConformanceSoftwareComponent element) throws IOException {
16297      composeBackbone(element);
16298      if (element.hasNameElement()) {
16299        composeStringCore("name", element.getNameElement(), false);
16300        composeStringExtras("name", element.getNameElement(), false);
16301      }
16302      if (element.hasVersionElement()) {
16303        composeStringCore("version", element.getVersionElement(), false);
16304        composeStringExtras("version", element.getVersionElement(), false);
16305      }
16306      if (element.hasReleaseDateElement()) {
16307        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
16308        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
16309      }
16310  }
16311
16312  protected void composeConformanceConformanceImplementationComponent(String name, Conformance.ConformanceImplementationComponent element) throws IOException {
16313    if (element != null) {
16314      open(name);
16315      composeConformanceConformanceImplementationComponentInner(element);
16316      close();
16317    }
16318  }
16319
16320  protected void composeConformanceConformanceImplementationComponentInner(Conformance.ConformanceImplementationComponent element) throws IOException {
16321      composeBackbone(element);
16322      if (element.hasDescriptionElement()) {
16323        composeStringCore("description", element.getDescriptionElement(), false);
16324        composeStringExtras("description", element.getDescriptionElement(), false);
16325      }
16326      if (element.hasUrlElement()) {
16327        composeUriCore("url", element.getUrlElement(), false);
16328        composeUriExtras("url", element.getUrlElement(), false);
16329      }
16330  }
16331
16332  protected void composeConformanceConformanceRestComponent(String name, Conformance.ConformanceRestComponent element) throws IOException {
16333    if (element != null) {
16334      open(name);
16335      composeConformanceConformanceRestComponentInner(element);
16336      close();
16337    }
16338  }
16339
16340  protected void composeConformanceConformanceRestComponentInner(Conformance.ConformanceRestComponent element) throws IOException {
16341      composeBackbone(element);
16342      if (element.hasModeElement()) {
16343        composeEnumerationCore("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16344        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16345      }
16346      if (element.hasDocumentationElement()) {
16347        composeStringCore("documentation", element.getDocumentationElement(), false);
16348        composeStringExtras("documentation", element.getDocumentationElement(), false);
16349      }
16350      if (element.hasSecurity()) {
16351        composeConformanceConformanceRestSecurityComponent("security", element.getSecurity());
16352      }
16353      if (element.hasResource()) {
16354        openArray("resource");
16355        for (Conformance.ConformanceRestResourceComponent e : element.getResource()) 
16356          composeConformanceConformanceRestResourceComponent(null, e);
16357        closeArray();
16358      };
16359      if (element.hasInteraction()) {
16360        openArray("interaction");
16361        for (Conformance.SystemInteractionComponent e : element.getInteraction()) 
16362          composeConformanceSystemInteractionComponent(null, e);
16363        closeArray();
16364      };
16365      if (element.hasTransactionModeElement()) {
16366        composeEnumerationCore("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16367        composeEnumerationExtras("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16368      }
16369      if (element.hasSearchParam()) {
16370        openArray("searchParam");
16371        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16372          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16373        closeArray();
16374      };
16375      if (element.hasOperation()) {
16376        openArray("operation");
16377        for (Conformance.ConformanceRestOperationComponent e : element.getOperation()) 
16378          composeConformanceConformanceRestOperationComponent(null, e);
16379        closeArray();
16380      };
16381      if (element.hasCompartment()) {
16382        openArray("compartment");
16383        for (UriType e : element.getCompartment()) 
16384          composeUriCore(null, e, true);
16385        closeArray();
16386        if (anyHasExtras(element.getCompartment())) {
16387          openArray("_compartment");
16388          for (UriType e : element.getCompartment()) 
16389            composeUriExtras(null, e, true);
16390          closeArray();
16391        }
16392      };
16393  }
16394
16395  protected void composeConformanceConformanceRestSecurityComponent(String name, Conformance.ConformanceRestSecurityComponent element) throws IOException {
16396    if (element != null) {
16397      open(name);
16398      composeConformanceConformanceRestSecurityComponentInner(element);
16399      close();
16400    }
16401  }
16402
16403  protected void composeConformanceConformanceRestSecurityComponentInner(Conformance.ConformanceRestSecurityComponent element) throws IOException {
16404      composeBackbone(element);
16405      if (element.hasCorsElement()) {
16406        composeBooleanCore("cors", element.getCorsElement(), false);
16407        composeBooleanExtras("cors", element.getCorsElement(), false);
16408      }
16409      if (element.hasService()) {
16410        openArray("service");
16411        for (CodeableConcept e : element.getService()) 
16412          composeCodeableConcept(null, e);
16413        closeArray();
16414      };
16415      if (element.hasDescriptionElement()) {
16416        composeStringCore("description", element.getDescriptionElement(), false);
16417        composeStringExtras("description", element.getDescriptionElement(), false);
16418      }
16419      if (element.hasCertificate()) {
16420        openArray("certificate");
16421        for (Conformance.ConformanceRestSecurityCertificateComponent e : element.getCertificate()) 
16422          composeConformanceConformanceRestSecurityCertificateComponent(null, e);
16423        closeArray();
16424      };
16425  }
16426
16427  protected void composeConformanceConformanceRestSecurityCertificateComponent(String name, Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16428    if (element != null) {
16429      open(name);
16430      composeConformanceConformanceRestSecurityCertificateComponentInner(element);
16431      close();
16432    }
16433  }
16434
16435  protected void composeConformanceConformanceRestSecurityCertificateComponentInner(Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16436      composeBackbone(element);
16437      if (element.hasTypeElement()) {
16438        composeCodeCore("type", element.getTypeElement(), false);
16439        composeCodeExtras("type", element.getTypeElement(), false);
16440      }
16441      if (element.hasBlobElement()) {
16442        composeBase64BinaryCore("blob", element.getBlobElement(), false);
16443        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
16444      }
16445  }
16446
16447  protected void composeConformanceConformanceRestResourceComponent(String name, Conformance.ConformanceRestResourceComponent element) throws IOException {
16448    if (element != null) {
16449      open(name);
16450      composeConformanceConformanceRestResourceComponentInner(element);
16451      close();
16452    }
16453  }
16454
16455  protected void composeConformanceConformanceRestResourceComponentInner(Conformance.ConformanceRestResourceComponent element) throws IOException {
16456      composeBackbone(element);
16457      if (element.hasTypeElement()) {
16458        composeCodeCore("type", element.getTypeElement(), false);
16459        composeCodeExtras("type", element.getTypeElement(), false);
16460      }
16461      if (element.hasProfile()) {
16462        composeReference("profile", element.getProfile());
16463      }
16464      if (element.hasInteraction()) {
16465        openArray("interaction");
16466        for (Conformance.ResourceInteractionComponent e : element.getInteraction()) 
16467          composeConformanceResourceInteractionComponent(null, e);
16468        closeArray();
16469      };
16470      if (element.hasVersioningElement()) {
16471        composeEnumerationCore("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16472        composeEnumerationExtras("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16473      }
16474      if (element.hasReadHistoryElement()) {
16475        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
16476        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
16477      }
16478      if (element.hasUpdateCreateElement()) {
16479        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
16480        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
16481      }
16482      if (element.hasConditionalCreateElement()) {
16483        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
16484        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
16485      }
16486      if (element.hasConditionalUpdateElement()) {
16487        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
16488        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
16489      }
16490      if (element.hasConditionalDeleteElement()) {
16491        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16492        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16493      }
16494      if (element.hasSearchInclude()) {
16495        openArray("searchInclude");
16496        for (StringType e : element.getSearchInclude()) 
16497          composeStringCore(null, e, true);
16498        closeArray();
16499        if (anyHasExtras(element.getSearchInclude())) {
16500          openArray("_searchInclude");
16501          for (StringType e : element.getSearchInclude()) 
16502            composeStringExtras(null, e, true);
16503          closeArray();
16504        }
16505      };
16506      if (element.hasSearchRevInclude()) {
16507        openArray("searchRevInclude");
16508        for (StringType e : element.getSearchRevInclude()) 
16509          composeStringCore(null, e, true);
16510        closeArray();
16511        if (anyHasExtras(element.getSearchRevInclude())) {
16512          openArray("_searchRevInclude");
16513          for (StringType e : element.getSearchRevInclude()) 
16514            composeStringExtras(null, e, true);
16515          closeArray();
16516        }
16517      };
16518      if (element.hasSearchParam()) {
16519        openArray("searchParam");
16520        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16521          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16522        closeArray();
16523      };
16524  }
16525
16526  protected void composeConformanceResourceInteractionComponent(String name, Conformance.ResourceInteractionComponent element) throws IOException {
16527    if (element != null) {
16528      open(name);
16529      composeConformanceResourceInteractionComponentInner(element);
16530      close();
16531    }
16532  }
16533
16534  protected void composeConformanceResourceInteractionComponentInner(Conformance.ResourceInteractionComponent element) throws IOException {
16535      composeBackbone(element);
16536      if (element.hasCodeElement()) {
16537        composeEnumerationCore("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16538        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16539      }
16540      if (element.hasDocumentationElement()) {
16541        composeStringCore("documentation", element.getDocumentationElement(), false);
16542        composeStringExtras("documentation", element.getDocumentationElement(), false);
16543      }
16544  }
16545
16546  protected void composeConformanceConformanceRestResourceSearchParamComponent(String name, Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16547    if (element != null) {
16548      open(name);
16549      composeConformanceConformanceRestResourceSearchParamComponentInner(element);
16550      close();
16551    }
16552  }
16553
16554  protected void composeConformanceConformanceRestResourceSearchParamComponentInner(Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16555      composeBackbone(element);
16556      if (element.hasNameElement()) {
16557        composeStringCore("name", element.getNameElement(), false);
16558        composeStringExtras("name", element.getNameElement(), false);
16559      }
16560      if (element.hasDefinitionElement()) {
16561        composeUriCore("definition", element.getDefinitionElement(), false);
16562        composeUriExtras("definition", element.getDefinitionElement(), false);
16563      }
16564      if (element.hasTypeElement()) {
16565        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16566        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16567      }
16568      if (element.hasDocumentationElement()) {
16569        composeStringCore("documentation", element.getDocumentationElement(), false);
16570        composeStringExtras("documentation", element.getDocumentationElement(), false);
16571      }
16572      if (element.hasTarget()) {
16573        openArray("target");
16574        for (CodeType e : element.getTarget()) 
16575          composeCodeCore(null, e, true);
16576        closeArray();
16577        if (anyHasExtras(element.getTarget())) {
16578          openArray("_target");
16579          for (CodeType e : element.getTarget()) 
16580            composeCodeExtras(null, e, true);
16581          closeArray();
16582        }
16583      };
16584      if (element.hasModifier()) {
16585        openArray("modifier");
16586        for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16587          composeEnumerationCore(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16588        closeArray();
16589        if (anyHasExtras(element.getModifier())) {
16590          openArray("_modifier");
16591          for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16592            composeEnumerationExtras(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16593          closeArray();
16594        }
16595      };
16596      if (element.hasChain()) {
16597        openArray("chain");
16598        for (StringType e : element.getChain()) 
16599          composeStringCore(null, e, true);
16600        closeArray();
16601        if (anyHasExtras(element.getChain())) {
16602          openArray("_chain");
16603          for (StringType e : element.getChain()) 
16604            composeStringExtras(null, e, true);
16605          closeArray();
16606        }
16607      };
16608  }
16609
16610  protected void composeConformanceSystemInteractionComponent(String name, Conformance.SystemInteractionComponent element) throws IOException {
16611    if (element != null) {
16612      open(name);
16613      composeConformanceSystemInteractionComponentInner(element);
16614      close();
16615    }
16616  }
16617
16618  protected void composeConformanceSystemInteractionComponentInner(Conformance.SystemInteractionComponent element) throws IOException {
16619      composeBackbone(element);
16620      if (element.hasCodeElement()) {
16621        composeEnumerationCore("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16622        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16623      }
16624      if (element.hasDocumentationElement()) {
16625        composeStringCore("documentation", element.getDocumentationElement(), false);
16626        composeStringExtras("documentation", element.getDocumentationElement(), false);
16627      }
16628  }
16629
16630  protected void composeConformanceConformanceRestOperationComponent(String name, Conformance.ConformanceRestOperationComponent element) throws IOException {
16631    if (element != null) {
16632      open(name);
16633      composeConformanceConformanceRestOperationComponentInner(element);
16634      close();
16635    }
16636  }
16637
16638  protected void composeConformanceConformanceRestOperationComponentInner(Conformance.ConformanceRestOperationComponent element) throws IOException {
16639      composeBackbone(element);
16640      if (element.hasNameElement()) {
16641        composeStringCore("name", element.getNameElement(), false);
16642        composeStringExtras("name", element.getNameElement(), false);
16643      }
16644      if (element.hasDefinition()) {
16645        composeReference("definition", element.getDefinition());
16646      }
16647  }
16648
16649  protected void composeConformanceConformanceMessagingComponent(String name, Conformance.ConformanceMessagingComponent element) throws IOException {
16650    if (element != null) {
16651      open(name);
16652      composeConformanceConformanceMessagingComponentInner(element);
16653      close();
16654    }
16655  }
16656
16657  protected void composeConformanceConformanceMessagingComponentInner(Conformance.ConformanceMessagingComponent element) throws IOException {
16658      composeBackbone(element);
16659      if (element.hasEndpoint()) {
16660        openArray("endpoint");
16661        for (Conformance.ConformanceMessagingEndpointComponent e : element.getEndpoint()) 
16662          composeConformanceConformanceMessagingEndpointComponent(null, e);
16663        closeArray();
16664      };
16665      if (element.hasReliableCacheElement()) {
16666        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
16667        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
16668      }
16669      if (element.hasDocumentationElement()) {
16670        composeStringCore("documentation", element.getDocumentationElement(), false);
16671        composeStringExtras("documentation", element.getDocumentationElement(), false);
16672      }
16673      if (element.hasEvent()) {
16674        openArray("event");
16675        for (Conformance.ConformanceMessagingEventComponent e : element.getEvent()) 
16676          composeConformanceConformanceMessagingEventComponent(null, e);
16677        closeArray();
16678      };
16679  }
16680
16681  protected void composeConformanceConformanceMessagingEndpointComponent(String name, Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16682    if (element != null) {
16683      open(name);
16684      composeConformanceConformanceMessagingEndpointComponentInner(element);
16685      close();
16686    }
16687  }
16688
16689  protected void composeConformanceConformanceMessagingEndpointComponentInner(Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16690      composeBackbone(element);
16691      if (element.hasProtocol()) {
16692        composeCoding("protocol", element.getProtocol());
16693      }
16694      if (element.hasAddressElement()) {
16695        composeUriCore("address", element.getAddressElement(), false);
16696        composeUriExtras("address", element.getAddressElement(), false);
16697      }
16698  }
16699
16700  protected void composeConformanceConformanceMessagingEventComponent(String name, Conformance.ConformanceMessagingEventComponent element) throws IOException {
16701    if (element != null) {
16702      open(name);
16703      composeConformanceConformanceMessagingEventComponentInner(element);
16704      close();
16705    }
16706  }
16707
16708  protected void composeConformanceConformanceMessagingEventComponentInner(Conformance.ConformanceMessagingEventComponent element) throws IOException {
16709      composeBackbone(element);
16710      if (element.hasCode()) {
16711        composeCoding("code", element.getCode());
16712      }
16713      if (element.hasCategoryElement()) {
16714        composeEnumerationCore("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16715        composeEnumerationExtras("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16716      }
16717      if (element.hasModeElement()) {
16718        composeEnumerationCore("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16719        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16720      }
16721      if (element.hasFocusElement()) {
16722        composeCodeCore("focus", element.getFocusElement(), false);
16723        composeCodeExtras("focus", element.getFocusElement(), false);
16724      }
16725      if (element.hasRequest()) {
16726        composeReference("request", element.getRequest());
16727      }
16728      if (element.hasResponse()) {
16729        composeReference("response", element.getResponse());
16730      }
16731      if (element.hasDocumentationElement()) {
16732        composeStringCore("documentation", element.getDocumentationElement(), false);
16733        composeStringExtras("documentation", element.getDocumentationElement(), false);
16734      }
16735  }
16736
16737  protected void composeConformanceConformanceDocumentComponent(String name, Conformance.ConformanceDocumentComponent element) throws IOException {
16738    if (element != null) {
16739      open(name);
16740      composeConformanceConformanceDocumentComponentInner(element);
16741      close();
16742    }
16743  }
16744
16745  protected void composeConformanceConformanceDocumentComponentInner(Conformance.ConformanceDocumentComponent element) throws IOException {
16746      composeBackbone(element);
16747      if (element.hasModeElement()) {
16748        composeEnumerationCore("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16749        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16750      }
16751      if (element.hasDocumentationElement()) {
16752        composeStringCore("documentation", element.getDocumentationElement(), false);
16753        composeStringExtras("documentation", element.getDocumentationElement(), false);
16754      }
16755      if (element.hasProfile()) {
16756        composeReference("profile", element.getProfile());
16757      }
16758  }
16759
16760  protected void composeContract(String name, Contract element) throws IOException {
16761    if (element != null) {
16762      prop("resourceType", name);
16763      composeContractInner(element);
16764    }
16765  }
16766
16767  protected void composeContractInner(Contract element) throws IOException {
16768      composeDomainResourceElements(element);
16769      if (element.hasIdentifier()) {
16770        composeIdentifier("identifier", element.getIdentifier());
16771      }
16772      if (element.hasIssuedElement()) {
16773        composeDateTimeCore("issued", element.getIssuedElement(), false);
16774        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16775      }
16776      if (element.hasApplies()) {
16777        composePeriod("applies", element.getApplies());
16778      }
16779      if (element.hasSubject()) {
16780        openArray("subject");
16781        for (Reference e : element.getSubject()) 
16782          composeReference(null, e);
16783        closeArray();
16784      };
16785      if (element.hasAuthority()) {
16786        openArray("authority");
16787        for (Reference e : element.getAuthority()) 
16788          composeReference(null, e);
16789        closeArray();
16790      };
16791      if (element.hasDomain()) {
16792        openArray("domain");
16793        for (Reference e : element.getDomain()) 
16794          composeReference(null, e);
16795        closeArray();
16796      };
16797      if (element.hasType()) {
16798        composeCodeableConcept("type", element.getType());
16799      }
16800      if (element.hasSubType()) {
16801        openArray("subType");
16802        for (CodeableConcept e : element.getSubType()) 
16803          composeCodeableConcept(null, e);
16804        closeArray();
16805      };
16806      if (element.hasAction()) {
16807        openArray("action");
16808        for (CodeableConcept e : element.getAction()) 
16809          composeCodeableConcept(null, e);
16810        closeArray();
16811      };
16812      if (element.hasActionReason()) {
16813        openArray("actionReason");
16814        for (CodeableConcept e : element.getActionReason()) 
16815          composeCodeableConcept(null, e);
16816        closeArray();
16817      };
16818      if (element.hasActor()) {
16819        openArray("actor");
16820        for (Contract.ActorComponent e : element.getActor()) 
16821          composeContractActorComponent(null, e);
16822        closeArray();
16823      };
16824      if (element.hasValuedItem()) {
16825        openArray("valuedItem");
16826        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
16827          composeContractValuedItemComponent(null, e);
16828        closeArray();
16829      };
16830      if (element.hasSigner()) {
16831        openArray("signer");
16832        for (Contract.SignatoryComponent e : element.getSigner()) 
16833          composeContractSignatoryComponent(null, e);
16834        closeArray();
16835      };
16836      if (element.hasTerm()) {
16837        openArray("term");
16838        for (Contract.TermComponent e : element.getTerm()) 
16839          composeContractTermComponent(null, e);
16840        closeArray();
16841      };
16842      if (element.hasBinding()) {
16843        composeType("binding", element.getBinding());
16844      }
16845      if (element.hasFriendly()) {
16846        openArray("friendly");
16847        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
16848          composeContractFriendlyLanguageComponent(null, e);
16849        closeArray();
16850      };
16851      if (element.hasLegal()) {
16852        openArray("legal");
16853        for (Contract.LegalLanguageComponent e : element.getLegal()) 
16854          composeContractLegalLanguageComponent(null, e);
16855        closeArray();
16856      };
16857      if (element.hasRule()) {
16858        openArray("rule");
16859        for (Contract.ComputableLanguageComponent e : element.getRule()) 
16860          composeContractComputableLanguageComponent(null, e);
16861        closeArray();
16862      };
16863  }
16864
16865  protected void composeContractActorComponent(String name, Contract.ActorComponent element) throws IOException {
16866    if (element != null) {
16867      open(name);
16868      composeContractActorComponentInner(element);
16869      close();
16870    }
16871  }
16872
16873  protected void composeContractActorComponentInner(Contract.ActorComponent element) throws IOException {
16874      composeBackbone(element);
16875      if (element.hasEntity()) {
16876        composeReference("entity", element.getEntity());
16877      }
16878      if (element.hasRole()) {
16879        openArray("role");
16880        for (CodeableConcept e : element.getRole()) 
16881          composeCodeableConcept(null, e);
16882        closeArray();
16883      };
16884  }
16885
16886  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
16887    if (element != null) {
16888      open(name);
16889      composeContractValuedItemComponentInner(element);
16890      close();
16891    }
16892  }
16893
16894  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
16895      composeBackbone(element);
16896      if (element.hasEntity()) {
16897        composeType("entity", element.getEntity());
16898      }
16899      if (element.hasIdentifier()) {
16900        composeIdentifier("identifier", element.getIdentifier());
16901      }
16902      if (element.hasEffectiveTimeElement()) {
16903        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
16904        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
16905      }
16906      if (element.hasQuantity()) {
16907        composeSimpleQuantity("quantity", element.getQuantity());
16908      }
16909      if (element.hasUnitPrice()) {
16910        composeMoney("unitPrice", element.getUnitPrice());
16911      }
16912      if (element.hasFactorElement()) {
16913        composeDecimalCore("factor", element.getFactorElement(), false);
16914        composeDecimalExtras("factor", element.getFactorElement(), false);
16915      }
16916      if (element.hasPointsElement()) {
16917        composeDecimalCore("points", element.getPointsElement(), false);
16918        composeDecimalExtras("points", element.getPointsElement(), false);
16919      }
16920      if (element.hasNet()) {
16921        composeMoney("net", element.getNet());
16922      }
16923  }
16924
16925  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
16926    if (element != null) {
16927      open(name);
16928      composeContractSignatoryComponentInner(element);
16929      close();
16930    }
16931  }
16932
16933  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
16934      composeBackbone(element);
16935      if (element.hasType()) {
16936        composeCoding("type", element.getType());
16937      }
16938      if (element.hasParty()) {
16939        composeReference("party", element.getParty());
16940      }
16941      if (element.hasSignatureElement()) {
16942        composeStringCore("signature", element.getSignatureElement(), false);
16943        composeStringExtras("signature", element.getSignatureElement(), false);
16944      }
16945  }
16946
16947  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
16948    if (element != null) {
16949      open(name);
16950      composeContractTermComponentInner(element);
16951      close();
16952    }
16953  }
16954
16955  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
16956      composeBackbone(element);
16957      if (element.hasIdentifier()) {
16958        composeIdentifier("identifier", element.getIdentifier());
16959      }
16960      if (element.hasIssuedElement()) {
16961        composeDateTimeCore("issued", element.getIssuedElement(), false);
16962        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16963      }
16964      if (element.hasApplies()) {
16965        composePeriod("applies", element.getApplies());
16966      }
16967      if (element.hasType()) {
16968        composeCodeableConcept("type", element.getType());
16969      }
16970      if (element.hasSubType()) {
16971        composeCodeableConcept("subType", element.getSubType());
16972      }
16973      if (element.hasSubject()) {
16974        composeReference("subject", element.getSubject());
16975      }
16976      if (element.hasAction()) {
16977        openArray("action");
16978        for (CodeableConcept e : element.getAction()) 
16979          composeCodeableConcept(null, e);
16980        closeArray();
16981      };
16982      if (element.hasActionReason()) {
16983        openArray("actionReason");
16984        for (CodeableConcept e : element.getActionReason()) 
16985          composeCodeableConcept(null, e);
16986        closeArray();
16987      };
16988      if (element.hasActor()) {
16989        openArray("actor");
16990        for (Contract.TermActorComponent e : element.getActor()) 
16991          composeContractTermActorComponent(null, e);
16992        closeArray();
16993      };
16994      if (element.hasTextElement()) {
16995        composeStringCore("text", element.getTextElement(), false);
16996        composeStringExtras("text", element.getTextElement(), false);
16997      }
16998      if (element.hasValuedItem()) {
16999        openArray("valuedItem");
17000        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
17001          composeContractTermValuedItemComponent(null, e);
17002        closeArray();
17003      };
17004      if (element.hasGroup()) {
17005        openArray("group");
17006        for (Contract.TermComponent e : element.getGroup()) 
17007          composeContractTermComponent(null, e);
17008        closeArray();
17009      };
17010  }
17011
17012  protected void composeContractTermActorComponent(String name, Contract.TermActorComponent element) throws IOException {
17013    if (element != null) {
17014      open(name);
17015      composeContractTermActorComponentInner(element);
17016      close();
17017    }
17018  }
17019
17020  protected void composeContractTermActorComponentInner(Contract.TermActorComponent element) throws IOException {
17021      composeBackbone(element);
17022      if (element.hasEntity()) {
17023        composeReference("entity", element.getEntity());
17024      }
17025      if (element.hasRole()) {
17026        openArray("role");
17027        for (CodeableConcept e : element.getRole()) 
17028          composeCodeableConcept(null, e);
17029        closeArray();
17030      };
17031  }
17032
17033  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
17034    if (element != null) {
17035      open(name);
17036      composeContractTermValuedItemComponentInner(element);
17037      close();
17038    }
17039  }
17040
17041  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
17042      composeBackbone(element);
17043      if (element.hasEntity()) {
17044        composeType("entity", element.getEntity());
17045      }
17046      if (element.hasIdentifier()) {
17047        composeIdentifier("identifier", element.getIdentifier());
17048      }
17049      if (element.hasEffectiveTimeElement()) {
17050        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
17051        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
17052      }
17053      if (element.hasQuantity()) {
17054        composeSimpleQuantity("quantity", element.getQuantity());
17055      }
17056      if (element.hasUnitPrice()) {
17057        composeMoney("unitPrice", element.getUnitPrice());
17058      }
17059      if (element.hasFactorElement()) {
17060        composeDecimalCore("factor", element.getFactorElement(), false);
17061        composeDecimalExtras("factor", element.getFactorElement(), false);
17062      }
17063      if (element.hasPointsElement()) {
17064        composeDecimalCore("points", element.getPointsElement(), false);
17065        composeDecimalExtras("points", element.getPointsElement(), false);
17066      }
17067      if (element.hasNet()) {
17068        composeMoney("net", element.getNet());
17069      }
17070  }
17071
17072  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
17073    if (element != null) {
17074      open(name);
17075      composeContractFriendlyLanguageComponentInner(element);
17076      close();
17077    }
17078  }
17079
17080  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
17081      composeBackbone(element);
17082      if (element.hasContent()) {
17083        composeType("content", element.getContent());
17084      }
17085  }
17086
17087  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
17088    if (element != null) {
17089      open(name);
17090      composeContractLegalLanguageComponentInner(element);
17091      close();
17092    }
17093  }
17094
17095  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
17096      composeBackbone(element);
17097      if (element.hasContent()) {
17098        composeType("content", element.getContent());
17099      }
17100  }
17101
17102  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
17103    if (element != null) {
17104      open(name);
17105      composeContractComputableLanguageComponentInner(element);
17106      close();
17107    }
17108  }
17109
17110  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
17111      composeBackbone(element);
17112      if (element.hasContent()) {
17113        composeType("content", element.getContent());
17114      }
17115  }
17116
17117  protected void composeCoverage(String name, Coverage element) throws IOException {
17118    if (element != null) {
17119      prop("resourceType", name);
17120      composeCoverageInner(element);
17121    }
17122  }
17123
17124  protected void composeCoverageInner(Coverage element) throws IOException {
17125      composeDomainResourceElements(element);
17126      if (element.hasIssuer()) {
17127        composeReference("issuer", element.getIssuer());
17128      }
17129      if (element.hasBin()) {
17130        composeIdentifier("bin", element.getBin());
17131      }
17132      if (element.hasPeriod()) {
17133        composePeriod("period", element.getPeriod());
17134      }
17135      if (element.hasType()) {
17136        composeCoding("type", element.getType());
17137      }
17138      if (element.hasSubscriberId()) {
17139        composeIdentifier("subscriberId", element.getSubscriberId());
17140      }
17141      if (element.hasIdentifier()) {
17142        openArray("identifier");
17143        for (Identifier e : element.getIdentifier()) 
17144          composeIdentifier(null, e);
17145        closeArray();
17146      };
17147      if (element.hasGroupElement()) {
17148        composeStringCore("group", element.getGroupElement(), false);
17149        composeStringExtras("group", element.getGroupElement(), false);
17150      }
17151      if (element.hasPlanElement()) {
17152        composeStringCore("plan", element.getPlanElement(), false);
17153        composeStringExtras("plan", element.getPlanElement(), false);
17154      }
17155      if (element.hasSubPlanElement()) {
17156        composeStringCore("subPlan", element.getSubPlanElement(), false);
17157        composeStringExtras("subPlan", element.getSubPlanElement(), false);
17158      }
17159      if (element.hasDependentElement()) {
17160        composePositiveIntCore("dependent", element.getDependentElement(), false);
17161        composePositiveIntExtras("dependent", element.getDependentElement(), false);
17162      }
17163      if (element.hasSequenceElement()) {
17164        composePositiveIntCore("sequence", element.getSequenceElement(), false);
17165        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
17166      }
17167      if (element.hasSubscriber()) {
17168        composeReference("subscriber", element.getSubscriber());
17169      }
17170      if (element.hasNetwork()) {
17171        composeIdentifier("network", element.getNetwork());
17172      }
17173      if (element.hasContract()) {
17174        openArray("contract");
17175        for (Reference e : element.getContract()) 
17176          composeReference(null, e);
17177        closeArray();
17178      };
17179  }
17180
17181  protected void composeDataElement(String name, DataElement element) throws IOException {
17182    if (element != null) {
17183      prop("resourceType", name);
17184      composeDataElementInner(element);
17185    }
17186  }
17187
17188  protected void composeDataElementInner(DataElement element) throws IOException {
17189      composeDomainResourceElements(element);
17190      if (element.hasUrlElement()) {
17191        composeUriCore("url", element.getUrlElement(), false);
17192        composeUriExtras("url", element.getUrlElement(), false);
17193      }
17194      if (element.hasIdentifier()) {
17195        openArray("identifier");
17196        for (Identifier e : element.getIdentifier()) 
17197          composeIdentifier(null, e);
17198        closeArray();
17199      };
17200      if (element.hasVersionElement()) {
17201        composeStringCore("version", element.getVersionElement(), false);
17202        composeStringExtras("version", element.getVersionElement(), false);
17203      }
17204      if (element.hasNameElement()) {
17205        composeStringCore("name", element.getNameElement(), false);
17206        composeStringExtras("name", element.getNameElement(), false);
17207      }
17208      if (element.hasStatusElement()) {
17209        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17210        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17211      }
17212      if (element.hasExperimentalElement()) {
17213        composeBooleanCore("experimental", element.getExperimentalElement(), false);
17214        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
17215      }
17216      if (element.hasPublisherElement()) {
17217        composeStringCore("publisher", element.getPublisherElement(), false);
17218        composeStringExtras("publisher", element.getPublisherElement(), false);
17219      }
17220      if (element.hasContact()) {
17221        openArray("contact");
17222        for (DataElement.DataElementContactComponent e : element.getContact()) 
17223          composeDataElementDataElementContactComponent(null, e);
17224        closeArray();
17225      };
17226      if (element.hasDateElement()) {
17227        composeDateTimeCore("date", element.getDateElement(), false);
17228        composeDateTimeExtras("date", element.getDateElement(), false);
17229      }
17230      if (element.hasUseContext()) {
17231        openArray("useContext");
17232        for (CodeableConcept e : element.getUseContext()) 
17233          composeCodeableConcept(null, e);
17234        closeArray();
17235      };
17236      if (element.hasCopyrightElement()) {
17237        composeStringCore("copyright", element.getCopyrightElement(), false);
17238        composeStringExtras("copyright", element.getCopyrightElement(), false);
17239      }
17240      if (element.hasStringencyElement()) {
17241        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17242        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17243      }
17244      if (element.hasMapping()) {
17245        openArray("mapping");
17246        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
17247          composeDataElementDataElementMappingComponent(null, e);
17248        closeArray();
17249      };
17250      if (element.hasElement()) {
17251        openArray("element");
17252        for (ElementDefinition e : element.getElement()) 
17253          composeElementDefinition(null, e);
17254        closeArray();
17255      };
17256  }
17257
17258  protected void composeDataElementDataElementContactComponent(String name, DataElement.DataElementContactComponent element) throws IOException {
17259    if (element != null) {
17260      open(name);
17261      composeDataElementDataElementContactComponentInner(element);
17262      close();
17263    }
17264  }
17265
17266  protected void composeDataElementDataElementContactComponentInner(DataElement.DataElementContactComponent element) throws IOException {
17267      composeBackbone(element);
17268      if (element.hasNameElement()) {
17269        composeStringCore("name", element.getNameElement(), false);
17270        composeStringExtras("name", element.getNameElement(), false);
17271      }
17272      if (element.hasTelecom()) {
17273        openArray("telecom");
17274        for (ContactPoint e : element.getTelecom()) 
17275          composeContactPoint(null, e);
17276        closeArray();
17277      };
17278  }
17279
17280  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
17281    if (element != null) {
17282      open(name);
17283      composeDataElementDataElementMappingComponentInner(element);
17284      close();
17285    }
17286  }
17287
17288  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
17289      composeBackbone(element);
17290      if (element.hasIdentityElement()) {
17291        composeIdCore("identity", element.getIdentityElement(), false);
17292        composeIdExtras("identity", element.getIdentityElement(), false);
17293      }
17294      if (element.hasUriElement()) {
17295        composeUriCore("uri", element.getUriElement(), false);
17296        composeUriExtras("uri", element.getUriElement(), false);
17297      }
17298      if (element.hasNameElement()) {
17299        composeStringCore("name", element.getNameElement(), false);
17300        composeStringExtras("name", element.getNameElement(), false);
17301      }
17302      if (element.hasCommentsElement()) {
17303        composeStringCore("comments", element.getCommentsElement(), false);
17304        composeStringExtras("comments", element.getCommentsElement(), false);
17305      }
17306  }
17307
17308  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
17309    if (element != null) {
17310      prop("resourceType", name);
17311      composeDetectedIssueInner(element);
17312    }
17313  }
17314
17315  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
17316      composeDomainResourceElements(element);
17317      if (element.hasPatient()) {
17318        composeReference("patient", element.getPatient());
17319      }
17320      if (element.hasCategory()) {
17321        composeCodeableConcept("category", element.getCategory());
17322      }
17323      if (element.hasSeverityElement()) {
17324        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17325        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17326      }
17327      if (element.hasImplicated()) {
17328        openArray("implicated");
17329        for (Reference e : element.getImplicated()) 
17330          composeReference(null, e);
17331        closeArray();
17332      };
17333      if (element.hasDetailElement()) {
17334        composeStringCore("detail", element.getDetailElement(), false);
17335        composeStringExtras("detail", element.getDetailElement(), false);
17336      }
17337      if (element.hasDateElement()) {
17338        composeDateTimeCore("date", element.getDateElement(), false);
17339        composeDateTimeExtras("date", element.getDateElement(), false);
17340      }
17341      if (element.hasAuthor()) {
17342        composeReference("author", element.getAuthor());
17343      }
17344      if (element.hasIdentifier()) {
17345        composeIdentifier("identifier", element.getIdentifier());
17346      }
17347      if (element.hasReferenceElement()) {
17348        composeUriCore("reference", element.getReferenceElement(), false);
17349        composeUriExtras("reference", element.getReferenceElement(), false);
17350      }
17351      if (element.hasMitigation()) {
17352        openArray("mitigation");
17353        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
17354          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
17355        closeArray();
17356      };
17357  }
17358
17359  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17360    if (element != null) {
17361      open(name);
17362      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
17363      close();
17364    }
17365  }
17366
17367  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17368      composeBackbone(element);
17369      if (element.hasAction()) {
17370        composeCodeableConcept("action", element.getAction());
17371      }
17372      if (element.hasDateElement()) {
17373        composeDateTimeCore("date", element.getDateElement(), false);
17374        composeDateTimeExtras("date", element.getDateElement(), false);
17375      }
17376      if (element.hasAuthor()) {
17377        composeReference("author", element.getAuthor());
17378      }
17379  }
17380
17381  protected void composeDevice(String name, Device element) throws IOException {
17382    if (element != null) {
17383      prop("resourceType", name);
17384      composeDeviceInner(element);
17385    }
17386  }
17387
17388  protected void composeDeviceInner(Device element) throws IOException {
17389      composeDomainResourceElements(element);
17390      if (element.hasIdentifier()) {
17391        openArray("identifier");
17392        for (Identifier e : element.getIdentifier()) 
17393          composeIdentifier(null, e);
17394        closeArray();
17395      };
17396      if (element.hasType()) {
17397        composeCodeableConcept("type", element.getType());
17398      }
17399      if (element.hasNote()) {
17400        openArray("note");
17401        for (Annotation e : element.getNote()) 
17402          composeAnnotation(null, e);
17403        closeArray();
17404      };
17405      if (element.hasStatusElement()) {
17406        composeEnumerationCore("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17407        composeEnumerationExtras("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17408      }
17409      if (element.hasManufacturerElement()) {
17410        composeStringCore("manufacturer", element.getManufacturerElement(), false);
17411        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
17412      }
17413      if (element.hasModelElement()) {
17414        composeStringCore("model", element.getModelElement(), false);
17415        composeStringExtras("model", element.getModelElement(), false);
17416      }
17417      if (element.hasVersionElement()) {
17418        composeStringCore("version", element.getVersionElement(), false);
17419        composeStringExtras("version", element.getVersionElement(), false);
17420      }
17421      if (element.hasManufactureDateElement()) {
17422        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
17423        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
17424      }
17425      if (element.hasExpiryElement()) {
17426        composeDateTimeCore("expiry", element.getExpiryElement(), false);
17427        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
17428      }
17429      if (element.hasUdiElement()) {
17430        composeStringCore("udi", element.getUdiElement(), false);
17431        composeStringExtras("udi", element.getUdiElement(), false);
17432      }
17433      if (element.hasLotNumberElement()) {
17434        composeStringCore("lotNumber", element.getLotNumberElement(), false);
17435        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
17436      }
17437      if (element.hasOwner()) {
17438        composeReference("owner", element.getOwner());
17439      }
17440      if (element.hasLocation()) {
17441        composeReference("location", element.getLocation());
17442      }
17443      if (element.hasPatient()) {
17444        composeReference("patient", element.getPatient());
17445      }
17446      if (element.hasContact()) {
17447        openArray("contact");
17448        for (ContactPoint e : element.getContact()) 
17449          composeContactPoint(null, e);
17450        closeArray();
17451      };
17452      if (element.hasUrlElement()) {
17453        composeUriCore("url", element.getUrlElement(), false);
17454        composeUriExtras("url", element.getUrlElement(), false);
17455      }
17456  }
17457
17458  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
17459    if (element != null) {
17460      prop("resourceType", name);
17461      composeDeviceComponentInner(element);
17462    }
17463  }
17464
17465  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
17466      composeDomainResourceElements(element);
17467      if (element.hasType()) {
17468        composeCodeableConcept("type", element.getType());
17469      }
17470      if (element.hasIdentifier()) {
17471        composeIdentifier("identifier", element.getIdentifier());
17472      }
17473      if (element.hasLastSystemChangeElement()) {
17474        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
17475        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
17476      }
17477      if (element.hasSource()) {
17478        composeReference("source", element.getSource());
17479      }
17480      if (element.hasParent()) {
17481        composeReference("parent", element.getParent());
17482      }
17483      if (element.hasOperationalStatus()) {
17484        openArray("operationalStatus");
17485        for (CodeableConcept e : element.getOperationalStatus()) 
17486          composeCodeableConcept(null, e);
17487        closeArray();
17488      };
17489      if (element.hasParameterGroup()) {
17490        composeCodeableConcept("parameterGroup", element.getParameterGroup());
17491      }
17492      if (element.hasMeasurementPrincipleElement()) {
17493        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17494        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17495      }
17496      if (element.hasProductionSpecification()) {
17497        openArray("productionSpecification");
17498        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
17499          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
17500        closeArray();
17501      };
17502      if (element.hasLanguageCode()) {
17503        composeCodeableConcept("languageCode", element.getLanguageCode());
17504      }
17505  }
17506
17507  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17508    if (element != null) {
17509      open(name);
17510      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
17511      close();
17512    }
17513  }
17514
17515  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17516      composeBackbone(element);
17517      if (element.hasSpecType()) {
17518        composeCodeableConcept("specType", element.getSpecType());
17519      }
17520      if (element.hasComponentId()) {
17521        composeIdentifier("componentId", element.getComponentId());
17522      }
17523      if (element.hasProductionSpecElement()) {
17524        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
17525        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
17526      }
17527  }
17528
17529  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
17530    if (element != null) {
17531      prop("resourceType", name);
17532      composeDeviceMetricInner(element);
17533    }
17534  }
17535
17536  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
17537      composeDomainResourceElements(element);
17538      if (element.hasType()) {
17539        composeCodeableConcept("type", element.getType());
17540      }
17541      if (element.hasIdentifier()) {
17542        composeIdentifier("identifier", element.getIdentifier());
17543      }
17544      if (element.hasUnit()) {
17545        composeCodeableConcept("unit", element.getUnit());
17546      }
17547      if (element.hasSource()) {
17548        composeReference("source", element.getSource());
17549      }
17550      if (element.hasParent()) {
17551        composeReference("parent", element.getParent());
17552      }
17553      if (element.hasOperationalStatusElement()) {
17554        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17555        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17556      }
17557      if (element.hasColorElement()) {
17558        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17559        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17560      }
17561      if (element.hasCategoryElement()) {
17562        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17563        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17564      }
17565      if (element.hasMeasurementPeriod()) {
17566        composeTiming("measurementPeriod", element.getMeasurementPeriod());
17567      }
17568      if (element.hasCalibration()) {
17569        openArray("calibration");
17570        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
17571          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
17572        closeArray();
17573      };
17574  }
17575
17576  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17577    if (element != null) {
17578      open(name);
17579      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
17580      close();
17581    }
17582  }
17583
17584  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17585      composeBackbone(element);
17586      if (element.hasTypeElement()) {
17587        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17588        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17589      }
17590      if (element.hasStateElement()) {
17591        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17592        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17593      }
17594      if (element.hasTimeElement()) {
17595        composeInstantCore("time", element.getTimeElement(), false);
17596        composeInstantExtras("time", element.getTimeElement(), false);
17597      }
17598  }
17599
17600  protected void composeDeviceUseRequest(String name, DeviceUseRequest element) throws IOException {
17601    if (element != null) {
17602      prop("resourceType", name);
17603      composeDeviceUseRequestInner(element);
17604    }
17605  }
17606
17607  protected void composeDeviceUseRequestInner(DeviceUseRequest element) throws IOException {
17608      composeDomainResourceElements(element);
17609      if (element.hasBodySite()) {
17610        composeType("bodySite", element.getBodySite());
17611      }
17612      if (element.hasStatusElement()) {
17613        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17614        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17615      }
17616      if (element.hasDevice()) {
17617        composeReference("device", element.getDevice());
17618      }
17619      if (element.hasEncounter()) {
17620        composeReference("encounter", element.getEncounter());
17621      }
17622      if (element.hasIdentifier()) {
17623        openArray("identifier");
17624        for (Identifier e : element.getIdentifier()) 
17625          composeIdentifier(null, e);
17626        closeArray();
17627      };
17628      if (element.hasIndication()) {
17629        openArray("indication");
17630        for (CodeableConcept e : element.getIndication()) 
17631          composeCodeableConcept(null, e);
17632        closeArray();
17633      };
17634      if (element.hasNotes()) {
17635        openArray("notes");
17636        for (StringType e : element.getNotes()) 
17637          composeStringCore(null, e, true);
17638        closeArray();
17639        if (anyHasExtras(element.getNotes())) {
17640          openArray("_notes");
17641          for (StringType e : element.getNotes()) 
17642            composeStringExtras(null, e, true);
17643          closeArray();
17644        }
17645      };
17646      if (element.hasPrnReason()) {
17647        openArray("prnReason");
17648        for (CodeableConcept e : element.getPrnReason()) 
17649          composeCodeableConcept(null, e);
17650        closeArray();
17651      };
17652      if (element.hasOrderedOnElement()) {
17653        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
17654        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
17655      }
17656      if (element.hasRecordedOnElement()) {
17657        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17658        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17659      }
17660      if (element.hasSubject()) {
17661        composeReference("subject", element.getSubject());
17662      }
17663      if (element.hasTiming()) {
17664        composeType("timing", element.getTiming());
17665      }
17666      if (element.hasPriorityElement()) {
17667        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17668        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17669      }
17670  }
17671
17672  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
17673    if (element != null) {
17674      prop("resourceType", name);
17675      composeDeviceUseStatementInner(element);
17676    }
17677  }
17678
17679  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
17680      composeDomainResourceElements(element);
17681      if (element.hasBodySite()) {
17682        composeType("bodySite", element.getBodySite());
17683      }
17684      if (element.hasWhenUsed()) {
17685        composePeriod("whenUsed", element.getWhenUsed());
17686      }
17687      if (element.hasDevice()) {
17688        composeReference("device", element.getDevice());
17689      }
17690      if (element.hasIdentifier()) {
17691        openArray("identifier");
17692        for (Identifier e : element.getIdentifier()) 
17693          composeIdentifier(null, e);
17694        closeArray();
17695      };
17696      if (element.hasIndication()) {
17697        openArray("indication");
17698        for (CodeableConcept e : element.getIndication()) 
17699          composeCodeableConcept(null, e);
17700        closeArray();
17701      };
17702      if (element.hasNotes()) {
17703        openArray("notes");
17704        for (StringType e : element.getNotes()) 
17705          composeStringCore(null, e, true);
17706        closeArray();
17707        if (anyHasExtras(element.getNotes())) {
17708          openArray("_notes");
17709          for (StringType e : element.getNotes()) 
17710            composeStringExtras(null, e, true);
17711          closeArray();
17712        }
17713      };
17714      if (element.hasRecordedOnElement()) {
17715        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17716        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17717      }
17718      if (element.hasSubject()) {
17719        composeReference("subject", element.getSubject());
17720      }
17721      if (element.hasTiming()) {
17722        composeType("timing", element.getTiming());
17723      }
17724  }
17725
17726  protected void composeDiagnosticOrder(String name, DiagnosticOrder element) throws IOException {
17727    if (element != null) {
17728      prop("resourceType", name);
17729      composeDiagnosticOrderInner(element);
17730    }
17731  }
17732
17733  protected void composeDiagnosticOrderInner(DiagnosticOrder element) throws IOException {
17734      composeDomainResourceElements(element);
17735      if (element.hasSubject()) {
17736        composeReference("subject", element.getSubject());
17737      }
17738      if (element.hasOrderer()) {
17739        composeReference("orderer", element.getOrderer());
17740      }
17741      if (element.hasIdentifier()) {
17742        openArray("identifier");
17743        for (Identifier e : element.getIdentifier()) 
17744          composeIdentifier(null, e);
17745        closeArray();
17746      };
17747      if (element.hasEncounter()) {
17748        composeReference("encounter", element.getEncounter());
17749      }
17750      if (element.hasReason()) {
17751        openArray("reason");
17752        for (CodeableConcept e : element.getReason()) 
17753          composeCodeableConcept(null, e);
17754        closeArray();
17755      };
17756      if (element.hasSupportingInformation()) {
17757        openArray("supportingInformation");
17758        for (Reference e : element.getSupportingInformation()) 
17759          composeReference(null, e);
17760        closeArray();
17761      };
17762      if (element.hasSpecimen()) {
17763        openArray("specimen");
17764        for (Reference e : element.getSpecimen()) 
17765          composeReference(null, e);
17766        closeArray();
17767      };
17768      if (element.hasStatusElement()) {
17769        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17770        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17771      }
17772      if (element.hasPriorityElement()) {
17773        composeEnumerationCore("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17774        composeEnumerationExtras("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17775      }
17776      if (element.hasEvent()) {
17777        openArray("event");
17778        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17779          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17780        closeArray();
17781      };
17782      if (element.hasItem()) {
17783        openArray("item");
17784        for (DiagnosticOrder.DiagnosticOrderItemComponent e : element.getItem()) 
17785          composeDiagnosticOrderDiagnosticOrderItemComponent(null, e);
17786        closeArray();
17787      };
17788      if (element.hasNote()) {
17789        openArray("note");
17790        for (Annotation e : element.getNote()) 
17791          composeAnnotation(null, e);
17792        closeArray();
17793      };
17794  }
17795
17796  protected void composeDiagnosticOrderDiagnosticOrderEventComponent(String name, DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17797    if (element != null) {
17798      open(name);
17799      composeDiagnosticOrderDiagnosticOrderEventComponentInner(element);
17800      close();
17801    }
17802  }
17803
17804  protected void composeDiagnosticOrderDiagnosticOrderEventComponentInner(DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17805      composeBackbone(element);
17806      if (element.hasStatusElement()) {
17807        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17808        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17809      }
17810      if (element.hasDescription()) {
17811        composeCodeableConcept("description", element.getDescription());
17812      }
17813      if (element.hasDateTimeElement()) {
17814        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
17815        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
17816      }
17817      if (element.hasActor()) {
17818        composeReference("actor", element.getActor());
17819      }
17820  }
17821
17822  protected void composeDiagnosticOrderDiagnosticOrderItemComponent(String name, DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17823    if (element != null) {
17824      open(name);
17825      composeDiagnosticOrderDiagnosticOrderItemComponentInner(element);
17826      close();
17827    }
17828  }
17829
17830  protected void composeDiagnosticOrderDiagnosticOrderItemComponentInner(DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17831      composeBackbone(element);
17832      if (element.hasCode()) {
17833        composeCodeableConcept("code", element.getCode());
17834      }
17835      if (element.hasSpecimen()) {
17836        openArray("specimen");
17837        for (Reference e : element.getSpecimen()) 
17838          composeReference(null, e);
17839        closeArray();
17840      };
17841      if (element.hasBodySite()) {
17842        composeCodeableConcept("bodySite", element.getBodySite());
17843      }
17844      if (element.hasStatusElement()) {
17845        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17846        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17847      }
17848      if (element.hasEvent()) {
17849        openArray("event");
17850        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17851          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17852        closeArray();
17853      };
17854  }
17855
17856  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
17857    if (element != null) {
17858      prop("resourceType", name);
17859      composeDiagnosticReportInner(element);
17860    }
17861  }
17862
17863  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
17864      composeDomainResourceElements(element);
17865      if (element.hasIdentifier()) {
17866        openArray("identifier");
17867        for (Identifier e : element.getIdentifier()) 
17868          composeIdentifier(null, e);
17869        closeArray();
17870      };
17871      if (element.hasStatusElement()) {
17872        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17873        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17874      }
17875      if (element.hasCategory()) {
17876        composeCodeableConcept("category", element.getCategory());
17877      }
17878      if (element.hasCode()) {
17879        composeCodeableConcept("code", element.getCode());
17880      }
17881      if (element.hasSubject()) {
17882        composeReference("subject", element.getSubject());
17883      }
17884      if (element.hasEncounter()) {
17885        composeReference("encounter", element.getEncounter());
17886      }
17887      if (element.hasEffective()) {
17888        composeType("effective", element.getEffective());
17889      }
17890      if (element.hasIssuedElement()) {
17891        composeInstantCore("issued", element.getIssuedElement(), false);
17892        composeInstantExtras("issued", element.getIssuedElement(), false);
17893      }
17894      if (element.hasPerformer()) {
17895        composeReference("performer", element.getPerformer());
17896      }
17897      if (element.hasRequest()) {
17898        openArray("request");
17899        for (Reference e : element.getRequest()) 
17900          composeReference(null, e);
17901        closeArray();
17902      };
17903      if (element.hasSpecimen()) {
17904        openArray("specimen");
17905        for (Reference e : element.getSpecimen()) 
17906          composeReference(null, e);
17907        closeArray();
17908      };
17909      if (element.hasResult()) {
17910        openArray("result");
17911        for (Reference e : element.getResult()) 
17912          composeReference(null, e);
17913        closeArray();
17914      };
17915      if (element.hasImagingStudy()) {
17916        openArray("imagingStudy");
17917        for (Reference e : element.getImagingStudy()) 
17918          composeReference(null, e);
17919        closeArray();
17920      };
17921      if (element.hasImage()) {
17922        openArray("image");
17923        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
17924          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
17925        closeArray();
17926      };
17927      if (element.hasConclusionElement()) {
17928        composeStringCore("conclusion", element.getConclusionElement(), false);
17929        composeStringExtras("conclusion", element.getConclusionElement(), false);
17930      }
17931      if (element.hasCodedDiagnosis()) {
17932        openArray("codedDiagnosis");
17933        for (CodeableConcept e : element.getCodedDiagnosis()) 
17934          composeCodeableConcept(null, e);
17935        closeArray();
17936      };
17937      if (element.hasPresentedForm()) {
17938        openArray("presentedForm");
17939        for (Attachment e : element.getPresentedForm()) 
17940          composeAttachment(null, e);
17941        closeArray();
17942      };
17943  }
17944
17945  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17946    if (element != null) {
17947      open(name);
17948      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
17949      close();
17950    }
17951  }
17952
17953  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17954      composeBackbone(element);
17955      if (element.hasCommentElement()) {
17956        composeStringCore("comment", element.getCommentElement(), false);
17957        composeStringExtras("comment", element.getCommentElement(), false);
17958      }
17959      if (element.hasLink()) {
17960        composeReference("link", element.getLink());
17961      }
17962  }
17963
17964  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
17965    if (element != null) {
17966      prop("resourceType", name);
17967      composeDocumentManifestInner(element);
17968    }
17969  }
17970
17971  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
17972      composeDomainResourceElements(element);
17973      if (element.hasMasterIdentifier()) {
17974        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
17975      }
17976      if (element.hasIdentifier()) {
17977        openArray("identifier");
17978        for (Identifier e : element.getIdentifier()) 
17979          composeIdentifier(null, e);
17980        closeArray();
17981      };
17982      if (element.hasSubject()) {
17983        composeReference("subject", element.getSubject());
17984      }
17985      if (element.hasRecipient()) {
17986        openArray("recipient");
17987        for (Reference e : element.getRecipient()) 
17988          composeReference(null, e);
17989        closeArray();
17990      };
17991      if (element.hasType()) {
17992        composeCodeableConcept("type", element.getType());
17993      }
17994      if (element.hasAuthor()) {
17995        openArray("author");
17996        for (Reference e : element.getAuthor()) 
17997          composeReference(null, e);
17998        closeArray();
17999      };
18000      if (element.hasCreatedElement()) {
18001        composeDateTimeCore("created", element.getCreatedElement(), false);
18002        composeDateTimeExtras("created", element.getCreatedElement(), false);
18003      }
18004      if (element.hasSourceElement()) {
18005        composeUriCore("source", element.getSourceElement(), false);
18006        composeUriExtras("source", element.getSourceElement(), false);
18007      }
18008      if (element.hasStatusElement()) {
18009        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18010        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18011      }
18012      if (element.hasDescriptionElement()) {
18013        composeStringCore("description", element.getDescriptionElement(), false);
18014        composeStringExtras("description", element.getDescriptionElement(), false);
18015      }
18016      if (element.hasContent()) {
18017        openArray("content");
18018        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
18019          composeDocumentManifestDocumentManifestContentComponent(null, e);
18020        closeArray();
18021      };
18022      if (element.hasRelated()) {
18023        openArray("related");
18024        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
18025          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
18026        closeArray();
18027      };
18028  }
18029
18030  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18031    if (element != null) {
18032      open(name);
18033      composeDocumentManifestDocumentManifestContentComponentInner(element);
18034      close();
18035    }
18036  }
18037
18038  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18039      composeBackbone(element);
18040      if (element.hasP()) {
18041        composeType("p", element.getP());
18042      }
18043  }
18044
18045  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18046    if (element != null) {
18047      open(name);
18048      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
18049      close();
18050    }
18051  }
18052
18053  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18054      composeBackbone(element);
18055      if (element.hasIdentifier()) {
18056        composeIdentifier("identifier", element.getIdentifier());
18057      }
18058      if (element.hasRef()) {
18059        composeReference("ref", element.getRef());
18060      }
18061  }
18062
18063  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
18064    if (element != null) {
18065      prop("resourceType", name);
18066      composeDocumentReferenceInner(element);
18067    }
18068  }
18069
18070  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
18071      composeDomainResourceElements(element);
18072      if (element.hasMasterIdentifier()) {
18073        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
18074      }
18075      if (element.hasIdentifier()) {
18076        openArray("identifier");
18077        for (Identifier e : element.getIdentifier()) 
18078          composeIdentifier(null, e);
18079        closeArray();
18080      };
18081      if (element.hasSubject()) {
18082        composeReference("subject", element.getSubject());
18083      }
18084      if (element.hasType()) {
18085        composeCodeableConcept("type", element.getType());
18086      }
18087      if (element.hasClass_()) {
18088        composeCodeableConcept("class", element.getClass_());
18089      }
18090      if (element.hasAuthor()) {
18091        openArray("author");
18092        for (Reference e : element.getAuthor()) 
18093          composeReference(null, e);
18094        closeArray();
18095      };
18096      if (element.hasCustodian()) {
18097        composeReference("custodian", element.getCustodian());
18098      }
18099      if (element.hasAuthenticator()) {
18100        composeReference("authenticator", element.getAuthenticator());
18101      }
18102      if (element.hasCreatedElement()) {
18103        composeDateTimeCore("created", element.getCreatedElement(), false);
18104        composeDateTimeExtras("created", element.getCreatedElement(), false);
18105      }
18106      if (element.hasIndexedElement()) {
18107        composeInstantCore("indexed", element.getIndexedElement(), false);
18108        composeInstantExtras("indexed", element.getIndexedElement(), false);
18109      }
18110      if (element.hasStatusElement()) {
18111        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18112        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18113      }
18114      if (element.hasDocStatus()) {
18115        composeCodeableConcept("docStatus", element.getDocStatus());
18116      }
18117      if (element.hasRelatesTo()) {
18118        openArray("relatesTo");
18119        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
18120          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
18121        closeArray();
18122      };
18123      if (element.hasDescriptionElement()) {
18124        composeStringCore("description", element.getDescriptionElement(), false);
18125        composeStringExtras("description", element.getDescriptionElement(), false);
18126      }
18127      if (element.hasSecurityLabel()) {
18128        openArray("securityLabel");
18129        for (CodeableConcept e : element.getSecurityLabel()) 
18130          composeCodeableConcept(null, e);
18131        closeArray();
18132      };
18133      if (element.hasContent()) {
18134        openArray("content");
18135        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
18136          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
18137        closeArray();
18138      };
18139      if (element.hasContext()) {
18140        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
18141      }
18142  }
18143
18144  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18145    if (element != null) {
18146      open(name);
18147      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
18148      close();
18149    }
18150  }
18151
18152  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18153      composeBackbone(element);
18154      if (element.hasCodeElement()) {
18155        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18156        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18157      }
18158      if (element.hasTarget()) {
18159        composeReference("target", element.getTarget());
18160      }
18161  }
18162
18163  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18164    if (element != null) {
18165      open(name);
18166      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
18167      close();
18168    }
18169  }
18170
18171  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18172      composeBackbone(element);
18173      if (element.hasAttachment()) {
18174        composeAttachment("attachment", element.getAttachment());
18175      }
18176      if (element.hasFormat()) {
18177        openArray("format");
18178        for (Coding e : element.getFormat()) 
18179          composeCoding(null, e);
18180        closeArray();
18181      };
18182  }
18183
18184  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18185    if (element != null) {
18186      open(name);
18187      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
18188      close();
18189    }
18190  }
18191
18192  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18193      composeBackbone(element);
18194      if (element.hasEncounter()) {
18195        composeReference("encounter", element.getEncounter());
18196      }
18197      if (element.hasEvent()) {
18198        openArray("event");
18199        for (CodeableConcept e : element.getEvent()) 
18200          composeCodeableConcept(null, e);
18201        closeArray();
18202      };
18203      if (element.hasPeriod()) {
18204        composePeriod("period", element.getPeriod());
18205      }
18206      if (element.hasFacilityType()) {
18207        composeCodeableConcept("facilityType", element.getFacilityType());
18208      }
18209      if (element.hasPracticeSetting()) {
18210        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
18211      }
18212      if (element.hasSourcePatientInfo()) {
18213        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
18214      }
18215      if (element.hasRelated()) {
18216        openArray("related");
18217        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
18218          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
18219        closeArray();
18220      };
18221  }
18222
18223  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18224    if (element != null) {
18225      open(name);
18226      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
18227      close();
18228    }
18229  }
18230
18231  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18232      composeBackbone(element);
18233      if (element.hasIdentifier()) {
18234        composeIdentifier("identifier", element.getIdentifier());
18235      }
18236      if (element.hasRef()) {
18237        composeReference("ref", element.getRef());
18238      }
18239  }
18240
18241  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
18242    if (element != null) {
18243      prop("resourceType", name);
18244      composeEligibilityRequestInner(element);
18245    }
18246  }
18247
18248  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
18249      composeDomainResourceElements(element);
18250      if (element.hasIdentifier()) {
18251        openArray("identifier");
18252        for (Identifier e : element.getIdentifier()) 
18253          composeIdentifier(null, e);
18254        closeArray();
18255      };
18256      if (element.hasRuleset()) {
18257        composeCoding("ruleset", element.getRuleset());
18258      }
18259      if (element.hasOriginalRuleset()) {
18260        composeCoding("originalRuleset", element.getOriginalRuleset());
18261      }
18262      if (element.hasCreatedElement()) {
18263        composeDateTimeCore("created", element.getCreatedElement(), false);
18264        composeDateTimeExtras("created", element.getCreatedElement(), false);
18265      }
18266      if (element.hasTarget()) {
18267        composeReference("target", element.getTarget());
18268      }
18269      if (element.hasProvider()) {
18270        composeReference("provider", element.getProvider());
18271      }
18272      if (element.hasOrganization()) {
18273        composeReference("organization", element.getOrganization());
18274      }
18275  }
18276
18277  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
18278    if (element != null) {
18279      prop("resourceType", name);
18280      composeEligibilityResponseInner(element);
18281    }
18282  }
18283
18284  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
18285      composeDomainResourceElements(element);
18286      if (element.hasIdentifier()) {
18287        openArray("identifier");
18288        for (Identifier e : element.getIdentifier()) 
18289          composeIdentifier(null, e);
18290        closeArray();
18291      };
18292      if (element.hasRequest()) {
18293        composeReference("request", element.getRequest());
18294      }
18295      if (element.hasOutcomeElement()) {
18296        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18297        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18298      }
18299      if (element.hasDispositionElement()) {
18300        composeStringCore("disposition", element.getDispositionElement(), false);
18301        composeStringExtras("disposition", element.getDispositionElement(), false);
18302      }
18303      if (element.hasRuleset()) {
18304        composeCoding("ruleset", element.getRuleset());
18305      }
18306      if (element.hasOriginalRuleset()) {
18307        composeCoding("originalRuleset", element.getOriginalRuleset());
18308      }
18309      if (element.hasCreatedElement()) {
18310        composeDateTimeCore("created", element.getCreatedElement(), false);
18311        composeDateTimeExtras("created", element.getCreatedElement(), false);
18312      }
18313      if (element.hasOrganization()) {
18314        composeReference("organization", element.getOrganization());
18315      }
18316      if (element.hasRequestProvider()) {
18317        composeReference("requestProvider", element.getRequestProvider());
18318      }
18319      if (element.hasRequestOrganization()) {
18320        composeReference("requestOrganization", element.getRequestOrganization());
18321      }
18322  }
18323
18324  protected void composeEncounter(String name, Encounter element) throws IOException {
18325    if (element != null) {
18326      prop("resourceType", name);
18327      composeEncounterInner(element);
18328    }
18329  }
18330
18331  protected void composeEncounterInner(Encounter element) throws IOException {
18332      composeDomainResourceElements(element);
18333      if (element.hasIdentifier()) {
18334        openArray("identifier");
18335        for (Identifier e : element.getIdentifier()) 
18336          composeIdentifier(null, e);
18337        closeArray();
18338      };
18339      if (element.hasStatusElement()) {
18340        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18341        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18342      }
18343      if (element.hasStatusHistory()) {
18344        openArray("statusHistory");
18345        for (Encounter.EncounterStatusHistoryComponent e : element.getStatusHistory()) 
18346          composeEncounterEncounterStatusHistoryComponent(null, e);
18347        closeArray();
18348      };
18349      if (element.hasClass_Element()) {
18350        composeEnumerationCore("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18351        composeEnumerationExtras("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18352      }
18353      if (element.hasType()) {
18354        openArray("type");
18355        for (CodeableConcept e : element.getType()) 
18356          composeCodeableConcept(null, e);
18357        closeArray();
18358      };
18359      if (element.hasPriority()) {
18360        composeCodeableConcept("priority", element.getPriority());
18361      }
18362      if (element.hasPatient()) {
18363        composeReference("patient", element.getPatient());
18364      }
18365      if (element.hasEpisodeOfCare()) {
18366        openArray("episodeOfCare");
18367        for (Reference e : element.getEpisodeOfCare()) 
18368          composeReference(null, e);
18369        closeArray();
18370      };
18371      if (element.hasIncomingReferral()) {
18372        openArray("incomingReferral");
18373        for (Reference e : element.getIncomingReferral()) 
18374          composeReference(null, e);
18375        closeArray();
18376      };
18377      if (element.hasParticipant()) {
18378        openArray("participant");
18379        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
18380          composeEncounterEncounterParticipantComponent(null, e);
18381        closeArray();
18382      };
18383      if (element.hasAppointment()) {
18384        composeReference("appointment", element.getAppointment());
18385      }
18386      if (element.hasPeriod()) {
18387        composePeriod("period", element.getPeriod());
18388      }
18389      if (element.hasLength()) {
18390        composeDuration("length", element.getLength());
18391      }
18392      if (element.hasReason()) {
18393        openArray("reason");
18394        for (CodeableConcept e : element.getReason()) 
18395          composeCodeableConcept(null, e);
18396        closeArray();
18397      };
18398      if (element.hasIndication()) {
18399        openArray("indication");
18400        for (Reference e : element.getIndication()) 
18401          composeReference(null, e);
18402        closeArray();
18403      };
18404      if (element.hasHospitalization()) {
18405        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
18406      }
18407      if (element.hasLocation()) {
18408        openArray("location");
18409        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
18410          composeEncounterEncounterLocationComponent(null, e);
18411        closeArray();
18412      };
18413      if (element.hasServiceProvider()) {
18414        composeReference("serviceProvider", element.getServiceProvider());
18415      }
18416      if (element.hasPartOf()) {
18417        composeReference("partOf", element.getPartOf());
18418      }
18419  }
18420
18421  protected void composeEncounterEncounterStatusHistoryComponent(String name, Encounter.EncounterStatusHistoryComponent element) throws IOException {
18422    if (element != null) {
18423      open(name);
18424      composeEncounterEncounterStatusHistoryComponentInner(element);
18425      close();
18426    }
18427  }
18428
18429  protected void composeEncounterEncounterStatusHistoryComponentInner(Encounter.EncounterStatusHistoryComponent element) throws IOException {
18430      composeBackbone(element);
18431      if (element.hasStatusElement()) {
18432        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18433        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18434      }
18435      if (element.hasPeriod()) {
18436        composePeriod("period", element.getPeriod());
18437      }
18438  }
18439
18440  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
18441    if (element != null) {
18442      open(name);
18443      composeEncounterEncounterParticipantComponentInner(element);
18444      close();
18445    }
18446  }
18447
18448  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
18449      composeBackbone(element);
18450      if (element.hasType()) {
18451        openArray("type");
18452        for (CodeableConcept e : element.getType()) 
18453          composeCodeableConcept(null, e);
18454        closeArray();
18455      };
18456      if (element.hasPeriod()) {
18457        composePeriod("period", element.getPeriod());
18458      }
18459      if (element.hasIndividual()) {
18460        composeReference("individual", element.getIndividual());
18461      }
18462  }
18463
18464  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
18465    if (element != null) {
18466      open(name);
18467      composeEncounterEncounterHospitalizationComponentInner(element);
18468      close();
18469    }
18470  }
18471
18472  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
18473      composeBackbone(element);
18474      if (element.hasPreAdmissionIdentifier()) {
18475        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
18476      }
18477      if (element.hasOrigin()) {
18478        composeReference("origin", element.getOrigin());
18479      }
18480      if (element.hasAdmitSource()) {
18481        composeCodeableConcept("admitSource", element.getAdmitSource());
18482      }
18483      if (element.hasAdmittingDiagnosis()) {
18484        openArray("admittingDiagnosis");
18485        for (Reference e : element.getAdmittingDiagnosis()) 
18486          composeReference(null, e);
18487        closeArray();
18488      };
18489      if (element.hasReAdmission()) {
18490        composeCodeableConcept("reAdmission", element.getReAdmission());
18491      }
18492      if (element.hasDietPreference()) {
18493        openArray("dietPreference");
18494        for (CodeableConcept e : element.getDietPreference()) 
18495          composeCodeableConcept(null, e);
18496        closeArray();
18497      };
18498      if (element.hasSpecialCourtesy()) {
18499        openArray("specialCourtesy");
18500        for (CodeableConcept e : element.getSpecialCourtesy()) 
18501          composeCodeableConcept(null, e);
18502        closeArray();
18503      };
18504      if (element.hasSpecialArrangement()) {
18505        openArray("specialArrangement");
18506        for (CodeableConcept e : element.getSpecialArrangement()) 
18507          composeCodeableConcept(null, e);
18508        closeArray();
18509      };
18510      if (element.hasDestination()) {
18511        composeReference("destination", element.getDestination());
18512      }
18513      if (element.hasDischargeDisposition()) {
18514        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
18515      }
18516      if (element.hasDischargeDiagnosis()) {
18517        openArray("dischargeDiagnosis");
18518        for (Reference e : element.getDischargeDiagnosis()) 
18519          composeReference(null, e);
18520        closeArray();
18521      };
18522  }
18523
18524  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
18525    if (element != null) {
18526      open(name);
18527      composeEncounterEncounterLocationComponentInner(element);
18528      close();
18529    }
18530  }
18531
18532  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
18533      composeBackbone(element);
18534      if (element.hasLocation()) {
18535        composeReference("location", element.getLocation());
18536      }
18537      if (element.hasStatusElement()) {
18538        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18539        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18540      }
18541      if (element.hasPeriod()) {
18542        composePeriod("period", element.getPeriod());
18543      }
18544  }
18545
18546  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
18547    if (element != null) {
18548      prop("resourceType", name);
18549      composeEnrollmentRequestInner(element);
18550    }
18551  }
18552
18553  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
18554      composeDomainResourceElements(element);
18555      if (element.hasIdentifier()) {
18556        openArray("identifier");
18557        for (Identifier e : element.getIdentifier()) 
18558          composeIdentifier(null, e);
18559        closeArray();
18560      };
18561      if (element.hasRuleset()) {
18562        composeCoding("ruleset", element.getRuleset());
18563      }
18564      if (element.hasOriginalRuleset()) {
18565        composeCoding("originalRuleset", element.getOriginalRuleset());
18566      }
18567      if (element.hasCreatedElement()) {
18568        composeDateTimeCore("created", element.getCreatedElement(), false);
18569        composeDateTimeExtras("created", element.getCreatedElement(), false);
18570      }
18571      if (element.hasTarget()) {
18572        composeReference("target", element.getTarget());
18573      }
18574      if (element.hasProvider()) {
18575        composeReference("provider", element.getProvider());
18576      }
18577      if (element.hasOrganization()) {
18578        composeReference("organization", element.getOrganization());
18579      }
18580      if (element.hasSubject()) {
18581        composeReference("subject", element.getSubject());
18582      }
18583      if (element.hasCoverage()) {
18584        composeReference("coverage", element.getCoverage());
18585      }
18586      if (element.hasRelationship()) {
18587        composeCoding("relationship", element.getRelationship());
18588      }
18589  }
18590
18591  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
18592    if (element != null) {
18593      prop("resourceType", name);
18594      composeEnrollmentResponseInner(element);
18595    }
18596  }
18597
18598  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
18599      composeDomainResourceElements(element);
18600      if (element.hasIdentifier()) {
18601        openArray("identifier");
18602        for (Identifier e : element.getIdentifier()) 
18603          composeIdentifier(null, e);
18604        closeArray();
18605      };
18606      if (element.hasRequest()) {
18607        composeReference("request", element.getRequest());
18608      }
18609      if (element.hasOutcomeElement()) {
18610        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18611        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18612      }
18613      if (element.hasDispositionElement()) {
18614        composeStringCore("disposition", element.getDispositionElement(), false);
18615        composeStringExtras("disposition", element.getDispositionElement(), false);
18616      }
18617      if (element.hasRuleset()) {
18618        composeCoding("ruleset", element.getRuleset());
18619      }
18620      if (element.hasOriginalRuleset()) {
18621        composeCoding("originalRuleset", element.getOriginalRuleset());
18622      }
18623      if (element.hasCreatedElement()) {
18624        composeDateTimeCore("created", element.getCreatedElement(), false);
18625        composeDateTimeExtras("created", element.getCreatedElement(), false);
18626      }
18627      if (element.hasOrganization()) {
18628        composeReference("organization", element.getOrganization());
18629      }
18630      if (element.hasRequestProvider()) {
18631        composeReference("requestProvider", element.getRequestProvider());
18632      }
18633      if (element.hasRequestOrganization()) {
18634        composeReference("requestOrganization", element.getRequestOrganization());
18635      }
18636  }
18637
18638  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
18639    if (element != null) {
18640      prop("resourceType", name);
18641      composeEpisodeOfCareInner(element);
18642    }
18643  }
18644
18645  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
18646      composeDomainResourceElements(element);
18647      if (element.hasIdentifier()) {
18648        openArray("identifier");
18649        for (Identifier e : element.getIdentifier()) 
18650          composeIdentifier(null, e);
18651        closeArray();
18652      };
18653      if (element.hasStatusElement()) {
18654        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18655        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18656      }
18657      if (element.hasStatusHistory()) {
18658        openArray("statusHistory");
18659        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
18660          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
18661        closeArray();
18662      };
18663      if (element.hasType()) {
18664        openArray("type");
18665        for (CodeableConcept e : element.getType()) 
18666          composeCodeableConcept(null, e);
18667        closeArray();
18668      };
18669      if (element.hasCondition()) {
18670        openArray("condition");
18671        for (Reference e : element.getCondition()) 
18672          composeReference(null, e);
18673        closeArray();
18674      };
18675      if (element.hasPatient()) {
18676        composeReference("patient", element.getPatient());
18677      }
18678      if (element.hasManagingOrganization()) {
18679        composeReference("managingOrganization", element.getManagingOrganization());
18680      }
18681      if (element.hasPeriod()) {
18682        composePeriod("period", element.getPeriod());
18683      }
18684      if (element.hasReferralRequest()) {
18685        openArray("referralRequest");
18686        for (Reference e : element.getReferralRequest()) 
18687          composeReference(null, e);
18688        closeArray();
18689      };
18690      if (element.hasCareManager()) {
18691        composeReference("careManager", element.getCareManager());
18692      }
18693      if (element.hasCareTeam()) {
18694        openArray("careTeam");
18695        for (EpisodeOfCare.EpisodeOfCareCareTeamComponent e : element.getCareTeam()) 
18696          composeEpisodeOfCareEpisodeOfCareCareTeamComponent(null, e);
18697        closeArray();
18698      };
18699  }
18700
18701  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18702    if (element != null) {
18703      open(name);
18704      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
18705      close();
18706    }
18707  }
18708
18709  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18710      composeBackbone(element);
18711      if (element.hasStatusElement()) {
18712        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18713        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18714      }
18715      if (element.hasPeriod()) {
18716        composePeriod("period", element.getPeriod());
18717      }
18718  }
18719
18720  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponent(String name, EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18721    if (element != null) {
18722      open(name);
18723      composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(element);
18724      close();
18725    }
18726  }
18727
18728  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18729      composeBackbone(element);
18730      if (element.hasRole()) {
18731        openArray("role");
18732        for (CodeableConcept e : element.getRole()) 
18733          composeCodeableConcept(null, e);
18734        closeArray();
18735      };
18736      if (element.hasPeriod()) {
18737        composePeriod("period", element.getPeriod());
18738      }
18739      if (element.hasMember()) {
18740        composeReference("member", element.getMember());
18741      }
18742  }
18743
18744  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
18745    if (element != null) {
18746      prop("resourceType", name);
18747      composeExplanationOfBenefitInner(element);
18748    }
18749  }
18750
18751  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
18752      composeDomainResourceElements(element);
18753      if (element.hasIdentifier()) {
18754        openArray("identifier");
18755        for (Identifier e : element.getIdentifier()) 
18756          composeIdentifier(null, e);
18757        closeArray();
18758      };
18759      if (element.hasRequest()) {
18760        composeReference("request", element.getRequest());
18761      }
18762      if (element.hasOutcomeElement()) {
18763        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18764        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18765      }
18766      if (element.hasDispositionElement()) {
18767        composeStringCore("disposition", element.getDispositionElement(), false);
18768        composeStringExtras("disposition", element.getDispositionElement(), false);
18769      }
18770      if (element.hasRuleset()) {
18771        composeCoding("ruleset", element.getRuleset());
18772      }
18773      if (element.hasOriginalRuleset()) {
18774        composeCoding("originalRuleset", element.getOriginalRuleset());
18775      }
18776      if (element.hasCreatedElement()) {
18777        composeDateTimeCore("created", element.getCreatedElement(), false);
18778        composeDateTimeExtras("created", element.getCreatedElement(), false);
18779      }
18780      if (element.hasOrganization()) {
18781        composeReference("organization", element.getOrganization());
18782      }
18783      if (element.hasRequestProvider()) {
18784        composeReference("requestProvider", element.getRequestProvider());
18785      }
18786      if (element.hasRequestOrganization()) {
18787        composeReference("requestOrganization", element.getRequestOrganization());
18788      }
18789  }
18790
18791  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
18792    if (element != null) {
18793      prop("resourceType", name);
18794      composeFamilyMemberHistoryInner(element);
18795    }
18796  }
18797
18798  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
18799      composeDomainResourceElements(element);
18800      if (element.hasIdentifier()) {
18801        openArray("identifier");
18802        for (Identifier e : element.getIdentifier()) 
18803          composeIdentifier(null, e);
18804        closeArray();
18805      };
18806      if (element.hasPatient()) {
18807        composeReference("patient", element.getPatient());
18808      }
18809      if (element.hasDateElement()) {
18810        composeDateTimeCore("date", element.getDateElement(), false);
18811        composeDateTimeExtras("date", element.getDateElement(), false);
18812      }
18813      if (element.hasStatusElement()) {
18814        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18815        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18816      }
18817      if (element.hasNameElement()) {
18818        composeStringCore("name", element.getNameElement(), false);
18819        composeStringExtras("name", element.getNameElement(), false);
18820      }
18821      if (element.hasRelationship()) {
18822        composeCodeableConcept("relationship", element.getRelationship());
18823      }
18824      if (element.hasGenderElement()) {
18825        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18826        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18827      }
18828      if (element.hasBorn()) {
18829        composeType("born", element.getBorn());
18830      }
18831      if (element.hasAge()) {
18832        composeType("age", element.getAge());
18833      }
18834      if (element.hasDeceased()) {
18835        composeType("deceased", element.getDeceased());
18836      }
18837      if (element.hasNote()) {
18838        composeAnnotation("note", element.getNote());
18839      }
18840      if (element.hasCondition()) {
18841        openArray("condition");
18842        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
18843          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
18844        closeArray();
18845      };
18846  }
18847
18848  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18849    if (element != null) {
18850      open(name);
18851      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
18852      close();
18853    }
18854  }
18855
18856  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18857      composeBackbone(element);
18858      if (element.hasCode()) {
18859        composeCodeableConcept("code", element.getCode());
18860      }
18861      if (element.hasOutcome()) {
18862        composeCodeableConcept("outcome", element.getOutcome());
18863      }
18864      if (element.hasOnset()) {
18865        composeType("onset", element.getOnset());
18866      }
18867      if (element.hasNote()) {
18868        composeAnnotation("note", element.getNote());
18869      }
18870  }
18871
18872  protected void composeFlag(String name, Flag element) throws IOException {
18873    if (element != null) {
18874      prop("resourceType", name);
18875      composeFlagInner(element);
18876    }
18877  }
18878
18879  protected void composeFlagInner(Flag element) throws IOException {
18880      composeDomainResourceElements(element);
18881      if (element.hasIdentifier()) {
18882        openArray("identifier");
18883        for (Identifier e : element.getIdentifier()) 
18884          composeIdentifier(null, e);
18885        closeArray();
18886      };
18887      if (element.hasCategory()) {
18888        composeCodeableConcept("category", element.getCategory());
18889      }
18890      if (element.hasStatusElement()) {
18891        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18892        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18893      }
18894      if (element.hasPeriod()) {
18895        composePeriod("period", element.getPeriod());
18896      }
18897      if (element.hasSubject()) {
18898        composeReference("subject", element.getSubject());
18899      }
18900      if (element.hasEncounter()) {
18901        composeReference("encounter", element.getEncounter());
18902      }
18903      if (element.hasAuthor()) {
18904        composeReference("author", element.getAuthor());
18905      }
18906      if (element.hasCode()) {
18907        composeCodeableConcept("code", element.getCode());
18908      }
18909  }
18910
18911  protected void composeGoal(String name, Goal element) throws IOException {
18912    if (element != null) {
18913      prop("resourceType", name);
18914      composeGoalInner(element);
18915    }
18916  }
18917
18918  protected void composeGoalInner(Goal element) throws IOException {
18919      composeDomainResourceElements(element);
18920      if (element.hasIdentifier()) {
18921        openArray("identifier");
18922        for (Identifier e : element.getIdentifier()) 
18923          composeIdentifier(null, e);
18924        closeArray();
18925      };
18926      if (element.hasSubject()) {
18927        composeReference("subject", element.getSubject());
18928      }
18929      if (element.hasStart()) {
18930        composeType("start", element.getStart());
18931      }
18932      if (element.hasTarget()) {
18933        composeType("target", element.getTarget());
18934      }
18935      if (element.hasCategory()) {
18936        openArray("category");
18937        for (CodeableConcept e : element.getCategory()) 
18938          composeCodeableConcept(null, e);
18939        closeArray();
18940      };
18941      if (element.hasDescriptionElement()) {
18942        composeStringCore("description", element.getDescriptionElement(), false);
18943        composeStringExtras("description", element.getDescriptionElement(), false);
18944      }
18945      if (element.hasStatusElement()) {
18946        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18947        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18948      }
18949      if (element.hasStatusDateElement()) {
18950        composeDateCore("statusDate", element.getStatusDateElement(), false);
18951        composeDateExtras("statusDate", element.getStatusDateElement(), false);
18952      }
18953      if (element.hasStatusReason()) {
18954        composeCodeableConcept("statusReason", element.getStatusReason());
18955      }
18956      if (element.hasAuthor()) {
18957        composeReference("author", element.getAuthor());
18958      }
18959      if (element.hasPriority()) {
18960        composeCodeableConcept("priority", element.getPriority());
18961      }
18962      if (element.hasAddresses()) {
18963        openArray("addresses");
18964        for (Reference e : element.getAddresses()) 
18965          composeReference(null, e);
18966        closeArray();
18967      };
18968      if (element.hasNote()) {
18969        openArray("note");
18970        for (Annotation e : element.getNote()) 
18971          composeAnnotation(null, e);
18972        closeArray();
18973      };
18974      if (element.hasOutcome()) {
18975        openArray("outcome");
18976        for (Goal.GoalOutcomeComponent e : element.getOutcome()) 
18977          composeGoalGoalOutcomeComponent(null, e);
18978        closeArray();
18979      };
18980  }
18981
18982  protected void composeGoalGoalOutcomeComponent(String name, Goal.GoalOutcomeComponent element) throws IOException {
18983    if (element != null) {
18984      open(name);
18985      composeGoalGoalOutcomeComponentInner(element);
18986      close();
18987    }
18988  }
18989
18990  protected void composeGoalGoalOutcomeComponentInner(Goal.GoalOutcomeComponent element) throws IOException {
18991      composeBackbone(element);
18992      if (element.hasResult()) {
18993        composeType("result", element.getResult());
18994      }
18995  }
18996
18997  protected void composeGroup(String name, Group element) throws IOException {
18998    if (element != null) {
18999      prop("resourceType", name);
19000      composeGroupInner(element);
19001    }
19002  }
19003
19004  protected void composeGroupInner(Group element) throws IOException {
19005      composeDomainResourceElements(element);
19006      if (element.hasIdentifier()) {
19007        openArray("identifier");
19008        for (Identifier e : element.getIdentifier()) 
19009          composeIdentifier(null, e);
19010        closeArray();
19011      };
19012      if (element.hasTypeElement()) {
19013        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19014        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19015      }
19016      if (element.hasActualElement()) {
19017        composeBooleanCore("actual", element.getActualElement(), false);
19018        composeBooleanExtras("actual", element.getActualElement(), false);
19019      }
19020      if (element.hasCode()) {
19021        composeCodeableConcept("code", element.getCode());
19022      }
19023      if (element.hasNameElement()) {
19024        composeStringCore("name", element.getNameElement(), false);
19025        composeStringExtras("name", element.getNameElement(), false);
19026      }
19027      if (element.hasQuantityElement()) {
19028        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
19029        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
19030      }
19031      if (element.hasCharacteristic()) {
19032        openArray("characteristic");
19033        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
19034          composeGroupGroupCharacteristicComponent(null, e);
19035        closeArray();
19036      };
19037      if (element.hasMember()) {
19038        openArray("member");
19039        for (Group.GroupMemberComponent e : element.getMember()) 
19040          composeGroupGroupMemberComponent(null, e);
19041        closeArray();
19042      };
19043  }
19044
19045  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
19046    if (element != null) {
19047      open(name);
19048      composeGroupGroupCharacteristicComponentInner(element);
19049      close();
19050    }
19051  }
19052
19053  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
19054      composeBackbone(element);
19055      if (element.hasCode()) {
19056        composeCodeableConcept("code", element.getCode());
19057      }
19058      if (element.hasValue()) {
19059        composeType("value", element.getValue());
19060      }
19061      if (element.hasExcludeElement()) {
19062        composeBooleanCore("exclude", element.getExcludeElement(), false);
19063        composeBooleanExtras("exclude", element.getExcludeElement(), false);
19064      }
19065      if (element.hasPeriod()) {
19066        composePeriod("period", element.getPeriod());
19067      }
19068  }
19069
19070  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
19071    if (element != null) {
19072      open(name);
19073      composeGroupGroupMemberComponentInner(element);
19074      close();
19075    }
19076  }
19077
19078  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
19079      composeBackbone(element);
19080      if (element.hasEntity()) {
19081        composeReference("entity", element.getEntity());
19082      }
19083      if (element.hasPeriod()) {
19084        composePeriod("period", element.getPeriod());
19085      }
19086      if (element.hasInactiveElement()) {
19087        composeBooleanCore("inactive", element.getInactiveElement(), false);
19088        composeBooleanExtras("inactive", element.getInactiveElement(), false);
19089      }
19090  }
19091
19092  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
19093    if (element != null) {
19094      prop("resourceType", name);
19095      composeHealthcareServiceInner(element);
19096    }
19097  }
19098
19099  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
19100      composeDomainResourceElements(element);
19101      if (element.hasIdentifier()) {
19102        openArray("identifier");
19103        for (Identifier e : element.getIdentifier()) 
19104          composeIdentifier(null, e);
19105        closeArray();
19106      };
19107      if (element.hasProvidedBy()) {
19108        composeReference("providedBy", element.getProvidedBy());
19109      }
19110      if (element.hasServiceCategory()) {
19111        composeCodeableConcept("serviceCategory", element.getServiceCategory());
19112      }
19113      if (element.hasServiceType()) {
19114        openArray("serviceType");
19115        for (HealthcareService.ServiceTypeComponent e : element.getServiceType()) 
19116          composeHealthcareServiceServiceTypeComponent(null, e);
19117        closeArray();
19118      };
19119      if (element.hasLocation()) {
19120        composeReference("location", element.getLocation());
19121      }
19122      if (element.hasServiceNameElement()) {
19123        composeStringCore("serviceName", element.getServiceNameElement(), false);
19124        composeStringExtras("serviceName", element.getServiceNameElement(), false);
19125      }
19126      if (element.hasCommentElement()) {
19127        composeStringCore("comment", element.getCommentElement(), false);
19128        composeStringExtras("comment", element.getCommentElement(), false);
19129      }
19130      if (element.hasExtraDetailsElement()) {
19131        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
19132        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
19133      }
19134      if (element.hasPhoto()) {
19135        composeAttachment("photo", element.getPhoto());
19136      }
19137      if (element.hasTelecom()) {
19138        openArray("telecom");
19139        for (ContactPoint e : element.getTelecom()) 
19140          composeContactPoint(null, e);
19141        closeArray();
19142      };
19143      if (element.hasCoverageArea()) {
19144        openArray("coverageArea");
19145        for (Reference e : element.getCoverageArea()) 
19146          composeReference(null, e);
19147        closeArray();
19148      };
19149      if (element.hasServiceProvisionCode()) {
19150        openArray("serviceProvisionCode");
19151        for (CodeableConcept e : element.getServiceProvisionCode()) 
19152          composeCodeableConcept(null, e);
19153        closeArray();
19154      };
19155      if (element.hasEligibility()) {
19156        composeCodeableConcept("eligibility", element.getEligibility());
19157      }
19158      if (element.hasEligibilityNoteElement()) {
19159        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
19160        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
19161      }
19162      if (element.hasProgramName()) {
19163        openArray("programName");
19164        for (StringType e : element.getProgramName()) 
19165          composeStringCore(null, e, true);
19166        closeArray();
19167        if (anyHasExtras(element.getProgramName())) {
19168          openArray("_programName");
19169          for (StringType e : element.getProgramName()) 
19170            composeStringExtras(null, e, true);
19171          closeArray();
19172        }
19173      };
19174      if (element.hasCharacteristic()) {
19175        openArray("characteristic");
19176        for (CodeableConcept e : element.getCharacteristic()) 
19177          composeCodeableConcept(null, e);
19178        closeArray();
19179      };
19180      if (element.hasReferralMethod()) {
19181        openArray("referralMethod");
19182        for (CodeableConcept e : element.getReferralMethod()) 
19183          composeCodeableConcept(null, e);
19184        closeArray();
19185      };
19186      if (element.hasPublicKeyElement()) {
19187        composeStringCore("publicKey", element.getPublicKeyElement(), false);
19188        composeStringExtras("publicKey", element.getPublicKeyElement(), false);
19189      }
19190      if (element.hasAppointmentRequiredElement()) {
19191        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
19192        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
19193      }
19194      if (element.hasAvailableTime()) {
19195        openArray("availableTime");
19196        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
19197          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
19198        closeArray();
19199      };
19200      if (element.hasNotAvailable()) {
19201        openArray("notAvailable");
19202        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
19203          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
19204        closeArray();
19205      };
19206      if (element.hasAvailabilityExceptionsElement()) {
19207        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19208        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19209      }
19210  }
19211
19212  protected void composeHealthcareServiceServiceTypeComponent(String name, HealthcareService.ServiceTypeComponent element) throws IOException {
19213    if (element != null) {
19214      open(name);
19215      composeHealthcareServiceServiceTypeComponentInner(element);
19216      close();
19217    }
19218  }
19219
19220  protected void composeHealthcareServiceServiceTypeComponentInner(HealthcareService.ServiceTypeComponent element) throws IOException {
19221      composeBackbone(element);
19222      if (element.hasType()) {
19223        composeCodeableConcept("type", element.getType());
19224      }
19225      if (element.hasSpecialty()) {
19226        openArray("specialty");
19227        for (CodeableConcept e : element.getSpecialty()) 
19228          composeCodeableConcept(null, e);
19229        closeArray();
19230      };
19231  }
19232
19233  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19234    if (element != null) {
19235      open(name);
19236      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
19237      close();
19238    }
19239  }
19240
19241  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19242      composeBackbone(element);
19243      if (element.hasDaysOfWeek()) {
19244        openArray("daysOfWeek");
19245        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19246          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19247        closeArray();
19248        if (anyHasExtras(element.getDaysOfWeek())) {
19249          openArray("_daysOfWeek");
19250          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19251            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19252          closeArray();
19253        }
19254      };
19255      if (element.hasAllDayElement()) {
19256        composeBooleanCore("allDay", element.getAllDayElement(), false);
19257        composeBooleanExtras("allDay", element.getAllDayElement(), false);
19258      }
19259      if (element.hasAvailableStartTimeElement()) {
19260        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
19261        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
19262      }
19263      if (element.hasAvailableEndTimeElement()) {
19264        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
19265        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
19266      }
19267  }
19268
19269  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19270    if (element != null) {
19271      open(name);
19272      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
19273      close();
19274    }
19275  }
19276
19277  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19278      composeBackbone(element);
19279      if (element.hasDescriptionElement()) {
19280        composeStringCore("description", element.getDescriptionElement(), false);
19281        composeStringExtras("description", element.getDescriptionElement(), false);
19282      }
19283      if (element.hasDuring()) {
19284        composePeriod("during", element.getDuring());
19285      }
19286  }
19287
19288  protected void composeImagingObjectSelection(String name, ImagingObjectSelection element) throws IOException {
19289    if (element != null) {
19290      prop("resourceType", name);
19291      composeImagingObjectSelectionInner(element);
19292    }
19293  }
19294
19295  protected void composeImagingObjectSelectionInner(ImagingObjectSelection element) throws IOException {
19296      composeDomainResourceElements(element);
19297      if (element.hasUidElement()) {
19298        composeOidCore("uid", element.getUidElement(), false);
19299        composeOidExtras("uid", element.getUidElement(), false);
19300      }
19301      if (element.hasPatient()) {
19302        composeReference("patient", element.getPatient());
19303      }
19304      if (element.hasTitle()) {
19305        composeCodeableConcept("title", element.getTitle());
19306      }
19307      if (element.hasDescriptionElement()) {
19308        composeStringCore("description", element.getDescriptionElement(), false);
19309        composeStringExtras("description", element.getDescriptionElement(), false);
19310      }
19311      if (element.hasAuthor()) {
19312        composeReference("author", element.getAuthor());
19313      }
19314      if (element.hasAuthoringTimeElement()) {
19315        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
19316        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
19317      }
19318      if (element.hasStudy()) {
19319        openArray("study");
19320        for (ImagingObjectSelection.StudyComponent e : element.getStudy()) 
19321          composeImagingObjectSelectionStudyComponent(null, e);
19322        closeArray();
19323      };
19324  }
19325
19326  protected void composeImagingObjectSelectionStudyComponent(String name, ImagingObjectSelection.StudyComponent element) throws IOException {
19327    if (element != null) {
19328      open(name);
19329      composeImagingObjectSelectionStudyComponentInner(element);
19330      close();
19331    }
19332  }
19333
19334  protected void composeImagingObjectSelectionStudyComponentInner(ImagingObjectSelection.StudyComponent element) throws IOException {
19335      composeBackbone(element);
19336      if (element.hasUidElement()) {
19337        composeOidCore("uid", element.getUidElement(), false);
19338        composeOidExtras("uid", element.getUidElement(), false);
19339      }
19340      if (element.hasUrlElement()) {
19341        composeUriCore("url", element.getUrlElement(), false);
19342        composeUriExtras("url", element.getUrlElement(), false);
19343      }
19344      if (element.hasImagingStudy()) {
19345        composeReference("imagingStudy", element.getImagingStudy());
19346      }
19347      if (element.hasSeries()) {
19348        openArray("series");
19349        for (ImagingObjectSelection.SeriesComponent e : element.getSeries()) 
19350          composeImagingObjectSelectionSeriesComponent(null, e);
19351        closeArray();
19352      };
19353  }
19354
19355  protected void composeImagingObjectSelectionSeriesComponent(String name, ImagingObjectSelection.SeriesComponent element) throws IOException {
19356    if (element != null) {
19357      open(name);
19358      composeImagingObjectSelectionSeriesComponentInner(element);
19359      close();
19360    }
19361  }
19362
19363  protected void composeImagingObjectSelectionSeriesComponentInner(ImagingObjectSelection.SeriesComponent element) throws IOException {
19364      composeBackbone(element);
19365      if (element.hasUidElement()) {
19366        composeOidCore("uid", element.getUidElement(), false);
19367        composeOidExtras("uid", element.getUidElement(), false);
19368      }
19369      if (element.hasUrlElement()) {
19370        composeUriCore("url", element.getUrlElement(), false);
19371        composeUriExtras("url", element.getUrlElement(), false);
19372      }
19373      if (element.hasInstance()) {
19374        openArray("instance");
19375        for (ImagingObjectSelection.InstanceComponent e : element.getInstance()) 
19376          composeImagingObjectSelectionInstanceComponent(null, e);
19377        closeArray();
19378      };
19379  }
19380
19381  protected void composeImagingObjectSelectionInstanceComponent(String name, ImagingObjectSelection.InstanceComponent element) throws IOException {
19382    if (element != null) {
19383      open(name);
19384      composeImagingObjectSelectionInstanceComponentInner(element);
19385      close();
19386    }
19387  }
19388
19389  protected void composeImagingObjectSelectionInstanceComponentInner(ImagingObjectSelection.InstanceComponent element) throws IOException {
19390      composeBackbone(element);
19391      if (element.hasSopClassElement()) {
19392        composeOidCore("sopClass", element.getSopClassElement(), false);
19393        composeOidExtras("sopClass", element.getSopClassElement(), false);
19394      }
19395      if (element.hasUidElement()) {
19396        composeOidCore("uid", element.getUidElement(), false);
19397        composeOidExtras("uid", element.getUidElement(), false);
19398      }
19399      if (element.hasUrlElement()) {
19400        composeUriCore("url", element.getUrlElement(), false);
19401        composeUriExtras("url", element.getUrlElement(), false);
19402      }
19403      if (element.hasFrames()) {
19404        openArray("frames");
19405        for (ImagingObjectSelection.FramesComponent e : element.getFrames()) 
19406          composeImagingObjectSelectionFramesComponent(null, e);
19407        closeArray();
19408      };
19409  }
19410
19411  protected void composeImagingObjectSelectionFramesComponent(String name, ImagingObjectSelection.FramesComponent element) throws IOException {
19412    if (element != null) {
19413      open(name);
19414      composeImagingObjectSelectionFramesComponentInner(element);
19415      close();
19416    }
19417  }
19418
19419  protected void composeImagingObjectSelectionFramesComponentInner(ImagingObjectSelection.FramesComponent element) throws IOException {
19420      composeBackbone(element);
19421      if (element.hasFrameNumbers()) {
19422        openArray("frameNumbers");
19423        for (UnsignedIntType e : element.getFrameNumbers()) 
19424          composeUnsignedIntCore(null, e, true);
19425        closeArray();
19426        if (anyHasExtras(element.getFrameNumbers())) {
19427          openArray("_frameNumbers");
19428          for (UnsignedIntType e : element.getFrameNumbers()) 
19429            composeUnsignedIntExtras(null, e, true);
19430          closeArray();
19431        }
19432      };
19433      if (element.hasUrlElement()) {
19434        composeUriCore("url", element.getUrlElement(), false);
19435        composeUriExtras("url", element.getUrlElement(), false);
19436      }
19437  }
19438
19439  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
19440    if (element != null) {
19441      prop("resourceType", name);
19442      composeImagingStudyInner(element);
19443    }
19444  }
19445
19446  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
19447      composeDomainResourceElements(element);
19448      if (element.hasStartedElement()) {
19449        composeDateTimeCore("started", element.getStartedElement(), false);
19450        composeDateTimeExtras("started", element.getStartedElement(), false);
19451      }
19452      if (element.hasPatient()) {
19453        composeReference("patient", element.getPatient());
19454      }
19455      if (element.hasUidElement()) {
19456        composeOidCore("uid", element.getUidElement(), false);
19457        composeOidExtras("uid", element.getUidElement(), false);
19458      }
19459      if (element.hasAccession()) {
19460        composeIdentifier("accession", element.getAccession());
19461      }
19462      if (element.hasIdentifier()) {
19463        openArray("identifier");
19464        for (Identifier e : element.getIdentifier()) 
19465          composeIdentifier(null, e);
19466        closeArray();
19467      };
19468      if (element.hasOrder()) {
19469        openArray("order");
19470        for (Reference e : element.getOrder()) 
19471          composeReference(null, e);
19472        closeArray();
19473      };
19474      if (element.hasModalityList()) {
19475        openArray("modalityList");
19476        for (Coding e : element.getModalityList()) 
19477          composeCoding(null, e);
19478        closeArray();
19479      };
19480      if (element.hasReferrer()) {
19481        composeReference("referrer", element.getReferrer());
19482      }
19483      if (element.hasAvailabilityElement()) {
19484        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19485        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19486      }
19487      if (element.hasUrlElement()) {
19488        composeUriCore("url", element.getUrlElement(), false);
19489        composeUriExtras("url", element.getUrlElement(), false);
19490      }
19491      if (element.hasNumberOfSeriesElement()) {
19492        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
19493        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
19494      }
19495      if (element.hasNumberOfInstancesElement()) {
19496        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19497        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19498      }
19499      if (element.hasProcedure()) {
19500        openArray("procedure");
19501        for (Reference e : element.getProcedure()) 
19502          composeReference(null, e);
19503        closeArray();
19504      };
19505      if (element.hasInterpreter()) {
19506        composeReference("interpreter", element.getInterpreter());
19507      }
19508      if (element.hasDescriptionElement()) {
19509        composeStringCore("description", element.getDescriptionElement(), false);
19510        composeStringExtras("description", element.getDescriptionElement(), false);
19511      }
19512      if (element.hasSeries()) {
19513        openArray("series");
19514        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
19515          composeImagingStudyImagingStudySeriesComponent(null, e);
19516        closeArray();
19517      };
19518  }
19519
19520  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19521    if (element != null) {
19522      open(name);
19523      composeImagingStudyImagingStudySeriesComponentInner(element);
19524      close();
19525    }
19526  }
19527
19528  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19529      composeBackbone(element);
19530      if (element.hasNumberElement()) {
19531        composeUnsignedIntCore("number", element.getNumberElement(), false);
19532        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19533      }
19534      if (element.hasModality()) {
19535        composeCoding("modality", element.getModality());
19536      }
19537      if (element.hasUidElement()) {
19538        composeOidCore("uid", element.getUidElement(), false);
19539        composeOidExtras("uid", element.getUidElement(), false);
19540      }
19541      if (element.hasDescriptionElement()) {
19542        composeStringCore("description", element.getDescriptionElement(), false);
19543        composeStringExtras("description", element.getDescriptionElement(), false);
19544      }
19545      if (element.hasNumberOfInstancesElement()) {
19546        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19547        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19548      }
19549      if (element.hasAvailabilityElement()) {
19550        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19551        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19552      }
19553      if (element.hasUrlElement()) {
19554        composeUriCore("url", element.getUrlElement(), false);
19555        composeUriExtras("url", element.getUrlElement(), false);
19556      }
19557      if (element.hasBodySite()) {
19558        composeCoding("bodySite", element.getBodySite());
19559      }
19560      if (element.hasLaterality()) {
19561        composeCoding("laterality", element.getLaterality());
19562      }
19563      if (element.hasStartedElement()) {
19564        composeDateTimeCore("started", element.getStartedElement(), false);
19565        composeDateTimeExtras("started", element.getStartedElement(), false);
19566      }
19567      if (element.hasInstance()) {
19568        openArray("instance");
19569        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
19570          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
19571        closeArray();
19572      };
19573  }
19574
19575  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19576    if (element != null) {
19577      open(name);
19578      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
19579      close();
19580    }
19581  }
19582
19583  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19584      composeBackbone(element);
19585      if (element.hasNumberElement()) {
19586        composeUnsignedIntCore("number", element.getNumberElement(), false);
19587        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19588      }
19589      if (element.hasUidElement()) {
19590        composeOidCore("uid", element.getUidElement(), false);
19591        composeOidExtras("uid", element.getUidElement(), false);
19592      }
19593      if (element.hasSopClassElement()) {
19594        composeOidCore("sopClass", element.getSopClassElement(), false);
19595        composeOidExtras("sopClass", element.getSopClassElement(), false);
19596      }
19597      if (element.hasTypeElement()) {
19598        composeStringCore("type", element.getTypeElement(), false);
19599        composeStringExtras("type", element.getTypeElement(), false);
19600      }
19601      if (element.hasTitleElement()) {
19602        composeStringCore("title", element.getTitleElement(), false);
19603        composeStringExtras("title", element.getTitleElement(), false);
19604      }
19605      if (element.hasContent()) {
19606        openArray("content");
19607        for (Attachment e : element.getContent()) 
19608          composeAttachment(null, e);
19609        closeArray();
19610      };
19611  }
19612
19613  protected void composeImmunization(String name, Immunization element) throws IOException {
19614    if (element != null) {
19615      prop("resourceType", name);
19616      composeImmunizationInner(element);
19617    }
19618  }
19619
19620  protected void composeImmunizationInner(Immunization element) throws IOException {
19621      composeDomainResourceElements(element);
19622      if (element.hasIdentifier()) {
19623        openArray("identifier");
19624        for (Identifier e : element.getIdentifier()) 
19625          composeIdentifier(null, e);
19626        closeArray();
19627      };
19628      if (element.hasStatusElement()) {
19629        composeCodeCore("status", element.getStatusElement(), false);
19630        composeCodeExtras("status", element.getStatusElement(), false);
19631      }
19632      if (element.hasDateElement()) {
19633        composeDateTimeCore("date", element.getDateElement(), false);
19634        composeDateTimeExtras("date", element.getDateElement(), false);
19635      }
19636      if (element.hasVaccineCode()) {
19637        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19638      }
19639      if (element.hasPatient()) {
19640        composeReference("patient", element.getPatient());
19641      }
19642      if (element.hasWasNotGivenElement()) {
19643        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
19644        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
19645      }
19646      if (element.hasReportedElement()) {
19647        composeBooleanCore("reported", element.getReportedElement(), false);
19648        composeBooleanExtras("reported", element.getReportedElement(), false);
19649      }
19650      if (element.hasPerformer()) {
19651        composeReference("performer", element.getPerformer());
19652      }
19653      if (element.hasRequester()) {
19654        composeReference("requester", element.getRequester());
19655      }
19656      if (element.hasEncounter()) {
19657        composeReference("encounter", element.getEncounter());
19658      }
19659      if (element.hasManufacturer()) {
19660        composeReference("manufacturer", element.getManufacturer());
19661      }
19662      if (element.hasLocation()) {
19663        composeReference("location", element.getLocation());
19664      }
19665      if (element.hasLotNumberElement()) {
19666        composeStringCore("lotNumber", element.getLotNumberElement(), false);
19667        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
19668      }
19669      if (element.hasExpirationDateElement()) {
19670        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
19671        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
19672      }
19673      if (element.hasSite()) {
19674        composeCodeableConcept("site", element.getSite());
19675      }
19676      if (element.hasRoute()) {
19677        composeCodeableConcept("route", element.getRoute());
19678      }
19679      if (element.hasDoseQuantity()) {
19680        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
19681      }
19682      if (element.hasNote()) {
19683        openArray("note");
19684        for (Annotation e : element.getNote()) 
19685          composeAnnotation(null, e);
19686        closeArray();
19687      };
19688      if (element.hasExplanation()) {
19689        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
19690      }
19691      if (element.hasReaction()) {
19692        openArray("reaction");
19693        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
19694          composeImmunizationImmunizationReactionComponent(null, e);
19695        closeArray();
19696      };
19697      if (element.hasVaccinationProtocol()) {
19698        openArray("vaccinationProtocol");
19699        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
19700          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
19701        closeArray();
19702      };
19703  }
19704
19705  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
19706    if (element != null) {
19707      open(name);
19708      composeImmunizationImmunizationExplanationComponentInner(element);
19709      close();
19710    }
19711  }
19712
19713  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
19714      composeBackbone(element);
19715      if (element.hasReason()) {
19716        openArray("reason");
19717        for (CodeableConcept e : element.getReason()) 
19718          composeCodeableConcept(null, e);
19719        closeArray();
19720      };
19721      if (element.hasReasonNotGiven()) {
19722        openArray("reasonNotGiven");
19723        for (CodeableConcept e : element.getReasonNotGiven()) 
19724          composeCodeableConcept(null, e);
19725        closeArray();
19726      };
19727  }
19728
19729  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
19730    if (element != null) {
19731      open(name);
19732      composeImmunizationImmunizationReactionComponentInner(element);
19733      close();
19734    }
19735  }
19736
19737  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
19738      composeBackbone(element);
19739      if (element.hasDateElement()) {
19740        composeDateTimeCore("date", element.getDateElement(), false);
19741        composeDateTimeExtras("date", element.getDateElement(), false);
19742      }
19743      if (element.hasDetail()) {
19744        composeReference("detail", element.getDetail());
19745      }
19746      if (element.hasReportedElement()) {
19747        composeBooleanCore("reported", element.getReportedElement(), false);
19748        composeBooleanExtras("reported", element.getReportedElement(), false);
19749      }
19750  }
19751
19752  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19753    if (element != null) {
19754      open(name);
19755      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
19756      close();
19757    }
19758  }
19759
19760  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19761      composeBackbone(element);
19762      if (element.hasDoseSequenceElement()) {
19763        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
19764        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
19765      }
19766      if (element.hasDescriptionElement()) {
19767        composeStringCore("description", element.getDescriptionElement(), false);
19768        composeStringExtras("description", element.getDescriptionElement(), false);
19769      }
19770      if (element.hasAuthority()) {
19771        composeReference("authority", element.getAuthority());
19772      }
19773      if (element.hasSeriesElement()) {
19774        composeStringCore("series", element.getSeriesElement(), false);
19775        composeStringExtras("series", element.getSeriesElement(), false);
19776      }
19777      if (element.hasSeriesDosesElement()) {
19778        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
19779        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
19780      }
19781      if (element.hasTargetDisease()) {
19782        openArray("targetDisease");
19783        for (CodeableConcept e : element.getTargetDisease()) 
19784          composeCodeableConcept(null, e);
19785        closeArray();
19786      };
19787      if (element.hasDoseStatus()) {
19788        composeCodeableConcept("doseStatus", element.getDoseStatus());
19789      }
19790      if (element.hasDoseStatusReason()) {
19791        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
19792      }
19793  }
19794
19795  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
19796    if (element != null) {
19797      prop("resourceType", name);
19798      composeImmunizationRecommendationInner(element);
19799    }
19800  }
19801
19802  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
19803      composeDomainResourceElements(element);
19804      if (element.hasIdentifier()) {
19805        openArray("identifier");
19806        for (Identifier e : element.getIdentifier()) 
19807          composeIdentifier(null, e);
19808        closeArray();
19809      };
19810      if (element.hasPatient()) {
19811        composeReference("patient", element.getPatient());
19812      }
19813      if (element.hasRecommendation()) {
19814        openArray("recommendation");
19815        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
19816          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
19817        closeArray();
19818      };
19819  }
19820
19821  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19822    if (element != null) {
19823      open(name);
19824      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
19825      close();
19826    }
19827  }
19828
19829  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19830      composeBackbone(element);
19831      if (element.hasDateElement()) {
19832        composeDateTimeCore("date", element.getDateElement(), false);
19833        composeDateTimeExtras("date", element.getDateElement(), false);
19834      }
19835      if (element.hasVaccineCode()) {
19836        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19837      }
19838      if (element.hasDoseNumberElement()) {
19839        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
19840        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
19841      }
19842      if (element.hasForecastStatus()) {
19843        composeCodeableConcept("forecastStatus", element.getForecastStatus());
19844      }
19845      if (element.hasDateCriterion()) {
19846        openArray("dateCriterion");
19847        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
19848          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
19849        closeArray();
19850      };
19851      if (element.hasProtocol()) {
19852        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
19853      }
19854      if (element.hasSupportingImmunization()) {
19855        openArray("supportingImmunization");
19856        for (Reference e : element.getSupportingImmunization()) 
19857          composeReference(null, e);
19858        closeArray();
19859      };
19860      if (element.hasSupportingPatientInformation()) {
19861        openArray("supportingPatientInformation");
19862        for (Reference e : element.getSupportingPatientInformation()) 
19863          composeReference(null, e);
19864        closeArray();
19865      };
19866  }
19867
19868  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19869    if (element != null) {
19870      open(name);
19871      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
19872      close();
19873    }
19874  }
19875
19876  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19877      composeBackbone(element);
19878      if (element.hasCode()) {
19879        composeCodeableConcept("code", element.getCode());
19880      }
19881      if (element.hasValueElement()) {
19882        composeDateTimeCore("value", element.getValueElement(), false);
19883        composeDateTimeExtras("value", element.getValueElement(), false);
19884      }
19885  }
19886
19887  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19888    if (element != null) {
19889      open(name);
19890      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
19891      close();
19892    }
19893  }
19894
19895  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19896      composeBackbone(element);
19897      if (element.hasDoseSequenceElement()) {
19898        composeIntegerCore("doseSequence", element.getDoseSequenceElement(), false);
19899        composeIntegerExtras("doseSequence", element.getDoseSequenceElement(), false);
19900      }
19901      if (element.hasDescriptionElement()) {
19902        composeStringCore("description", element.getDescriptionElement(), false);
19903        composeStringExtras("description", element.getDescriptionElement(), false);
19904      }
19905      if (element.hasAuthority()) {
19906        composeReference("authority", element.getAuthority());
19907      }
19908      if (element.hasSeriesElement()) {
19909        composeStringCore("series", element.getSeriesElement(), false);
19910        composeStringExtras("series", element.getSeriesElement(), false);
19911      }
19912  }
19913
19914  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
19915    if (element != null) {
19916      prop("resourceType", name);
19917      composeImplementationGuideInner(element);
19918    }
19919  }
19920
19921  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
19922      composeDomainResourceElements(element);
19923      if (element.hasUrlElement()) {
19924        composeUriCore("url", element.getUrlElement(), false);
19925        composeUriExtras("url", element.getUrlElement(), false);
19926      }
19927      if (element.hasVersionElement()) {
19928        composeStringCore("version", element.getVersionElement(), false);
19929        composeStringExtras("version", element.getVersionElement(), false);
19930      }
19931      if (element.hasNameElement()) {
19932        composeStringCore("name", element.getNameElement(), false);
19933        composeStringExtras("name", element.getNameElement(), false);
19934      }
19935      if (element.hasStatusElement()) {
19936        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19937        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19938      }
19939      if (element.hasExperimentalElement()) {
19940        composeBooleanCore("experimental", element.getExperimentalElement(), false);
19941        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
19942      }
19943      if (element.hasPublisherElement()) {
19944        composeStringCore("publisher", element.getPublisherElement(), false);
19945        composeStringExtras("publisher", element.getPublisherElement(), false);
19946      }
19947      if (element.hasContact()) {
19948        openArray("contact");
19949        for (ImplementationGuide.ImplementationGuideContactComponent e : element.getContact()) 
19950          composeImplementationGuideImplementationGuideContactComponent(null, e);
19951        closeArray();
19952      };
19953      if (element.hasDateElement()) {
19954        composeDateTimeCore("date", element.getDateElement(), false);
19955        composeDateTimeExtras("date", element.getDateElement(), false);
19956      }
19957      if (element.hasDescriptionElement()) {
19958        composeStringCore("description", element.getDescriptionElement(), false);
19959        composeStringExtras("description", element.getDescriptionElement(), false);
19960      }
19961      if (element.hasUseContext()) {
19962        openArray("useContext");
19963        for (CodeableConcept e : element.getUseContext()) 
19964          composeCodeableConcept(null, e);
19965        closeArray();
19966      };
19967      if (element.hasCopyrightElement()) {
19968        composeStringCore("copyright", element.getCopyrightElement(), false);
19969        composeStringExtras("copyright", element.getCopyrightElement(), false);
19970      }
19971      if (element.hasFhirVersionElement()) {
19972        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
19973        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
19974      }
19975      if (element.hasDependency()) {
19976        openArray("dependency");
19977        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
19978          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
19979        closeArray();
19980      };
19981      if (element.hasPackage()) {
19982        openArray("package");
19983        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
19984          composeImplementationGuideImplementationGuidePackageComponent(null, e);
19985        closeArray();
19986      };
19987      if (element.hasGlobal()) {
19988        openArray("global");
19989        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
19990          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
19991        closeArray();
19992      };
19993      if (element.hasBinary()) {
19994        openArray("binary");
19995        for (UriType e : element.getBinary()) 
19996          composeUriCore(null, e, true);
19997        closeArray();
19998        if (anyHasExtras(element.getBinary())) {
19999          openArray("_binary");
20000          for (UriType e : element.getBinary()) 
20001            composeUriExtras(null, e, true);
20002          closeArray();
20003        }
20004      };
20005      if (element.hasPage()) {
20006        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
20007      }
20008  }
20009
20010  protected void composeImplementationGuideImplementationGuideContactComponent(String name, ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20011    if (element != null) {
20012      open(name);
20013      composeImplementationGuideImplementationGuideContactComponentInner(element);
20014      close();
20015    }
20016  }
20017
20018  protected void composeImplementationGuideImplementationGuideContactComponentInner(ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20019      composeBackbone(element);
20020      if (element.hasNameElement()) {
20021        composeStringCore("name", element.getNameElement(), false);
20022        composeStringExtras("name", element.getNameElement(), false);
20023      }
20024      if (element.hasTelecom()) {
20025        openArray("telecom");
20026        for (ContactPoint e : element.getTelecom()) 
20027          composeContactPoint(null, e);
20028        closeArray();
20029      };
20030  }
20031
20032  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20033    if (element != null) {
20034      open(name);
20035      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
20036      close();
20037    }
20038  }
20039
20040  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20041      composeBackbone(element);
20042      if (element.hasTypeElement()) {
20043        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20044        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20045      }
20046      if (element.hasUriElement()) {
20047        composeUriCore("uri", element.getUriElement(), false);
20048        composeUriExtras("uri", element.getUriElement(), false);
20049      }
20050  }
20051
20052  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20053    if (element != null) {
20054      open(name);
20055      composeImplementationGuideImplementationGuidePackageComponentInner(element);
20056      close();
20057    }
20058  }
20059
20060  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20061      composeBackbone(element);
20062      if (element.hasNameElement()) {
20063        composeStringCore("name", element.getNameElement(), false);
20064        composeStringExtras("name", element.getNameElement(), false);
20065      }
20066      if (element.hasDescriptionElement()) {
20067        composeStringCore("description", element.getDescriptionElement(), false);
20068        composeStringExtras("description", element.getDescriptionElement(), false);
20069      }
20070      if (element.hasResource()) {
20071        openArray("resource");
20072        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
20073          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
20074        closeArray();
20075      };
20076  }
20077
20078  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20079    if (element != null) {
20080      open(name);
20081      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
20082      close();
20083    }
20084  }
20085
20086  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20087      composeBackbone(element);
20088      if (element.hasPurposeElement()) {
20089        composeEnumerationCore("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20090        composeEnumerationExtras("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20091      }
20092      if (element.hasNameElement()) {
20093        composeStringCore("name", element.getNameElement(), false);
20094        composeStringExtras("name", element.getNameElement(), false);
20095      }
20096      if (element.hasDescriptionElement()) {
20097        composeStringCore("description", element.getDescriptionElement(), false);
20098        composeStringExtras("description", element.getDescriptionElement(), false);
20099      }
20100      if (element.hasAcronymElement()) {
20101        composeStringCore("acronym", element.getAcronymElement(), false);
20102        composeStringExtras("acronym", element.getAcronymElement(), false);
20103      }
20104      if (element.hasSource()) {
20105        composeType("source", element.getSource());
20106      }
20107      if (element.hasExampleFor()) {
20108        composeReference("exampleFor", element.getExampleFor());
20109      }
20110  }
20111
20112  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20113    if (element != null) {
20114      open(name);
20115      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
20116      close();
20117    }
20118  }
20119
20120  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20121      composeBackbone(element);
20122      if (element.hasTypeElement()) {
20123        composeCodeCore("type", element.getTypeElement(), false);
20124        composeCodeExtras("type", element.getTypeElement(), false);
20125      }
20126      if (element.hasProfile()) {
20127        composeReference("profile", element.getProfile());
20128      }
20129  }
20130
20131  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20132    if (element != null) {
20133      open(name);
20134      composeImplementationGuideImplementationGuidePageComponentInner(element);
20135      close();
20136    }
20137  }
20138
20139  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20140      composeBackbone(element);
20141      if (element.hasSourceElement()) {
20142        composeUriCore("source", element.getSourceElement(), false);
20143        composeUriExtras("source", element.getSourceElement(), false);
20144      }
20145      if (element.hasNameElement()) {
20146        composeStringCore("name", element.getNameElement(), false);
20147        composeStringExtras("name", element.getNameElement(), false);
20148      }
20149      if (element.hasKindElement()) {
20150        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20151        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20152      }
20153      if (element.hasType()) {
20154        openArray("type");
20155        for (CodeType e : element.getType()) 
20156          composeCodeCore(null, e, true);
20157        closeArray();
20158        if (anyHasExtras(element.getType())) {
20159          openArray("_type");
20160          for (CodeType e : element.getType()) 
20161            composeCodeExtras(null, e, true);
20162          closeArray();
20163        }
20164      };
20165      if (element.hasPackage()) {
20166        openArray("package");
20167        for (StringType e : element.getPackage()) 
20168          composeStringCore(null, e, true);
20169        closeArray();
20170        if (anyHasExtras(element.getPackage())) {
20171          openArray("_package");
20172          for (StringType e : element.getPackage()) 
20173            composeStringExtras(null, e, true);
20174          closeArray();
20175        }
20176      };
20177      if (element.hasFormatElement()) {
20178        composeCodeCore("format", element.getFormatElement(), false);
20179        composeCodeExtras("format", element.getFormatElement(), false);
20180      }
20181      if (element.hasPage()) {
20182        openArray("page");
20183        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
20184          composeImplementationGuideImplementationGuidePageComponent(null, e);
20185        closeArray();
20186      };
20187  }
20188
20189  protected void composeList_(String name, List_ element) throws IOException {
20190    if (element != null) {
20191      prop("resourceType", name);
20192      composeList_Inner(element);
20193    }
20194  }
20195
20196  protected void composeList_Inner(List_ element) throws IOException {
20197      composeDomainResourceElements(element);
20198      if (element.hasIdentifier()) {
20199        openArray("identifier");
20200        for (Identifier e : element.getIdentifier()) 
20201          composeIdentifier(null, e);
20202        closeArray();
20203      };
20204      if (element.hasTitleElement()) {
20205        composeStringCore("title", element.getTitleElement(), false);
20206        composeStringExtras("title", element.getTitleElement(), false);
20207      }
20208      if (element.hasCode()) {
20209        composeCodeableConcept("code", element.getCode());
20210      }
20211      if (element.hasSubject()) {
20212        composeReference("subject", element.getSubject());
20213      }
20214      if (element.hasSource()) {
20215        composeReference("source", element.getSource());
20216      }
20217      if (element.hasEncounter()) {
20218        composeReference("encounter", element.getEncounter());
20219      }
20220      if (element.hasStatusElement()) {
20221        composeEnumerationCore("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20222        composeEnumerationExtras("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20223      }
20224      if (element.hasDateElement()) {
20225        composeDateTimeCore("date", element.getDateElement(), false);
20226        composeDateTimeExtras("date", element.getDateElement(), false);
20227      }
20228      if (element.hasOrderedBy()) {
20229        composeCodeableConcept("orderedBy", element.getOrderedBy());
20230      }
20231      if (element.hasModeElement()) {
20232        composeEnumerationCore("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20233        composeEnumerationExtras("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20234      }
20235      if (element.hasNoteElement()) {
20236        composeStringCore("note", element.getNoteElement(), false);
20237        composeStringExtras("note", element.getNoteElement(), false);
20238      }
20239      if (element.hasEntry()) {
20240        openArray("entry");
20241        for (List_.ListEntryComponent e : element.getEntry()) 
20242          composeList_ListEntryComponent(null, e);
20243        closeArray();
20244      };
20245      if (element.hasEmptyReason()) {
20246        composeCodeableConcept("emptyReason", element.getEmptyReason());
20247      }
20248  }
20249
20250  protected void composeList_ListEntryComponent(String name, List_.ListEntryComponent element) throws IOException {
20251    if (element != null) {
20252      open(name);
20253      composeList_ListEntryComponentInner(element);
20254      close();
20255    }
20256  }
20257
20258  protected void composeList_ListEntryComponentInner(List_.ListEntryComponent element) throws IOException {
20259      composeBackbone(element);
20260      if (element.hasFlag()) {
20261        composeCodeableConcept("flag", element.getFlag());
20262      }
20263      if (element.hasDeletedElement()) {
20264        composeBooleanCore("deleted", element.getDeletedElement(), false);
20265        composeBooleanExtras("deleted", element.getDeletedElement(), false);
20266      }
20267      if (element.hasDateElement()) {
20268        composeDateTimeCore("date", element.getDateElement(), false);
20269        composeDateTimeExtras("date", element.getDateElement(), false);
20270      }
20271      if (element.hasItem()) {
20272        composeReference("item", element.getItem());
20273      }
20274  }
20275
20276  protected void composeLocation(String name, Location element) throws IOException {
20277    if (element != null) {
20278      prop("resourceType", name);
20279      composeLocationInner(element);
20280    }
20281  }
20282
20283  protected void composeLocationInner(Location element) throws IOException {
20284      composeDomainResourceElements(element);
20285      if (element.hasIdentifier()) {
20286        openArray("identifier");
20287        for (Identifier e : element.getIdentifier()) 
20288          composeIdentifier(null, e);
20289        closeArray();
20290      };
20291      if (element.hasStatusElement()) {
20292        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20293        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20294      }
20295      if (element.hasNameElement()) {
20296        composeStringCore("name", element.getNameElement(), false);
20297        composeStringExtras("name", element.getNameElement(), false);
20298      }
20299      if (element.hasDescriptionElement()) {
20300        composeStringCore("description", element.getDescriptionElement(), false);
20301        composeStringExtras("description", element.getDescriptionElement(), false);
20302      }
20303      if (element.hasModeElement()) {
20304        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20305        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20306      }
20307      if (element.hasType()) {
20308        composeCodeableConcept("type", element.getType());
20309      }
20310      if (element.hasTelecom()) {
20311        openArray("telecom");
20312        for (ContactPoint e : element.getTelecom()) 
20313          composeContactPoint(null, e);
20314        closeArray();
20315      };
20316      if (element.hasAddress()) {
20317        composeAddress("address", element.getAddress());
20318      }
20319      if (element.hasPhysicalType()) {
20320        composeCodeableConcept("physicalType", element.getPhysicalType());
20321      }
20322      if (element.hasPosition()) {
20323        composeLocationLocationPositionComponent("position", element.getPosition());
20324      }
20325      if (element.hasManagingOrganization()) {
20326        composeReference("managingOrganization", element.getManagingOrganization());
20327      }
20328      if (element.hasPartOf()) {
20329        composeReference("partOf", element.getPartOf());
20330      }
20331  }
20332
20333  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
20334    if (element != null) {
20335      open(name);
20336      composeLocationLocationPositionComponentInner(element);
20337      close();
20338    }
20339  }
20340
20341  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
20342      composeBackbone(element);
20343      if (element.hasLongitudeElement()) {
20344        composeDecimalCore("longitude", element.getLongitudeElement(), false);
20345        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
20346      }
20347      if (element.hasLatitudeElement()) {
20348        composeDecimalCore("latitude", element.getLatitudeElement(), false);
20349        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
20350      }
20351      if (element.hasAltitudeElement()) {
20352        composeDecimalCore("altitude", element.getAltitudeElement(), false);
20353        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
20354      }
20355  }
20356
20357  protected void composeMedia(String name, Media element) throws IOException {
20358    if (element != null) {
20359      prop("resourceType", name);
20360      composeMediaInner(element);
20361    }
20362  }
20363
20364  protected void composeMediaInner(Media element) throws IOException {
20365      composeDomainResourceElements(element);
20366      if (element.hasTypeElement()) {
20367        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20368        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20369      }
20370      if (element.hasSubtype()) {
20371        composeCodeableConcept("subtype", element.getSubtype());
20372      }
20373      if (element.hasIdentifier()) {
20374        openArray("identifier");
20375        for (Identifier e : element.getIdentifier()) 
20376          composeIdentifier(null, e);
20377        closeArray();
20378      };
20379      if (element.hasSubject()) {
20380        composeReference("subject", element.getSubject());
20381      }
20382      if (element.hasOperator()) {
20383        composeReference("operator", element.getOperator());
20384      }
20385      if (element.hasView()) {
20386        composeCodeableConcept("view", element.getView());
20387      }
20388      if (element.hasDeviceNameElement()) {
20389        composeStringCore("deviceName", element.getDeviceNameElement(), false);
20390        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
20391      }
20392      if (element.hasHeightElement()) {
20393        composePositiveIntCore("height", element.getHeightElement(), false);
20394        composePositiveIntExtras("height", element.getHeightElement(), false);
20395      }
20396      if (element.hasWidthElement()) {
20397        composePositiveIntCore("width", element.getWidthElement(), false);
20398        composePositiveIntExtras("width", element.getWidthElement(), false);
20399      }
20400      if (element.hasFramesElement()) {
20401        composePositiveIntCore("frames", element.getFramesElement(), false);
20402        composePositiveIntExtras("frames", element.getFramesElement(), false);
20403      }
20404      if (element.hasDurationElement()) {
20405        composeUnsignedIntCore("duration", element.getDurationElement(), false);
20406        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
20407      }
20408      if (element.hasContent()) {
20409        composeAttachment("content", element.getContent());
20410      }
20411  }
20412
20413  protected void composeMedication(String name, Medication element) throws IOException {
20414    if (element != null) {
20415      prop("resourceType", name);
20416      composeMedicationInner(element);
20417    }
20418  }
20419
20420  protected void composeMedicationInner(Medication element) throws IOException {
20421      composeDomainResourceElements(element);
20422      if (element.hasCode()) {
20423        composeCodeableConcept("code", element.getCode());
20424      }
20425      if (element.hasIsBrandElement()) {
20426        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
20427        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
20428      }
20429      if (element.hasManufacturer()) {
20430        composeReference("manufacturer", element.getManufacturer());
20431      }
20432      if (element.hasProduct()) {
20433        composeMedicationMedicationProductComponent("product", element.getProduct());
20434      }
20435      if (element.hasPackage()) {
20436        composeMedicationMedicationPackageComponent("package", element.getPackage());
20437      }
20438  }
20439
20440  protected void composeMedicationMedicationProductComponent(String name, Medication.MedicationProductComponent element) throws IOException {
20441    if (element != null) {
20442      open(name);
20443      composeMedicationMedicationProductComponentInner(element);
20444      close();
20445    }
20446  }
20447
20448  protected void composeMedicationMedicationProductComponentInner(Medication.MedicationProductComponent element) throws IOException {
20449      composeBackbone(element);
20450      if (element.hasForm()) {
20451        composeCodeableConcept("form", element.getForm());
20452      }
20453      if (element.hasIngredient()) {
20454        openArray("ingredient");
20455        for (Medication.MedicationProductIngredientComponent e : element.getIngredient()) 
20456          composeMedicationMedicationProductIngredientComponent(null, e);
20457        closeArray();
20458      };
20459      if (element.hasBatch()) {
20460        openArray("batch");
20461        for (Medication.MedicationProductBatchComponent e : element.getBatch()) 
20462          composeMedicationMedicationProductBatchComponent(null, e);
20463        closeArray();
20464      };
20465  }
20466
20467  protected void composeMedicationMedicationProductIngredientComponent(String name, Medication.MedicationProductIngredientComponent element) throws IOException {
20468    if (element != null) {
20469      open(name);
20470      composeMedicationMedicationProductIngredientComponentInner(element);
20471      close();
20472    }
20473  }
20474
20475  protected void composeMedicationMedicationProductIngredientComponentInner(Medication.MedicationProductIngredientComponent element) throws IOException {
20476      composeBackbone(element);
20477      if (element.hasItem()) {
20478        composeReference("item", element.getItem());
20479      }
20480      if (element.hasAmount()) {
20481        composeRatio("amount", element.getAmount());
20482      }
20483  }
20484
20485  protected void composeMedicationMedicationProductBatchComponent(String name, Medication.MedicationProductBatchComponent element) throws IOException {
20486    if (element != null) {
20487      open(name);
20488      composeMedicationMedicationProductBatchComponentInner(element);
20489      close();
20490    }
20491  }
20492
20493  protected void composeMedicationMedicationProductBatchComponentInner(Medication.MedicationProductBatchComponent element) throws IOException {
20494      composeBackbone(element);
20495      if (element.hasLotNumberElement()) {
20496        composeStringCore("lotNumber", element.getLotNumberElement(), false);
20497        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
20498      }
20499      if (element.hasExpirationDateElement()) {
20500        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
20501        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
20502      }
20503  }
20504
20505  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
20506    if (element != null) {
20507      open(name);
20508      composeMedicationMedicationPackageComponentInner(element);
20509      close();
20510    }
20511  }
20512
20513  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
20514      composeBackbone(element);
20515      if (element.hasContainer()) {
20516        composeCodeableConcept("container", element.getContainer());
20517      }
20518      if (element.hasContent()) {
20519        openArray("content");
20520        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
20521          composeMedicationMedicationPackageContentComponent(null, e);
20522        closeArray();
20523      };
20524  }
20525
20526  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
20527    if (element != null) {
20528      open(name);
20529      composeMedicationMedicationPackageContentComponentInner(element);
20530      close();
20531    }
20532  }
20533
20534  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
20535      composeBackbone(element);
20536      if (element.hasItem()) {
20537        composeReference("item", element.getItem());
20538      }
20539      if (element.hasAmount()) {
20540        composeSimpleQuantity("amount", element.getAmount());
20541      }
20542  }
20543
20544  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
20545    if (element != null) {
20546      prop("resourceType", name);
20547      composeMedicationAdministrationInner(element);
20548    }
20549  }
20550
20551  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
20552      composeDomainResourceElements(element);
20553      if (element.hasIdentifier()) {
20554        openArray("identifier");
20555        for (Identifier e : element.getIdentifier()) 
20556          composeIdentifier(null, e);
20557        closeArray();
20558      };
20559      if (element.hasStatusElement()) {
20560        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20561        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20562      }
20563      if (element.hasPatient()) {
20564        composeReference("patient", element.getPatient());
20565      }
20566      if (element.hasPractitioner()) {
20567        composeReference("practitioner", element.getPractitioner());
20568      }
20569      if (element.hasEncounter()) {
20570        composeReference("encounter", element.getEncounter());
20571      }
20572      if (element.hasPrescription()) {
20573        composeReference("prescription", element.getPrescription());
20574      }
20575      if (element.hasWasNotGivenElement()) {
20576        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
20577        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
20578      }
20579      if (element.hasReasonNotGiven()) {
20580        openArray("reasonNotGiven");
20581        for (CodeableConcept e : element.getReasonNotGiven()) 
20582          composeCodeableConcept(null, e);
20583        closeArray();
20584      };
20585      if (element.hasReasonGiven()) {
20586        openArray("reasonGiven");
20587        for (CodeableConcept e : element.getReasonGiven()) 
20588          composeCodeableConcept(null, e);
20589        closeArray();
20590      };
20591      if (element.hasEffectiveTime()) {
20592        composeType("effectiveTime", element.getEffectiveTime());
20593      }
20594      if (element.hasMedication()) {
20595        composeType("medication", element.getMedication());
20596      }
20597      if (element.hasDevice()) {
20598        openArray("device");
20599        for (Reference e : element.getDevice()) 
20600          composeReference(null, e);
20601        closeArray();
20602      };
20603      if (element.hasNoteElement()) {
20604        composeStringCore("note", element.getNoteElement(), false);
20605        composeStringExtras("note", element.getNoteElement(), false);
20606      }
20607      if (element.hasDosage()) {
20608        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
20609      }
20610  }
20611
20612  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20613    if (element != null) {
20614      open(name);
20615      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
20616      close();
20617    }
20618  }
20619
20620  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20621      composeBackbone(element);
20622      if (element.hasTextElement()) {
20623        composeStringCore("text", element.getTextElement(), false);
20624        composeStringExtras("text", element.getTextElement(), false);
20625      }
20626      if (element.hasSite()) {
20627        composeType("site", element.getSite());
20628      }
20629      if (element.hasRoute()) {
20630        composeCodeableConcept("route", element.getRoute());
20631      }
20632      if (element.hasMethod()) {
20633        composeCodeableConcept("method", element.getMethod());
20634      }
20635      if (element.hasQuantity()) {
20636        composeSimpleQuantity("quantity", element.getQuantity());
20637      }
20638      if (element.hasRate()) {
20639        composeType("rate", element.getRate());
20640      }
20641  }
20642
20643  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
20644    if (element != null) {
20645      prop("resourceType", name);
20646      composeMedicationDispenseInner(element);
20647    }
20648  }
20649
20650  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
20651      composeDomainResourceElements(element);
20652      if (element.hasIdentifier()) {
20653        composeIdentifier("identifier", element.getIdentifier());
20654      }
20655      if (element.hasStatusElement()) {
20656        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20657        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20658      }
20659      if (element.hasPatient()) {
20660        composeReference("patient", element.getPatient());
20661      }
20662      if (element.hasDispenser()) {
20663        composeReference("dispenser", element.getDispenser());
20664      }
20665      if (element.hasAuthorizingPrescription()) {
20666        openArray("authorizingPrescription");
20667        for (Reference e : element.getAuthorizingPrescription()) 
20668          composeReference(null, e);
20669        closeArray();
20670      };
20671      if (element.hasType()) {
20672        composeCodeableConcept("type", element.getType());
20673      }
20674      if (element.hasQuantity()) {
20675        composeSimpleQuantity("quantity", element.getQuantity());
20676      }
20677      if (element.hasDaysSupply()) {
20678        composeSimpleQuantity("daysSupply", element.getDaysSupply());
20679      }
20680      if (element.hasMedication()) {
20681        composeType("medication", element.getMedication());
20682      }
20683      if (element.hasWhenPreparedElement()) {
20684        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
20685        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
20686      }
20687      if (element.hasWhenHandedOverElement()) {
20688        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
20689        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
20690      }
20691      if (element.hasDestination()) {
20692        composeReference("destination", element.getDestination());
20693      }
20694      if (element.hasReceiver()) {
20695        openArray("receiver");
20696        for (Reference e : element.getReceiver()) 
20697          composeReference(null, e);
20698        closeArray();
20699      };
20700      if (element.hasNoteElement()) {
20701        composeStringCore("note", element.getNoteElement(), false);
20702        composeStringExtras("note", element.getNoteElement(), false);
20703      }
20704      if (element.hasDosageInstruction()) {
20705        openArray("dosageInstruction");
20706        for (MedicationDispense.MedicationDispenseDosageInstructionComponent e : element.getDosageInstruction()) 
20707          composeMedicationDispenseMedicationDispenseDosageInstructionComponent(null, e);
20708        closeArray();
20709      };
20710      if (element.hasSubstitution()) {
20711        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
20712      }
20713  }
20714
20715  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponent(String name, MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20716    if (element != null) {
20717      open(name);
20718      composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(element);
20719      close();
20720    }
20721  }
20722
20723  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20724      composeBackbone(element);
20725      if (element.hasTextElement()) {
20726        composeStringCore("text", element.getTextElement(), false);
20727        composeStringExtras("text", element.getTextElement(), false);
20728      }
20729      if (element.hasAdditionalInstructions()) {
20730        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20731      }
20732      if (element.hasTiming()) {
20733        composeTiming("timing", element.getTiming());
20734      }
20735      if (element.hasAsNeeded()) {
20736        composeType("asNeeded", element.getAsNeeded());
20737      }
20738      if (element.hasSite()) {
20739        composeType("site", element.getSite());
20740      }
20741      if (element.hasRoute()) {
20742        composeCodeableConcept("route", element.getRoute());
20743      }
20744      if (element.hasMethod()) {
20745        composeCodeableConcept("method", element.getMethod());
20746      }
20747      if (element.hasDose()) {
20748        composeType("dose", element.getDose());
20749      }
20750      if (element.hasRate()) {
20751        composeType("rate", element.getRate());
20752      }
20753      if (element.hasMaxDosePerPeriod()) {
20754        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20755      }
20756  }
20757
20758  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20759    if (element != null) {
20760      open(name);
20761      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
20762      close();
20763    }
20764  }
20765
20766  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20767      composeBackbone(element);
20768      if (element.hasType()) {
20769        composeCodeableConcept("type", element.getType());
20770      }
20771      if (element.hasReason()) {
20772        openArray("reason");
20773        for (CodeableConcept e : element.getReason()) 
20774          composeCodeableConcept(null, e);
20775        closeArray();
20776      };
20777      if (element.hasResponsibleParty()) {
20778        openArray("responsibleParty");
20779        for (Reference e : element.getResponsibleParty()) 
20780          composeReference(null, e);
20781        closeArray();
20782      };
20783  }
20784
20785  protected void composeMedicationOrder(String name, MedicationOrder element) throws IOException {
20786    if (element != null) {
20787      prop("resourceType", name);
20788      composeMedicationOrderInner(element);
20789    }
20790  }
20791
20792  protected void composeMedicationOrderInner(MedicationOrder element) throws IOException {
20793      composeDomainResourceElements(element);
20794      if (element.hasIdentifier()) {
20795        openArray("identifier");
20796        for (Identifier e : element.getIdentifier()) 
20797          composeIdentifier(null, e);
20798        closeArray();
20799      };
20800      if (element.hasDateWrittenElement()) {
20801        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
20802        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
20803      }
20804      if (element.hasStatusElement()) {
20805        composeEnumerationCore("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20806        composeEnumerationExtras("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20807      }
20808      if (element.hasDateEndedElement()) {
20809        composeDateTimeCore("dateEnded", element.getDateEndedElement(), false);
20810        composeDateTimeExtras("dateEnded", element.getDateEndedElement(), false);
20811      }
20812      if (element.hasReasonEnded()) {
20813        composeCodeableConcept("reasonEnded", element.getReasonEnded());
20814      }
20815      if (element.hasPatient()) {
20816        composeReference("patient", element.getPatient());
20817      }
20818      if (element.hasPrescriber()) {
20819        composeReference("prescriber", element.getPrescriber());
20820      }
20821      if (element.hasEncounter()) {
20822        composeReference("encounter", element.getEncounter());
20823      }
20824      if (element.hasReason()) {
20825        composeType("reason", element.getReason());
20826      }
20827      if (element.hasNoteElement()) {
20828        composeStringCore("note", element.getNoteElement(), false);
20829        composeStringExtras("note", element.getNoteElement(), false);
20830      }
20831      if (element.hasMedication()) {
20832        composeType("medication", element.getMedication());
20833      }
20834      if (element.hasDosageInstruction()) {
20835        openArray("dosageInstruction");
20836        for (MedicationOrder.MedicationOrderDosageInstructionComponent e : element.getDosageInstruction()) 
20837          composeMedicationOrderMedicationOrderDosageInstructionComponent(null, e);
20838        closeArray();
20839      };
20840      if (element.hasDispenseRequest()) {
20841        composeMedicationOrderMedicationOrderDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
20842      }
20843      if (element.hasSubstitution()) {
20844        composeMedicationOrderMedicationOrderSubstitutionComponent("substitution", element.getSubstitution());
20845      }
20846      if (element.hasPriorPrescription()) {
20847        composeReference("priorPrescription", element.getPriorPrescription());
20848      }
20849  }
20850
20851  protected void composeMedicationOrderMedicationOrderDosageInstructionComponent(String name, MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20852    if (element != null) {
20853      open(name);
20854      composeMedicationOrderMedicationOrderDosageInstructionComponentInner(element);
20855      close();
20856    }
20857  }
20858
20859  protected void composeMedicationOrderMedicationOrderDosageInstructionComponentInner(MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20860      composeBackbone(element);
20861      if (element.hasTextElement()) {
20862        composeStringCore("text", element.getTextElement(), false);
20863        composeStringExtras("text", element.getTextElement(), false);
20864      }
20865      if (element.hasAdditionalInstructions()) {
20866        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20867      }
20868      if (element.hasTiming()) {
20869        composeTiming("timing", element.getTiming());
20870      }
20871      if (element.hasAsNeeded()) {
20872        composeType("asNeeded", element.getAsNeeded());
20873      }
20874      if (element.hasSite()) {
20875        composeType("site", element.getSite());
20876      }
20877      if (element.hasRoute()) {
20878        composeCodeableConcept("route", element.getRoute());
20879      }
20880      if (element.hasMethod()) {
20881        composeCodeableConcept("method", element.getMethod());
20882      }
20883      if (element.hasDose()) {
20884        composeType("dose", element.getDose());
20885      }
20886      if (element.hasRate()) {
20887        composeType("rate", element.getRate());
20888      }
20889      if (element.hasMaxDosePerPeriod()) {
20890        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20891      }
20892  }
20893
20894  protected void composeMedicationOrderMedicationOrderDispenseRequestComponent(String name, MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20895    if (element != null) {
20896      open(name);
20897      composeMedicationOrderMedicationOrderDispenseRequestComponentInner(element);
20898      close();
20899    }
20900  }
20901
20902  protected void composeMedicationOrderMedicationOrderDispenseRequestComponentInner(MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20903      composeBackbone(element);
20904      if (element.hasMedication()) {
20905        composeType("medication", element.getMedication());
20906      }
20907      if (element.hasValidityPeriod()) {
20908        composePeriod("validityPeriod", element.getValidityPeriod());
20909      }
20910      if (element.hasNumberOfRepeatsAllowedElement()) {
20911        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20912        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20913      }
20914      if (element.hasQuantity()) {
20915        composeSimpleQuantity("quantity", element.getQuantity());
20916      }
20917      if (element.hasExpectedSupplyDuration()) {
20918        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
20919      }
20920  }
20921
20922  protected void composeMedicationOrderMedicationOrderSubstitutionComponent(String name, MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20923    if (element != null) {
20924      open(name);
20925      composeMedicationOrderMedicationOrderSubstitutionComponentInner(element);
20926      close();
20927    }
20928  }
20929
20930  protected void composeMedicationOrderMedicationOrderSubstitutionComponentInner(MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20931      composeBackbone(element);
20932      if (element.hasType()) {
20933        composeCodeableConcept("type", element.getType());
20934      }
20935      if (element.hasReason()) {
20936        composeCodeableConcept("reason", element.getReason());
20937      }
20938  }
20939
20940  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
20941    if (element != null) {
20942      prop("resourceType", name);
20943      composeMedicationStatementInner(element);
20944    }
20945  }
20946
20947  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
20948      composeDomainResourceElements(element);
20949      if (element.hasIdentifier()) {
20950        openArray("identifier");
20951        for (Identifier e : element.getIdentifier()) 
20952          composeIdentifier(null, e);
20953        closeArray();
20954      };
20955      if (element.hasPatient()) {
20956        composeReference("patient", element.getPatient());
20957      }
20958      if (element.hasInformationSource()) {
20959        composeReference("informationSource", element.getInformationSource());
20960      }
20961      if (element.hasDateAssertedElement()) {
20962        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
20963        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
20964      }
20965      if (element.hasStatusElement()) {
20966        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20967        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20968      }
20969      if (element.hasWasNotTakenElement()) {
20970        composeBooleanCore("wasNotTaken", element.getWasNotTakenElement(), false);
20971        composeBooleanExtras("wasNotTaken", element.getWasNotTakenElement(), false);
20972      }
20973      if (element.hasReasonNotTaken()) {
20974        openArray("reasonNotTaken");
20975        for (CodeableConcept e : element.getReasonNotTaken()) 
20976          composeCodeableConcept(null, e);
20977        closeArray();
20978      };
20979      if (element.hasReasonForUse()) {
20980        composeType("reasonForUse", element.getReasonForUse());
20981      }
20982      if (element.hasEffective()) {
20983        composeType("effective", element.getEffective());
20984      }
20985      if (element.hasNoteElement()) {
20986        composeStringCore("note", element.getNoteElement(), false);
20987        composeStringExtras("note", element.getNoteElement(), false);
20988      }
20989      if (element.hasSupportingInformation()) {
20990        openArray("supportingInformation");
20991        for (Reference e : element.getSupportingInformation()) 
20992          composeReference(null, e);
20993        closeArray();
20994      };
20995      if (element.hasMedication()) {
20996        composeType("medication", element.getMedication());
20997      }
20998      if (element.hasDosage()) {
20999        openArray("dosage");
21000        for (MedicationStatement.MedicationStatementDosageComponent e : element.getDosage()) 
21001          composeMedicationStatementMedicationStatementDosageComponent(null, e);
21002        closeArray();
21003      };
21004  }
21005
21006  protected void composeMedicationStatementMedicationStatementDosageComponent(String name, MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21007    if (element != null) {
21008      open(name);
21009      composeMedicationStatementMedicationStatementDosageComponentInner(element);
21010      close();
21011    }
21012  }
21013
21014  protected void composeMedicationStatementMedicationStatementDosageComponentInner(MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21015      composeBackbone(element);
21016      if (element.hasTextElement()) {
21017        composeStringCore("text", element.getTextElement(), false);
21018        composeStringExtras("text", element.getTextElement(), false);
21019      }
21020      if (element.hasTiming()) {
21021        composeTiming("timing", element.getTiming());
21022      }
21023      if (element.hasAsNeeded()) {
21024        composeType("asNeeded", element.getAsNeeded());
21025      }
21026      if (element.hasSite()) {
21027        composeType("site", element.getSite());
21028      }
21029      if (element.hasRoute()) {
21030        composeCodeableConcept("route", element.getRoute());
21031      }
21032      if (element.hasMethod()) {
21033        composeCodeableConcept("method", element.getMethod());
21034      }
21035      if (element.hasQuantity()) {
21036        composeType("quantity", element.getQuantity());
21037      }
21038      if (element.hasRate()) {
21039        composeType("rate", element.getRate());
21040      }
21041      if (element.hasMaxDosePerPeriod()) {
21042        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21043      }
21044  }
21045
21046  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
21047    if (element != null) {
21048      prop("resourceType", name);
21049      composeMessageHeaderInner(element);
21050    }
21051  }
21052
21053  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
21054      composeDomainResourceElements(element);
21055      if (element.hasTimestampElement()) {
21056        composeInstantCore("timestamp", element.getTimestampElement(), false);
21057        composeInstantExtras("timestamp", element.getTimestampElement(), false);
21058      }
21059      if (element.hasEvent()) {
21060        composeCoding("event", element.getEvent());
21061      }
21062      if (element.hasResponse()) {
21063        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
21064      }
21065      if (element.hasSource()) {
21066        composeMessageHeaderMessageSourceComponent("source", element.getSource());
21067      }
21068      if (element.hasDestination()) {
21069        openArray("destination");
21070        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
21071          composeMessageHeaderMessageDestinationComponent(null, e);
21072        closeArray();
21073      };
21074      if (element.hasEnterer()) {
21075        composeReference("enterer", element.getEnterer());
21076      }
21077      if (element.hasAuthor()) {
21078        composeReference("author", element.getAuthor());
21079      }
21080      if (element.hasReceiver()) {
21081        composeReference("receiver", element.getReceiver());
21082      }
21083      if (element.hasResponsible()) {
21084        composeReference("responsible", element.getResponsible());
21085      }
21086      if (element.hasReason()) {
21087        composeCodeableConcept("reason", element.getReason());
21088      }
21089      if (element.hasData()) {
21090        openArray("data");
21091        for (Reference e : element.getData()) 
21092          composeReference(null, e);
21093        closeArray();
21094      };
21095  }
21096
21097  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21098    if (element != null) {
21099      open(name);
21100      composeMessageHeaderMessageHeaderResponseComponentInner(element);
21101      close();
21102    }
21103  }
21104
21105  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21106      composeBackbone(element);
21107      if (element.hasIdentifierElement()) {
21108        composeIdCore("identifier", element.getIdentifierElement(), false);
21109        composeIdExtras("identifier", element.getIdentifierElement(), false);
21110      }
21111      if (element.hasCodeElement()) {
21112        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21113        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21114      }
21115      if (element.hasDetails()) {
21116        composeReference("details", element.getDetails());
21117      }
21118  }
21119
21120  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
21121    if (element != null) {
21122      open(name);
21123      composeMessageHeaderMessageSourceComponentInner(element);
21124      close();
21125    }
21126  }
21127
21128  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
21129      composeBackbone(element);
21130      if (element.hasNameElement()) {
21131        composeStringCore("name", element.getNameElement(), false);
21132        composeStringExtras("name", element.getNameElement(), false);
21133      }
21134      if (element.hasSoftwareElement()) {
21135        composeStringCore("software", element.getSoftwareElement(), false);
21136        composeStringExtras("software", element.getSoftwareElement(), false);
21137      }
21138      if (element.hasVersionElement()) {
21139        composeStringCore("version", element.getVersionElement(), false);
21140        composeStringExtras("version", element.getVersionElement(), false);
21141      }
21142      if (element.hasContact()) {
21143        composeContactPoint("contact", element.getContact());
21144      }
21145      if (element.hasEndpointElement()) {
21146        composeUriCore("endpoint", element.getEndpointElement(), false);
21147        composeUriExtras("endpoint", element.getEndpointElement(), false);
21148      }
21149  }
21150
21151  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
21152    if (element != null) {
21153      open(name);
21154      composeMessageHeaderMessageDestinationComponentInner(element);
21155      close();
21156    }
21157  }
21158
21159  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
21160      composeBackbone(element);
21161      if (element.hasNameElement()) {
21162        composeStringCore("name", element.getNameElement(), false);
21163        composeStringExtras("name", element.getNameElement(), false);
21164      }
21165      if (element.hasTarget()) {
21166        composeReference("target", element.getTarget());
21167      }
21168      if (element.hasEndpointElement()) {
21169        composeUriCore("endpoint", element.getEndpointElement(), false);
21170        composeUriExtras("endpoint", element.getEndpointElement(), false);
21171      }
21172  }
21173
21174  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
21175    if (element != null) {
21176      prop("resourceType", name);
21177      composeNamingSystemInner(element);
21178    }
21179  }
21180
21181  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
21182      composeDomainResourceElements(element);
21183      if (element.hasNameElement()) {
21184        composeStringCore("name", element.getNameElement(), false);
21185        composeStringExtras("name", element.getNameElement(), false);
21186      }
21187      if (element.hasStatusElement()) {
21188        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21189        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21190      }
21191      if (element.hasKindElement()) {
21192        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21193        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21194      }
21195      if (element.hasPublisherElement()) {
21196        composeStringCore("publisher", element.getPublisherElement(), false);
21197        composeStringExtras("publisher", element.getPublisherElement(), false);
21198      }
21199      if (element.hasContact()) {
21200        openArray("contact");
21201        for (NamingSystem.NamingSystemContactComponent e : element.getContact()) 
21202          composeNamingSystemNamingSystemContactComponent(null, e);
21203        closeArray();
21204      };
21205      if (element.hasResponsibleElement()) {
21206        composeStringCore("responsible", element.getResponsibleElement(), false);
21207        composeStringExtras("responsible", element.getResponsibleElement(), false);
21208      }
21209      if (element.hasDateElement()) {
21210        composeDateTimeCore("date", element.getDateElement(), false);
21211        composeDateTimeExtras("date", element.getDateElement(), false);
21212      }
21213      if (element.hasType()) {
21214        composeCodeableConcept("type", element.getType());
21215      }
21216      if (element.hasDescriptionElement()) {
21217        composeStringCore("description", element.getDescriptionElement(), false);
21218        composeStringExtras("description", element.getDescriptionElement(), false);
21219      }
21220      if (element.hasUseContext()) {
21221        openArray("useContext");
21222        for (CodeableConcept e : element.getUseContext()) 
21223          composeCodeableConcept(null, e);
21224        closeArray();
21225      };
21226      if (element.hasUsageElement()) {
21227        composeStringCore("usage", element.getUsageElement(), false);
21228        composeStringExtras("usage", element.getUsageElement(), false);
21229      }
21230      if (element.hasUniqueId()) {
21231        openArray("uniqueId");
21232        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
21233          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
21234        closeArray();
21235      };
21236      if (element.hasReplacedBy()) {
21237        composeReference("replacedBy", element.getReplacedBy());
21238      }
21239  }
21240
21241  protected void composeNamingSystemNamingSystemContactComponent(String name, NamingSystem.NamingSystemContactComponent element) throws IOException {
21242    if (element != null) {
21243      open(name);
21244      composeNamingSystemNamingSystemContactComponentInner(element);
21245      close();
21246    }
21247  }
21248
21249  protected void composeNamingSystemNamingSystemContactComponentInner(NamingSystem.NamingSystemContactComponent element) throws IOException {
21250      composeBackbone(element);
21251      if (element.hasNameElement()) {
21252        composeStringCore("name", element.getNameElement(), false);
21253        composeStringExtras("name", element.getNameElement(), false);
21254      }
21255      if (element.hasTelecom()) {
21256        openArray("telecom");
21257        for (ContactPoint e : element.getTelecom()) 
21258          composeContactPoint(null, e);
21259        closeArray();
21260      };
21261  }
21262
21263  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21264    if (element != null) {
21265      open(name);
21266      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
21267      close();
21268    }
21269  }
21270
21271  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21272      composeBackbone(element);
21273      if (element.hasTypeElement()) {
21274        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21275        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21276      }
21277      if (element.hasValueElement()) {
21278        composeStringCore("value", element.getValueElement(), false);
21279        composeStringExtras("value", element.getValueElement(), false);
21280      }
21281      if (element.hasPreferredElement()) {
21282        composeBooleanCore("preferred", element.getPreferredElement(), false);
21283        composeBooleanExtras("preferred", element.getPreferredElement(), false);
21284      }
21285      if (element.hasPeriod()) {
21286        composePeriod("period", element.getPeriod());
21287      }
21288  }
21289
21290  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
21291    if (element != null) {
21292      prop("resourceType", name);
21293      composeNutritionOrderInner(element);
21294    }
21295  }
21296
21297  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
21298      composeDomainResourceElements(element);
21299      if (element.hasPatient()) {
21300        composeReference("patient", element.getPatient());
21301      }
21302      if (element.hasOrderer()) {
21303        composeReference("orderer", element.getOrderer());
21304      }
21305      if (element.hasIdentifier()) {
21306        openArray("identifier");
21307        for (Identifier e : element.getIdentifier()) 
21308          composeIdentifier(null, e);
21309        closeArray();
21310      };
21311      if (element.hasEncounter()) {
21312        composeReference("encounter", element.getEncounter());
21313      }
21314      if (element.hasDateTimeElement()) {
21315        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
21316        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
21317      }
21318      if (element.hasStatusElement()) {
21319        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21320        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21321      }
21322      if (element.hasAllergyIntolerance()) {
21323        openArray("allergyIntolerance");
21324        for (Reference e : element.getAllergyIntolerance()) 
21325          composeReference(null, e);
21326        closeArray();
21327      };
21328      if (element.hasFoodPreferenceModifier()) {
21329        openArray("foodPreferenceModifier");
21330        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
21331          composeCodeableConcept(null, e);
21332        closeArray();
21333      };
21334      if (element.hasExcludeFoodModifier()) {
21335        openArray("excludeFoodModifier");
21336        for (CodeableConcept e : element.getExcludeFoodModifier()) 
21337          composeCodeableConcept(null, e);
21338        closeArray();
21339      };
21340      if (element.hasOralDiet()) {
21341        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
21342      }
21343      if (element.hasSupplement()) {
21344        openArray("supplement");
21345        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
21346          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
21347        closeArray();
21348      };
21349      if (element.hasEnteralFormula()) {
21350        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
21351      }
21352  }
21353
21354  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21355    if (element != null) {
21356      open(name);
21357      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
21358      close();
21359    }
21360  }
21361
21362  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21363      composeBackbone(element);
21364      if (element.hasType()) {
21365        openArray("type");
21366        for (CodeableConcept e : element.getType()) 
21367          composeCodeableConcept(null, e);
21368        closeArray();
21369      };
21370      if (element.hasSchedule()) {
21371        openArray("schedule");
21372        for (Timing e : element.getSchedule()) 
21373          composeTiming(null, e);
21374        closeArray();
21375      };
21376      if (element.hasNutrient()) {
21377        openArray("nutrient");
21378        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
21379          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
21380        closeArray();
21381      };
21382      if (element.hasTexture()) {
21383        openArray("texture");
21384        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
21385          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
21386        closeArray();
21387      };
21388      if (element.hasFluidConsistencyType()) {
21389        openArray("fluidConsistencyType");
21390        for (CodeableConcept e : element.getFluidConsistencyType()) 
21391          composeCodeableConcept(null, e);
21392        closeArray();
21393      };
21394      if (element.hasInstructionElement()) {
21395        composeStringCore("instruction", element.getInstructionElement(), false);
21396        composeStringExtras("instruction", element.getInstructionElement(), false);
21397      }
21398  }
21399
21400  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21401    if (element != null) {
21402      open(name);
21403      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
21404      close();
21405    }
21406  }
21407
21408  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21409      composeBackbone(element);
21410      if (element.hasModifier()) {
21411        composeCodeableConcept("modifier", element.getModifier());
21412      }
21413      if (element.hasAmount()) {
21414        composeSimpleQuantity("amount", element.getAmount());
21415      }
21416  }
21417
21418  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21419    if (element != null) {
21420      open(name);
21421      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
21422      close();
21423    }
21424  }
21425
21426  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21427      composeBackbone(element);
21428      if (element.hasModifier()) {
21429        composeCodeableConcept("modifier", element.getModifier());
21430      }
21431      if (element.hasFoodType()) {
21432        composeCodeableConcept("foodType", element.getFoodType());
21433      }
21434  }
21435
21436  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21437    if (element != null) {
21438      open(name);
21439      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
21440      close();
21441    }
21442  }
21443
21444  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21445      composeBackbone(element);
21446      if (element.hasType()) {
21447        composeCodeableConcept("type", element.getType());
21448      }
21449      if (element.hasProductNameElement()) {
21450        composeStringCore("productName", element.getProductNameElement(), false);
21451        composeStringExtras("productName", element.getProductNameElement(), false);
21452      }
21453      if (element.hasSchedule()) {
21454        openArray("schedule");
21455        for (Timing e : element.getSchedule()) 
21456          composeTiming(null, e);
21457        closeArray();
21458      };
21459      if (element.hasQuantity()) {
21460        composeSimpleQuantity("quantity", element.getQuantity());
21461      }
21462      if (element.hasInstructionElement()) {
21463        composeStringCore("instruction", element.getInstructionElement(), false);
21464        composeStringExtras("instruction", element.getInstructionElement(), false);
21465      }
21466  }
21467
21468  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21469    if (element != null) {
21470      open(name);
21471      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
21472      close();
21473    }
21474  }
21475
21476  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21477      composeBackbone(element);
21478      if (element.hasBaseFormulaType()) {
21479        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
21480      }
21481      if (element.hasBaseFormulaProductNameElement()) {
21482        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21483        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21484      }
21485      if (element.hasAdditiveType()) {
21486        composeCodeableConcept("additiveType", element.getAdditiveType());
21487      }
21488      if (element.hasAdditiveProductNameElement()) {
21489        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
21490        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
21491      }
21492      if (element.hasCaloricDensity()) {
21493        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
21494      }
21495      if (element.hasRouteofAdministration()) {
21496        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
21497      }
21498      if (element.hasAdministration()) {
21499        openArray("administration");
21500        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
21501          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
21502        closeArray();
21503      };
21504      if (element.hasMaxVolumeToDeliver()) {
21505        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
21506      }
21507      if (element.hasAdministrationInstructionElement()) {
21508        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
21509        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
21510      }
21511  }
21512
21513  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21514    if (element != null) {
21515      open(name);
21516      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
21517      close();
21518    }
21519  }
21520
21521  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21522      composeBackbone(element);
21523      if (element.hasSchedule()) {
21524        composeTiming("schedule", element.getSchedule());
21525      }
21526      if (element.hasQuantity()) {
21527        composeSimpleQuantity("quantity", element.getQuantity());
21528      }
21529      if (element.hasRate()) {
21530        composeType("rate", element.getRate());
21531      }
21532  }
21533
21534  protected void composeObservation(String name, Observation element) throws IOException {
21535    if (element != null) {
21536      prop("resourceType", name);
21537      composeObservationInner(element);
21538    }
21539  }
21540
21541  protected void composeObservationInner(Observation element) throws IOException {
21542      composeDomainResourceElements(element);
21543      if (element.hasIdentifier()) {
21544        openArray("identifier");
21545        for (Identifier e : element.getIdentifier()) 
21546          composeIdentifier(null, e);
21547        closeArray();
21548      };
21549      if (element.hasStatusElement()) {
21550        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21551        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21552      }
21553      if (element.hasCategory()) {
21554        composeCodeableConcept("category", element.getCategory());
21555      }
21556      if (element.hasCode()) {
21557        composeCodeableConcept("code", element.getCode());
21558      }
21559      if (element.hasSubject()) {
21560        composeReference("subject", element.getSubject());
21561      }
21562      if (element.hasEncounter()) {
21563        composeReference("encounter", element.getEncounter());
21564      }
21565      if (element.hasEffective()) {
21566        composeType("effective", element.getEffective());
21567      }
21568      if (element.hasIssuedElement()) {
21569        composeInstantCore("issued", element.getIssuedElement(), false);
21570        composeInstantExtras("issued", element.getIssuedElement(), false);
21571      }
21572      if (element.hasPerformer()) {
21573        openArray("performer");
21574        for (Reference e : element.getPerformer()) 
21575          composeReference(null, e);
21576        closeArray();
21577      };
21578      if (element.hasValue()) {
21579        composeType("value", element.getValue());
21580      }
21581      if (element.hasDataAbsentReason()) {
21582        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21583      }
21584      if (element.hasInterpretation()) {
21585        composeCodeableConcept("interpretation", element.getInterpretation());
21586      }
21587      if (element.hasCommentsElement()) {
21588        composeStringCore("comments", element.getCommentsElement(), false);
21589        composeStringExtras("comments", element.getCommentsElement(), false);
21590      }
21591      if (element.hasBodySite()) {
21592        composeCodeableConcept("bodySite", element.getBodySite());
21593      }
21594      if (element.hasMethod()) {
21595        composeCodeableConcept("method", element.getMethod());
21596      }
21597      if (element.hasSpecimen()) {
21598        composeReference("specimen", element.getSpecimen());
21599      }
21600      if (element.hasDevice()) {
21601        composeReference("device", element.getDevice());
21602      }
21603      if (element.hasReferenceRange()) {
21604        openArray("referenceRange");
21605        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21606          composeObservationObservationReferenceRangeComponent(null, e);
21607        closeArray();
21608      };
21609      if (element.hasRelated()) {
21610        openArray("related");
21611        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
21612          composeObservationObservationRelatedComponent(null, e);
21613        closeArray();
21614      };
21615      if (element.hasComponent()) {
21616        openArray("component");
21617        for (Observation.ObservationComponentComponent e : element.getComponent()) 
21618          composeObservationObservationComponentComponent(null, e);
21619        closeArray();
21620      };
21621  }
21622
21623  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
21624    if (element != null) {
21625      open(name);
21626      composeObservationObservationReferenceRangeComponentInner(element);
21627      close();
21628    }
21629  }
21630
21631  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
21632      composeBackbone(element);
21633      if (element.hasLow()) {
21634        composeSimpleQuantity("low", element.getLow());
21635      }
21636      if (element.hasHigh()) {
21637        composeSimpleQuantity("high", element.getHigh());
21638      }
21639      if (element.hasMeaning()) {
21640        composeCodeableConcept("meaning", element.getMeaning());
21641      }
21642      if (element.hasAge()) {
21643        composeRange("age", element.getAge());
21644      }
21645      if (element.hasTextElement()) {
21646        composeStringCore("text", element.getTextElement(), false);
21647        composeStringExtras("text", element.getTextElement(), false);
21648      }
21649  }
21650
21651  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
21652    if (element != null) {
21653      open(name);
21654      composeObservationObservationRelatedComponentInner(element);
21655      close();
21656    }
21657  }
21658
21659  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
21660      composeBackbone(element);
21661      if (element.hasTypeElement()) {
21662        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21663        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21664      }
21665      if (element.hasTarget()) {
21666        composeReference("target", element.getTarget());
21667      }
21668  }
21669
21670  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
21671    if (element != null) {
21672      open(name);
21673      composeObservationObservationComponentComponentInner(element);
21674      close();
21675    }
21676  }
21677
21678  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
21679      composeBackbone(element);
21680      if (element.hasCode()) {
21681        composeCodeableConcept("code", element.getCode());
21682      }
21683      if (element.hasValue()) {
21684        composeType("value", element.getValue());
21685      }
21686      if (element.hasDataAbsentReason()) {
21687        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21688      }
21689      if (element.hasReferenceRange()) {
21690        openArray("referenceRange");
21691        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21692          composeObservationObservationReferenceRangeComponent(null, e);
21693        closeArray();
21694      };
21695  }
21696
21697  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
21698    if (element != null) {
21699      prop("resourceType", name);
21700      composeOperationDefinitionInner(element);
21701    }
21702  }
21703
21704  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
21705      composeDomainResourceElements(element);
21706      if (element.hasUrlElement()) {
21707        composeUriCore("url", element.getUrlElement(), false);
21708        composeUriExtras("url", element.getUrlElement(), false);
21709      }
21710      if (element.hasVersionElement()) {
21711        composeStringCore("version", element.getVersionElement(), false);
21712        composeStringExtras("version", element.getVersionElement(), false);
21713      }
21714      if (element.hasNameElement()) {
21715        composeStringCore("name", element.getNameElement(), false);
21716        composeStringExtras("name", element.getNameElement(), false);
21717      }
21718      if (element.hasStatusElement()) {
21719        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21720        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21721      }
21722      if (element.hasKindElement()) {
21723        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21724        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21725      }
21726      if (element.hasExperimentalElement()) {
21727        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21728        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21729      }
21730      if (element.hasPublisherElement()) {
21731        composeStringCore("publisher", element.getPublisherElement(), false);
21732        composeStringExtras("publisher", element.getPublisherElement(), false);
21733      }
21734      if (element.hasContact()) {
21735        openArray("contact");
21736        for (OperationDefinition.OperationDefinitionContactComponent e : element.getContact()) 
21737          composeOperationDefinitionOperationDefinitionContactComponent(null, e);
21738        closeArray();
21739      };
21740      if (element.hasDateElement()) {
21741        composeDateTimeCore("date", element.getDateElement(), false);
21742        composeDateTimeExtras("date", element.getDateElement(), false);
21743      }
21744      if (element.hasDescriptionElement()) {
21745        composeStringCore("description", element.getDescriptionElement(), false);
21746        composeStringExtras("description", element.getDescriptionElement(), false);
21747      }
21748      if (element.hasRequirementsElement()) {
21749        composeStringCore("requirements", element.getRequirementsElement(), false);
21750        composeStringExtras("requirements", element.getRequirementsElement(), false);
21751      }
21752      if (element.hasIdempotentElement()) {
21753        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
21754        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
21755      }
21756      if (element.hasCodeElement()) {
21757        composeCodeCore("code", element.getCodeElement(), false);
21758        composeCodeExtras("code", element.getCodeElement(), false);
21759      }
21760      if (element.hasNotesElement()) {
21761        composeStringCore("notes", element.getNotesElement(), false);
21762        composeStringExtras("notes", element.getNotesElement(), false);
21763      }
21764      if (element.hasBase()) {
21765        composeReference("base", element.getBase());
21766      }
21767      if (element.hasSystemElement()) {
21768        composeBooleanCore("system", element.getSystemElement(), false);
21769        composeBooleanExtras("system", element.getSystemElement(), false);
21770      }
21771      if (element.hasType()) {
21772        openArray("type");
21773        for (CodeType e : element.getType()) 
21774          composeCodeCore(null, e, true);
21775        closeArray();
21776        if (anyHasExtras(element.getType())) {
21777          openArray("_type");
21778          for (CodeType e : element.getType()) 
21779            composeCodeExtras(null, e, true);
21780          closeArray();
21781        }
21782      };
21783      if (element.hasInstanceElement()) {
21784        composeBooleanCore("instance", element.getInstanceElement(), false);
21785        composeBooleanExtras("instance", element.getInstanceElement(), false);
21786      }
21787      if (element.hasParameter()) {
21788        openArray("parameter");
21789        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
21790          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21791        closeArray();
21792      };
21793  }
21794
21795  protected void composeOperationDefinitionOperationDefinitionContactComponent(String name, OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21796    if (element != null) {
21797      open(name);
21798      composeOperationDefinitionOperationDefinitionContactComponentInner(element);
21799      close();
21800    }
21801  }
21802
21803  protected void composeOperationDefinitionOperationDefinitionContactComponentInner(OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21804      composeBackbone(element);
21805      if (element.hasNameElement()) {
21806        composeStringCore("name", element.getNameElement(), false);
21807        composeStringExtras("name", element.getNameElement(), false);
21808      }
21809      if (element.hasTelecom()) {
21810        openArray("telecom");
21811        for (ContactPoint e : element.getTelecom()) 
21812          composeContactPoint(null, e);
21813        closeArray();
21814      };
21815  }
21816
21817  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21818    if (element != null) {
21819      open(name);
21820      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
21821      close();
21822    }
21823  }
21824
21825  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21826      composeBackbone(element);
21827      if (element.hasNameElement()) {
21828        composeCodeCore("name", element.getNameElement(), false);
21829        composeCodeExtras("name", element.getNameElement(), false);
21830      }
21831      if (element.hasUseElement()) {
21832        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21833        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21834      }
21835      if (element.hasMinElement()) {
21836        composeIntegerCore("min", element.getMinElement(), false);
21837        composeIntegerExtras("min", element.getMinElement(), false);
21838      }
21839      if (element.hasMaxElement()) {
21840        composeStringCore("max", element.getMaxElement(), false);
21841        composeStringExtras("max", element.getMaxElement(), false);
21842      }
21843      if (element.hasDocumentationElement()) {
21844        composeStringCore("documentation", element.getDocumentationElement(), false);
21845        composeStringExtras("documentation", element.getDocumentationElement(), false);
21846      }
21847      if (element.hasTypeElement()) {
21848        composeCodeCore("type", element.getTypeElement(), false);
21849        composeCodeExtras("type", element.getTypeElement(), false);
21850      }
21851      if (element.hasProfile()) {
21852        composeReference("profile", element.getProfile());
21853      }
21854      if (element.hasBinding()) {
21855        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
21856      }
21857      if (element.hasPart()) {
21858        openArray("part");
21859        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
21860          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21861        closeArray();
21862      };
21863  }
21864
21865  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21866    if (element != null) {
21867      open(name);
21868      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
21869      close();
21870    }
21871  }
21872
21873  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21874      composeBackbone(element);
21875      if (element.hasStrengthElement()) {
21876        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21877        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21878      }
21879      if (element.hasValueSet()) {
21880        composeType("valueSet", element.getValueSet());
21881      }
21882  }
21883
21884  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
21885    if (element != null) {
21886      prop("resourceType", name);
21887      composeOperationOutcomeInner(element);
21888    }
21889  }
21890
21891  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
21892      composeDomainResourceElements(element);
21893      if (element.hasIssue()) {
21894        openArray("issue");
21895        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
21896          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
21897        closeArray();
21898      };
21899  }
21900
21901  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21902    if (element != null) {
21903      open(name);
21904      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
21905      close();
21906    }
21907  }
21908
21909  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21910      composeBackbone(element);
21911      if (element.hasSeverityElement()) {
21912        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21913        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21914      }
21915      if (element.hasCodeElement()) {
21916        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21917        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21918      }
21919      if (element.hasDetails()) {
21920        composeCodeableConcept("details", element.getDetails());
21921      }
21922      if (element.hasDiagnosticsElement()) {
21923        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
21924        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
21925      }
21926      if (element.hasLocation()) {
21927        openArray("location");
21928        for (StringType e : element.getLocation()) 
21929          composeStringCore(null, e, true);
21930        closeArray();
21931        if (anyHasExtras(element.getLocation())) {
21932          openArray("_location");
21933          for (StringType e : element.getLocation()) 
21934            composeStringExtras(null, e, true);
21935          closeArray();
21936        }
21937      };
21938  }
21939
21940  protected void composeOrder(String name, Order element) throws IOException {
21941    if (element != null) {
21942      prop("resourceType", name);
21943      composeOrderInner(element);
21944    }
21945  }
21946
21947  protected void composeOrderInner(Order element) throws IOException {
21948      composeDomainResourceElements(element);
21949      if (element.hasIdentifier()) {
21950        openArray("identifier");
21951        for (Identifier e : element.getIdentifier()) 
21952          composeIdentifier(null, e);
21953        closeArray();
21954      };
21955      if (element.hasDateElement()) {
21956        composeDateTimeCore("date", element.getDateElement(), false);
21957        composeDateTimeExtras("date", element.getDateElement(), false);
21958      }
21959      if (element.hasSubject()) {
21960        composeReference("subject", element.getSubject());
21961      }
21962      if (element.hasSource()) {
21963        composeReference("source", element.getSource());
21964      }
21965      if (element.hasTarget()) {
21966        composeReference("target", element.getTarget());
21967      }
21968      if (element.hasReason()) {
21969        composeType("reason", element.getReason());
21970      }
21971      if (element.hasWhen()) {
21972        composeOrderOrderWhenComponent("when", element.getWhen());
21973      }
21974      if (element.hasDetail()) {
21975        openArray("detail");
21976        for (Reference e : element.getDetail()) 
21977          composeReference(null, e);
21978        closeArray();
21979      };
21980  }
21981
21982  protected void composeOrderOrderWhenComponent(String name, Order.OrderWhenComponent element) throws IOException {
21983    if (element != null) {
21984      open(name);
21985      composeOrderOrderWhenComponentInner(element);
21986      close();
21987    }
21988  }
21989
21990  protected void composeOrderOrderWhenComponentInner(Order.OrderWhenComponent element) throws IOException {
21991      composeBackbone(element);
21992      if (element.hasCode()) {
21993        composeCodeableConcept("code", element.getCode());
21994      }
21995      if (element.hasSchedule()) {
21996        composeTiming("schedule", element.getSchedule());
21997      }
21998  }
21999
22000  protected void composeOrderResponse(String name, OrderResponse element) throws IOException {
22001    if (element != null) {
22002      prop("resourceType", name);
22003      composeOrderResponseInner(element);
22004    }
22005  }
22006
22007  protected void composeOrderResponseInner(OrderResponse element) throws IOException {
22008      composeDomainResourceElements(element);
22009      if (element.hasIdentifier()) {
22010        openArray("identifier");
22011        for (Identifier e : element.getIdentifier()) 
22012          composeIdentifier(null, e);
22013        closeArray();
22014      };
22015      if (element.hasRequest()) {
22016        composeReference("request", element.getRequest());
22017      }
22018      if (element.hasDateElement()) {
22019        composeDateTimeCore("date", element.getDateElement(), false);
22020        composeDateTimeExtras("date", element.getDateElement(), false);
22021      }
22022      if (element.hasWho()) {
22023        composeReference("who", element.getWho());
22024      }
22025      if (element.hasOrderStatusElement()) {
22026        composeEnumerationCore("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22027        composeEnumerationExtras("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22028      }
22029      if (element.hasDescriptionElement()) {
22030        composeStringCore("description", element.getDescriptionElement(), false);
22031        composeStringExtras("description", element.getDescriptionElement(), false);
22032      }
22033      if (element.hasFulfillment()) {
22034        openArray("fulfillment");
22035        for (Reference e : element.getFulfillment()) 
22036          composeReference(null, e);
22037        closeArray();
22038      };
22039  }
22040
22041  protected void composeOrganization(String name, Organization element) throws IOException {
22042    if (element != null) {
22043      prop("resourceType", name);
22044      composeOrganizationInner(element);
22045    }
22046  }
22047
22048  protected void composeOrganizationInner(Organization element) throws IOException {
22049      composeDomainResourceElements(element);
22050      if (element.hasIdentifier()) {
22051        openArray("identifier");
22052        for (Identifier e : element.getIdentifier()) 
22053          composeIdentifier(null, e);
22054        closeArray();
22055      };
22056      if (element.hasActiveElement()) {
22057        composeBooleanCore("active", element.getActiveElement(), false);
22058        composeBooleanExtras("active", element.getActiveElement(), false);
22059      }
22060      if (element.hasType()) {
22061        composeCodeableConcept("type", element.getType());
22062      }
22063      if (element.hasNameElement()) {
22064        composeStringCore("name", element.getNameElement(), false);
22065        composeStringExtras("name", element.getNameElement(), false);
22066      }
22067      if (element.hasTelecom()) {
22068        openArray("telecom");
22069        for (ContactPoint e : element.getTelecom()) 
22070          composeContactPoint(null, e);
22071        closeArray();
22072      };
22073      if (element.hasAddress()) {
22074        openArray("address");
22075        for (Address e : element.getAddress()) 
22076          composeAddress(null, e);
22077        closeArray();
22078      };
22079      if (element.hasPartOf()) {
22080        composeReference("partOf", element.getPartOf());
22081      }
22082      if (element.hasContact()) {
22083        openArray("contact");
22084        for (Organization.OrganizationContactComponent e : element.getContact()) 
22085          composeOrganizationOrganizationContactComponent(null, e);
22086        closeArray();
22087      };
22088  }
22089
22090  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
22091    if (element != null) {
22092      open(name);
22093      composeOrganizationOrganizationContactComponentInner(element);
22094      close();
22095    }
22096  }
22097
22098  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
22099      composeBackbone(element);
22100      if (element.hasPurpose()) {
22101        composeCodeableConcept("purpose", element.getPurpose());
22102      }
22103      if (element.hasName()) {
22104        composeHumanName("name", element.getName());
22105      }
22106      if (element.hasTelecom()) {
22107        openArray("telecom");
22108        for (ContactPoint e : element.getTelecom()) 
22109          composeContactPoint(null, e);
22110        closeArray();
22111      };
22112      if (element.hasAddress()) {
22113        composeAddress("address", element.getAddress());
22114      }
22115  }
22116
22117  protected void composePatient(String name, Patient element) throws IOException {
22118    if (element != null) {
22119      prop("resourceType", name);
22120      composePatientInner(element);
22121    }
22122  }
22123
22124  protected void composePatientInner(Patient element) throws IOException {
22125      composeDomainResourceElements(element);
22126      if (element.hasIdentifier()) {
22127        openArray("identifier");
22128        for (Identifier e : element.getIdentifier()) 
22129          composeIdentifier(null, e);
22130        closeArray();
22131      };
22132      if (element.hasActiveElement()) {
22133        composeBooleanCore("active", element.getActiveElement(), false);
22134        composeBooleanExtras("active", element.getActiveElement(), false);
22135      }
22136      if (element.hasName()) {
22137        openArray("name");
22138        for (HumanName e : element.getName()) 
22139          composeHumanName(null, e);
22140        closeArray();
22141      };
22142      if (element.hasTelecom()) {
22143        openArray("telecom");
22144        for (ContactPoint e : element.getTelecom()) 
22145          composeContactPoint(null, e);
22146        closeArray();
22147      };
22148      if (element.hasGenderElement()) {
22149        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22150        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22151      }
22152      if (element.hasBirthDateElement()) {
22153        composeDateCore("birthDate", element.getBirthDateElement(), false);
22154        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22155      }
22156      if (element.hasDeceased()) {
22157        composeType("deceased", element.getDeceased());
22158      }
22159      if (element.hasAddress()) {
22160        openArray("address");
22161        for (Address e : element.getAddress()) 
22162          composeAddress(null, e);
22163        closeArray();
22164      };
22165      if (element.hasMaritalStatus()) {
22166        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
22167      }
22168      if (element.hasMultipleBirth()) {
22169        composeType("multipleBirth", element.getMultipleBirth());
22170      }
22171      if (element.hasPhoto()) {
22172        openArray("photo");
22173        for (Attachment e : element.getPhoto()) 
22174          composeAttachment(null, e);
22175        closeArray();
22176      };
22177      if (element.hasContact()) {
22178        openArray("contact");
22179        for (Patient.ContactComponent e : element.getContact()) 
22180          composePatientContactComponent(null, e);
22181        closeArray();
22182      };
22183      if (element.hasAnimal()) {
22184        composePatientAnimalComponent("animal", element.getAnimal());
22185      }
22186      if (element.hasCommunication()) {
22187        openArray("communication");
22188        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
22189          composePatientPatientCommunicationComponent(null, e);
22190        closeArray();
22191      };
22192      if (element.hasCareProvider()) {
22193        openArray("careProvider");
22194        for (Reference e : element.getCareProvider()) 
22195          composeReference(null, e);
22196        closeArray();
22197      };
22198      if (element.hasManagingOrganization()) {
22199        composeReference("managingOrganization", element.getManagingOrganization());
22200      }
22201      if (element.hasLink()) {
22202        openArray("link");
22203        for (Patient.PatientLinkComponent e : element.getLink()) 
22204          composePatientPatientLinkComponent(null, e);
22205        closeArray();
22206      };
22207  }
22208
22209  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
22210    if (element != null) {
22211      open(name);
22212      composePatientContactComponentInner(element);
22213      close();
22214    }
22215  }
22216
22217  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
22218      composeBackbone(element);
22219      if (element.hasRelationship()) {
22220        openArray("relationship");
22221        for (CodeableConcept e : element.getRelationship()) 
22222          composeCodeableConcept(null, e);
22223        closeArray();
22224      };
22225      if (element.hasName()) {
22226        composeHumanName("name", element.getName());
22227      }
22228      if (element.hasTelecom()) {
22229        openArray("telecom");
22230        for (ContactPoint e : element.getTelecom()) 
22231          composeContactPoint(null, e);
22232        closeArray();
22233      };
22234      if (element.hasAddress()) {
22235        composeAddress("address", element.getAddress());
22236      }
22237      if (element.hasGenderElement()) {
22238        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22239        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22240      }
22241      if (element.hasOrganization()) {
22242        composeReference("organization", element.getOrganization());
22243      }
22244      if (element.hasPeriod()) {
22245        composePeriod("period", element.getPeriod());
22246      }
22247  }
22248
22249  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
22250    if (element != null) {
22251      open(name);
22252      composePatientAnimalComponentInner(element);
22253      close();
22254    }
22255  }
22256
22257  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
22258      composeBackbone(element);
22259      if (element.hasSpecies()) {
22260        composeCodeableConcept("species", element.getSpecies());
22261      }
22262      if (element.hasBreed()) {
22263        composeCodeableConcept("breed", element.getBreed());
22264      }
22265      if (element.hasGenderStatus()) {
22266        composeCodeableConcept("genderStatus", element.getGenderStatus());
22267      }
22268  }
22269
22270  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
22271    if (element != null) {
22272      open(name);
22273      composePatientPatientCommunicationComponentInner(element);
22274      close();
22275    }
22276  }
22277
22278  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
22279      composeBackbone(element);
22280      if (element.hasLanguage()) {
22281        composeCodeableConcept("language", element.getLanguage());
22282      }
22283      if (element.hasPreferredElement()) {
22284        composeBooleanCore("preferred", element.getPreferredElement(), false);
22285        composeBooleanExtras("preferred", element.getPreferredElement(), false);
22286      }
22287  }
22288
22289  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
22290    if (element != null) {
22291      open(name);
22292      composePatientPatientLinkComponentInner(element);
22293      close();
22294    }
22295  }
22296
22297  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
22298      composeBackbone(element);
22299      if (element.hasOther()) {
22300        composeReference("other", element.getOther());
22301      }
22302      if (element.hasTypeElement()) {
22303        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22304        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22305      }
22306  }
22307
22308  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
22309    if (element != null) {
22310      prop("resourceType", name);
22311      composePaymentNoticeInner(element);
22312    }
22313  }
22314
22315  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
22316      composeDomainResourceElements(element);
22317      if (element.hasIdentifier()) {
22318        openArray("identifier");
22319        for (Identifier e : element.getIdentifier()) 
22320          composeIdentifier(null, e);
22321        closeArray();
22322      };
22323      if (element.hasRuleset()) {
22324        composeCoding("ruleset", element.getRuleset());
22325      }
22326      if (element.hasOriginalRuleset()) {
22327        composeCoding("originalRuleset", element.getOriginalRuleset());
22328      }
22329      if (element.hasCreatedElement()) {
22330        composeDateTimeCore("created", element.getCreatedElement(), false);
22331        composeDateTimeExtras("created", element.getCreatedElement(), false);
22332      }
22333      if (element.hasTarget()) {
22334        composeReference("target", element.getTarget());
22335      }
22336      if (element.hasProvider()) {
22337        composeReference("provider", element.getProvider());
22338      }
22339      if (element.hasOrganization()) {
22340        composeReference("organization", element.getOrganization());
22341      }
22342      if (element.hasRequest()) {
22343        composeReference("request", element.getRequest());
22344      }
22345      if (element.hasResponse()) {
22346        composeReference("response", element.getResponse());
22347      }
22348      if (element.hasPaymentStatus()) {
22349        composeCoding("paymentStatus", element.getPaymentStatus());
22350      }
22351  }
22352
22353  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
22354    if (element != null) {
22355      prop("resourceType", name);
22356      composePaymentReconciliationInner(element);
22357    }
22358  }
22359
22360  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
22361      composeDomainResourceElements(element);
22362      if (element.hasIdentifier()) {
22363        openArray("identifier");
22364        for (Identifier e : element.getIdentifier()) 
22365          composeIdentifier(null, e);
22366        closeArray();
22367      };
22368      if (element.hasRequest()) {
22369        composeReference("request", element.getRequest());
22370      }
22371      if (element.hasOutcomeElement()) {
22372        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22373        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22374      }
22375      if (element.hasDispositionElement()) {
22376        composeStringCore("disposition", element.getDispositionElement(), false);
22377        composeStringExtras("disposition", element.getDispositionElement(), false);
22378      }
22379      if (element.hasRuleset()) {
22380        composeCoding("ruleset", element.getRuleset());
22381      }
22382      if (element.hasOriginalRuleset()) {
22383        composeCoding("originalRuleset", element.getOriginalRuleset());
22384      }
22385      if (element.hasCreatedElement()) {
22386        composeDateTimeCore("created", element.getCreatedElement(), false);
22387        composeDateTimeExtras("created", element.getCreatedElement(), false);
22388      }
22389      if (element.hasPeriod()) {
22390        composePeriod("period", element.getPeriod());
22391      }
22392      if (element.hasOrganization()) {
22393        composeReference("organization", element.getOrganization());
22394      }
22395      if (element.hasRequestProvider()) {
22396        composeReference("requestProvider", element.getRequestProvider());
22397      }
22398      if (element.hasRequestOrganization()) {
22399        composeReference("requestOrganization", element.getRequestOrganization());
22400      }
22401      if (element.hasDetail()) {
22402        openArray("detail");
22403        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
22404          composePaymentReconciliationDetailsComponent(null, e);
22405        closeArray();
22406      };
22407      if (element.hasForm()) {
22408        composeCoding("form", element.getForm());
22409      }
22410      if (element.hasTotal()) {
22411        composeMoney("total", element.getTotal());
22412      }
22413      if (element.hasNote()) {
22414        openArray("note");
22415        for (PaymentReconciliation.NotesComponent e : element.getNote()) 
22416          composePaymentReconciliationNotesComponent(null, e);
22417        closeArray();
22418      };
22419  }
22420
22421  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
22422    if (element != null) {
22423      open(name);
22424      composePaymentReconciliationDetailsComponentInner(element);
22425      close();
22426    }
22427  }
22428
22429  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
22430      composeBackbone(element);
22431      if (element.hasType()) {
22432        composeCoding("type", element.getType());
22433      }
22434      if (element.hasRequest()) {
22435        composeReference("request", element.getRequest());
22436      }
22437      if (element.hasResponce()) {
22438        composeReference("responce", element.getResponce());
22439      }
22440      if (element.hasSubmitter()) {
22441        composeReference("submitter", element.getSubmitter());
22442      }
22443      if (element.hasPayee()) {
22444        composeReference("payee", element.getPayee());
22445      }
22446      if (element.hasDateElement()) {
22447        composeDateCore("date", element.getDateElement(), false);
22448        composeDateExtras("date", element.getDateElement(), false);
22449      }
22450      if (element.hasAmount()) {
22451        composeMoney("amount", element.getAmount());
22452      }
22453  }
22454
22455  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
22456    if (element != null) {
22457      open(name);
22458      composePaymentReconciliationNotesComponentInner(element);
22459      close();
22460    }
22461  }
22462
22463  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
22464      composeBackbone(element);
22465      if (element.hasType()) {
22466        composeCoding("type", element.getType());
22467      }
22468      if (element.hasTextElement()) {
22469        composeStringCore("text", element.getTextElement(), false);
22470        composeStringExtras("text", element.getTextElement(), false);
22471      }
22472  }
22473
22474  protected void composePerson(String name, Person element) throws IOException {
22475    if (element != null) {
22476      prop("resourceType", name);
22477      composePersonInner(element);
22478    }
22479  }
22480
22481  protected void composePersonInner(Person element) throws IOException {
22482      composeDomainResourceElements(element);
22483      if (element.hasIdentifier()) {
22484        openArray("identifier");
22485        for (Identifier e : element.getIdentifier()) 
22486          composeIdentifier(null, e);
22487        closeArray();
22488      };
22489      if (element.hasName()) {
22490        openArray("name");
22491        for (HumanName e : element.getName()) 
22492          composeHumanName(null, e);
22493        closeArray();
22494      };
22495      if (element.hasTelecom()) {
22496        openArray("telecom");
22497        for (ContactPoint e : element.getTelecom()) 
22498          composeContactPoint(null, e);
22499        closeArray();
22500      };
22501      if (element.hasGenderElement()) {
22502        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22503        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22504      }
22505      if (element.hasBirthDateElement()) {
22506        composeDateCore("birthDate", element.getBirthDateElement(), false);
22507        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22508      }
22509      if (element.hasAddress()) {
22510        openArray("address");
22511        for (Address e : element.getAddress()) 
22512          composeAddress(null, e);
22513        closeArray();
22514      };
22515      if (element.hasPhoto()) {
22516        composeAttachment("photo", element.getPhoto());
22517      }
22518      if (element.hasManagingOrganization()) {
22519        composeReference("managingOrganization", element.getManagingOrganization());
22520      }
22521      if (element.hasActiveElement()) {
22522        composeBooleanCore("active", element.getActiveElement(), false);
22523        composeBooleanExtras("active", element.getActiveElement(), false);
22524      }
22525      if (element.hasLink()) {
22526        openArray("link");
22527        for (Person.PersonLinkComponent e : element.getLink()) 
22528          composePersonPersonLinkComponent(null, e);
22529        closeArray();
22530      };
22531  }
22532
22533  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
22534    if (element != null) {
22535      open(name);
22536      composePersonPersonLinkComponentInner(element);
22537      close();
22538    }
22539  }
22540
22541  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
22542      composeBackbone(element);
22543      if (element.hasTarget()) {
22544        composeReference("target", element.getTarget());
22545      }
22546      if (element.hasAssuranceElement()) {
22547        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22548        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22549      }
22550  }
22551
22552  protected void composePractitioner(String name, Practitioner element) throws IOException {
22553    if (element != null) {
22554      prop("resourceType", name);
22555      composePractitionerInner(element);
22556    }
22557  }
22558
22559  protected void composePractitionerInner(Practitioner element) throws IOException {
22560      composeDomainResourceElements(element);
22561      if (element.hasIdentifier()) {
22562        openArray("identifier");
22563        for (Identifier e : element.getIdentifier()) 
22564          composeIdentifier(null, e);
22565        closeArray();
22566      };
22567      if (element.hasActiveElement()) {
22568        composeBooleanCore("active", element.getActiveElement(), false);
22569        composeBooleanExtras("active", element.getActiveElement(), false);
22570      }
22571      if (element.hasName()) {
22572        composeHumanName("name", element.getName());
22573      }
22574      if (element.hasTelecom()) {
22575        openArray("telecom");
22576        for (ContactPoint e : element.getTelecom()) 
22577          composeContactPoint(null, e);
22578        closeArray();
22579      };
22580      if (element.hasAddress()) {
22581        openArray("address");
22582        for (Address e : element.getAddress()) 
22583          composeAddress(null, e);
22584        closeArray();
22585      };
22586      if (element.hasGenderElement()) {
22587        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22588        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22589      }
22590      if (element.hasBirthDateElement()) {
22591        composeDateCore("birthDate", element.getBirthDateElement(), false);
22592        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22593      }
22594      if (element.hasPhoto()) {
22595        openArray("photo");
22596        for (Attachment e : element.getPhoto()) 
22597          composeAttachment(null, e);
22598        closeArray();
22599      };
22600      if (element.hasPractitionerRole()) {
22601        openArray("practitionerRole");
22602        for (Practitioner.PractitionerPractitionerRoleComponent e : element.getPractitionerRole()) 
22603          composePractitionerPractitionerPractitionerRoleComponent(null, e);
22604        closeArray();
22605      };
22606      if (element.hasQualification()) {
22607        openArray("qualification");
22608        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
22609          composePractitionerPractitionerQualificationComponent(null, e);
22610        closeArray();
22611      };
22612      if (element.hasCommunication()) {
22613        openArray("communication");
22614        for (CodeableConcept e : element.getCommunication()) 
22615          composeCodeableConcept(null, e);
22616        closeArray();
22617      };
22618  }
22619
22620  protected void composePractitionerPractitionerPractitionerRoleComponent(String name, Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22621    if (element != null) {
22622      open(name);
22623      composePractitionerPractitionerPractitionerRoleComponentInner(element);
22624      close();
22625    }
22626  }
22627
22628  protected void composePractitionerPractitionerPractitionerRoleComponentInner(Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22629      composeBackbone(element);
22630      if (element.hasManagingOrganization()) {
22631        composeReference("managingOrganization", element.getManagingOrganization());
22632      }
22633      if (element.hasRole()) {
22634        composeCodeableConcept("role", element.getRole());
22635      }
22636      if (element.hasSpecialty()) {
22637        openArray("specialty");
22638        for (CodeableConcept e : element.getSpecialty()) 
22639          composeCodeableConcept(null, e);
22640        closeArray();
22641      };
22642      if (element.hasPeriod()) {
22643        composePeriod("period", element.getPeriod());
22644      }
22645      if (element.hasLocation()) {
22646        openArray("location");
22647        for (Reference e : element.getLocation()) 
22648          composeReference(null, e);
22649        closeArray();
22650      };
22651      if (element.hasHealthcareService()) {
22652        openArray("healthcareService");
22653        for (Reference e : element.getHealthcareService()) 
22654          composeReference(null, e);
22655        closeArray();
22656      };
22657  }
22658
22659  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
22660    if (element != null) {
22661      open(name);
22662      composePractitionerPractitionerQualificationComponentInner(element);
22663      close();
22664    }
22665  }
22666
22667  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
22668      composeBackbone(element);
22669      if (element.hasIdentifier()) {
22670        openArray("identifier");
22671        for (Identifier e : element.getIdentifier()) 
22672          composeIdentifier(null, e);
22673        closeArray();
22674      };
22675      if (element.hasCode()) {
22676        composeCodeableConcept("code", element.getCode());
22677      }
22678      if (element.hasPeriod()) {
22679        composePeriod("period", element.getPeriod());
22680      }
22681      if (element.hasIssuer()) {
22682        composeReference("issuer", element.getIssuer());
22683      }
22684  }
22685
22686  protected void composeProcedure(String name, Procedure element) throws IOException {
22687    if (element != null) {
22688      prop("resourceType", name);
22689      composeProcedureInner(element);
22690    }
22691  }
22692
22693  protected void composeProcedureInner(Procedure element) throws IOException {
22694      composeDomainResourceElements(element);
22695      if (element.hasIdentifier()) {
22696        openArray("identifier");
22697        for (Identifier e : element.getIdentifier()) 
22698          composeIdentifier(null, e);
22699        closeArray();
22700      };
22701      if (element.hasSubject()) {
22702        composeReference("subject", element.getSubject());
22703      }
22704      if (element.hasStatusElement()) {
22705        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22706        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22707      }
22708      if (element.hasCategory()) {
22709        composeCodeableConcept("category", element.getCategory());
22710      }
22711      if (element.hasCode()) {
22712        composeCodeableConcept("code", element.getCode());
22713      }
22714      if (element.hasNotPerformedElement()) {
22715        composeBooleanCore("notPerformed", element.getNotPerformedElement(), false);
22716        composeBooleanExtras("notPerformed", element.getNotPerformedElement(), false);
22717      }
22718      if (element.hasReasonNotPerformed()) {
22719        openArray("reasonNotPerformed");
22720        for (CodeableConcept e : element.getReasonNotPerformed()) 
22721          composeCodeableConcept(null, e);
22722        closeArray();
22723      };
22724      if (element.hasBodySite()) {
22725        openArray("bodySite");
22726        for (CodeableConcept e : element.getBodySite()) 
22727          composeCodeableConcept(null, e);
22728        closeArray();
22729      };
22730      if (element.hasReason()) {
22731        composeType("reason", element.getReason());
22732      }
22733      if (element.hasPerformer()) {
22734        openArray("performer");
22735        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
22736          composeProcedureProcedurePerformerComponent(null, e);
22737        closeArray();
22738      };
22739      if (element.hasPerformed()) {
22740        composeType("performed", element.getPerformed());
22741      }
22742      if (element.hasEncounter()) {
22743        composeReference("encounter", element.getEncounter());
22744      }
22745      if (element.hasLocation()) {
22746        composeReference("location", element.getLocation());
22747      }
22748      if (element.hasOutcome()) {
22749        composeCodeableConcept("outcome", element.getOutcome());
22750      }
22751      if (element.hasReport()) {
22752        openArray("report");
22753        for (Reference e : element.getReport()) 
22754          composeReference(null, e);
22755        closeArray();
22756      };
22757      if (element.hasComplication()) {
22758        openArray("complication");
22759        for (CodeableConcept e : element.getComplication()) 
22760          composeCodeableConcept(null, e);
22761        closeArray();
22762      };
22763      if (element.hasFollowUp()) {
22764        openArray("followUp");
22765        for (CodeableConcept e : element.getFollowUp()) 
22766          composeCodeableConcept(null, e);
22767        closeArray();
22768      };
22769      if (element.hasRequest()) {
22770        composeReference("request", element.getRequest());
22771      }
22772      if (element.hasNotes()) {
22773        openArray("notes");
22774        for (Annotation e : element.getNotes()) 
22775          composeAnnotation(null, e);
22776        closeArray();
22777      };
22778      if (element.hasFocalDevice()) {
22779        openArray("focalDevice");
22780        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
22781          composeProcedureProcedureFocalDeviceComponent(null, e);
22782        closeArray();
22783      };
22784      if (element.hasUsed()) {
22785        openArray("used");
22786        for (Reference e : element.getUsed()) 
22787          composeReference(null, e);
22788        closeArray();
22789      };
22790  }
22791
22792  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
22793    if (element != null) {
22794      open(name);
22795      composeProcedureProcedurePerformerComponentInner(element);
22796      close();
22797    }
22798  }
22799
22800  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
22801      composeBackbone(element);
22802      if (element.hasActor()) {
22803        composeReference("actor", element.getActor());
22804      }
22805      if (element.hasRole()) {
22806        composeCodeableConcept("role", element.getRole());
22807      }
22808  }
22809
22810  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22811    if (element != null) {
22812      open(name);
22813      composeProcedureProcedureFocalDeviceComponentInner(element);
22814      close();
22815    }
22816  }
22817
22818  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22819      composeBackbone(element);
22820      if (element.hasAction()) {
22821        composeCodeableConcept("action", element.getAction());
22822      }
22823      if (element.hasManipulated()) {
22824        composeReference("manipulated", element.getManipulated());
22825      }
22826  }
22827
22828  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
22829    if (element != null) {
22830      prop("resourceType", name);
22831      composeProcedureRequestInner(element);
22832    }
22833  }
22834
22835  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
22836      composeDomainResourceElements(element);
22837      if (element.hasIdentifier()) {
22838        openArray("identifier");
22839        for (Identifier e : element.getIdentifier()) 
22840          composeIdentifier(null, e);
22841        closeArray();
22842      };
22843      if (element.hasSubject()) {
22844        composeReference("subject", element.getSubject());
22845      }
22846      if (element.hasCode()) {
22847        composeCodeableConcept("code", element.getCode());
22848      }
22849      if (element.hasBodySite()) {
22850        openArray("bodySite");
22851        for (CodeableConcept e : element.getBodySite()) 
22852          composeCodeableConcept(null, e);
22853        closeArray();
22854      };
22855      if (element.hasReason()) {
22856        composeType("reason", element.getReason());
22857      }
22858      if (element.hasScheduled()) {
22859        composeType("scheduled", element.getScheduled());
22860      }
22861      if (element.hasEncounter()) {
22862        composeReference("encounter", element.getEncounter());
22863      }
22864      if (element.hasPerformer()) {
22865        composeReference("performer", element.getPerformer());
22866      }
22867      if (element.hasStatusElement()) {
22868        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22869        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22870      }
22871      if (element.hasNotes()) {
22872        openArray("notes");
22873        for (Annotation e : element.getNotes()) 
22874          composeAnnotation(null, e);
22875        closeArray();
22876      };
22877      if (element.hasAsNeeded()) {
22878        composeType("asNeeded", element.getAsNeeded());
22879      }
22880      if (element.hasOrderedOnElement()) {
22881        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
22882        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
22883      }
22884      if (element.hasOrderer()) {
22885        composeReference("orderer", element.getOrderer());
22886      }
22887      if (element.hasPriorityElement()) {
22888        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22889        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22890      }
22891  }
22892
22893  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
22894    if (element != null) {
22895      prop("resourceType", name);
22896      composeProcessRequestInner(element);
22897    }
22898  }
22899
22900  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
22901      composeDomainResourceElements(element);
22902      if (element.hasActionElement()) {
22903        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22904        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22905      }
22906      if (element.hasIdentifier()) {
22907        openArray("identifier");
22908        for (Identifier e : element.getIdentifier()) 
22909          composeIdentifier(null, e);
22910        closeArray();
22911      };
22912      if (element.hasRuleset()) {
22913        composeCoding("ruleset", element.getRuleset());
22914      }
22915      if (element.hasOriginalRuleset()) {
22916        composeCoding("originalRuleset", element.getOriginalRuleset());
22917      }
22918      if (element.hasCreatedElement()) {
22919        composeDateTimeCore("created", element.getCreatedElement(), false);
22920        composeDateTimeExtras("created", element.getCreatedElement(), false);
22921      }
22922      if (element.hasTarget()) {
22923        composeReference("target", element.getTarget());
22924      }
22925      if (element.hasProvider()) {
22926        composeReference("provider", element.getProvider());
22927      }
22928      if (element.hasOrganization()) {
22929        composeReference("organization", element.getOrganization());
22930      }
22931      if (element.hasRequest()) {
22932        composeReference("request", element.getRequest());
22933      }
22934      if (element.hasResponse()) {
22935        composeReference("response", element.getResponse());
22936      }
22937      if (element.hasNullifyElement()) {
22938        composeBooleanCore("nullify", element.getNullifyElement(), false);
22939        composeBooleanExtras("nullify", element.getNullifyElement(), false);
22940      }
22941      if (element.hasReferenceElement()) {
22942        composeStringCore("reference", element.getReferenceElement(), false);
22943        composeStringExtras("reference", element.getReferenceElement(), false);
22944      }
22945      if (element.hasItem()) {
22946        openArray("item");
22947        for (ProcessRequest.ItemsComponent e : element.getItem()) 
22948          composeProcessRequestItemsComponent(null, e);
22949        closeArray();
22950      };
22951      if (element.hasInclude()) {
22952        openArray("include");
22953        for (StringType e : element.getInclude()) 
22954          composeStringCore(null, e, true);
22955        closeArray();
22956        if (anyHasExtras(element.getInclude())) {
22957          openArray("_include");
22958          for (StringType e : element.getInclude()) 
22959            composeStringExtras(null, e, true);
22960          closeArray();
22961        }
22962      };
22963      if (element.hasExclude()) {
22964        openArray("exclude");
22965        for (StringType e : element.getExclude()) 
22966          composeStringCore(null, e, true);
22967        closeArray();
22968        if (anyHasExtras(element.getExclude())) {
22969          openArray("_exclude");
22970          for (StringType e : element.getExclude()) 
22971            composeStringExtras(null, e, true);
22972          closeArray();
22973        }
22974      };
22975      if (element.hasPeriod()) {
22976        composePeriod("period", element.getPeriod());
22977      }
22978  }
22979
22980  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
22981    if (element != null) {
22982      open(name);
22983      composeProcessRequestItemsComponentInner(element);
22984      close();
22985    }
22986  }
22987
22988  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
22989      composeBackbone(element);
22990      if (element.hasSequenceLinkIdElement()) {
22991        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
22992        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
22993      }
22994  }
22995
22996  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
22997    if (element != null) {
22998      prop("resourceType", name);
22999      composeProcessResponseInner(element);
23000    }
23001  }
23002
23003  protected void composeProcessResponseInner(ProcessResponse 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.hasRequest()) {
23012        composeReference("request", element.getRequest());
23013      }
23014      if (element.hasOutcome()) {
23015        composeCoding("outcome", element.getOutcome());
23016      }
23017      if (element.hasDispositionElement()) {
23018        composeStringCore("disposition", element.getDispositionElement(), false);
23019        composeStringExtras("disposition", element.getDispositionElement(), false);
23020      }
23021      if (element.hasRuleset()) {
23022        composeCoding("ruleset", element.getRuleset());
23023      }
23024      if (element.hasOriginalRuleset()) {
23025        composeCoding("originalRuleset", element.getOriginalRuleset());
23026      }
23027      if (element.hasCreatedElement()) {
23028        composeDateTimeCore("created", element.getCreatedElement(), false);
23029        composeDateTimeExtras("created", element.getCreatedElement(), false);
23030      }
23031      if (element.hasOrganization()) {
23032        composeReference("organization", element.getOrganization());
23033      }
23034      if (element.hasRequestProvider()) {
23035        composeReference("requestProvider", element.getRequestProvider());
23036      }
23037      if (element.hasRequestOrganization()) {
23038        composeReference("requestOrganization", element.getRequestOrganization());
23039      }
23040      if (element.hasForm()) {
23041        composeCoding("form", element.getForm());
23042      }
23043      if (element.hasNotes()) {
23044        openArray("notes");
23045        for (ProcessResponse.ProcessResponseNotesComponent e : element.getNotes()) 
23046          composeProcessResponseProcessResponseNotesComponent(null, e);
23047        closeArray();
23048      };
23049      if (element.hasError()) {
23050        openArray("error");
23051        for (Coding e : element.getError()) 
23052          composeCoding(null, e);
23053        closeArray();
23054      };
23055  }
23056
23057  protected void composeProcessResponseProcessResponseNotesComponent(String name, ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23058    if (element != null) {
23059      open(name);
23060      composeProcessResponseProcessResponseNotesComponentInner(element);
23061      close();
23062    }
23063  }
23064
23065  protected void composeProcessResponseProcessResponseNotesComponentInner(ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23066      composeBackbone(element);
23067      if (element.hasType()) {
23068        composeCoding("type", element.getType());
23069      }
23070      if (element.hasTextElement()) {
23071        composeStringCore("text", element.getTextElement(), false);
23072        composeStringExtras("text", element.getTextElement(), false);
23073      }
23074  }
23075
23076  protected void composeProvenance(String name, Provenance element) throws IOException {
23077    if (element != null) {
23078      prop("resourceType", name);
23079      composeProvenanceInner(element);
23080    }
23081  }
23082
23083  protected void composeProvenanceInner(Provenance element) throws IOException {
23084      composeDomainResourceElements(element);
23085      if (element.hasTarget()) {
23086        openArray("target");
23087        for (Reference e : element.getTarget()) 
23088          composeReference(null, e);
23089        closeArray();
23090      };
23091      if (element.hasPeriod()) {
23092        composePeriod("period", element.getPeriod());
23093      }
23094      if (element.hasRecordedElement()) {
23095        composeInstantCore("recorded", element.getRecordedElement(), false);
23096        composeInstantExtras("recorded", element.getRecordedElement(), false);
23097      }
23098      if (element.hasReason()) {
23099        openArray("reason");
23100        for (CodeableConcept e : element.getReason()) 
23101          composeCodeableConcept(null, e);
23102        closeArray();
23103      };
23104      if (element.hasActivity()) {
23105        composeCodeableConcept("activity", element.getActivity());
23106      }
23107      if (element.hasLocation()) {
23108        composeReference("location", element.getLocation());
23109      }
23110      if (element.hasPolicy()) {
23111        openArray("policy");
23112        for (UriType e : element.getPolicy()) 
23113          composeUriCore(null, e, true);
23114        closeArray();
23115        if (anyHasExtras(element.getPolicy())) {
23116          openArray("_policy");
23117          for (UriType e : element.getPolicy()) 
23118            composeUriExtras(null, e, true);
23119          closeArray();
23120        }
23121      };
23122      if (element.hasAgent()) {
23123        openArray("agent");
23124        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
23125          composeProvenanceProvenanceAgentComponent(null, e);
23126        closeArray();
23127      };
23128      if (element.hasEntity()) {
23129        openArray("entity");
23130        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
23131          composeProvenanceProvenanceEntityComponent(null, e);
23132        closeArray();
23133      };
23134      if (element.hasSignature()) {
23135        openArray("signature");
23136        for (Signature e : element.getSignature()) 
23137          composeSignature(null, e);
23138        closeArray();
23139      };
23140  }
23141
23142  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
23143    if (element != null) {
23144      open(name);
23145      composeProvenanceProvenanceAgentComponentInner(element);
23146      close();
23147    }
23148  }
23149
23150  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
23151      composeBackbone(element);
23152      if (element.hasRole()) {
23153        composeCoding("role", element.getRole());
23154      }
23155      if (element.hasActor()) {
23156        composeReference("actor", element.getActor());
23157      }
23158      if (element.hasUserId()) {
23159        composeIdentifier("userId", element.getUserId());
23160      }
23161      if (element.hasRelatedAgent()) {
23162        openArray("relatedAgent");
23163        for (Provenance.ProvenanceAgentRelatedAgentComponent e : element.getRelatedAgent()) 
23164          composeProvenanceProvenanceAgentRelatedAgentComponent(null, e);
23165        closeArray();
23166      };
23167  }
23168
23169  protected void composeProvenanceProvenanceAgentRelatedAgentComponent(String name, Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23170    if (element != null) {
23171      open(name);
23172      composeProvenanceProvenanceAgentRelatedAgentComponentInner(element);
23173      close();
23174    }
23175  }
23176
23177  protected void composeProvenanceProvenanceAgentRelatedAgentComponentInner(Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23178      composeBackbone(element);
23179      if (element.hasType()) {
23180        composeCodeableConcept("type", element.getType());
23181      }
23182      if (element.hasTargetElement()) {
23183        composeUriCore("target", element.getTargetElement(), false);
23184        composeUriExtras("target", element.getTargetElement(), false);
23185      }
23186  }
23187
23188  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
23189    if (element != null) {
23190      open(name);
23191      composeProvenanceProvenanceEntityComponentInner(element);
23192      close();
23193    }
23194  }
23195
23196  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
23197      composeBackbone(element);
23198      if (element.hasRoleElement()) {
23199        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23200        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23201      }
23202      if (element.hasType()) {
23203        composeCoding("type", element.getType());
23204      }
23205      if (element.hasReferenceElement()) {
23206        composeUriCore("reference", element.getReferenceElement(), false);
23207        composeUriExtras("reference", element.getReferenceElement(), false);
23208      }
23209      if (element.hasDisplayElement()) {
23210        composeStringCore("display", element.getDisplayElement(), false);
23211        composeStringExtras("display", element.getDisplayElement(), false);
23212      }
23213      if (element.hasAgent()) {
23214        composeProvenanceProvenanceAgentComponent("agent", element.getAgent());
23215      }
23216  }
23217
23218  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
23219    if (element != null) {
23220      prop("resourceType", name);
23221      composeQuestionnaireInner(element);
23222    }
23223  }
23224
23225  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
23226      composeDomainResourceElements(element);
23227      if (element.hasIdentifier()) {
23228        openArray("identifier");
23229        for (Identifier e : element.getIdentifier()) 
23230          composeIdentifier(null, e);
23231        closeArray();
23232      };
23233      if (element.hasVersionElement()) {
23234        composeStringCore("version", element.getVersionElement(), false);
23235        composeStringExtras("version", element.getVersionElement(), false);
23236      }
23237      if (element.hasStatusElement()) {
23238        composeEnumerationCore("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23239        composeEnumerationExtras("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23240      }
23241      if (element.hasDateElement()) {
23242        composeDateTimeCore("date", element.getDateElement(), false);
23243        composeDateTimeExtras("date", element.getDateElement(), false);
23244      }
23245      if (element.hasPublisherElement()) {
23246        composeStringCore("publisher", element.getPublisherElement(), false);
23247        composeStringExtras("publisher", element.getPublisherElement(), false);
23248      }
23249      if (element.hasTelecom()) {
23250        openArray("telecom");
23251        for (ContactPoint e : element.getTelecom()) 
23252          composeContactPoint(null, e);
23253        closeArray();
23254      };
23255      if (element.hasSubjectType()) {
23256        openArray("subjectType");
23257        for (CodeType e : element.getSubjectType()) 
23258          composeCodeCore(null, e, true);
23259        closeArray();
23260        if (anyHasExtras(element.getSubjectType())) {
23261          openArray("_subjectType");
23262          for (CodeType e : element.getSubjectType()) 
23263            composeCodeExtras(null, e, true);
23264          closeArray();
23265        }
23266      };
23267      if (element.hasGroup()) {
23268        composeQuestionnaireGroupComponent("group", element.getGroup());
23269      }
23270  }
23271
23272  protected void composeQuestionnaireGroupComponent(String name, Questionnaire.GroupComponent element) throws IOException {
23273    if (element != null) {
23274      open(name);
23275      composeQuestionnaireGroupComponentInner(element);
23276      close();
23277    }
23278  }
23279
23280  protected void composeQuestionnaireGroupComponentInner(Questionnaire.GroupComponent element) throws IOException {
23281      composeBackbone(element);
23282      if (element.hasLinkIdElement()) {
23283        composeStringCore("linkId", element.getLinkIdElement(), false);
23284        composeStringExtras("linkId", element.getLinkIdElement(), false);
23285      }
23286      if (element.hasTitleElement()) {
23287        composeStringCore("title", element.getTitleElement(), false);
23288        composeStringExtras("title", element.getTitleElement(), false);
23289      }
23290      if (element.hasConcept()) {
23291        openArray("concept");
23292        for (Coding e : element.getConcept()) 
23293          composeCoding(null, e);
23294        closeArray();
23295      };
23296      if (element.hasTextElement()) {
23297        composeStringCore("text", element.getTextElement(), false);
23298        composeStringExtras("text", element.getTextElement(), false);
23299      }
23300      if (element.hasRequiredElement()) {
23301        composeBooleanCore("required", element.getRequiredElement(), false);
23302        composeBooleanExtras("required", element.getRequiredElement(), false);
23303      }
23304      if (element.hasRepeatsElement()) {
23305        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23306        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23307      }
23308      if (element.hasGroup()) {
23309        openArray("group");
23310        for (Questionnaire.GroupComponent e : element.getGroup()) 
23311          composeQuestionnaireGroupComponent(null, e);
23312        closeArray();
23313      };
23314      if (element.hasQuestion()) {
23315        openArray("question");
23316        for (Questionnaire.QuestionComponent e : element.getQuestion()) 
23317          composeQuestionnaireQuestionComponent(null, e);
23318        closeArray();
23319      };
23320  }
23321
23322  protected void composeQuestionnaireQuestionComponent(String name, Questionnaire.QuestionComponent element) throws IOException {
23323    if (element != null) {
23324      open(name);
23325      composeQuestionnaireQuestionComponentInner(element);
23326      close();
23327    }
23328  }
23329
23330  protected void composeQuestionnaireQuestionComponentInner(Questionnaire.QuestionComponent element) throws IOException {
23331      composeBackbone(element);
23332      if (element.hasLinkIdElement()) {
23333        composeStringCore("linkId", element.getLinkIdElement(), false);
23334        composeStringExtras("linkId", element.getLinkIdElement(), false);
23335      }
23336      if (element.hasConcept()) {
23337        openArray("concept");
23338        for (Coding e : element.getConcept()) 
23339          composeCoding(null, e);
23340        closeArray();
23341      };
23342      if (element.hasTextElement()) {
23343        composeStringCore("text", element.getTextElement(), false);
23344        composeStringExtras("text", element.getTextElement(), false);
23345      }
23346      if (element.hasTypeElement()) {
23347        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23348        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23349      }
23350      if (element.hasRequiredElement()) {
23351        composeBooleanCore("required", element.getRequiredElement(), false);
23352        composeBooleanExtras("required", element.getRequiredElement(), false);
23353      }
23354      if (element.hasRepeatsElement()) {
23355        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23356        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23357      }
23358      if (element.hasOptions()) {
23359        composeReference("options", element.getOptions());
23360      }
23361      if (element.hasOption()) {
23362        openArray("option");
23363        for (Coding e : element.getOption()) 
23364          composeCoding(null, e);
23365        closeArray();
23366      };
23367      if (element.hasGroup()) {
23368        openArray("group");
23369        for (Questionnaire.GroupComponent e : element.getGroup()) 
23370          composeQuestionnaireGroupComponent(null, e);
23371        closeArray();
23372      };
23373  }
23374
23375  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
23376    if (element != null) {
23377      prop("resourceType", name);
23378      composeQuestionnaireResponseInner(element);
23379    }
23380  }
23381
23382  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
23383      composeDomainResourceElements(element);
23384      if (element.hasIdentifier()) {
23385        composeIdentifier("identifier", element.getIdentifier());
23386      }
23387      if (element.hasQuestionnaire()) {
23388        composeReference("questionnaire", element.getQuestionnaire());
23389      }
23390      if (element.hasStatusElement()) {
23391        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23392        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23393      }
23394      if (element.hasSubject()) {
23395        composeReference("subject", element.getSubject());
23396      }
23397      if (element.hasAuthor()) {
23398        composeReference("author", element.getAuthor());
23399      }
23400      if (element.hasAuthoredElement()) {
23401        composeDateTimeCore("authored", element.getAuthoredElement(), false);
23402        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
23403      }
23404      if (element.hasSource()) {
23405        composeReference("source", element.getSource());
23406      }
23407      if (element.hasEncounter()) {
23408        composeReference("encounter", element.getEncounter());
23409      }
23410      if (element.hasGroup()) {
23411        composeQuestionnaireResponseGroupComponent("group", element.getGroup());
23412      }
23413  }
23414
23415  protected void composeQuestionnaireResponseGroupComponent(String name, QuestionnaireResponse.GroupComponent element) throws IOException {
23416    if (element != null) {
23417      open(name);
23418      composeQuestionnaireResponseGroupComponentInner(element);
23419      close();
23420    }
23421  }
23422
23423  protected void composeQuestionnaireResponseGroupComponentInner(QuestionnaireResponse.GroupComponent element) throws IOException {
23424      composeBackbone(element);
23425      if (element.hasLinkIdElement()) {
23426        composeStringCore("linkId", element.getLinkIdElement(), false);
23427        composeStringExtras("linkId", element.getLinkIdElement(), false);
23428      }
23429      if (element.hasTitleElement()) {
23430        composeStringCore("title", element.getTitleElement(), false);
23431        composeStringExtras("title", element.getTitleElement(), false);
23432      }
23433      if (element.hasTextElement()) {
23434        composeStringCore("text", element.getTextElement(), false);
23435        composeStringExtras("text", element.getTextElement(), false);
23436      }
23437      if (element.hasSubject()) {
23438        composeReference("subject", element.getSubject());
23439      }
23440      if (element.hasGroup()) {
23441        openArray("group");
23442        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23443          composeQuestionnaireResponseGroupComponent(null, e);
23444        closeArray();
23445      };
23446      if (element.hasQuestion()) {
23447        openArray("question");
23448        for (QuestionnaireResponse.QuestionComponent e : element.getQuestion()) 
23449          composeQuestionnaireResponseQuestionComponent(null, e);
23450        closeArray();
23451      };
23452  }
23453
23454  protected void composeQuestionnaireResponseQuestionComponent(String name, QuestionnaireResponse.QuestionComponent element) throws IOException {
23455    if (element != null) {
23456      open(name);
23457      composeQuestionnaireResponseQuestionComponentInner(element);
23458      close();
23459    }
23460  }
23461
23462  protected void composeQuestionnaireResponseQuestionComponentInner(QuestionnaireResponse.QuestionComponent element) throws IOException {
23463      composeBackbone(element);
23464      if (element.hasLinkIdElement()) {
23465        composeStringCore("linkId", element.getLinkIdElement(), false);
23466        composeStringExtras("linkId", element.getLinkIdElement(), false);
23467      }
23468      if (element.hasTextElement()) {
23469        composeStringCore("text", element.getTextElement(), false);
23470        composeStringExtras("text", element.getTextElement(), false);
23471      }
23472      if (element.hasAnswer()) {
23473        openArray("answer");
23474        for (QuestionnaireResponse.QuestionAnswerComponent e : element.getAnswer()) 
23475          composeQuestionnaireResponseQuestionAnswerComponent(null, e);
23476        closeArray();
23477      };
23478  }
23479
23480  protected void composeQuestionnaireResponseQuestionAnswerComponent(String name, QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23481    if (element != null) {
23482      open(name);
23483      composeQuestionnaireResponseQuestionAnswerComponentInner(element);
23484      close();
23485    }
23486  }
23487
23488  protected void composeQuestionnaireResponseQuestionAnswerComponentInner(QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23489      composeBackbone(element);
23490      if (element.hasValue()) {
23491        composeType("value", element.getValue());
23492      }
23493      if (element.hasGroup()) {
23494        openArray("group");
23495        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23496          composeQuestionnaireResponseGroupComponent(null, e);
23497        closeArray();
23498      };
23499  }
23500
23501  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
23502    if (element != null) {
23503      prop("resourceType", name);
23504      composeReferralRequestInner(element);
23505    }
23506  }
23507
23508  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
23509      composeDomainResourceElements(element);
23510      if (element.hasStatusElement()) {
23511        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23512        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23513      }
23514      if (element.hasIdentifier()) {
23515        openArray("identifier");
23516        for (Identifier e : element.getIdentifier()) 
23517          composeIdentifier(null, e);
23518        closeArray();
23519      };
23520      if (element.hasDateElement()) {
23521        composeDateTimeCore("date", element.getDateElement(), false);
23522        composeDateTimeExtras("date", element.getDateElement(), false);
23523      }
23524      if (element.hasType()) {
23525        composeCodeableConcept("type", element.getType());
23526      }
23527      if (element.hasSpecialty()) {
23528        composeCodeableConcept("specialty", element.getSpecialty());
23529      }
23530      if (element.hasPriority()) {
23531        composeCodeableConcept("priority", element.getPriority());
23532      }
23533      if (element.hasPatient()) {
23534        composeReference("patient", element.getPatient());
23535      }
23536      if (element.hasRequester()) {
23537        composeReference("requester", element.getRequester());
23538      }
23539      if (element.hasRecipient()) {
23540        openArray("recipient");
23541        for (Reference e : element.getRecipient()) 
23542          composeReference(null, e);
23543        closeArray();
23544      };
23545      if (element.hasEncounter()) {
23546        composeReference("encounter", element.getEncounter());
23547      }
23548      if (element.hasDateSentElement()) {
23549        composeDateTimeCore("dateSent", element.getDateSentElement(), false);
23550        composeDateTimeExtras("dateSent", element.getDateSentElement(), false);
23551      }
23552      if (element.hasReason()) {
23553        composeCodeableConcept("reason", element.getReason());
23554      }
23555      if (element.hasDescriptionElement()) {
23556        composeStringCore("description", element.getDescriptionElement(), false);
23557        composeStringExtras("description", element.getDescriptionElement(), false);
23558      }
23559      if (element.hasServiceRequested()) {
23560        openArray("serviceRequested");
23561        for (CodeableConcept e : element.getServiceRequested()) 
23562          composeCodeableConcept(null, e);
23563        closeArray();
23564      };
23565      if (element.hasSupportingInformation()) {
23566        openArray("supportingInformation");
23567        for (Reference e : element.getSupportingInformation()) 
23568          composeReference(null, e);
23569        closeArray();
23570      };
23571      if (element.hasFulfillmentTime()) {
23572        composePeriod("fulfillmentTime", element.getFulfillmentTime());
23573      }
23574  }
23575
23576  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
23577    if (element != null) {
23578      prop("resourceType", name);
23579      composeRelatedPersonInner(element);
23580    }
23581  }
23582
23583  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
23584      composeDomainResourceElements(element);
23585      if (element.hasIdentifier()) {
23586        openArray("identifier");
23587        for (Identifier e : element.getIdentifier()) 
23588          composeIdentifier(null, e);
23589        closeArray();
23590      };
23591      if (element.hasPatient()) {
23592        composeReference("patient", element.getPatient());
23593      }
23594      if (element.hasRelationship()) {
23595        composeCodeableConcept("relationship", element.getRelationship());
23596      }
23597      if (element.hasName()) {
23598        composeHumanName("name", element.getName());
23599      }
23600      if (element.hasTelecom()) {
23601        openArray("telecom");
23602        for (ContactPoint e : element.getTelecom()) 
23603          composeContactPoint(null, e);
23604        closeArray();
23605      };
23606      if (element.hasGenderElement()) {
23607        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23608        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23609      }
23610      if (element.hasBirthDateElement()) {
23611        composeDateCore("birthDate", element.getBirthDateElement(), false);
23612        composeDateExtras("birthDate", element.getBirthDateElement(), false);
23613      }
23614      if (element.hasAddress()) {
23615        openArray("address");
23616        for (Address e : element.getAddress()) 
23617          composeAddress(null, e);
23618        closeArray();
23619      };
23620      if (element.hasPhoto()) {
23621        openArray("photo");
23622        for (Attachment e : element.getPhoto()) 
23623          composeAttachment(null, e);
23624        closeArray();
23625      };
23626      if (element.hasPeriod()) {
23627        composePeriod("period", element.getPeriod());
23628      }
23629  }
23630
23631  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
23632    if (element != null) {
23633      prop("resourceType", name);
23634      composeRiskAssessmentInner(element);
23635    }
23636  }
23637
23638  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
23639      composeDomainResourceElements(element);
23640      if (element.hasSubject()) {
23641        composeReference("subject", element.getSubject());
23642      }
23643      if (element.hasDateElement()) {
23644        composeDateTimeCore("date", element.getDateElement(), false);
23645        composeDateTimeExtras("date", element.getDateElement(), false);
23646      }
23647      if (element.hasCondition()) {
23648        composeReference("condition", element.getCondition());
23649      }
23650      if (element.hasEncounter()) {
23651        composeReference("encounter", element.getEncounter());
23652      }
23653      if (element.hasPerformer()) {
23654        composeReference("performer", element.getPerformer());
23655      }
23656      if (element.hasIdentifier()) {
23657        composeIdentifier("identifier", element.getIdentifier());
23658      }
23659      if (element.hasMethod()) {
23660        composeCodeableConcept("method", element.getMethod());
23661      }
23662      if (element.hasBasis()) {
23663        openArray("basis");
23664        for (Reference e : element.getBasis()) 
23665          composeReference(null, e);
23666        closeArray();
23667      };
23668      if (element.hasPrediction()) {
23669        openArray("prediction");
23670        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
23671          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
23672        closeArray();
23673      };
23674      if (element.hasMitigationElement()) {
23675        composeStringCore("mitigation", element.getMitigationElement(), false);
23676        composeStringExtras("mitigation", element.getMitigationElement(), false);
23677      }
23678  }
23679
23680  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23681    if (element != null) {
23682      open(name);
23683      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
23684      close();
23685    }
23686  }
23687
23688  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23689      composeBackbone(element);
23690      if (element.hasOutcome()) {
23691        composeCodeableConcept("outcome", element.getOutcome());
23692      }
23693      if (element.hasProbability()) {
23694        composeType("probability", element.getProbability());
23695      }
23696      if (element.hasRelativeRiskElement()) {
23697        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
23698        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
23699      }
23700      if (element.hasWhen()) {
23701        composeType("when", element.getWhen());
23702      }
23703      if (element.hasRationaleElement()) {
23704        composeStringCore("rationale", element.getRationaleElement(), false);
23705        composeStringExtras("rationale", element.getRationaleElement(), false);
23706      }
23707  }
23708
23709  protected void composeSchedule(String name, Schedule element) throws IOException {
23710    if (element != null) {
23711      prop("resourceType", name);
23712      composeScheduleInner(element);
23713    }
23714  }
23715
23716  protected void composeScheduleInner(Schedule element) throws IOException {
23717      composeDomainResourceElements(element);
23718      if (element.hasIdentifier()) {
23719        openArray("identifier");
23720        for (Identifier e : element.getIdentifier()) 
23721          composeIdentifier(null, e);
23722        closeArray();
23723      };
23724      if (element.hasType()) {
23725        openArray("type");
23726        for (CodeableConcept e : element.getType()) 
23727          composeCodeableConcept(null, e);
23728        closeArray();
23729      };
23730      if (element.hasActor()) {
23731        composeReference("actor", element.getActor());
23732      }
23733      if (element.hasPlanningHorizon()) {
23734        composePeriod("planningHorizon", element.getPlanningHorizon());
23735      }
23736      if (element.hasCommentElement()) {
23737        composeStringCore("comment", element.getCommentElement(), false);
23738        composeStringExtras("comment", element.getCommentElement(), false);
23739      }
23740  }
23741
23742  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
23743    if (element != null) {
23744      prop("resourceType", name);
23745      composeSearchParameterInner(element);
23746    }
23747  }
23748
23749  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
23750      composeDomainResourceElements(element);
23751      if (element.hasUrlElement()) {
23752        composeUriCore("url", element.getUrlElement(), false);
23753        composeUriExtras("url", element.getUrlElement(), false);
23754      }
23755      if (element.hasNameElement()) {
23756        composeStringCore("name", element.getNameElement(), false);
23757        composeStringExtras("name", element.getNameElement(), false);
23758      }
23759      if (element.hasStatusElement()) {
23760        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23761        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23762      }
23763      if (element.hasExperimentalElement()) {
23764        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23765        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23766      }
23767      if (element.hasPublisherElement()) {
23768        composeStringCore("publisher", element.getPublisherElement(), false);
23769        composeStringExtras("publisher", element.getPublisherElement(), false);
23770      }
23771      if (element.hasContact()) {
23772        openArray("contact");
23773        for (SearchParameter.SearchParameterContactComponent e : element.getContact()) 
23774          composeSearchParameterSearchParameterContactComponent(null, e);
23775        closeArray();
23776      };
23777      if (element.hasDateElement()) {
23778        composeDateTimeCore("date", element.getDateElement(), false);
23779        composeDateTimeExtras("date", element.getDateElement(), false);
23780      }
23781      if (element.hasRequirementsElement()) {
23782        composeStringCore("requirements", element.getRequirementsElement(), false);
23783        composeStringExtras("requirements", element.getRequirementsElement(), false);
23784      }
23785      if (element.hasCodeElement()) {
23786        composeCodeCore("code", element.getCodeElement(), false);
23787        composeCodeExtras("code", element.getCodeElement(), false);
23788      }
23789      if (element.hasBaseElement()) {
23790        composeCodeCore("base", element.getBaseElement(), false);
23791        composeCodeExtras("base", element.getBaseElement(), false);
23792      }
23793      if (element.hasTypeElement()) {
23794        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23795        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23796      }
23797      if (element.hasDescriptionElement()) {
23798        composeStringCore("description", element.getDescriptionElement(), false);
23799        composeStringExtras("description", element.getDescriptionElement(), false);
23800      }
23801      if (element.hasXpathElement()) {
23802        composeStringCore("xpath", element.getXpathElement(), false);
23803        composeStringExtras("xpath", element.getXpathElement(), false);
23804      }
23805      if (element.hasXpathUsageElement()) {
23806        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23807        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23808      }
23809      if (element.hasTarget()) {
23810        openArray("target");
23811        for (CodeType e : element.getTarget()) 
23812          composeCodeCore(null, e, true);
23813        closeArray();
23814        if (anyHasExtras(element.getTarget())) {
23815          openArray("_target");
23816          for (CodeType e : element.getTarget()) 
23817            composeCodeExtras(null, e, true);
23818          closeArray();
23819        }
23820      };
23821  }
23822
23823  protected void composeSearchParameterSearchParameterContactComponent(String name, SearchParameter.SearchParameterContactComponent element) throws IOException {
23824    if (element != null) {
23825      open(name);
23826      composeSearchParameterSearchParameterContactComponentInner(element);
23827      close();
23828    }
23829  }
23830
23831  protected void composeSearchParameterSearchParameterContactComponentInner(SearchParameter.SearchParameterContactComponent element) throws IOException {
23832      composeBackbone(element);
23833      if (element.hasNameElement()) {
23834        composeStringCore("name", element.getNameElement(), false);
23835        composeStringExtras("name", element.getNameElement(), false);
23836      }
23837      if (element.hasTelecom()) {
23838        openArray("telecom");
23839        for (ContactPoint e : element.getTelecom()) 
23840          composeContactPoint(null, e);
23841        closeArray();
23842      };
23843  }
23844
23845  protected void composeSlot(String name, Slot element) throws IOException {
23846    if (element != null) {
23847      prop("resourceType", name);
23848      composeSlotInner(element);
23849    }
23850  }
23851
23852  protected void composeSlotInner(Slot element) throws IOException {
23853      composeDomainResourceElements(element);
23854      if (element.hasIdentifier()) {
23855        openArray("identifier");
23856        for (Identifier e : element.getIdentifier()) 
23857          composeIdentifier(null, e);
23858        closeArray();
23859      };
23860      if (element.hasType()) {
23861        composeCodeableConcept("type", element.getType());
23862      }
23863      if (element.hasSchedule()) {
23864        composeReference("schedule", element.getSchedule());
23865      }
23866      if (element.hasFreeBusyTypeElement()) {
23867        composeEnumerationCore("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23868        composeEnumerationExtras("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23869      }
23870      if (element.hasStartElement()) {
23871        composeInstantCore("start", element.getStartElement(), false);
23872        composeInstantExtras("start", element.getStartElement(), false);
23873      }
23874      if (element.hasEndElement()) {
23875        composeInstantCore("end", element.getEndElement(), false);
23876        composeInstantExtras("end", element.getEndElement(), false);
23877      }
23878      if (element.hasOverbookedElement()) {
23879        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
23880        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
23881      }
23882      if (element.hasCommentElement()) {
23883        composeStringCore("comment", element.getCommentElement(), false);
23884        composeStringExtras("comment", element.getCommentElement(), false);
23885      }
23886  }
23887
23888  protected void composeSpecimen(String name, Specimen element) throws IOException {
23889    if (element != null) {
23890      prop("resourceType", name);
23891      composeSpecimenInner(element);
23892    }
23893  }
23894
23895  protected void composeSpecimenInner(Specimen element) throws IOException {
23896      composeDomainResourceElements(element);
23897      if (element.hasIdentifier()) {
23898        openArray("identifier");
23899        for (Identifier e : element.getIdentifier()) 
23900          composeIdentifier(null, e);
23901        closeArray();
23902      };
23903      if (element.hasStatusElement()) {
23904        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23905        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23906      }
23907      if (element.hasType()) {
23908        composeCodeableConcept("type", element.getType());
23909      }
23910      if (element.hasParent()) {
23911        openArray("parent");
23912        for (Reference e : element.getParent()) 
23913          composeReference(null, e);
23914        closeArray();
23915      };
23916      if (element.hasSubject()) {
23917        composeReference("subject", element.getSubject());
23918      }
23919      if (element.hasAccessionIdentifier()) {
23920        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
23921      }
23922      if (element.hasReceivedTimeElement()) {
23923        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
23924        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
23925      }
23926      if (element.hasCollection()) {
23927        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
23928      }
23929      if (element.hasTreatment()) {
23930        openArray("treatment");
23931        for (Specimen.SpecimenTreatmentComponent e : element.getTreatment()) 
23932          composeSpecimenSpecimenTreatmentComponent(null, e);
23933        closeArray();
23934      };
23935      if (element.hasContainer()) {
23936        openArray("container");
23937        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
23938          composeSpecimenSpecimenContainerComponent(null, e);
23939        closeArray();
23940      };
23941  }
23942
23943  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
23944    if (element != null) {
23945      open(name);
23946      composeSpecimenSpecimenCollectionComponentInner(element);
23947      close();
23948    }
23949  }
23950
23951  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
23952      composeBackbone(element);
23953      if (element.hasCollector()) {
23954        composeReference("collector", element.getCollector());
23955      }
23956      if (element.hasComment()) {
23957        openArray("comment");
23958        for (StringType e : element.getComment()) 
23959          composeStringCore(null, e, true);
23960        closeArray();
23961        if (anyHasExtras(element.getComment())) {
23962          openArray("_comment");
23963          for (StringType e : element.getComment()) 
23964            composeStringExtras(null, e, true);
23965          closeArray();
23966        }
23967      };
23968      if (element.hasCollected()) {
23969        composeType("collected", element.getCollected());
23970      }
23971      if (element.hasQuantity()) {
23972        composeSimpleQuantity("quantity", element.getQuantity());
23973      }
23974      if (element.hasMethod()) {
23975        composeCodeableConcept("method", element.getMethod());
23976      }
23977      if (element.hasBodySite()) {
23978        composeCodeableConcept("bodySite", element.getBodySite());
23979      }
23980  }
23981
23982  protected void composeSpecimenSpecimenTreatmentComponent(String name, Specimen.SpecimenTreatmentComponent element) throws IOException {
23983    if (element != null) {
23984      open(name);
23985      composeSpecimenSpecimenTreatmentComponentInner(element);
23986      close();
23987    }
23988  }
23989
23990  protected void composeSpecimenSpecimenTreatmentComponentInner(Specimen.SpecimenTreatmentComponent element) throws IOException {
23991      composeBackbone(element);
23992      if (element.hasDescriptionElement()) {
23993        composeStringCore("description", element.getDescriptionElement(), false);
23994        composeStringExtras("description", element.getDescriptionElement(), false);
23995      }
23996      if (element.hasProcedure()) {
23997        composeCodeableConcept("procedure", element.getProcedure());
23998      }
23999      if (element.hasAdditive()) {
24000        openArray("additive");
24001        for (Reference e : element.getAdditive()) 
24002          composeReference(null, e);
24003        closeArray();
24004      };
24005  }
24006
24007  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
24008    if (element != null) {
24009      open(name);
24010      composeSpecimenSpecimenContainerComponentInner(element);
24011      close();
24012    }
24013  }
24014
24015  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
24016      composeBackbone(element);
24017      if (element.hasIdentifier()) {
24018        openArray("identifier");
24019        for (Identifier e : element.getIdentifier()) 
24020          composeIdentifier(null, e);
24021        closeArray();
24022      };
24023      if (element.hasDescriptionElement()) {
24024        composeStringCore("description", element.getDescriptionElement(), false);
24025        composeStringExtras("description", element.getDescriptionElement(), false);
24026      }
24027      if (element.hasType()) {
24028        composeCodeableConcept("type", element.getType());
24029      }
24030      if (element.hasCapacity()) {
24031        composeSimpleQuantity("capacity", element.getCapacity());
24032      }
24033      if (element.hasSpecimenQuantity()) {
24034        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
24035      }
24036      if (element.hasAdditive()) {
24037        composeType("additive", element.getAdditive());
24038      }
24039  }
24040
24041  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
24042    if (element != null) {
24043      prop("resourceType", name);
24044      composeStructureDefinitionInner(element);
24045    }
24046  }
24047
24048  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
24049      composeDomainResourceElements(element);
24050      if (element.hasUrlElement()) {
24051        composeUriCore("url", element.getUrlElement(), false);
24052        composeUriExtras("url", element.getUrlElement(), false);
24053      }
24054      if (element.hasIdentifier()) {
24055        openArray("identifier");
24056        for (Identifier e : element.getIdentifier()) 
24057          composeIdentifier(null, e);
24058        closeArray();
24059      };
24060      if (element.hasVersionElement()) {
24061        composeStringCore("version", element.getVersionElement(), false);
24062        composeStringExtras("version", element.getVersionElement(), false);
24063      }
24064      if (element.hasNameElement()) {
24065        composeStringCore("name", element.getNameElement(), false);
24066        composeStringExtras("name", element.getNameElement(), false);
24067      }
24068      if (element.hasDisplayElement()) {
24069        composeStringCore("display", element.getDisplayElement(), false);
24070        composeStringExtras("display", element.getDisplayElement(), false);
24071      }
24072      if (element.hasStatusElement()) {
24073        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24074        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24075      }
24076      if (element.hasExperimentalElement()) {
24077        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24078        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24079      }
24080      if (element.hasPublisherElement()) {
24081        composeStringCore("publisher", element.getPublisherElement(), false);
24082        composeStringExtras("publisher", element.getPublisherElement(), false);
24083      }
24084      if (element.hasContact()) {
24085        openArray("contact");
24086        for (StructureDefinition.StructureDefinitionContactComponent e : element.getContact()) 
24087          composeStructureDefinitionStructureDefinitionContactComponent(null, e);
24088        closeArray();
24089      };
24090      if (element.hasDateElement()) {
24091        composeDateTimeCore("date", element.getDateElement(), false);
24092        composeDateTimeExtras("date", element.getDateElement(), false);
24093      }
24094      if (element.hasDescriptionElement()) {
24095        composeStringCore("description", element.getDescriptionElement(), false);
24096        composeStringExtras("description", element.getDescriptionElement(), false);
24097      }
24098      if (element.hasUseContext()) {
24099        openArray("useContext");
24100        for (CodeableConcept e : element.getUseContext()) 
24101          composeCodeableConcept(null, e);
24102        closeArray();
24103      };
24104      if (element.hasRequirementsElement()) {
24105        composeStringCore("requirements", element.getRequirementsElement(), false);
24106        composeStringExtras("requirements", element.getRequirementsElement(), false);
24107      }
24108      if (element.hasCopyrightElement()) {
24109        composeStringCore("copyright", element.getCopyrightElement(), false);
24110        composeStringExtras("copyright", element.getCopyrightElement(), false);
24111      }
24112      if (element.hasCode()) {
24113        openArray("code");
24114        for (Coding e : element.getCode()) 
24115          composeCoding(null, e);
24116        closeArray();
24117      };
24118      if (element.hasFhirVersionElement()) {
24119        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
24120        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
24121      }
24122      if (element.hasMapping()) {
24123        openArray("mapping");
24124        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
24125          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
24126        closeArray();
24127      };
24128      if (element.hasKindElement()) {
24129        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24130        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24131      }
24132      if (element.hasConstrainedTypeElement()) {
24133        composeCodeCore("constrainedType", element.getConstrainedTypeElement(), false);
24134        composeCodeExtras("constrainedType", element.getConstrainedTypeElement(), false);
24135      }
24136      if (element.hasAbstractElement()) {
24137        composeBooleanCore("abstract", element.getAbstractElement(), false);
24138        composeBooleanExtras("abstract", element.getAbstractElement(), false);
24139      }
24140      if (element.hasContextTypeElement()) {
24141        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24142        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24143      }
24144      if (element.hasContext()) {
24145        openArray("context");
24146        for (StringType e : element.getContext()) 
24147          composeStringCore(null, e, true);
24148        closeArray();
24149        if (anyHasExtras(element.getContext())) {
24150          openArray("_context");
24151          for (StringType e : element.getContext()) 
24152            composeStringExtras(null, e, true);
24153          closeArray();
24154        }
24155      };
24156      if (element.hasBaseElement()) {
24157        composeUriCore("base", element.getBaseElement(), false);
24158        composeUriExtras("base", element.getBaseElement(), false);
24159      }
24160      if (element.hasSnapshot()) {
24161        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
24162      }
24163      if (element.hasDifferential()) {
24164        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
24165      }
24166  }
24167
24168  protected void composeStructureDefinitionStructureDefinitionContactComponent(String name, StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24169    if (element != null) {
24170      open(name);
24171      composeStructureDefinitionStructureDefinitionContactComponentInner(element);
24172      close();
24173    }
24174  }
24175
24176  protected void composeStructureDefinitionStructureDefinitionContactComponentInner(StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24177      composeBackbone(element);
24178      if (element.hasNameElement()) {
24179        composeStringCore("name", element.getNameElement(), false);
24180        composeStringExtras("name", element.getNameElement(), false);
24181      }
24182      if (element.hasTelecom()) {
24183        openArray("telecom");
24184        for (ContactPoint e : element.getTelecom()) 
24185          composeContactPoint(null, e);
24186        closeArray();
24187      };
24188  }
24189
24190  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24191    if (element != null) {
24192      open(name);
24193      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
24194      close();
24195    }
24196  }
24197
24198  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24199      composeBackbone(element);
24200      if (element.hasIdentityElement()) {
24201        composeIdCore("identity", element.getIdentityElement(), false);
24202        composeIdExtras("identity", element.getIdentityElement(), false);
24203      }
24204      if (element.hasUriElement()) {
24205        composeUriCore("uri", element.getUriElement(), false);
24206        composeUriExtras("uri", element.getUriElement(), false);
24207      }
24208      if (element.hasNameElement()) {
24209        composeStringCore("name", element.getNameElement(), false);
24210        composeStringExtras("name", element.getNameElement(), false);
24211      }
24212      if (element.hasCommentsElement()) {
24213        composeStringCore("comments", element.getCommentsElement(), false);
24214        composeStringExtras("comments", element.getCommentsElement(), false);
24215      }
24216  }
24217
24218  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24219    if (element != null) {
24220      open(name);
24221      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
24222      close();
24223    }
24224  }
24225
24226  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24227      composeBackbone(element);
24228      if (element.hasElement()) {
24229        openArray("element");
24230        for (ElementDefinition e : element.getElement()) 
24231          composeElementDefinition(null, e);
24232        closeArray();
24233      };
24234  }
24235
24236  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24237    if (element != null) {
24238      open(name);
24239      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
24240      close();
24241    }
24242  }
24243
24244  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24245      composeBackbone(element);
24246      if (element.hasElement()) {
24247        openArray("element");
24248        for (ElementDefinition e : element.getElement()) 
24249          composeElementDefinition(null, e);
24250        closeArray();
24251      };
24252  }
24253
24254  protected void composeSubscription(String name, Subscription element) throws IOException {
24255    if (element != null) {
24256      prop("resourceType", name);
24257      composeSubscriptionInner(element);
24258    }
24259  }
24260
24261  protected void composeSubscriptionInner(Subscription element) throws IOException {
24262      composeDomainResourceElements(element);
24263      if (element.hasCriteriaElement()) {
24264        composeStringCore("criteria", element.getCriteriaElement(), false);
24265        composeStringExtras("criteria", element.getCriteriaElement(), false);
24266      }
24267      if (element.hasContact()) {
24268        openArray("contact");
24269        for (ContactPoint e : element.getContact()) 
24270          composeContactPoint(null, e);
24271        closeArray();
24272      };
24273      if (element.hasReasonElement()) {
24274        composeStringCore("reason", element.getReasonElement(), false);
24275        composeStringExtras("reason", element.getReasonElement(), false);
24276      }
24277      if (element.hasStatusElement()) {
24278        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24279        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24280      }
24281      if (element.hasErrorElement()) {
24282        composeStringCore("error", element.getErrorElement(), false);
24283        composeStringExtras("error", element.getErrorElement(), false);
24284      }
24285      if (element.hasChannel()) {
24286        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
24287      }
24288      if (element.hasEndElement()) {
24289        composeInstantCore("end", element.getEndElement(), false);
24290        composeInstantExtras("end", element.getEndElement(), false);
24291      }
24292      if (element.hasTag()) {
24293        openArray("tag");
24294        for (Coding e : element.getTag()) 
24295          composeCoding(null, e);
24296        closeArray();
24297      };
24298  }
24299
24300  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
24301    if (element != null) {
24302      open(name);
24303      composeSubscriptionSubscriptionChannelComponentInner(element);
24304      close();
24305    }
24306  }
24307
24308  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
24309      composeBackbone(element);
24310      if (element.hasTypeElement()) {
24311        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24312        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24313      }
24314      if (element.hasEndpointElement()) {
24315        composeUriCore("endpoint", element.getEndpointElement(), false);
24316        composeUriExtras("endpoint", element.getEndpointElement(), false);
24317      }
24318      if (element.hasPayloadElement()) {
24319        composeStringCore("payload", element.getPayloadElement(), false);
24320        composeStringExtras("payload", element.getPayloadElement(), false);
24321      }
24322      if (element.hasHeaderElement()) {
24323        composeStringCore("header", element.getHeaderElement(), false);
24324        composeStringExtras("header", element.getHeaderElement(), false);
24325      }
24326  }
24327
24328  protected void composeSubstance(String name, Substance element) throws IOException {
24329    if (element != null) {
24330      prop("resourceType", name);
24331      composeSubstanceInner(element);
24332    }
24333  }
24334
24335  protected void composeSubstanceInner(Substance element) throws IOException {
24336      composeDomainResourceElements(element);
24337      if (element.hasIdentifier()) {
24338        openArray("identifier");
24339        for (Identifier e : element.getIdentifier()) 
24340          composeIdentifier(null, e);
24341        closeArray();
24342      };
24343      if (element.hasCategory()) {
24344        openArray("category");
24345        for (CodeableConcept e : element.getCategory()) 
24346          composeCodeableConcept(null, e);
24347        closeArray();
24348      };
24349      if (element.hasCode()) {
24350        composeCodeableConcept("code", element.getCode());
24351      }
24352      if (element.hasDescriptionElement()) {
24353        composeStringCore("description", element.getDescriptionElement(), false);
24354        composeStringExtras("description", element.getDescriptionElement(), false);
24355      }
24356      if (element.hasInstance()) {
24357        openArray("instance");
24358        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
24359          composeSubstanceSubstanceInstanceComponent(null, e);
24360        closeArray();
24361      };
24362      if (element.hasIngredient()) {
24363        openArray("ingredient");
24364        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
24365          composeSubstanceSubstanceIngredientComponent(null, e);
24366        closeArray();
24367      };
24368  }
24369
24370  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
24371    if (element != null) {
24372      open(name);
24373      composeSubstanceSubstanceInstanceComponentInner(element);
24374      close();
24375    }
24376  }
24377
24378  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
24379      composeBackbone(element);
24380      if (element.hasIdentifier()) {
24381        composeIdentifier("identifier", element.getIdentifier());
24382      }
24383      if (element.hasExpiryElement()) {
24384        composeDateTimeCore("expiry", element.getExpiryElement(), false);
24385        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
24386      }
24387      if (element.hasQuantity()) {
24388        composeSimpleQuantity("quantity", element.getQuantity());
24389      }
24390  }
24391
24392  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
24393    if (element != null) {
24394      open(name);
24395      composeSubstanceSubstanceIngredientComponentInner(element);
24396      close();
24397    }
24398  }
24399
24400  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
24401      composeBackbone(element);
24402      if (element.hasQuantity()) {
24403        composeRatio("quantity", element.getQuantity());
24404      }
24405      if (element.hasSubstance()) {
24406        composeReference("substance", element.getSubstance());
24407      }
24408  }
24409
24410  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
24411    if (element != null) {
24412      prop("resourceType", name);
24413      composeSupplyDeliveryInner(element);
24414    }
24415  }
24416
24417  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
24418      composeDomainResourceElements(element);
24419      if (element.hasIdentifier()) {
24420        composeIdentifier("identifier", element.getIdentifier());
24421      }
24422      if (element.hasStatusElement()) {
24423        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24424        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24425      }
24426      if (element.hasPatient()) {
24427        composeReference("patient", element.getPatient());
24428      }
24429      if (element.hasType()) {
24430        composeCodeableConcept("type", element.getType());
24431      }
24432      if (element.hasQuantity()) {
24433        composeSimpleQuantity("quantity", element.getQuantity());
24434      }
24435      if (element.hasSuppliedItem()) {
24436        composeReference("suppliedItem", element.getSuppliedItem());
24437      }
24438      if (element.hasSupplier()) {
24439        composeReference("supplier", element.getSupplier());
24440      }
24441      if (element.hasWhenPrepared()) {
24442        composePeriod("whenPrepared", element.getWhenPrepared());
24443      }
24444      if (element.hasTimeElement()) {
24445        composeDateTimeCore("time", element.getTimeElement(), false);
24446        composeDateTimeExtras("time", element.getTimeElement(), false);
24447      }
24448      if (element.hasDestination()) {
24449        composeReference("destination", element.getDestination());
24450      }
24451      if (element.hasReceiver()) {
24452        openArray("receiver");
24453        for (Reference e : element.getReceiver()) 
24454          composeReference(null, e);
24455        closeArray();
24456      };
24457  }
24458
24459  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
24460    if (element != null) {
24461      prop("resourceType", name);
24462      composeSupplyRequestInner(element);
24463    }
24464  }
24465
24466  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
24467      composeDomainResourceElements(element);
24468      if (element.hasPatient()) {
24469        composeReference("patient", element.getPatient());
24470      }
24471      if (element.hasSource()) {
24472        composeReference("source", element.getSource());
24473      }
24474      if (element.hasDateElement()) {
24475        composeDateTimeCore("date", element.getDateElement(), false);
24476        composeDateTimeExtras("date", element.getDateElement(), false);
24477      }
24478      if (element.hasIdentifier()) {
24479        composeIdentifier("identifier", element.getIdentifier());
24480      }
24481      if (element.hasStatusElement()) {
24482        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24483        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24484      }
24485      if (element.hasKind()) {
24486        composeCodeableConcept("kind", element.getKind());
24487      }
24488      if (element.hasOrderedItem()) {
24489        composeReference("orderedItem", element.getOrderedItem());
24490      }
24491      if (element.hasSupplier()) {
24492        openArray("supplier");
24493        for (Reference e : element.getSupplier()) 
24494          composeReference(null, e);
24495        closeArray();
24496      };
24497      if (element.hasReason()) {
24498        composeType("reason", element.getReason());
24499      }
24500      if (element.hasWhen()) {
24501        composeSupplyRequestSupplyRequestWhenComponent("when", element.getWhen());
24502      }
24503  }
24504
24505  protected void composeSupplyRequestSupplyRequestWhenComponent(String name, SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24506    if (element != null) {
24507      open(name);
24508      composeSupplyRequestSupplyRequestWhenComponentInner(element);
24509      close();
24510    }
24511  }
24512
24513  protected void composeSupplyRequestSupplyRequestWhenComponentInner(SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24514      composeBackbone(element);
24515      if (element.hasCode()) {
24516        composeCodeableConcept("code", element.getCode());
24517      }
24518      if (element.hasSchedule()) {
24519        composeTiming("schedule", element.getSchedule());
24520      }
24521  }
24522
24523  protected void composeTestScript(String name, TestScript element) throws IOException {
24524    if (element != null) {
24525      prop("resourceType", name);
24526      composeTestScriptInner(element);
24527    }
24528  }
24529
24530  protected void composeTestScriptInner(TestScript element) throws IOException {
24531      composeDomainResourceElements(element);
24532      if (element.hasUrlElement()) {
24533        composeUriCore("url", element.getUrlElement(), false);
24534        composeUriExtras("url", element.getUrlElement(), false);
24535      }
24536      if (element.hasVersionElement()) {
24537        composeStringCore("version", element.getVersionElement(), false);
24538        composeStringExtras("version", element.getVersionElement(), false);
24539      }
24540      if (element.hasNameElement()) {
24541        composeStringCore("name", element.getNameElement(), false);
24542        composeStringExtras("name", element.getNameElement(), false);
24543      }
24544      if (element.hasStatusElement()) {
24545        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24546        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24547      }
24548      if (element.hasIdentifier()) {
24549        composeIdentifier("identifier", element.getIdentifier());
24550      }
24551      if (element.hasExperimentalElement()) {
24552        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24553        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24554      }
24555      if (element.hasPublisherElement()) {
24556        composeStringCore("publisher", element.getPublisherElement(), false);
24557        composeStringExtras("publisher", element.getPublisherElement(), false);
24558      }
24559      if (element.hasContact()) {
24560        openArray("contact");
24561        for (TestScript.TestScriptContactComponent e : element.getContact()) 
24562          composeTestScriptTestScriptContactComponent(null, e);
24563        closeArray();
24564      };
24565      if (element.hasDateElement()) {
24566        composeDateTimeCore("date", element.getDateElement(), false);
24567        composeDateTimeExtras("date", element.getDateElement(), false);
24568      }
24569      if (element.hasDescriptionElement()) {
24570        composeStringCore("description", element.getDescriptionElement(), false);
24571        composeStringExtras("description", element.getDescriptionElement(), false);
24572      }
24573      if (element.hasUseContext()) {
24574        openArray("useContext");
24575        for (CodeableConcept e : element.getUseContext()) 
24576          composeCodeableConcept(null, e);
24577        closeArray();
24578      };
24579      if (element.hasRequirementsElement()) {
24580        composeStringCore("requirements", element.getRequirementsElement(), false);
24581        composeStringExtras("requirements", element.getRequirementsElement(), false);
24582      }
24583      if (element.hasCopyrightElement()) {
24584        composeStringCore("copyright", element.getCopyrightElement(), false);
24585        composeStringExtras("copyright", element.getCopyrightElement(), false);
24586      }
24587      if (element.hasMetadata()) {
24588        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24589      }
24590      if (element.hasMultiserverElement()) {
24591        composeBooleanCore("multiserver", element.getMultiserverElement(), false);
24592        composeBooleanExtras("multiserver", element.getMultiserverElement(), false);
24593      }
24594      if (element.hasFixture()) {
24595        openArray("fixture");
24596        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
24597          composeTestScriptTestScriptFixtureComponent(null, e);
24598        closeArray();
24599      };
24600      if (element.hasProfile()) {
24601        openArray("profile");
24602        for (Reference e : element.getProfile()) 
24603          composeReference(null, e);
24604        closeArray();
24605      };
24606      if (element.hasVariable()) {
24607        openArray("variable");
24608        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
24609          composeTestScriptTestScriptVariableComponent(null, e);
24610        closeArray();
24611      };
24612      if (element.hasSetup()) {
24613        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
24614      }
24615      if (element.hasTest()) {
24616        openArray("test");
24617        for (TestScript.TestScriptTestComponent e : element.getTest()) 
24618          composeTestScriptTestScriptTestComponent(null, e);
24619        closeArray();
24620      };
24621      if (element.hasTeardown()) {
24622        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
24623      }
24624  }
24625
24626  protected void composeTestScriptTestScriptContactComponent(String name, TestScript.TestScriptContactComponent element) throws IOException {
24627    if (element != null) {
24628      open(name);
24629      composeTestScriptTestScriptContactComponentInner(element);
24630      close();
24631    }
24632  }
24633
24634  protected void composeTestScriptTestScriptContactComponentInner(TestScript.TestScriptContactComponent element) throws IOException {
24635      composeBackbone(element);
24636      if (element.hasNameElement()) {
24637        composeStringCore("name", element.getNameElement(), false);
24638        composeStringExtras("name", element.getNameElement(), false);
24639      }
24640      if (element.hasTelecom()) {
24641        openArray("telecom");
24642        for (ContactPoint e : element.getTelecom()) 
24643          composeContactPoint(null, e);
24644        closeArray();
24645      };
24646  }
24647
24648  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
24649    if (element != null) {
24650      open(name);
24651      composeTestScriptTestScriptMetadataComponentInner(element);
24652      close();
24653    }
24654  }
24655
24656  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
24657      composeBackbone(element);
24658      if (element.hasLink()) {
24659        openArray("link");
24660        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
24661          composeTestScriptTestScriptMetadataLinkComponent(null, e);
24662        closeArray();
24663      };
24664      if (element.hasCapability()) {
24665        openArray("capability");
24666        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
24667          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
24668        closeArray();
24669      };
24670  }
24671
24672  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24673    if (element != null) {
24674      open(name);
24675      composeTestScriptTestScriptMetadataLinkComponentInner(element);
24676      close();
24677    }
24678  }
24679
24680  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24681      composeBackbone(element);
24682      if (element.hasUrlElement()) {
24683        composeUriCore("url", element.getUrlElement(), false);
24684        composeUriExtras("url", element.getUrlElement(), false);
24685      }
24686      if (element.hasDescriptionElement()) {
24687        composeStringCore("description", element.getDescriptionElement(), false);
24688        composeStringExtras("description", element.getDescriptionElement(), false);
24689      }
24690  }
24691
24692  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24693    if (element != null) {
24694      open(name);
24695      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
24696      close();
24697    }
24698  }
24699
24700  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24701      composeBackbone(element);
24702      if (element.hasRequiredElement()) {
24703        composeBooleanCore("required", element.getRequiredElement(), false);
24704        composeBooleanExtras("required", element.getRequiredElement(), false);
24705      }
24706      if (element.hasValidatedElement()) {
24707        composeBooleanCore("validated", element.getValidatedElement(), false);
24708        composeBooleanExtras("validated", element.getValidatedElement(), false);
24709      }
24710      if (element.hasDescriptionElement()) {
24711        composeStringCore("description", element.getDescriptionElement(), false);
24712        composeStringExtras("description", element.getDescriptionElement(), false);
24713      }
24714      if (element.hasDestinationElement()) {
24715        composeIntegerCore("destination", element.getDestinationElement(), false);
24716        composeIntegerExtras("destination", element.getDestinationElement(), false);
24717      }
24718      if (element.hasLink()) {
24719        openArray("link");
24720        for (UriType e : element.getLink()) 
24721          composeUriCore(null, e, true);
24722        closeArray();
24723        if (anyHasExtras(element.getLink())) {
24724          openArray("_link");
24725          for (UriType e : element.getLink()) 
24726            composeUriExtras(null, e, true);
24727          closeArray();
24728        }
24729      };
24730      if (element.hasConformance()) {
24731        composeReference("conformance", element.getConformance());
24732      }
24733  }
24734
24735  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
24736    if (element != null) {
24737      open(name);
24738      composeTestScriptTestScriptFixtureComponentInner(element);
24739      close();
24740    }
24741  }
24742
24743  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
24744      composeBackbone(element);
24745      if (element.hasAutocreateElement()) {
24746        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
24747        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
24748      }
24749      if (element.hasAutodeleteElement()) {
24750        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
24751        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
24752      }
24753      if (element.hasResource()) {
24754        composeReference("resource", element.getResource());
24755      }
24756  }
24757
24758  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
24759    if (element != null) {
24760      open(name);
24761      composeTestScriptTestScriptVariableComponentInner(element);
24762      close();
24763    }
24764  }
24765
24766  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
24767      composeBackbone(element);
24768      if (element.hasNameElement()) {
24769        composeStringCore("name", element.getNameElement(), false);
24770        composeStringExtras("name", element.getNameElement(), false);
24771      }
24772      if (element.hasHeaderFieldElement()) {
24773        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24774        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24775      }
24776      if (element.hasPathElement()) {
24777        composeStringCore("path", element.getPathElement(), false);
24778        composeStringExtras("path", element.getPathElement(), false);
24779      }
24780      if (element.hasSourceIdElement()) {
24781        composeIdCore("sourceId", element.getSourceIdElement(), false);
24782        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24783      }
24784  }
24785
24786  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
24787    if (element != null) {
24788      open(name);
24789      composeTestScriptTestScriptSetupComponentInner(element);
24790      close();
24791    }
24792  }
24793
24794  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
24795      composeBackbone(element);
24796      if (element.hasMetadata()) {
24797        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24798      }
24799      if (element.hasAction()) {
24800        openArray("action");
24801        for (TestScript.TestScriptSetupActionComponent e : element.getAction()) 
24802          composeTestScriptTestScriptSetupActionComponent(null, e);
24803        closeArray();
24804      };
24805  }
24806
24807  protected void composeTestScriptTestScriptSetupActionComponent(String name, TestScript.TestScriptSetupActionComponent element) throws IOException {
24808    if (element != null) {
24809      open(name);
24810      composeTestScriptTestScriptSetupActionComponentInner(element);
24811      close();
24812    }
24813  }
24814
24815  protected void composeTestScriptTestScriptSetupActionComponentInner(TestScript.TestScriptSetupActionComponent element) throws IOException {
24816      composeBackbone(element);
24817      if (element.hasOperation()) {
24818        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
24819      }
24820      if (element.hasAssert()) {
24821        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
24822      }
24823  }
24824
24825  protected void composeTestScriptTestScriptSetupActionOperationComponent(String name, TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24826    if (element != null) {
24827      open(name);
24828      composeTestScriptTestScriptSetupActionOperationComponentInner(element);
24829      close();
24830    }
24831  }
24832
24833  protected void composeTestScriptTestScriptSetupActionOperationComponentInner(TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24834      composeBackbone(element);
24835      if (element.hasType()) {
24836        composeCoding("type", element.getType());
24837      }
24838      if (element.hasResourceElement()) {
24839        composeCodeCore("resource", element.getResourceElement(), false);
24840        composeCodeExtras("resource", element.getResourceElement(), false);
24841      }
24842      if (element.hasLabelElement()) {
24843        composeStringCore("label", element.getLabelElement(), false);
24844        composeStringExtras("label", element.getLabelElement(), false);
24845      }
24846      if (element.hasDescriptionElement()) {
24847        composeStringCore("description", element.getDescriptionElement(), false);
24848        composeStringExtras("description", element.getDescriptionElement(), false);
24849      }
24850      if (element.hasAcceptElement()) {
24851        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24852        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24853      }
24854      if (element.hasContentTypeElement()) {
24855        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24856        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24857      }
24858      if (element.hasDestinationElement()) {
24859        composeIntegerCore("destination", element.getDestinationElement(), false);
24860        composeIntegerExtras("destination", element.getDestinationElement(), false);
24861      }
24862      if (element.hasEncodeRequestUrlElement()) {
24863        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24864        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24865      }
24866      if (element.hasParamsElement()) {
24867        composeStringCore("params", element.getParamsElement(), false);
24868        composeStringExtras("params", element.getParamsElement(), false);
24869      }
24870      if (element.hasRequestHeader()) {
24871        openArray("requestHeader");
24872        for (TestScript.TestScriptSetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
24873          composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(null, e);
24874        closeArray();
24875      };
24876      if (element.hasResponseIdElement()) {
24877        composeIdCore("responseId", element.getResponseIdElement(), false);
24878        composeIdExtras("responseId", element.getResponseIdElement(), false);
24879      }
24880      if (element.hasSourceIdElement()) {
24881        composeIdCore("sourceId", element.getSourceIdElement(), false);
24882        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24883      }
24884      if (element.hasTargetIdElement()) {
24885        composeIdCore("targetId", element.getTargetIdElement(), false);
24886        composeIdExtras("targetId", element.getTargetIdElement(), false);
24887      }
24888      if (element.hasUrlElement()) {
24889        composeStringCore("url", element.getUrlElement(), false);
24890        composeStringExtras("url", element.getUrlElement(), false);
24891      }
24892  }
24893
24894  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24895    if (element != null) {
24896      open(name);
24897      composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(element);
24898      close();
24899    }
24900  }
24901
24902  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24903      composeBackbone(element);
24904      if (element.hasFieldElement()) {
24905        composeStringCore("field", element.getFieldElement(), false);
24906        composeStringExtras("field", element.getFieldElement(), false);
24907      }
24908      if (element.hasValueElement()) {
24909        composeStringCore("value", element.getValueElement(), false);
24910        composeStringExtras("value", element.getValueElement(), false);
24911      }
24912  }
24913
24914  protected void composeTestScriptTestScriptSetupActionAssertComponent(String name, TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24915    if (element != null) {
24916      open(name);
24917      composeTestScriptTestScriptSetupActionAssertComponentInner(element);
24918      close();
24919    }
24920  }
24921
24922  protected void composeTestScriptTestScriptSetupActionAssertComponentInner(TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24923      composeBackbone(element);
24924      if (element.hasLabelElement()) {
24925        composeStringCore("label", element.getLabelElement(), false);
24926        composeStringExtras("label", element.getLabelElement(), false);
24927      }
24928      if (element.hasDescriptionElement()) {
24929        composeStringCore("description", element.getDescriptionElement(), false);
24930        composeStringExtras("description", element.getDescriptionElement(), false);
24931      }
24932      if (element.hasDirectionElement()) {
24933        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24934        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24935      }
24936      if (element.hasCompareToSourceIdElement()) {
24937        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
24938        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
24939      }
24940      if (element.hasCompareToSourcePathElement()) {
24941        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24942        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24943      }
24944      if (element.hasContentTypeElement()) {
24945        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24946        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24947      }
24948      if (element.hasHeaderFieldElement()) {
24949        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24950        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24951      }
24952      if (element.hasMinimumIdElement()) {
24953        composeStringCore("minimumId", element.getMinimumIdElement(), false);
24954        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
24955      }
24956      if (element.hasNavigationLinksElement()) {
24957        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
24958        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
24959      }
24960      if (element.hasOperatorElement()) {
24961        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24962        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24963      }
24964      if (element.hasPathElement()) {
24965        composeStringCore("path", element.getPathElement(), false);
24966        composeStringExtras("path", element.getPathElement(), false);
24967      }
24968      if (element.hasResourceElement()) {
24969        composeCodeCore("resource", element.getResourceElement(), false);
24970        composeCodeExtras("resource", element.getResourceElement(), false);
24971      }
24972      if (element.hasResponseElement()) {
24973        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24974        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24975      }
24976      if (element.hasResponseCodeElement()) {
24977        composeStringCore("responseCode", element.getResponseCodeElement(), false);
24978        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
24979      }
24980      if (element.hasSourceIdElement()) {
24981        composeIdCore("sourceId", element.getSourceIdElement(), false);
24982        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24983      }
24984      if (element.hasValidateProfileIdElement()) {
24985        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
24986        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
24987      }
24988      if (element.hasValueElement()) {
24989        composeStringCore("value", element.getValueElement(), false);
24990        composeStringExtras("value", element.getValueElement(), false);
24991      }
24992      if (element.hasWarningOnlyElement()) {
24993        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
24994        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
24995      }
24996  }
24997
24998  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
24999    if (element != null) {
25000      open(name);
25001      composeTestScriptTestScriptTestComponentInner(element);
25002      close();
25003    }
25004  }
25005
25006  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
25007      composeBackbone(element);
25008      if (element.hasNameElement()) {
25009        composeStringCore("name", element.getNameElement(), false);
25010        composeStringExtras("name", element.getNameElement(), false);
25011      }
25012      if (element.hasDescriptionElement()) {
25013        composeStringCore("description", element.getDescriptionElement(), false);
25014        composeStringExtras("description", element.getDescriptionElement(), false);
25015      }
25016      if (element.hasMetadata()) {
25017        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
25018      }
25019      if (element.hasAction()) {
25020        openArray("action");
25021        for (TestScript.TestScriptTestActionComponent e : element.getAction()) 
25022          composeTestScriptTestScriptTestActionComponent(null, e);
25023        closeArray();
25024      };
25025  }
25026
25027  protected void composeTestScriptTestScriptTestActionComponent(String name, TestScript.TestScriptTestActionComponent element) throws IOException {
25028    if (element != null) {
25029      open(name);
25030      composeTestScriptTestScriptTestActionComponentInner(element);
25031      close();
25032    }
25033  }
25034
25035  protected void composeTestScriptTestScriptTestActionComponentInner(TestScript.TestScriptTestActionComponent element) throws IOException {
25036      composeBackbone(element);
25037      if (element.hasOperation()) {
25038        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25039      }
25040      if (element.hasAssert()) {
25041        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
25042      }
25043  }
25044
25045  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
25046    if (element != null) {
25047      open(name);
25048      composeTestScriptTestScriptTeardownComponentInner(element);
25049      close();
25050    }
25051  }
25052
25053  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
25054      composeBackbone(element);
25055      if (element.hasAction()) {
25056        openArray("action");
25057        for (TestScript.TestScriptTeardownActionComponent e : element.getAction()) 
25058          composeTestScriptTestScriptTeardownActionComponent(null, e);
25059        closeArray();
25060      };
25061  }
25062
25063  protected void composeTestScriptTestScriptTeardownActionComponent(String name, TestScript.TestScriptTeardownActionComponent element) throws IOException {
25064    if (element != null) {
25065      open(name);
25066      composeTestScriptTestScriptTeardownActionComponentInner(element);
25067      close();
25068    }
25069  }
25070
25071  protected void composeTestScriptTestScriptTeardownActionComponentInner(TestScript.TestScriptTeardownActionComponent element) throws IOException {
25072      composeBackbone(element);
25073      if (element.hasOperation()) {
25074        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25075      }
25076  }
25077
25078  protected void composeValueSet(String name, ValueSet element) throws IOException {
25079    if (element != null) {
25080      prop("resourceType", name);
25081      composeValueSetInner(element);
25082    }
25083  }
25084
25085  protected void composeValueSetInner(ValueSet element) throws IOException {
25086      composeDomainResourceElements(element);
25087      if (element.hasUrlElement()) {
25088        composeUriCore("url", element.getUrlElement(), false);
25089        composeUriExtras("url", element.getUrlElement(), false);
25090      }
25091      if (element.hasIdentifier()) {
25092        composeIdentifier("identifier", element.getIdentifier());
25093      }
25094      if (element.hasVersionElement()) {
25095        composeStringCore("version", element.getVersionElement(), false);
25096        composeStringExtras("version", element.getVersionElement(), false);
25097      }
25098      if (element.hasNameElement()) {
25099        composeStringCore("name", element.getNameElement(), false);
25100        composeStringExtras("name", element.getNameElement(), false);
25101      }
25102      if (element.hasStatusElement()) {
25103        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25104        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25105      }
25106      if (element.hasExperimentalElement()) {
25107        composeBooleanCore("experimental", element.getExperimentalElement(), false);
25108        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
25109      }
25110      if (element.hasPublisherElement()) {
25111        composeStringCore("publisher", element.getPublisherElement(), false);
25112        composeStringExtras("publisher", element.getPublisherElement(), false);
25113      }
25114      if (element.hasContact()) {
25115        openArray("contact");
25116        for (ValueSet.ValueSetContactComponent e : element.getContact()) 
25117          composeValueSetValueSetContactComponent(null, e);
25118        closeArray();
25119      };
25120      if (element.hasDateElement()) {
25121        composeDateTimeCore("date", element.getDateElement(), false);
25122        composeDateTimeExtras("date", element.getDateElement(), false);
25123      }
25124      if (element.hasLockedDateElement()) {
25125        composeDateCore("lockedDate", element.getLockedDateElement(), false);
25126        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
25127      }
25128      if (element.hasDescriptionElement()) {
25129        composeStringCore("description", element.getDescriptionElement(), false);
25130        composeStringExtras("description", element.getDescriptionElement(), false);
25131      }
25132      if (element.hasUseContext()) {
25133        openArray("useContext");
25134        for (CodeableConcept e : element.getUseContext()) 
25135          composeCodeableConcept(null, e);
25136        closeArray();
25137      };
25138      if (element.hasImmutableElement()) {
25139        composeBooleanCore("immutable", element.getImmutableElement(), false);
25140        composeBooleanExtras("immutable", element.getImmutableElement(), false);
25141      }
25142      if (element.hasRequirementsElement()) {
25143        composeStringCore("requirements", element.getRequirementsElement(), false);
25144        composeStringExtras("requirements", element.getRequirementsElement(), false);
25145      }
25146      if (element.hasCopyrightElement()) {
25147        composeStringCore("copyright", element.getCopyrightElement(), false);
25148        composeStringExtras("copyright", element.getCopyrightElement(), false);
25149      }
25150      if (element.hasExtensibleElement()) {
25151        composeBooleanCore("extensible", element.getExtensibleElement(), false);
25152        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
25153      }
25154      if (element.hasCodeSystem()) {
25155        composeValueSetValueSetCodeSystemComponent("codeSystem", element.getCodeSystem());
25156      }
25157      if (element.hasCompose()) {
25158        composeValueSetValueSetComposeComponent("compose", element.getCompose());
25159      }
25160      if (element.hasExpansion()) {
25161        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
25162      }
25163  }
25164
25165  protected void composeValueSetValueSetContactComponent(String name, ValueSet.ValueSetContactComponent element) throws IOException {
25166    if (element != null) {
25167      open(name);
25168      composeValueSetValueSetContactComponentInner(element);
25169      close();
25170    }
25171  }
25172
25173  protected void composeValueSetValueSetContactComponentInner(ValueSet.ValueSetContactComponent element) throws IOException {
25174      composeBackbone(element);
25175      if (element.hasNameElement()) {
25176        composeStringCore("name", element.getNameElement(), false);
25177        composeStringExtras("name", element.getNameElement(), false);
25178      }
25179      if (element.hasTelecom()) {
25180        openArray("telecom");
25181        for (ContactPoint e : element.getTelecom()) 
25182          composeContactPoint(null, e);
25183        closeArray();
25184      };
25185  }
25186
25187  protected void composeValueSetValueSetCodeSystemComponent(String name, ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25188    if (element != null) {
25189      open(name);
25190      composeValueSetValueSetCodeSystemComponentInner(element);
25191      close();
25192    }
25193  }
25194
25195  protected void composeValueSetValueSetCodeSystemComponentInner(ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25196      composeBackbone(element);
25197      if (element.hasSystemElement()) {
25198        composeUriCore("system", element.getSystemElement(), false);
25199        composeUriExtras("system", element.getSystemElement(), false);
25200      }
25201      if (element.hasVersionElement()) {
25202        composeStringCore("version", element.getVersionElement(), false);
25203        composeStringExtras("version", element.getVersionElement(), false);
25204      }
25205      if (element.hasCaseSensitiveElement()) {
25206        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
25207        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
25208      }
25209      if (element.hasConcept()) {
25210        openArray("concept");
25211        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25212          composeValueSetConceptDefinitionComponent(null, e);
25213        closeArray();
25214      };
25215  }
25216
25217  protected void composeValueSetConceptDefinitionComponent(String name, ValueSet.ConceptDefinitionComponent element) throws IOException {
25218    if (element != null) {
25219      open(name);
25220      composeValueSetConceptDefinitionComponentInner(element);
25221      close();
25222    }
25223  }
25224
25225  protected void composeValueSetConceptDefinitionComponentInner(ValueSet.ConceptDefinitionComponent element) throws IOException {
25226      composeBackbone(element);
25227      if (element.hasCodeElement()) {
25228        composeCodeCore("code", element.getCodeElement(), false);
25229        composeCodeExtras("code", element.getCodeElement(), false);
25230      }
25231      if (element.hasAbstractElement()) {
25232        composeBooleanCore("abstract", element.getAbstractElement(), false);
25233        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25234      }
25235      if (element.hasDisplayElement()) {
25236        composeStringCore("display", element.getDisplayElement(), false);
25237        composeStringExtras("display", element.getDisplayElement(), false);
25238      }
25239      if (element.hasDefinitionElement()) {
25240        composeStringCore("definition", element.getDefinitionElement(), false);
25241        composeStringExtras("definition", element.getDefinitionElement(), false);
25242      }
25243      if (element.hasDesignation()) {
25244        openArray("designation");
25245        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25246          composeValueSetConceptDefinitionDesignationComponent(null, e);
25247        closeArray();
25248      };
25249      if (element.hasConcept()) {
25250        openArray("concept");
25251        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25252          composeValueSetConceptDefinitionComponent(null, e);
25253        closeArray();
25254      };
25255  }
25256
25257  protected void composeValueSetConceptDefinitionDesignationComponent(String name, ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25258    if (element != null) {
25259      open(name);
25260      composeValueSetConceptDefinitionDesignationComponentInner(element);
25261      close();
25262    }
25263  }
25264
25265  protected void composeValueSetConceptDefinitionDesignationComponentInner(ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25266      composeBackbone(element);
25267      if (element.hasLanguageElement()) {
25268        composeCodeCore("language", element.getLanguageElement(), false);
25269        composeCodeExtras("language", element.getLanguageElement(), false);
25270      }
25271      if (element.hasUse()) {
25272        composeCoding("use", element.getUse());
25273      }
25274      if (element.hasValueElement()) {
25275        composeStringCore("value", element.getValueElement(), false);
25276        composeStringExtras("value", element.getValueElement(), false);
25277      }
25278  }
25279
25280  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
25281    if (element != null) {
25282      open(name);
25283      composeValueSetValueSetComposeComponentInner(element);
25284      close();
25285    }
25286  }
25287
25288  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
25289      composeBackbone(element);
25290      if (element.hasImport()) {
25291        openArray("import");
25292        for (UriType e : element.getImport()) 
25293          composeUriCore(null, e, true);
25294        closeArray();
25295        if (anyHasExtras(element.getImport())) {
25296          openArray("_import");
25297          for (UriType e : element.getImport()) 
25298            composeUriExtras(null, e, true);
25299          closeArray();
25300        }
25301      };
25302      if (element.hasInclude()) {
25303        openArray("include");
25304        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
25305          composeValueSetConceptSetComponent(null, e);
25306        closeArray();
25307      };
25308      if (element.hasExclude()) {
25309        openArray("exclude");
25310        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
25311          composeValueSetConceptSetComponent(null, e);
25312        closeArray();
25313      };
25314  }
25315
25316  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
25317    if (element != null) {
25318      open(name);
25319      composeValueSetConceptSetComponentInner(element);
25320      close();
25321    }
25322  }
25323
25324  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
25325      composeBackbone(element);
25326      if (element.hasSystemElement()) {
25327        composeUriCore("system", element.getSystemElement(), false);
25328        composeUriExtras("system", element.getSystemElement(), false);
25329      }
25330      if (element.hasVersionElement()) {
25331        composeStringCore("version", element.getVersionElement(), false);
25332        composeStringExtras("version", element.getVersionElement(), false);
25333      }
25334      if (element.hasConcept()) {
25335        openArray("concept");
25336        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
25337          composeValueSetConceptReferenceComponent(null, e);
25338        closeArray();
25339      };
25340      if (element.hasFilter()) {
25341        openArray("filter");
25342        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
25343          composeValueSetConceptSetFilterComponent(null, e);
25344        closeArray();
25345      };
25346  }
25347
25348  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
25349    if (element != null) {
25350      open(name);
25351      composeValueSetConceptReferenceComponentInner(element);
25352      close();
25353    }
25354  }
25355
25356  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
25357      composeBackbone(element);
25358      if (element.hasCodeElement()) {
25359        composeCodeCore("code", element.getCodeElement(), false);
25360        composeCodeExtras("code", element.getCodeElement(), false);
25361      }
25362      if (element.hasDisplayElement()) {
25363        composeStringCore("display", element.getDisplayElement(), false);
25364        composeStringExtras("display", element.getDisplayElement(), false);
25365      }
25366      if (element.hasDesignation()) {
25367        openArray("designation");
25368        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25369          composeValueSetConceptDefinitionDesignationComponent(null, e);
25370        closeArray();
25371      };
25372  }
25373
25374  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
25375    if (element != null) {
25376      open(name);
25377      composeValueSetConceptSetFilterComponentInner(element);
25378      close();
25379    }
25380  }
25381
25382  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
25383      composeBackbone(element);
25384      if (element.hasPropertyElement()) {
25385        composeCodeCore("property", element.getPropertyElement(), false);
25386        composeCodeExtras("property", element.getPropertyElement(), false);
25387      }
25388      if (element.hasOpElement()) {
25389        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25390        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25391      }
25392      if (element.hasValueElement()) {
25393        composeCodeCore("value", element.getValueElement(), false);
25394        composeCodeExtras("value", element.getValueElement(), false);
25395      }
25396  }
25397
25398  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
25399    if (element != null) {
25400      open(name);
25401      composeValueSetValueSetExpansionComponentInner(element);
25402      close();
25403    }
25404  }
25405
25406  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
25407      composeBackbone(element);
25408      if (element.hasIdentifierElement()) {
25409        composeUriCore("identifier", element.getIdentifierElement(), false);
25410        composeUriExtras("identifier", element.getIdentifierElement(), false);
25411      }
25412      if (element.hasTimestampElement()) {
25413        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
25414        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
25415      }
25416      if (element.hasTotalElement()) {
25417        composeIntegerCore("total", element.getTotalElement(), false);
25418        composeIntegerExtras("total", element.getTotalElement(), false);
25419      }
25420      if (element.hasOffsetElement()) {
25421        composeIntegerCore("offset", element.getOffsetElement(), false);
25422        composeIntegerExtras("offset", element.getOffsetElement(), false);
25423      }
25424      if (element.hasParameter()) {
25425        openArray("parameter");
25426        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
25427          composeValueSetValueSetExpansionParameterComponent(null, e);
25428        closeArray();
25429      };
25430      if (element.hasContains()) {
25431        openArray("contains");
25432        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25433          composeValueSetValueSetExpansionContainsComponent(null, e);
25434        closeArray();
25435      };
25436  }
25437
25438  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25439    if (element != null) {
25440      open(name);
25441      composeValueSetValueSetExpansionParameterComponentInner(element);
25442      close();
25443    }
25444  }
25445
25446  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25447      composeBackbone(element);
25448      if (element.hasNameElement()) {
25449        composeStringCore("name", element.getNameElement(), false);
25450        composeStringExtras("name", element.getNameElement(), false);
25451      }
25452      if (element.hasValue()) {
25453        composeType("value", element.getValue());
25454      }
25455  }
25456
25457  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25458    if (element != null) {
25459      open(name);
25460      composeValueSetValueSetExpansionContainsComponentInner(element);
25461      close();
25462    }
25463  }
25464
25465  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25466      composeBackbone(element);
25467      if (element.hasSystemElement()) {
25468        composeUriCore("system", element.getSystemElement(), false);
25469        composeUriExtras("system", element.getSystemElement(), false);
25470      }
25471      if (element.hasAbstractElement()) {
25472        composeBooleanCore("abstract", element.getAbstractElement(), false);
25473        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25474      }
25475      if (element.hasVersionElement()) {
25476        composeStringCore("version", element.getVersionElement(), false);
25477        composeStringExtras("version", element.getVersionElement(), false);
25478      }
25479      if (element.hasCodeElement()) {
25480        composeCodeCore("code", element.getCodeElement(), false);
25481        composeCodeExtras("code", element.getCodeElement(), false);
25482      }
25483      if (element.hasDisplayElement()) {
25484        composeStringCore("display", element.getDisplayElement(), false);
25485        composeStringExtras("display", element.getDisplayElement(), false);
25486      }
25487      if (element.hasContains()) {
25488        openArray("contains");
25489        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25490          composeValueSetValueSetExpansionContainsComponent(null, e);
25491        closeArray();
25492      };
25493  }
25494
25495  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
25496    if (element != null) {
25497      prop("resourceType", name);
25498      composeVisionPrescriptionInner(element);
25499    }
25500  }
25501
25502  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
25503      composeDomainResourceElements(element);
25504      if (element.hasIdentifier()) {
25505        openArray("identifier");
25506        for (Identifier e : element.getIdentifier()) 
25507          composeIdentifier(null, e);
25508        closeArray();
25509      };
25510      if (element.hasDateWrittenElement()) {
25511        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
25512        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
25513      }
25514      if (element.hasPatient()) {
25515        composeReference("patient", element.getPatient());
25516      }
25517      if (element.hasPrescriber()) {
25518        composeReference("prescriber", element.getPrescriber());
25519      }
25520      if (element.hasEncounter()) {
25521        composeReference("encounter", element.getEncounter());
25522      }
25523      if (element.hasReason()) {
25524        composeType("reason", element.getReason());
25525      }
25526      if (element.hasDispense()) {
25527        openArray("dispense");
25528        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
25529          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
25530        closeArray();
25531      };
25532  }
25533
25534  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25535    if (element != null) {
25536      open(name);
25537      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
25538      close();
25539    }
25540  }
25541
25542  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25543      composeBackbone(element);
25544      if (element.hasProduct()) {
25545        composeCoding("product", element.getProduct());
25546      }
25547      if (element.hasEyeElement()) {
25548        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25549        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25550      }
25551      if (element.hasSphereElement()) {
25552        composeDecimalCore("sphere", element.getSphereElement(), false);
25553        composeDecimalExtras("sphere", element.getSphereElement(), false);
25554      }
25555      if (element.hasCylinderElement()) {
25556        composeDecimalCore("cylinder", element.getCylinderElement(), false);
25557        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
25558      }
25559      if (element.hasAxisElement()) {
25560        composeIntegerCore("axis", element.getAxisElement(), false);
25561        composeIntegerExtras("axis", element.getAxisElement(), false);
25562      }
25563      if (element.hasPrismElement()) {
25564        composeDecimalCore("prism", element.getPrismElement(), false);
25565        composeDecimalExtras("prism", element.getPrismElement(), false);
25566      }
25567      if (element.hasBaseElement()) {
25568        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25569        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25570      }
25571      if (element.hasAddElement()) {
25572        composeDecimalCore("add", element.getAddElement(), false);
25573        composeDecimalExtras("add", element.getAddElement(), false);
25574      }
25575      if (element.hasPowerElement()) {
25576        composeDecimalCore("power", element.getPowerElement(), false);
25577        composeDecimalExtras("power", element.getPowerElement(), false);
25578      }
25579      if (element.hasBackCurveElement()) {
25580        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
25581        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
25582      }
25583      if (element.hasDiameterElement()) {
25584        composeDecimalCore("diameter", element.getDiameterElement(), false);
25585        composeDecimalExtras("diameter", element.getDiameterElement(), false);
25586      }
25587      if (element.hasDuration()) {
25588        composeSimpleQuantity("duration", element.getDuration());
25589      }
25590      if (element.hasColorElement()) {
25591        composeStringCore("color", element.getColorElement(), false);
25592        composeStringExtras("color", element.getColorElement(), false);
25593      }
25594      if (element.hasBrandElement()) {
25595        composeStringCore("brand", element.getBrandElement(), false);
25596        composeStringExtras("brand", element.getBrandElement(), false);
25597      }
25598      if (element.hasNotesElement()) {
25599        composeStringCore("notes", element.getNotesElement(), false);
25600        composeStringExtras("notes", element.getNotesElement(), false);
25601      }
25602  }
25603
25604  @Override
25605  protected void composeResource(Resource resource) throws IOException {
25606    if (resource instanceof Parameters)
25607      composeParameters("Parameters", (Parameters)resource);
25608    else if (resource instanceof Account)
25609      composeAccount("Account", (Account)resource);
25610    else if (resource instanceof AllergyIntolerance)
25611      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
25612    else if (resource instanceof Appointment)
25613      composeAppointment("Appointment", (Appointment)resource);
25614    else if (resource instanceof AppointmentResponse)
25615      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
25616    else if (resource instanceof AuditEvent)
25617      composeAuditEvent("AuditEvent", (AuditEvent)resource);
25618    else if (resource instanceof Basic)
25619      composeBasic("Basic", (Basic)resource);
25620    else if (resource instanceof Binary)
25621      composeBinary("Binary", (Binary)resource);
25622    else if (resource instanceof BodySite)
25623      composeBodySite("BodySite", (BodySite)resource);
25624    else if (resource instanceof Bundle)
25625      composeBundle("Bundle", (Bundle)resource);
25626    else if (resource instanceof CarePlan)
25627      composeCarePlan("CarePlan", (CarePlan)resource);
25628    else if (resource instanceof Claim)
25629      composeClaim("Claim", (Claim)resource);
25630    else if (resource instanceof ClaimResponse)
25631      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
25632    else if (resource instanceof ClinicalImpression)
25633      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
25634    else if (resource instanceof Communication)
25635      composeCommunication("Communication", (Communication)resource);
25636    else if (resource instanceof CommunicationRequest)
25637      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
25638    else if (resource instanceof Composition)
25639      composeComposition("Composition", (Composition)resource);
25640    else if (resource instanceof ConceptMap)
25641      composeConceptMap("ConceptMap", (ConceptMap)resource);
25642    else if (resource instanceof Condition)
25643      composeCondition("Condition", (Condition)resource);
25644    else if (resource instanceof Conformance)
25645      composeConformance("Conformance", (Conformance)resource);
25646    else if (resource instanceof Contract)
25647      composeContract("Contract", (Contract)resource);
25648    else if (resource instanceof Coverage)
25649      composeCoverage("Coverage", (Coverage)resource);
25650    else if (resource instanceof DataElement)
25651      composeDataElement("DataElement", (DataElement)resource);
25652    else if (resource instanceof DetectedIssue)
25653      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
25654    else if (resource instanceof Device)
25655      composeDevice("Device", (Device)resource);
25656    else if (resource instanceof DeviceComponent)
25657      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
25658    else if (resource instanceof DeviceMetric)
25659      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
25660    else if (resource instanceof DeviceUseRequest)
25661      composeDeviceUseRequest("DeviceUseRequest", (DeviceUseRequest)resource);
25662    else if (resource instanceof DeviceUseStatement)
25663      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
25664    else if (resource instanceof DiagnosticOrder)
25665      composeDiagnosticOrder("DiagnosticOrder", (DiagnosticOrder)resource);
25666    else if (resource instanceof DiagnosticReport)
25667      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
25668    else if (resource instanceof DocumentManifest)
25669      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
25670    else if (resource instanceof DocumentReference)
25671      composeDocumentReference("DocumentReference", (DocumentReference)resource);
25672    else if (resource instanceof EligibilityRequest)
25673      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
25674    else if (resource instanceof EligibilityResponse)
25675      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
25676    else if (resource instanceof Encounter)
25677      composeEncounter("Encounter", (Encounter)resource);
25678    else if (resource instanceof EnrollmentRequest)
25679      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
25680    else if (resource instanceof EnrollmentResponse)
25681      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
25682    else if (resource instanceof EpisodeOfCare)
25683      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
25684    else if (resource instanceof ExplanationOfBenefit)
25685      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
25686    else if (resource instanceof FamilyMemberHistory)
25687      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
25688    else if (resource instanceof Flag)
25689      composeFlag("Flag", (Flag)resource);
25690    else if (resource instanceof Goal)
25691      composeGoal("Goal", (Goal)resource);
25692    else if (resource instanceof Group)
25693      composeGroup("Group", (Group)resource);
25694    else if (resource instanceof HealthcareService)
25695      composeHealthcareService("HealthcareService", (HealthcareService)resource);
25696    else if (resource instanceof ImagingObjectSelection)
25697      composeImagingObjectSelection("ImagingObjectSelection", (ImagingObjectSelection)resource);
25698    else if (resource instanceof ImagingStudy)
25699      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
25700    else if (resource instanceof Immunization)
25701      composeImmunization("Immunization", (Immunization)resource);
25702    else if (resource instanceof ImmunizationRecommendation)
25703      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
25704    else if (resource instanceof ImplementationGuide)
25705      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
25706    else if (resource instanceof List_)
25707      composeList_("List", (List_)resource);
25708    else if (resource instanceof Location)
25709      composeLocation("Location", (Location)resource);
25710    else if (resource instanceof Media)
25711      composeMedia("Media", (Media)resource);
25712    else if (resource instanceof Medication)
25713      composeMedication("Medication", (Medication)resource);
25714    else if (resource instanceof MedicationAdministration)
25715      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
25716    else if (resource instanceof MedicationDispense)
25717      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
25718    else if (resource instanceof MedicationOrder)
25719      composeMedicationOrder("MedicationOrder", (MedicationOrder)resource);
25720    else if (resource instanceof MedicationStatement)
25721      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
25722    else if (resource instanceof MessageHeader)
25723      composeMessageHeader("MessageHeader", (MessageHeader)resource);
25724    else if (resource instanceof NamingSystem)
25725      composeNamingSystem("NamingSystem", (NamingSystem)resource);
25726    else if (resource instanceof NutritionOrder)
25727      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
25728    else if (resource instanceof Observation)
25729      composeObservation("Observation", (Observation)resource);
25730    else if (resource instanceof OperationDefinition)
25731      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
25732    else if (resource instanceof OperationOutcome)
25733      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
25734    else if (resource instanceof Order)
25735      composeOrder("Order", (Order)resource);
25736    else if (resource instanceof OrderResponse)
25737      composeOrderResponse("OrderResponse", (OrderResponse)resource);
25738    else if (resource instanceof Organization)
25739      composeOrganization("Organization", (Organization)resource);
25740    else if (resource instanceof Patient)
25741      composePatient("Patient", (Patient)resource);
25742    else if (resource instanceof PaymentNotice)
25743      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
25744    else if (resource instanceof PaymentReconciliation)
25745      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
25746    else if (resource instanceof Person)
25747      composePerson("Person", (Person)resource);
25748    else if (resource instanceof Practitioner)
25749      composePractitioner("Practitioner", (Practitioner)resource);
25750    else if (resource instanceof Procedure)
25751      composeProcedure("Procedure", (Procedure)resource);
25752    else if (resource instanceof ProcedureRequest)
25753      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
25754    else if (resource instanceof ProcessRequest)
25755      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
25756    else if (resource instanceof ProcessResponse)
25757      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
25758    else if (resource instanceof Provenance)
25759      composeProvenance("Provenance", (Provenance)resource);
25760    else if (resource instanceof Questionnaire)
25761      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
25762    else if (resource instanceof QuestionnaireResponse)
25763      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
25764    else if (resource instanceof ReferralRequest)
25765      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
25766    else if (resource instanceof RelatedPerson)
25767      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
25768    else if (resource instanceof RiskAssessment)
25769      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
25770    else if (resource instanceof Schedule)
25771      composeSchedule("Schedule", (Schedule)resource);
25772    else if (resource instanceof SearchParameter)
25773      composeSearchParameter("SearchParameter", (SearchParameter)resource);
25774    else if (resource instanceof Slot)
25775      composeSlot("Slot", (Slot)resource);
25776    else if (resource instanceof Specimen)
25777      composeSpecimen("Specimen", (Specimen)resource);
25778    else if (resource instanceof StructureDefinition)
25779      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
25780    else if (resource instanceof Subscription)
25781      composeSubscription("Subscription", (Subscription)resource);
25782    else if (resource instanceof Substance)
25783      composeSubstance("Substance", (Substance)resource);
25784    else if (resource instanceof SupplyDelivery)
25785      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
25786    else if (resource instanceof SupplyRequest)
25787      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
25788    else if (resource instanceof TestScript)
25789      composeTestScript("TestScript", (TestScript)resource);
25790    else if (resource instanceof ValueSet)
25791      composeValueSet("ValueSet", (ValueSet)resource);
25792    else if (resource instanceof VisionPrescription)
25793      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
25794    else if (resource instanceof Binary)
25795      composeBinary("Binary", (Binary)resource);
25796    else
25797      throw new Error("Unhandled resource type "+resource.getClass().getName());
25798  }
25799
25800  protected void composeNamedReference(String name, Resource resource) throws IOException {
25801    if (resource instanceof Parameters)
25802      composeParameters(name, (Parameters)resource);
25803    else if (resource instanceof Account)
25804      composeAccount(name, (Account)resource);
25805    else if (resource instanceof AllergyIntolerance)
25806      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
25807    else if (resource instanceof Appointment)
25808      composeAppointment(name, (Appointment)resource);
25809    else if (resource instanceof AppointmentResponse)
25810      composeAppointmentResponse(name, (AppointmentResponse)resource);
25811    else if (resource instanceof AuditEvent)
25812      composeAuditEvent(name, (AuditEvent)resource);
25813    else if (resource instanceof Basic)
25814      composeBasic(name, (Basic)resource);
25815    else if (resource instanceof Binary)
25816      composeBinary(name, (Binary)resource);
25817    else if (resource instanceof BodySite)
25818      composeBodySite(name, (BodySite)resource);
25819    else if (resource instanceof Bundle)
25820      composeBundle(name, (Bundle)resource);
25821    else if (resource instanceof CarePlan)
25822      composeCarePlan(name, (CarePlan)resource);
25823    else if (resource instanceof Claim)
25824      composeClaim(name, (Claim)resource);
25825    else if (resource instanceof ClaimResponse)
25826      composeClaimResponse(name, (ClaimResponse)resource);
25827    else if (resource instanceof ClinicalImpression)
25828      composeClinicalImpression(name, (ClinicalImpression)resource);
25829    else if (resource instanceof Communication)
25830      composeCommunication(name, (Communication)resource);
25831    else if (resource instanceof CommunicationRequest)
25832      composeCommunicationRequest(name, (CommunicationRequest)resource);
25833    else if (resource instanceof Composition)
25834      composeComposition(name, (Composition)resource);
25835    else if (resource instanceof ConceptMap)
25836      composeConceptMap(name, (ConceptMap)resource);
25837    else if (resource instanceof Condition)
25838      composeCondition(name, (Condition)resource);
25839    else if (resource instanceof Conformance)
25840      composeConformance(name, (Conformance)resource);
25841    else if (resource instanceof Contract)
25842      composeContract(name, (Contract)resource);
25843    else if (resource instanceof Coverage)
25844      composeCoverage(name, (Coverage)resource);
25845    else if (resource instanceof DataElement)
25846      composeDataElement(name, (DataElement)resource);
25847    else if (resource instanceof DetectedIssue)
25848      composeDetectedIssue(name, (DetectedIssue)resource);
25849    else if (resource instanceof Device)
25850      composeDevice(name, (Device)resource);
25851    else if (resource instanceof DeviceComponent)
25852      composeDeviceComponent(name, (DeviceComponent)resource);
25853    else if (resource instanceof DeviceMetric)
25854      composeDeviceMetric(name, (DeviceMetric)resource);
25855    else if (resource instanceof DeviceUseRequest)
25856      composeDeviceUseRequest(name, (DeviceUseRequest)resource);
25857    else if (resource instanceof DeviceUseStatement)
25858      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
25859    else if (resource instanceof DiagnosticOrder)
25860      composeDiagnosticOrder(name, (DiagnosticOrder)resource);
25861    else if (resource instanceof DiagnosticReport)
25862      composeDiagnosticReport(name, (DiagnosticReport)resource);
25863    else if (resource instanceof DocumentManifest)
25864      composeDocumentManifest(name, (DocumentManifest)resource);
25865    else if (resource instanceof DocumentReference)
25866      composeDocumentReference(name, (DocumentReference)resource);
25867    else if (resource instanceof EligibilityRequest)
25868      composeEligibilityRequest(name, (EligibilityRequest)resource);
25869    else if (resource instanceof EligibilityResponse)
25870      composeEligibilityResponse(name, (EligibilityResponse)resource);
25871    else if (resource instanceof Encounter)
25872      composeEncounter(name, (Encounter)resource);
25873    else if (resource instanceof EnrollmentRequest)
25874      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
25875    else if (resource instanceof EnrollmentResponse)
25876      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
25877    else if (resource instanceof EpisodeOfCare)
25878      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
25879    else if (resource instanceof ExplanationOfBenefit)
25880      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
25881    else if (resource instanceof FamilyMemberHistory)
25882      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
25883    else if (resource instanceof Flag)
25884      composeFlag(name, (Flag)resource);
25885    else if (resource instanceof Goal)
25886      composeGoal(name, (Goal)resource);
25887    else if (resource instanceof Group)
25888      composeGroup(name, (Group)resource);
25889    else if (resource instanceof HealthcareService)
25890      composeHealthcareService(name, (HealthcareService)resource);
25891    else if (resource instanceof ImagingObjectSelection)
25892      composeImagingObjectSelection(name, (ImagingObjectSelection)resource);
25893    else if (resource instanceof ImagingStudy)
25894      composeImagingStudy(name, (ImagingStudy)resource);
25895    else if (resource instanceof Immunization)
25896      composeImmunization(name, (Immunization)resource);
25897    else if (resource instanceof ImmunizationRecommendation)
25898      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
25899    else if (resource instanceof ImplementationGuide)
25900      composeImplementationGuide(name, (ImplementationGuide)resource);
25901    else if (resource instanceof List_)
25902      composeList_(name, (List_)resource);
25903    else if (resource instanceof Location)
25904      composeLocation(name, (Location)resource);
25905    else if (resource instanceof Media)
25906      composeMedia(name, (Media)resource);
25907    else if (resource instanceof Medication)
25908      composeMedication(name, (Medication)resource);
25909    else if (resource instanceof MedicationAdministration)
25910      composeMedicationAdministration(name, (MedicationAdministration)resource);
25911    else if (resource instanceof MedicationDispense)
25912      composeMedicationDispense(name, (MedicationDispense)resource);
25913    else if (resource instanceof MedicationOrder)
25914      composeMedicationOrder(name, (MedicationOrder)resource);
25915    else if (resource instanceof MedicationStatement)
25916      composeMedicationStatement(name, (MedicationStatement)resource);
25917    else if (resource instanceof MessageHeader)
25918      composeMessageHeader(name, (MessageHeader)resource);
25919    else if (resource instanceof NamingSystem)
25920      composeNamingSystem(name, (NamingSystem)resource);
25921    else if (resource instanceof NutritionOrder)
25922      composeNutritionOrder(name, (NutritionOrder)resource);
25923    else if (resource instanceof Observation)
25924      composeObservation(name, (Observation)resource);
25925    else if (resource instanceof OperationDefinition)
25926      composeOperationDefinition(name, (OperationDefinition)resource);
25927    else if (resource instanceof OperationOutcome)
25928      composeOperationOutcome(name, (OperationOutcome)resource);
25929    else if (resource instanceof Order)
25930      composeOrder(name, (Order)resource);
25931    else if (resource instanceof OrderResponse)
25932      composeOrderResponse(name, (OrderResponse)resource);
25933    else if (resource instanceof Organization)
25934      composeOrganization(name, (Organization)resource);
25935    else if (resource instanceof Patient)
25936      composePatient(name, (Patient)resource);
25937    else if (resource instanceof PaymentNotice)
25938      composePaymentNotice(name, (PaymentNotice)resource);
25939    else if (resource instanceof PaymentReconciliation)
25940      composePaymentReconciliation(name, (PaymentReconciliation)resource);
25941    else if (resource instanceof Person)
25942      composePerson(name, (Person)resource);
25943    else if (resource instanceof Practitioner)
25944      composePractitioner(name, (Practitioner)resource);
25945    else if (resource instanceof Procedure)
25946      composeProcedure(name, (Procedure)resource);
25947    else if (resource instanceof ProcedureRequest)
25948      composeProcedureRequest(name, (ProcedureRequest)resource);
25949    else if (resource instanceof ProcessRequest)
25950      composeProcessRequest(name, (ProcessRequest)resource);
25951    else if (resource instanceof ProcessResponse)
25952      composeProcessResponse(name, (ProcessResponse)resource);
25953    else if (resource instanceof Provenance)
25954      composeProvenance(name, (Provenance)resource);
25955    else if (resource instanceof Questionnaire)
25956      composeQuestionnaire(name, (Questionnaire)resource);
25957    else if (resource instanceof QuestionnaireResponse)
25958      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
25959    else if (resource instanceof ReferralRequest)
25960      composeReferralRequest(name, (ReferralRequest)resource);
25961    else if (resource instanceof RelatedPerson)
25962      composeRelatedPerson(name, (RelatedPerson)resource);
25963    else if (resource instanceof RiskAssessment)
25964      composeRiskAssessment(name, (RiskAssessment)resource);
25965    else if (resource instanceof Schedule)
25966      composeSchedule(name, (Schedule)resource);
25967    else if (resource instanceof SearchParameter)
25968      composeSearchParameter(name, (SearchParameter)resource);
25969    else if (resource instanceof Slot)
25970      composeSlot(name, (Slot)resource);
25971    else if (resource instanceof Specimen)
25972      composeSpecimen(name, (Specimen)resource);
25973    else if (resource instanceof StructureDefinition)
25974      composeStructureDefinition(name, (StructureDefinition)resource);
25975    else if (resource instanceof Subscription)
25976      composeSubscription(name, (Subscription)resource);
25977    else if (resource instanceof Substance)
25978      composeSubstance(name, (Substance)resource);
25979    else if (resource instanceof SupplyDelivery)
25980      composeSupplyDelivery(name, (SupplyDelivery)resource);
25981    else if (resource instanceof SupplyRequest)
25982      composeSupplyRequest(name, (SupplyRequest)resource);
25983    else if (resource instanceof TestScript)
25984      composeTestScript(name, (TestScript)resource);
25985    else if (resource instanceof ValueSet)
25986      composeValueSet(name, (ValueSet)resource);
25987    else if (resource instanceof VisionPrescription)
25988      composeVisionPrescription(name, (VisionPrescription)resource);
25989    else if (resource instanceof Binary)
25990      composeBinary(name, (Binary)resource);
25991    else
25992      throw new Error("Unhandled resource type "+resource.getClass().getName());
25993  }
25994
25995  protected void composeType(String prefix, Type type) throws IOException {
25996    if (type == null)
25997      ;
25998    else if (type instanceof Money)
25999       composeMoney(prefix+"Money", (Money) type);
26000    else if (type instanceof SimpleQuantity)
26001       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
26002    else if (type instanceof Duration)
26003       composeDuration(prefix+"Duration", (Duration) type);
26004    else if (type instanceof Count)
26005       composeCount(prefix+"Count", (Count) type);
26006    else if (type instanceof Distance)
26007       composeDistance(prefix+"Distance", (Distance) type);
26008    else if (type instanceof Age)
26009       composeAge(prefix+"Age", (Age) type);
26010    else if (type instanceof Identifier)
26011       composeIdentifier(prefix+"Identifier", (Identifier) type);
26012    else if (type instanceof Coding)
26013       composeCoding(prefix+"Coding", (Coding) type);
26014    else if (type instanceof Reference)
26015       composeReference(prefix+"Reference", (Reference) type);
26016    else if (type instanceof Signature)
26017       composeSignature(prefix+"Signature", (Signature) type);
26018    else if (type instanceof SampledData)
26019       composeSampledData(prefix+"SampledData", (SampledData) type);
26020    else if (type instanceof Quantity)
26021       composeQuantity(prefix+"Quantity", (Quantity) type);
26022    else if (type instanceof Period)
26023       composePeriod(prefix+"Period", (Period) type);
26024    else if (type instanceof Attachment)
26025       composeAttachment(prefix+"Attachment", (Attachment) type);
26026    else if (type instanceof Ratio)
26027       composeRatio(prefix+"Ratio", (Ratio) type);
26028    else if (type instanceof Range)
26029       composeRange(prefix+"Range", (Range) type);
26030    else if (type instanceof Annotation)
26031       composeAnnotation(prefix+"Annotation", (Annotation) type);
26032    else if (type instanceof CodeableConcept)
26033       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
26034    else if (type instanceof HumanName)
26035       composeHumanName(prefix+"HumanName", (HumanName) type);
26036    else if (type instanceof ContactPoint)
26037       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
26038    else if (type instanceof Meta)
26039       composeMeta(prefix+"Meta", (Meta) type);
26040    else if (type instanceof Address)
26041       composeAddress(prefix+"Address", (Address) type);
26042    else if (type instanceof Timing)
26043       composeTiming(prefix+"Timing", (Timing) type);
26044    else if (type instanceof ElementDefinition)
26045       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
26046    else if (type instanceof DateType) {
26047      composeDateCore(prefix+"Date", (DateType) type, false);
26048      composeDateExtras(prefix+"Date", (DateType) type, false);
26049    }
26050    else if (type instanceof DateTimeType) {
26051      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
26052      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
26053    }
26054    else if (type instanceof CodeType) {
26055      composeCodeCore(prefix+"Code", (CodeType) type, false);
26056      composeCodeExtras(prefix+"Code", (CodeType) type, false);
26057    }
26058    else if (type instanceof StringType) {
26059      composeStringCore(prefix+"String", (StringType) type, false);
26060      composeStringExtras(prefix+"String", (StringType) type, false);
26061    }
26062    else if (type instanceof IntegerType) {
26063      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
26064      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
26065    }
26066    else if (type instanceof OidType) {
26067      composeOidCore(prefix+"Oid", (OidType) type, false);
26068      composeOidExtras(prefix+"Oid", (OidType) type, false);
26069    }
26070    else if (type instanceof UriType) {
26071      composeUriCore(prefix+"Uri", (UriType) type, false);
26072      composeUriExtras(prefix+"Uri", (UriType) type, false);
26073    }
26074    else if (type instanceof UuidType) {
26075      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
26076      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
26077    }
26078    else if (type instanceof InstantType) {
26079      composeInstantCore(prefix+"Instant", (InstantType) type, false);
26080      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
26081    }
26082    else if (type instanceof BooleanType) {
26083      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
26084      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
26085    }
26086    else if (type instanceof Base64BinaryType) {
26087      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
26088      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
26089    }
26090    else if (type instanceof UnsignedIntType) {
26091      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26092      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26093    }
26094    else if (type instanceof MarkdownType) {
26095      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
26096      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
26097    }
26098    else if (type instanceof TimeType) {
26099      composeTimeCore(prefix+"Time", (TimeType) type, false);
26100      composeTimeExtras(prefix+"Time", (TimeType) type, false);
26101    }
26102    else if (type instanceof IdType) {
26103      composeIdCore(prefix+"Id", (IdType) type, false);
26104      composeIdExtras(prefix+"Id", (IdType) type, false);
26105    }
26106    else if (type instanceof PositiveIntType) {
26107      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
26108      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
26109    }
26110    else if (type instanceof DecimalType) {
26111      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
26112      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
26113    }
26114    else
26115      throw new Error("Unhandled type");
26116  }
26117
26118  protected void composeTypeInner(Type type) throws IOException {
26119    if (type == null)
26120      ;
26121    else if (type instanceof Identifier)
26122       composeIdentifierInner((Identifier) type);
26123    else if (type instanceof Coding)
26124       composeCodingInner((Coding) type);
26125    else if (type instanceof Reference)
26126       composeReferenceInner((Reference) type);
26127    else if (type instanceof Signature)
26128       composeSignatureInner((Signature) type);
26129    else if (type instanceof SampledData)
26130       composeSampledDataInner((SampledData) type);
26131    else if (type instanceof Quantity)
26132       composeQuantityInner((Quantity) type);
26133    else if (type instanceof Period)
26134       composePeriodInner((Period) type);
26135    else if (type instanceof Attachment)
26136       composeAttachmentInner((Attachment) type);
26137    else if (type instanceof Ratio)
26138       composeRatioInner((Ratio) type);
26139    else if (type instanceof Range)
26140       composeRangeInner((Range) type);
26141    else if (type instanceof Annotation)
26142       composeAnnotationInner((Annotation) type);
26143    else if (type instanceof CodeableConcept)
26144       composeCodeableConceptInner((CodeableConcept) type);
26145    else if (type instanceof Money)
26146       composeMoneyInner((Money) type);
26147    else if (type instanceof SimpleQuantity)
26148       composeSimpleQuantityInner((SimpleQuantity) type);
26149    else if (type instanceof Duration)
26150       composeDurationInner((Duration) type);
26151    else if (type instanceof Count)
26152       composeCountInner((Count) type);
26153    else if (type instanceof Distance)
26154       composeDistanceInner((Distance) type);
26155    else if (type instanceof Age)
26156       composeAgeInner((Age) type);
26157    else if (type instanceof HumanName)
26158       composeHumanNameInner((HumanName) type);
26159    else if (type instanceof ContactPoint)
26160       composeContactPointInner((ContactPoint) type);
26161    else if (type instanceof Meta)
26162       composeMetaInner((Meta) type);
26163    else if (type instanceof Address)
26164       composeAddressInner((Address) type);
26165    else if (type instanceof Timing)
26166       composeTimingInner((Timing) type);
26167    else if (type instanceof ElementDefinition)
26168       composeElementDefinitionInner((ElementDefinition) type);
26169    else
26170      throw new Error("Unhandled type");
26171  }
26172
26173}