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        if (!array.get(i).isJsonNull()) {
10836          res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10837        }
10838      }
10839    };
10840    if (json.has("exclude")) {
10841      JsonArray array = json.getAsJsonArray("exclude");
10842      for (int i = 0; i < array.size(); i++) {
10843        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10844      }
10845    };
10846    return res;
10847  }
10848
10849  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10850    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
10851    parseBackboneProperties(json, res);
10852    if (json.has("system"))
10853      res.setSystemElement(parseUri(json.get("system").getAsString()));
10854    if (json.has("_system"))
10855      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10856    if (json.has("version"))
10857      res.setVersionElement(parseString(json.get("version").getAsString()));
10858    if (json.has("_version"))
10859      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10860    if (json.has("concept")) {
10861      JsonArray array = json.getAsJsonArray("concept");
10862      for (int i = 0; i < array.size(); i++) {
10863        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
10864      }
10865    };
10866    if (json.has("filter")) {
10867      JsonArray array = json.getAsJsonArray("filter");
10868      for (int i = 0; i < array.size(); i++) {
10869        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
10870      }
10871    };
10872    return res;
10873  }
10874
10875  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10876    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
10877    parseBackboneProperties(json, res);
10878    if (json.has("code"))
10879      res.setCodeElement(parseCode(json.get("code").getAsString()));
10880    if (json.has("_code"))
10881      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10882    if (json.has("display"))
10883      res.setDisplayElement(parseString(json.get("display").getAsString()));
10884    if (json.has("_display"))
10885      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10886    if (json.has("designation")) {
10887      JsonArray array = json.getAsJsonArray("designation");
10888      for (int i = 0; i < array.size(); i++) {
10889        res.getDesignation().add(parseValueSetConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
10890      }
10891    };
10892    return res;
10893  }
10894
10895  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10896    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
10897    parseBackboneProperties(json, res);
10898    if (json.has("property"))
10899      res.setPropertyElement(parseCode(json.get("property").getAsString()));
10900    if (json.has("_property"))
10901      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
10902    if (json.has("op"))
10903      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
10904    if (json.has("_op"))
10905      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
10906    if (json.has("value"))
10907      res.setValueElement(parseCode(json.get("value").getAsString()));
10908    if (json.has("_value"))
10909      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10910    return res;
10911  }
10912
10913  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10914    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
10915    parseBackboneProperties(json, res);
10916    if (json.has("identifier"))
10917      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
10918    if (json.has("_identifier"))
10919      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10920    if (json.has("timestamp"))
10921      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
10922    if (json.has("_timestamp"))
10923      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
10924    if (json.has("total"))
10925      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
10926    if (json.has("_total"))
10927      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
10928    if (json.has("offset"))
10929      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
10930    if (json.has("_offset"))
10931      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
10932    if (json.has("parameter")) {
10933      JsonArray array = json.getAsJsonArray("parameter");
10934      for (int i = 0; i < array.size(); i++) {
10935        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
10936      }
10937    };
10938    if (json.has("contains")) {
10939      JsonArray array = json.getAsJsonArray("contains");
10940      for (int i = 0; i < array.size(); i++) {
10941        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
10942      }
10943    };
10944    return res;
10945  }
10946
10947  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10948    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
10949    parseBackboneProperties(json, res);
10950    if (json.has("name"))
10951      res.setNameElement(parseString(json.get("name").getAsString()));
10952    if (json.has("_name"))
10953      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10954    Type value = parseType("value", json);
10955    if (value != null)
10956      res.setValue(value);
10957    return res;
10958  }
10959
10960  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10961    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
10962    parseBackboneProperties(json, res);
10963    if (json.has("system"))
10964      res.setSystemElement(parseUri(json.get("system").getAsString()));
10965    if (json.has("_system"))
10966      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10967    if (json.has("abstract"))
10968      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
10969    if (json.has("_abstract"))
10970      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
10971    if (json.has("version"))
10972      res.setVersionElement(parseString(json.get("version").getAsString()));
10973    if (json.has("_version"))
10974      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10975    if (json.has("code"))
10976      res.setCodeElement(parseCode(json.get("code").getAsString()));
10977    if (json.has("_code"))
10978      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10979    if (json.has("display"))
10980      res.setDisplayElement(parseString(json.get("display").getAsString()));
10981    if (json.has("_display"))
10982      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10983    if (json.has("contains")) {
10984      JsonArray array = json.getAsJsonArray("contains");
10985      for (int i = 0; i < array.size(); i++) {
10986        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
10987      }
10988    };
10989    return res;
10990  }
10991
10992  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
10993    VisionPrescription res = new VisionPrescription();
10994    parseDomainResourceProperties(json, res);
10995    if (json.has("identifier")) {
10996      JsonArray array = json.getAsJsonArray("identifier");
10997      for (int i = 0; i < array.size(); i++) {
10998        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10999      }
11000    };
11001    if (json.has("dateWritten"))
11002      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
11003    if (json.has("_dateWritten"))
11004      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
11005    if (json.has("patient"))
11006      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11007    if (json.has("prescriber"))
11008      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
11009    if (json.has("encounter"))
11010      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11011    Type reason = parseType("reason", json);
11012    if (reason != null)
11013      res.setReason(reason);
11014    if (json.has("dispense")) {
11015      JsonArray array = json.getAsJsonArray("dispense");
11016      for (int i = 0; i < array.size(); i++) {
11017        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
11018      }
11019    };
11020    return res;
11021  }
11022
11023  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
11024    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
11025    parseBackboneProperties(json, res);
11026    if (json.has("product"))
11027      res.setProduct(parseCoding(json.getAsJsonObject("product")));
11028    if (json.has("eye"))
11029      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
11030    if (json.has("_eye"))
11031      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
11032    if (json.has("sphere"))
11033      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
11034    if (json.has("_sphere"))
11035      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
11036    if (json.has("cylinder"))
11037      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
11038    if (json.has("_cylinder"))
11039      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
11040    if (json.has("axis"))
11041      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
11042    if (json.has("_axis"))
11043      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
11044    if (json.has("prism"))
11045      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
11046    if (json.has("_prism"))
11047      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
11048    if (json.has("base"))
11049      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
11050    if (json.has("_base"))
11051      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
11052    if (json.has("add"))
11053      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
11054    if (json.has("_add"))
11055      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
11056    if (json.has("power"))
11057      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
11058    if (json.has("_power"))
11059      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
11060    if (json.has("backCurve"))
11061      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
11062    if (json.has("_backCurve"))
11063      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
11064    if (json.has("diameter"))
11065      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
11066    if (json.has("_diameter"))
11067      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
11068    if (json.has("duration"))
11069      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
11070    if (json.has("color"))
11071      res.setColorElement(parseString(json.get("color").getAsString()));
11072    if (json.has("_color"))
11073      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
11074    if (json.has("brand"))
11075      res.setBrandElement(parseString(json.get("brand").getAsString()));
11076    if (json.has("_brand"))
11077      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
11078    if (json.has("notes"))
11079      res.setNotesElement(parseString(json.get("notes").getAsString()));
11080    if (json.has("_notes"))
11081      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
11082    return res;
11083  }
11084
11085  @Override
11086  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
11087    if (!json.has("resourceType")) {
11088      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11089    }
11090    String t = json.get("resourceType").getAsString();
11091    if (Utilities.noString(t))
11092      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11093    if (t.equals("Parameters"))
11094      return parseParameters(json);
11095    else if (t.equals("Account"))
11096      return parseAccount(json);
11097    else if (t.equals("AllergyIntolerance"))
11098      return parseAllergyIntolerance(json);
11099    else if (t.equals("Appointment"))
11100      return parseAppointment(json);
11101    else if (t.equals("AppointmentResponse"))
11102      return parseAppointmentResponse(json);
11103    else if (t.equals("AuditEvent"))
11104      return parseAuditEvent(json);
11105    else if (t.equals("Basic"))
11106      return parseBasic(json);
11107    else if (t.equals("Binary"))
11108      return parseBinary(json);
11109    else if (t.equals("BodySite"))
11110      return parseBodySite(json);
11111    else if (t.equals("Bundle"))
11112      return parseBundle(json);
11113    else if (t.equals("CarePlan"))
11114      return parseCarePlan(json);
11115    else if (t.equals("Claim"))
11116      return parseClaim(json);
11117    else if (t.equals("ClaimResponse"))
11118      return parseClaimResponse(json);
11119    else if (t.equals("ClinicalImpression"))
11120      return parseClinicalImpression(json);
11121    else if (t.equals("Communication"))
11122      return parseCommunication(json);
11123    else if (t.equals("CommunicationRequest"))
11124      return parseCommunicationRequest(json);
11125    else if (t.equals("Composition"))
11126      return parseComposition(json);
11127    else if (t.equals("ConceptMap"))
11128      return parseConceptMap(json);
11129    else if (t.equals("Condition"))
11130      return parseCondition(json);
11131    else if (t.equals("Conformance"))
11132      return parseConformance(json);
11133    else if (t.equals("Contract"))
11134      return parseContract(json);
11135    else if (t.equals("Coverage"))
11136      return parseCoverage(json);
11137    else if (t.equals("DataElement"))
11138      return parseDataElement(json);
11139    else if (t.equals("DetectedIssue"))
11140      return parseDetectedIssue(json);
11141    else if (t.equals("Device"))
11142      return parseDevice(json);
11143    else if (t.equals("DeviceComponent"))
11144      return parseDeviceComponent(json);
11145    else if (t.equals("DeviceMetric"))
11146      return parseDeviceMetric(json);
11147    else if (t.equals("DeviceUseRequest"))
11148      return parseDeviceUseRequest(json);
11149    else if (t.equals("DeviceUseStatement"))
11150      return parseDeviceUseStatement(json);
11151    else if (t.equals("DiagnosticOrder"))
11152      return parseDiagnosticOrder(json);
11153    else if (t.equals("DiagnosticReport"))
11154      return parseDiagnosticReport(json);
11155    else if (t.equals("DocumentManifest"))
11156      return parseDocumentManifest(json);
11157    else if (t.equals("DocumentReference"))
11158      return parseDocumentReference(json);
11159    else if (t.equals("EligibilityRequest"))
11160      return parseEligibilityRequest(json);
11161    else if (t.equals("EligibilityResponse"))
11162      return parseEligibilityResponse(json);
11163    else if (t.equals("Encounter"))
11164      return parseEncounter(json);
11165    else if (t.equals("EnrollmentRequest"))
11166      return parseEnrollmentRequest(json);
11167    else if (t.equals("EnrollmentResponse"))
11168      return parseEnrollmentResponse(json);
11169    else if (t.equals("EpisodeOfCare"))
11170      return parseEpisodeOfCare(json);
11171    else if (t.equals("ExplanationOfBenefit"))
11172      return parseExplanationOfBenefit(json);
11173    else if (t.equals("FamilyMemberHistory"))
11174      return parseFamilyMemberHistory(json);
11175    else if (t.equals("Flag"))
11176      return parseFlag(json);
11177    else if (t.equals("Goal"))
11178      return parseGoal(json);
11179    else if (t.equals("Group"))
11180      return parseGroup(json);
11181    else if (t.equals("HealthcareService"))
11182      return parseHealthcareService(json);
11183    else if (t.equals("ImagingObjectSelection"))
11184      return parseImagingObjectSelection(json);
11185    else if (t.equals("ImagingStudy"))
11186      return parseImagingStudy(json);
11187    else if (t.equals("Immunization"))
11188      return parseImmunization(json);
11189    else if (t.equals("ImmunizationRecommendation"))
11190      return parseImmunizationRecommendation(json);
11191    else if (t.equals("ImplementationGuide"))
11192      return parseImplementationGuide(json);
11193    else if (t.equals("List"))
11194      return parseList_(json);
11195    else if (t.equals("Location"))
11196      return parseLocation(json);
11197    else if (t.equals("Media"))
11198      return parseMedia(json);
11199    else if (t.equals("Medication"))
11200      return parseMedication(json);
11201    else if (t.equals("MedicationAdministration"))
11202      return parseMedicationAdministration(json);
11203    else if (t.equals("MedicationDispense"))
11204      return parseMedicationDispense(json);
11205    else if (t.equals("MedicationOrder"))
11206      return parseMedicationOrder(json);
11207    else if (t.equals("MedicationStatement"))
11208      return parseMedicationStatement(json);
11209    else if (t.equals("MessageHeader"))
11210      return parseMessageHeader(json);
11211    else if (t.equals("NamingSystem"))
11212      return parseNamingSystem(json);
11213    else if (t.equals("NutritionOrder"))
11214      return parseNutritionOrder(json);
11215    else if (t.equals("Observation"))
11216      return parseObservation(json);
11217    else if (t.equals("OperationDefinition"))
11218      return parseOperationDefinition(json);
11219    else if (t.equals("OperationOutcome"))
11220      return parseOperationOutcome(json);
11221    else if (t.equals("Order"))
11222      return parseOrder(json);
11223    else if (t.equals("OrderResponse"))
11224      return parseOrderResponse(json);
11225    else if (t.equals("Organization"))
11226      return parseOrganization(json);
11227    else if (t.equals("Patient"))
11228      return parsePatient(json);
11229    else if (t.equals("PaymentNotice"))
11230      return parsePaymentNotice(json);
11231    else if (t.equals("PaymentReconciliation"))
11232      return parsePaymentReconciliation(json);
11233    else if (t.equals("Person"))
11234      return parsePerson(json);
11235    else if (t.equals("Practitioner"))
11236      return parsePractitioner(json);
11237    else if (t.equals("Procedure"))
11238      return parseProcedure(json);
11239    else if (t.equals("ProcedureRequest"))
11240      return parseProcedureRequest(json);
11241    else if (t.equals("ProcessRequest"))
11242      return parseProcessRequest(json);
11243    else if (t.equals("ProcessResponse"))
11244      return parseProcessResponse(json);
11245    else if (t.equals("Provenance"))
11246      return parseProvenance(json);
11247    else if (t.equals("Questionnaire"))
11248      return parseQuestionnaire(json);
11249    else if (t.equals("QuestionnaireResponse"))
11250      return parseQuestionnaireResponse(json);
11251    else if (t.equals("ReferralRequest"))
11252      return parseReferralRequest(json);
11253    else if (t.equals("RelatedPerson"))
11254      return parseRelatedPerson(json);
11255    else if (t.equals("RiskAssessment"))
11256      return parseRiskAssessment(json);
11257    else if (t.equals("Schedule"))
11258      return parseSchedule(json);
11259    else if (t.equals("SearchParameter"))
11260      return parseSearchParameter(json);
11261    else if (t.equals("Slot"))
11262      return parseSlot(json);
11263    else if (t.equals("Specimen"))
11264      return parseSpecimen(json);
11265    else if (t.equals("StructureDefinition"))
11266      return parseStructureDefinition(json);
11267    else if (t.equals("Subscription"))
11268      return parseSubscription(json);
11269    else if (t.equals("Substance"))
11270      return parseSubstance(json);
11271    else if (t.equals("SupplyDelivery"))
11272      return parseSupplyDelivery(json);
11273    else if (t.equals("SupplyRequest"))
11274      return parseSupplyRequest(json);
11275    else if (t.equals("TestScript"))
11276      return parseTestScript(json);
11277    else if (t.equals("ValueSet"))
11278      return parseValueSet(json);
11279    else if (t.equals("VisionPrescription"))
11280      return parseVisionPrescription(json);
11281    else if (t.equals("Binary"))
11282      return parseBinary(json);
11283    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
11284  }
11285
11286  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
11287    if (json.has(prefix+"Identifier"))
11288      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
11289    else if (json.has(prefix+"Coding"))
11290      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
11291    else if (json.has(prefix+"Reference"))
11292      return parseReference(json.getAsJsonObject(prefix+"Reference"));
11293    else if (json.has(prefix+"Signature"))
11294      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
11295    else if (json.has(prefix+"SampledData"))
11296      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
11297    else if (json.has(prefix+"Quantity"))
11298      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
11299    else if (json.has(prefix+"Period"))
11300      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
11301    else if (json.has(prefix+"Attachment"))
11302      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
11303    else if (json.has(prefix+"Ratio"))
11304      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
11305    else if (json.has(prefix+"Range"))
11306      return parseRange(json.getAsJsonObject(prefix+"Range"));
11307    else if (json.has(prefix+"Annotation"))
11308      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
11309    else if (json.has(prefix+"CodeableConcept"))
11310      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
11311    else if (json.has(prefix+"Money"))
11312      return parseMoney(json.getAsJsonObject(prefix+"Money"));
11313    else if (json.has(prefix+"SimpleQuantity"))
11314      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
11315    else if (json.has(prefix+"Duration"))
11316      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
11317    else if (json.has(prefix+"Count"))
11318      return parseCount(json.getAsJsonObject(prefix+"Count"));
11319    else if (json.has(prefix+"Distance"))
11320      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
11321    else if (json.has(prefix+"Age"))
11322      return parseAge(json.getAsJsonObject(prefix+"Age"));
11323    else if (json.has(prefix+"HumanName"))
11324      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
11325    else if (json.has(prefix+"ContactPoint"))
11326      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
11327    else if (json.has(prefix+"Meta"))
11328      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
11329    else if (json.has(prefix+"Address"))
11330      return parseAddress(json.getAsJsonObject(prefix+"Address"));
11331    else if (json.has(prefix+"Timing"))
11332      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
11333    else if (json.has(prefix+"ElementDefinition"))
11334      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
11335    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
11336      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
11337      if (json.has("_"+prefix+"Date"))
11338        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
11339      return t;
11340    }
11341    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
11342      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
11343      if (json.has("_"+prefix+"DateTime"))
11344        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
11345      return t;
11346    }
11347    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
11348      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
11349      if (json.has("_"+prefix+"Code"))
11350        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
11351      return t;
11352    }
11353    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
11354      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
11355      if (json.has("_"+prefix+"String"))
11356        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
11357      return t;
11358    }
11359    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
11360      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
11361      if (json.has("_"+prefix+"Integer"))
11362        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
11363      return t;
11364    }
11365    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
11366      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
11367      if (json.has("_"+prefix+"Oid"))
11368        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
11369      return t;
11370    }
11371    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
11372      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
11373      if (json.has("_"+prefix+"Uri"))
11374        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
11375      return t;
11376    }
11377    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
11378      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
11379      if (json.has("_"+prefix+"Uuid"))
11380        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
11381      return t;
11382    }
11383    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
11384      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
11385      if (json.has("_"+prefix+"Instant"))
11386        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
11387      return t;
11388    }
11389    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
11390      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
11391      if (json.has("_"+prefix+"Boolean"))
11392        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
11393      return t;
11394    }
11395    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
11396      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
11397      if (json.has("_"+prefix+"Base64Binary"))
11398        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
11399      return t;
11400    }
11401    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
11402      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
11403      if (json.has("_"+prefix+"UnsignedInt"))
11404        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
11405      return t;
11406    }
11407    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
11408      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
11409      if (json.has("_"+prefix+"Markdown"))
11410        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
11411      return t;
11412    }
11413    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
11414      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
11415      if (json.has("_"+prefix+"Time"))
11416        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
11417      return t;
11418    }
11419    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
11420      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
11421      if (json.has("_"+prefix+"Id"))
11422        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
11423      return t;
11424    }
11425    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
11426      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
11427      if (json.has("_"+prefix+"PositiveInt"))
11428        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
11429      return t;
11430    }
11431    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
11432      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
11433      if (json.has("_"+prefix+"Decimal"))
11434        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
11435      return t;
11436    }
11437    return null;
11438  }
11439
11440  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
11441    if (type.equals("Identifier"))
11442      return parseIdentifier(json);
11443    else if (type.equals("Coding"))
11444      return parseCoding(json);
11445    else if (type.equals("Reference"))
11446      return parseReference(json);
11447    else if (type.equals("Signature"))
11448      return parseSignature(json);
11449    else if (type.equals("SampledData"))
11450      return parseSampledData(json);
11451    else if (type.equals("Quantity"))
11452      return parseQuantity(json);
11453    else if (type.equals("Period"))
11454      return parsePeriod(json);
11455    else if (type.equals("Attachment"))
11456      return parseAttachment(json);
11457    else if (type.equals("Ratio"))
11458      return parseRatio(json);
11459    else if (type.equals("Range"))
11460      return parseRange(json);
11461    else if (type.equals("Annotation"))
11462      return parseAnnotation(json);
11463    else if (type.equals("CodeableConcept"))
11464      return parseCodeableConcept(json);
11465    else if (type.equals("Money"))
11466      return parseMoney(json);
11467    else if (type.equals("SimpleQuantity"))
11468      return parseSimpleQuantity(json);
11469    else if (type.equals("Duration"))
11470      return parseDuration(json);
11471    else if (type.equals("Count"))
11472      return parseCount(json);
11473    else if (type.equals("Distance"))
11474      return parseDistance(json);
11475    else if (type.equals("Age"))
11476      return parseAge(json);
11477    else if (type.equals("HumanName"))
11478      return parseHumanName(json);
11479    else if (type.equals("ContactPoint"))
11480      return parseContactPoint(json);
11481    else if (type.equals("Meta"))
11482      return parseMeta(json);
11483    else if (type.equals("Address"))
11484      return parseAddress(json);
11485    else if (type.equals("Timing"))
11486      return parseTiming(json);
11487    else if (type.equals("ElementDefinition"))
11488      return parseElementDefinition(json);
11489    throw new FHIRFormatError("Unknown Type "+type);
11490  }
11491
11492  protected boolean hasTypeName(JsonObject json, String prefix) {
11493        if (json.has(prefix+"Identifier"))
11494      return true;
11495    if (json.has(prefix+"Coding"))
11496      return true;
11497    if (json.has(prefix+"Reference"))
11498      return true;
11499    if (json.has(prefix+"Signature"))
11500      return true;
11501    if (json.has(prefix+"SampledData"))
11502      return true;
11503    if (json.has(prefix+"Quantity"))
11504      return true;
11505    if (json.has(prefix+"Period"))
11506      return true;
11507    if (json.has(prefix+"Attachment"))
11508      return true;
11509    if (json.has(prefix+"Ratio"))
11510      return true;
11511    if (json.has(prefix+"Range"))
11512      return true;
11513    if (json.has(prefix+"Annotation"))
11514      return true;
11515    if (json.has(prefix+"CodeableConcept"))
11516      return true;
11517    if (json.has(prefix+"Money"))
11518      return true;
11519    if (json.has(prefix+"SimpleQuantity"))
11520      return true;
11521    if (json.has(prefix+"Duration"))
11522      return true;
11523    if (json.has(prefix+"Count"))
11524      return true;
11525    if (json.has(prefix+"Distance"))
11526      return true;
11527    if (json.has(prefix+"Age"))
11528      return true;
11529    if (json.has(prefix+"HumanName"))
11530      return true;
11531    if (json.has(prefix+"ContactPoint"))
11532      return true;
11533    if (json.has(prefix+"Meta"))
11534      return true;
11535    if (json.has(prefix+"Address"))
11536      return true;
11537    if (json.has(prefix+"Timing"))
11538      return true;
11539    if (json.has(prefix+"ElementDefinition"))
11540      return true;
11541    if (json.has(prefix+"Parameters"))
11542      return true;
11543    if (json.has(prefix+"Account"))
11544      return true;
11545    if (json.has(prefix+"AllergyIntolerance"))
11546      return true;
11547    if (json.has(prefix+"Appointment"))
11548      return true;
11549    if (json.has(prefix+"AppointmentResponse"))
11550      return true;
11551    if (json.has(prefix+"AuditEvent"))
11552      return true;
11553    if (json.has(prefix+"Basic"))
11554      return true;
11555    if (json.has(prefix+"Binary"))
11556      return true;
11557    if (json.has(prefix+"BodySite"))
11558      return true;
11559    if (json.has(prefix+"Bundle"))
11560      return true;
11561    if (json.has(prefix+"CarePlan"))
11562      return true;
11563    if (json.has(prefix+"Claim"))
11564      return true;
11565    if (json.has(prefix+"ClaimResponse"))
11566      return true;
11567    if (json.has(prefix+"ClinicalImpression"))
11568      return true;
11569    if (json.has(prefix+"Communication"))
11570      return true;
11571    if (json.has(prefix+"CommunicationRequest"))
11572      return true;
11573    if (json.has(prefix+"Composition"))
11574      return true;
11575    if (json.has(prefix+"ConceptMap"))
11576      return true;
11577    if (json.has(prefix+"Condition"))
11578      return true;
11579    if (json.has(prefix+"Conformance"))
11580      return true;
11581    if (json.has(prefix+"Contract"))
11582      return true;
11583    if (json.has(prefix+"Coverage"))
11584      return true;
11585    if (json.has(prefix+"DataElement"))
11586      return true;
11587    if (json.has(prefix+"DetectedIssue"))
11588      return true;
11589    if (json.has(prefix+"Device"))
11590      return true;
11591    if (json.has(prefix+"DeviceComponent"))
11592      return true;
11593    if (json.has(prefix+"DeviceMetric"))
11594      return true;
11595    if (json.has(prefix+"DeviceUseRequest"))
11596      return true;
11597    if (json.has(prefix+"DeviceUseStatement"))
11598      return true;
11599    if (json.has(prefix+"DiagnosticOrder"))
11600      return true;
11601    if (json.has(prefix+"DiagnosticReport"))
11602      return true;
11603    if (json.has(prefix+"DocumentManifest"))
11604      return true;
11605    if (json.has(prefix+"DocumentReference"))
11606      return true;
11607    if (json.has(prefix+"EligibilityRequest"))
11608      return true;
11609    if (json.has(prefix+"EligibilityResponse"))
11610      return true;
11611    if (json.has(prefix+"Encounter"))
11612      return true;
11613    if (json.has(prefix+"EnrollmentRequest"))
11614      return true;
11615    if (json.has(prefix+"EnrollmentResponse"))
11616      return true;
11617    if (json.has(prefix+"EpisodeOfCare"))
11618      return true;
11619    if (json.has(prefix+"ExplanationOfBenefit"))
11620      return true;
11621    if (json.has(prefix+"FamilyMemberHistory"))
11622      return true;
11623    if (json.has(prefix+"Flag"))
11624      return true;
11625    if (json.has(prefix+"Goal"))
11626      return true;
11627    if (json.has(prefix+"Group"))
11628      return true;
11629    if (json.has(prefix+"HealthcareService"))
11630      return true;
11631    if (json.has(prefix+"ImagingObjectSelection"))
11632      return true;
11633    if (json.has(prefix+"ImagingStudy"))
11634      return true;
11635    if (json.has(prefix+"Immunization"))
11636      return true;
11637    if (json.has(prefix+"ImmunizationRecommendation"))
11638      return true;
11639    if (json.has(prefix+"ImplementationGuide"))
11640      return true;
11641    if (json.has(prefix+"List"))
11642      return true;
11643    if (json.has(prefix+"Location"))
11644      return true;
11645    if (json.has(prefix+"Media"))
11646      return true;
11647    if (json.has(prefix+"Medication"))
11648      return true;
11649    if (json.has(prefix+"MedicationAdministration"))
11650      return true;
11651    if (json.has(prefix+"MedicationDispense"))
11652      return true;
11653    if (json.has(prefix+"MedicationOrder"))
11654      return true;
11655    if (json.has(prefix+"MedicationStatement"))
11656      return true;
11657    if (json.has(prefix+"MessageHeader"))
11658      return true;
11659    if (json.has(prefix+"NamingSystem"))
11660      return true;
11661    if (json.has(prefix+"NutritionOrder"))
11662      return true;
11663    if (json.has(prefix+"Observation"))
11664      return true;
11665    if (json.has(prefix+"OperationDefinition"))
11666      return true;
11667    if (json.has(prefix+"OperationOutcome"))
11668      return true;
11669    if (json.has(prefix+"Order"))
11670      return true;
11671    if (json.has(prefix+"OrderResponse"))
11672      return true;
11673    if (json.has(prefix+"Organization"))
11674      return true;
11675    if (json.has(prefix+"Patient"))
11676      return true;
11677    if (json.has(prefix+"PaymentNotice"))
11678      return true;
11679    if (json.has(prefix+"PaymentReconciliation"))
11680      return true;
11681    if (json.has(prefix+"Person"))
11682      return true;
11683    if (json.has(prefix+"Practitioner"))
11684      return true;
11685    if (json.has(prefix+"Procedure"))
11686      return true;
11687    if (json.has(prefix+"ProcedureRequest"))
11688      return true;
11689    if (json.has(prefix+"ProcessRequest"))
11690      return true;
11691    if (json.has(prefix+"ProcessResponse"))
11692      return true;
11693    if (json.has(prefix+"Provenance"))
11694      return true;
11695    if (json.has(prefix+"Questionnaire"))
11696      return true;
11697    if (json.has(prefix+"QuestionnaireResponse"))
11698      return true;
11699    if (json.has(prefix+"ReferralRequest"))
11700      return true;
11701    if (json.has(prefix+"RelatedPerson"))
11702      return true;
11703    if (json.has(prefix+"RiskAssessment"))
11704      return true;
11705    if (json.has(prefix+"Schedule"))
11706      return true;
11707    if (json.has(prefix+"SearchParameter"))
11708      return true;
11709    if (json.has(prefix+"Slot"))
11710      return true;
11711    if (json.has(prefix+"Specimen"))
11712      return true;
11713    if (json.has(prefix+"StructureDefinition"))
11714      return true;
11715    if (json.has(prefix+"Subscription"))
11716      return true;
11717    if (json.has(prefix+"Substance"))
11718      return true;
11719    if (json.has(prefix+"SupplyDelivery"))
11720      return true;
11721    if (json.has(prefix+"SupplyRequest"))
11722      return true;
11723    if (json.has(prefix+"TestScript"))
11724      return true;
11725    if (json.has(prefix+"ValueSet"))
11726      return true;
11727    if (json.has(prefix+"VisionPrescription"))
11728      return true;
11729    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
11730      return true;
11731    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
11732      return true;
11733    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
11734      return true;
11735    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
11736      return true;
11737    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
11738      return true;
11739    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
11740      return true;
11741    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
11742      return true;
11743    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
11744      return true;
11745    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
11746      return true;
11747    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
11748      return true;
11749    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
11750      return true;
11751    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
11752      return true;
11753    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
11754      return true;
11755    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
11756      return true;
11757    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
11758      return true;
11759    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
11760      return true;
11761    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
11762      return true;
11763    return false;
11764  }
11765  protected void composeElement(Element element) throws IOException {
11766    if (element.hasId())
11767      prop("id", element.getId());
11768      if (makeComments(element)) {
11769        openArray("fhir_comments");
11770        for (String s : element.getFormatCommentsPre())
11771          prop(null,  s);
11772        for (String s : element.getFormatCommentsPost())
11773          prop(null,  s);
11774         closeArray();
11775      }
11776    if (element.hasExtension()) {
11777      openArray("extension");
11778      for (Extension e : element.getExtension())
11779        composeExtension(null, e);
11780      closeArray();
11781    }
11782  }
11783
11784  protected void composeBackbone(BackboneElement element) throws IOException {
11785    composeElement(element);
11786    if (element.hasModifierExtension()) {
11787      openArray("modifierExtension");
11788      for (Extension e : element.getModifierExtension())
11789        composeExtension(null, e);
11790      closeArray();
11791    }
11792  }
11793
11794  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11795    if (value != null && value.getValue() != null) {
11796      prop(name, e.toCode(value.getValue()));
11797    } else if (inArray)   
11798      writeNull(name);
11799  }    
11800
11801  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11802    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11803      open(inArray ? null : "_"+name);
11804      composeElement(value);
11805      close();
11806    } else if (inArray)   
11807      writeNull(name);
11808  }    
11809
11810  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
11811    if (value != null && value.hasValue()) {
11812        prop(name, value.asStringValue());
11813    }    
11814    else if (inArray) 
11815      writeNull(name); 
11816  }    
11817
11818  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
11819    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11820      open(inArray ? null : "_"+name);
11821      composeElement(value);
11822      close();
11823    }
11824    else if (inArray) 
11825      writeNull(name); 
11826  }
11827
11828  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
11829    if (value != null && value.hasValue()) {
11830        prop(name, value.asStringValue());
11831    }    
11832    else if (inArray) 
11833      writeNull(name); 
11834  }    
11835
11836  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
11837    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11838      open(inArray ? null : "_"+name);
11839      composeElement(value);
11840      close();
11841    }
11842    else if (inArray) 
11843      writeNull(name); 
11844  }
11845
11846  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
11847    if (value != null && value.hasValue()) {
11848        prop(name, toString(value.getValue()));
11849    }    
11850    else if (inArray) 
11851      writeNull(name); 
11852  }    
11853
11854  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
11855    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11856      open(inArray ? null : "_"+name);
11857      composeElement(value);
11858      close();
11859    }
11860    else if (inArray) 
11861      writeNull(name); 
11862  }
11863
11864  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
11865    if (value != null && value.hasValue()) {
11866        prop(name, toString(value.getValue()));
11867    }    
11868    else if (inArray) 
11869      writeNull(name); 
11870  }    
11871
11872  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
11873    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11874      open(inArray ? null : "_"+name);
11875      composeElement(value);
11876      close();
11877    }
11878    else if (inArray) 
11879      writeNull(name); 
11880  }
11881
11882  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
11883    if (value != null && value.hasValue()) {
11884        prop(name, Integer.valueOf(value.getValue()));
11885    }    
11886    else if (inArray) 
11887      writeNull(name); 
11888  }    
11889
11890  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
11891    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11892      open(inArray ? null : "_"+name);
11893      composeElement(value);
11894      close();
11895    }
11896    else if (inArray) 
11897      writeNull(name); 
11898  }
11899
11900  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
11901    if (value != null && value.hasValue()) {
11902        prop(name, toString(value.getValue()));
11903    }    
11904    else if (inArray) 
11905      writeNull(name); 
11906  }    
11907
11908  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
11909    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11910      open(inArray ? null : "_"+name);
11911      composeElement(value);
11912      close();
11913    }
11914    else if (inArray) 
11915      writeNull(name); 
11916  }
11917
11918  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
11919    if (value != null && value.hasValue()) {
11920        prop(name, toString(value.getValue()));
11921    }    
11922    else if (inArray) 
11923      writeNull(name); 
11924  }    
11925
11926  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
11927    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11928      open(inArray ? null : "_"+name);
11929      composeElement(value);
11930      close();
11931    }
11932    else if (inArray) 
11933      writeNull(name); 
11934  }
11935
11936  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
11937    if (value != null && value.hasValue()) {
11938        prop(name, toString(value.getValue()));
11939    }    
11940    else if (inArray) 
11941      writeNull(name); 
11942  }    
11943
11944  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
11945    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11946      open(inArray ? null : "_"+name);
11947      composeElement(value);
11948      close();
11949    }
11950    else if (inArray) 
11951      writeNull(name); 
11952  }
11953
11954  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
11955    if (value != null && value.hasValue()) {
11956        prop(name, value.asStringValue());
11957    }    
11958    else if (inArray) 
11959      writeNull(name); 
11960  }    
11961
11962  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
11963    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11964      open(inArray ? null : "_"+name);
11965      composeElement(value);
11966      close();
11967    }
11968    else if (inArray) 
11969      writeNull(name); 
11970  }
11971
11972  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
11973    if (value != null && value.hasValue()) {
11974        prop(name, value.getValue());
11975    }    
11976    else if (inArray) 
11977      writeNull(name); 
11978  }    
11979
11980  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
11981    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11982      open(inArray ? null : "_"+name);
11983      composeElement(value);
11984      close();
11985    }
11986    else if (inArray) 
11987      writeNull(name); 
11988  }
11989
11990  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
11991    if (value != null && value.hasValue()) {
11992        prop(name, toString(value.getValue()));
11993    }    
11994    else if (inArray) 
11995      writeNull(name); 
11996  }    
11997
11998  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
11999    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12000      open(inArray ? null : "_"+name);
12001      composeElement(value);
12002      close();
12003    }
12004    else if (inArray) 
12005      writeNull(name); 
12006  }
12007
12008  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
12009    if (value != null && value.hasValue()) {
12010        prop(name, Integer.valueOf(value.getValue()));
12011    }    
12012    else if (inArray) 
12013      writeNull(name); 
12014  }    
12015
12016  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
12017    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12018      open(inArray ? null : "_"+name);
12019      composeElement(value);
12020      close();
12021    }
12022    else if (inArray) 
12023      writeNull(name); 
12024  }
12025
12026  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
12027    if (value != null && value.hasValue()) {
12028        prop(name, toString(value.getValue()));
12029    }    
12030    else if (inArray) 
12031      writeNull(name); 
12032  }    
12033
12034  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
12035    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12036      open(inArray ? null : "_"+name);
12037      composeElement(value);
12038      close();
12039    }
12040    else if (inArray) 
12041      writeNull(name); 
12042  }
12043
12044  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
12045    if (value != null && value.hasValue()) {
12046        prop(name, value.asStringValue());
12047    }    
12048    else if (inArray) 
12049      writeNull(name); 
12050  }    
12051
12052  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
12053    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12054      open(inArray ? null : "_"+name);
12055      composeElement(value);
12056      close();
12057    }
12058    else if (inArray) 
12059      writeNull(name); 
12060  }
12061
12062  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
12063    if (value != null && value.hasValue()) {
12064        prop(name, toString(value.getValue()));
12065    }    
12066    else if (inArray) 
12067      writeNull(name); 
12068  }    
12069
12070  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
12071    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12072      open(inArray ? null : "_"+name);
12073      composeElement(value);
12074      close();
12075    }
12076    else if (inArray) 
12077      writeNull(name); 
12078  }
12079
12080  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
12081    if (value != null && value.hasValue()) {
12082        prop(name, Integer.valueOf(value.getValue()));
12083    }    
12084    else if (inArray) 
12085      writeNull(name); 
12086  }    
12087
12088  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
12089    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12090      open(inArray ? null : "_"+name);
12091      composeElement(value);
12092      close();
12093    }
12094    else if (inArray) 
12095      writeNull(name); 
12096  }
12097
12098  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
12099    if (value != null && value.hasValue()) {
12100        prop(name, value.getValue());
12101    }    
12102    else if (inArray) 
12103      writeNull(name); 
12104  }    
12105
12106  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
12107    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12108      open(inArray ? null : "_"+name);
12109      composeElement(value);
12110      close();
12111    }
12112    else if (inArray) 
12113      writeNull(name); 
12114  }
12115
12116  protected void composeExtension(String name, Extension element) throws IOException {
12117    if (element != null) {
12118      open(name);
12119      composeExtensionInner(element);
12120      close();
12121    }
12122  }
12123
12124  protected void composeExtensionInner(Extension element) throws IOException {
12125      composeElement(element);
12126      if (element.hasUrlElement()) {
12127        composeUriCore("url", element.getUrlElement(), false);
12128        composeUriExtras("url", element.getUrlElement(), false);
12129      }
12130      if (element.hasValue()) {
12131        composeType("value", element.getValue());
12132      }
12133  }
12134
12135  protected void composeNarrative(String name, Narrative element) throws IOException {
12136    if (element != null) {
12137      open(name);
12138      composeNarrativeInner(element);
12139      close();
12140    }
12141  }
12142
12143  protected void composeNarrativeInner(Narrative element) throws IOException {
12144      composeElement(element);
12145      if (element.hasStatusElement()) {
12146        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12147        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12148      }
12149      if (element.hasDiv()) {
12150        composeXhtml("div", element.getDiv());
12151      }
12152  }
12153
12154  protected void composeIdentifier(String name, Identifier element) throws IOException {
12155    if (element != null) {
12156      open(name);
12157      composeIdentifierInner(element);
12158      close();
12159    }
12160  }
12161
12162  protected void composeIdentifierInner(Identifier element) throws IOException {
12163      composeElement(element);
12164      if (element.hasUseElement()) {
12165        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12166        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12167      }
12168      if (element.hasType()) {
12169        composeCodeableConcept("type", element.getType());
12170      }
12171      if (element.hasSystemElement()) {
12172        composeUriCore("system", element.getSystemElement(), false);
12173        composeUriExtras("system", element.getSystemElement(), false);
12174      }
12175      if (element.hasValueElement()) {
12176        composeStringCore("value", element.getValueElement(), false);
12177        composeStringExtras("value", element.getValueElement(), false);
12178      }
12179      if (element.hasPeriod()) {
12180        composePeriod("period", element.getPeriod());
12181      }
12182      if (element.hasAssigner()) {
12183        composeReference("assigner", element.getAssigner());
12184      }
12185  }
12186
12187  protected void composeCoding(String name, Coding element) throws IOException {
12188    if (element != null) {
12189      open(name);
12190      composeCodingInner(element);
12191      close();
12192    }
12193  }
12194
12195  protected void composeCodingInner(Coding element) throws IOException {
12196      composeElement(element);
12197      if (element.hasSystemElement()) {
12198        composeUriCore("system", element.getSystemElement(), false);
12199        composeUriExtras("system", element.getSystemElement(), false);
12200      }
12201      if (element.hasVersionElement()) {
12202        composeStringCore("version", element.getVersionElement(), false);
12203        composeStringExtras("version", element.getVersionElement(), false);
12204      }
12205      if (element.hasCodeElement()) {
12206        composeCodeCore("code", element.getCodeElement(), false);
12207        composeCodeExtras("code", element.getCodeElement(), false);
12208      }
12209      if (element.hasDisplayElement()) {
12210        composeStringCore("display", element.getDisplayElement(), false);
12211        composeStringExtras("display", element.getDisplayElement(), false);
12212      }
12213      if (element.hasUserSelectedElement()) {
12214        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
12215        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
12216      }
12217  }
12218
12219  protected void composeReference(String name, Reference element) throws IOException {
12220    if (element != null) {
12221      open(name);
12222      composeReferenceInner(element);
12223      close();
12224    }
12225  }
12226
12227  protected void composeReferenceInner(Reference element) throws IOException {
12228      composeElement(element);
12229      if (element.hasReferenceElement()) {
12230        composeStringCore("reference", element.getReferenceElement(), false);
12231        composeStringExtras("reference", element.getReferenceElement(), false);
12232      }
12233      if (element.hasDisplayElement()) {
12234        composeStringCore("display", element.getDisplayElement(), false);
12235        composeStringExtras("display", element.getDisplayElement(), false);
12236      }
12237  }
12238
12239  protected void composeSignature(String name, Signature element) throws IOException {
12240    if (element != null) {
12241      open(name);
12242      composeSignatureInner(element);
12243      close();
12244    }
12245  }
12246
12247  protected void composeSignatureInner(Signature element) throws IOException {
12248      composeElement(element);
12249      if (element.hasType()) {
12250        openArray("type");
12251        for (Coding e : element.getType()) 
12252          composeCoding(null, e);
12253        closeArray();
12254      };
12255      if (element.hasWhenElement()) {
12256        composeInstantCore("when", element.getWhenElement(), false);
12257        composeInstantExtras("when", element.getWhenElement(), false);
12258      }
12259      if (element.hasWho()) {
12260        composeType("who", element.getWho());
12261      }
12262      if (element.hasContentTypeElement()) {
12263        composeCodeCore("contentType", element.getContentTypeElement(), false);
12264        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12265      }
12266      if (element.hasBlobElement()) {
12267        composeBase64BinaryCore("blob", element.getBlobElement(), false);
12268        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
12269      }
12270  }
12271
12272  protected void composeSampledData(String name, SampledData element) throws IOException {
12273    if (element != null) {
12274      open(name);
12275      composeSampledDataInner(element);
12276      close();
12277    }
12278  }
12279
12280  protected void composeSampledDataInner(SampledData element) throws IOException {
12281      composeElement(element);
12282      if (element.hasOrigin()) {
12283        composeSimpleQuantity("origin", element.getOrigin());
12284      }
12285      if (element.hasPeriodElement()) {
12286        composeDecimalCore("period", element.getPeriodElement(), false);
12287        composeDecimalExtras("period", element.getPeriodElement(), false);
12288      }
12289      if (element.hasFactorElement()) {
12290        composeDecimalCore("factor", element.getFactorElement(), false);
12291        composeDecimalExtras("factor", element.getFactorElement(), false);
12292      }
12293      if (element.hasLowerLimitElement()) {
12294        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
12295        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
12296      }
12297      if (element.hasUpperLimitElement()) {
12298        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
12299        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
12300      }
12301      if (element.hasDimensionsElement()) {
12302        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
12303        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
12304      }
12305      if (element.hasDataElement()) {
12306        composeStringCore("data", element.getDataElement(), false);
12307        composeStringExtras("data", element.getDataElement(), false);
12308      }
12309  }
12310
12311  protected void composeQuantity(String name, Quantity element) throws IOException {
12312    if (element != null) {
12313      open(name);
12314      composeQuantityInner(element);
12315      close();
12316    }
12317  }
12318
12319  protected void composeQuantityInner(Quantity element) throws IOException {
12320      composeElement(element);
12321      if (element.hasValueElement()) {
12322        composeDecimalCore("value", element.getValueElement(), false);
12323        composeDecimalExtras("value", element.getValueElement(), false);
12324      }
12325      if (element.hasComparatorElement()) {
12326        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12327        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12328      }
12329      if (element.hasUnitElement()) {
12330        composeStringCore("unit", element.getUnitElement(), false);
12331        composeStringExtras("unit", element.getUnitElement(), false);
12332      }
12333      if (element.hasSystemElement()) {
12334        composeUriCore("system", element.getSystemElement(), false);
12335        composeUriExtras("system", element.getSystemElement(), false);
12336      }
12337      if (element.hasCodeElement()) {
12338        composeCodeCore("code", element.getCodeElement(), false);
12339        composeCodeExtras("code", element.getCodeElement(), false);
12340      }
12341  }
12342
12343  protected void composePeriod(String name, Period element) throws IOException {
12344    if (element != null) {
12345      open(name);
12346      composePeriodInner(element);
12347      close();
12348    }
12349  }
12350
12351  protected void composePeriodInner(Period element) throws IOException {
12352      composeElement(element);
12353      if (element.hasStartElement()) {
12354        composeDateTimeCore("start", element.getStartElement(), false);
12355        composeDateTimeExtras("start", element.getStartElement(), false);
12356      }
12357      if (element.hasEndElement()) {
12358        composeDateTimeCore("end", element.getEndElement(), false);
12359        composeDateTimeExtras("end", element.getEndElement(), false);
12360      }
12361  }
12362
12363  protected void composeAttachment(String name, Attachment element) throws IOException {
12364    if (element != null) {
12365      open(name);
12366      composeAttachmentInner(element);
12367      close();
12368    }
12369  }
12370
12371  protected void composeAttachmentInner(Attachment element) throws IOException {
12372      composeElement(element);
12373      if (element.hasContentTypeElement()) {
12374        composeCodeCore("contentType", element.getContentTypeElement(), false);
12375        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12376      }
12377      if (element.hasLanguageElement()) {
12378        composeCodeCore("language", element.getLanguageElement(), false);
12379        composeCodeExtras("language", element.getLanguageElement(), false);
12380      }
12381      if (element.hasDataElement()) {
12382        composeBase64BinaryCore("data", element.getDataElement(), false);
12383        composeBase64BinaryExtras("data", element.getDataElement(), false);
12384      }
12385      if (element.hasUrlElement()) {
12386        composeUriCore("url", element.getUrlElement(), false);
12387        composeUriExtras("url", element.getUrlElement(), false);
12388      }
12389      if (element.hasSizeElement()) {
12390        composeUnsignedIntCore("size", element.getSizeElement(), false);
12391        composeUnsignedIntExtras("size", element.getSizeElement(), false);
12392      }
12393      if (element.hasHashElement()) {
12394        composeBase64BinaryCore("hash", element.getHashElement(), false);
12395        composeBase64BinaryExtras("hash", element.getHashElement(), false);
12396      }
12397      if (element.hasTitleElement()) {
12398        composeStringCore("title", element.getTitleElement(), false);
12399        composeStringExtras("title", element.getTitleElement(), false);
12400      }
12401      if (element.hasCreationElement()) {
12402        composeDateTimeCore("creation", element.getCreationElement(), false);
12403        composeDateTimeExtras("creation", element.getCreationElement(), false);
12404      }
12405  }
12406
12407  protected void composeRatio(String name, Ratio element) throws IOException {
12408    if (element != null) {
12409      open(name);
12410      composeRatioInner(element);
12411      close();
12412    }
12413  }
12414
12415  protected void composeRatioInner(Ratio element) throws IOException {
12416      composeElement(element);
12417      if (element.hasNumerator()) {
12418        composeQuantity("numerator", element.getNumerator());
12419      }
12420      if (element.hasDenominator()) {
12421        composeQuantity("denominator", element.getDenominator());
12422      }
12423  }
12424
12425  protected void composeRange(String name, Range element) throws IOException {
12426    if (element != null) {
12427      open(name);
12428      composeRangeInner(element);
12429      close();
12430    }
12431  }
12432
12433  protected void composeRangeInner(Range element) throws IOException {
12434      composeElement(element);
12435      if (element.hasLow()) {
12436        composeSimpleQuantity("low", element.getLow());
12437      }
12438      if (element.hasHigh()) {
12439        composeSimpleQuantity("high", element.getHigh());
12440      }
12441  }
12442
12443  protected void composeAnnotation(String name, Annotation element) throws IOException {
12444    if (element != null) {
12445      open(name);
12446      composeAnnotationInner(element);
12447      close();
12448    }
12449  }
12450
12451  protected void composeAnnotationInner(Annotation element) throws IOException {
12452      composeElement(element);
12453      if (element.hasAuthor()) {
12454        composeType("author", element.getAuthor());
12455      }
12456      if (element.hasTimeElement()) {
12457        composeDateTimeCore("time", element.getTimeElement(), false);
12458        composeDateTimeExtras("time", element.getTimeElement(), false);
12459      }
12460      if (element.hasTextElement()) {
12461        composeStringCore("text", element.getTextElement(), false);
12462        composeStringExtras("text", element.getTextElement(), false);
12463      }
12464  }
12465
12466  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
12467    if (element != null) {
12468      open(name);
12469      composeCodeableConceptInner(element);
12470      close();
12471    }
12472  }
12473
12474  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
12475      composeElement(element);
12476      if (element.hasCoding()) {
12477        openArray("coding");
12478        for (Coding e : element.getCoding()) 
12479          composeCoding(null, e);
12480        closeArray();
12481      };
12482      if (element.hasTextElement()) {
12483        composeStringCore("text", element.getTextElement(), false);
12484        composeStringExtras("text", element.getTextElement(), false);
12485      }
12486  }
12487
12488  protected void composeMoney(String name, Money element) throws IOException {
12489    if (element != null) {
12490      open(name);
12491      composeMoneyInner(element);
12492      close();
12493    }
12494  }
12495
12496  protected void composeMoneyInner(Money element) throws IOException {
12497      composeElement(element);
12498      if (element.hasValueElement()) {
12499        composeDecimalCore("value", element.getValueElement(), false);
12500        composeDecimalExtras("value", element.getValueElement(), false);
12501      }
12502      if (element.hasComparatorElement()) {
12503        composeEnumerationCore("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12504        composeEnumerationExtras("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12505      }
12506      if (element.hasUnitElement()) {
12507        composeStringCore("unit", element.getUnitElement(), false);
12508        composeStringExtras("unit", element.getUnitElement(), false);
12509      }
12510      if (element.hasSystemElement()) {
12511        composeUriCore("system", element.getSystemElement(), false);
12512        composeUriExtras("system", element.getSystemElement(), false);
12513      }
12514      if (element.hasCodeElement()) {
12515        composeCodeCore("code", element.getCodeElement(), false);
12516        composeCodeExtras("code", element.getCodeElement(), false);
12517      }
12518  }
12519
12520  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
12521    if (element != null) {
12522      open(name);
12523      composeSimpleQuantityInner(element);
12524      close();
12525    }
12526  }
12527
12528  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
12529      composeElement(element);
12530      if (element.hasValueElement()) {
12531        composeDecimalCore("value", element.getValueElement(), false);
12532        composeDecimalExtras("value", element.getValueElement(), false);
12533      }
12534      if (element.hasComparatorElement()) {
12535        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12536        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12537      }
12538      if (element.hasUnitElement()) {
12539        composeStringCore("unit", element.getUnitElement(), false);
12540        composeStringExtras("unit", element.getUnitElement(), false);
12541      }
12542      if (element.hasSystemElement()) {
12543        composeUriCore("system", element.getSystemElement(), false);
12544        composeUriExtras("system", element.getSystemElement(), false);
12545      }
12546      if (element.hasCodeElement()) {
12547        composeCodeCore("code", element.getCodeElement(), false);
12548        composeCodeExtras("code", element.getCodeElement(), false);
12549      }
12550  }
12551
12552  protected void composeDuration(String name, Duration element) throws IOException {
12553    if (element != null) {
12554      open(name);
12555      composeDurationInner(element);
12556      close();
12557    }
12558  }
12559
12560  protected void composeDurationInner(Duration element) throws IOException {
12561      composeElement(element);
12562      if (element.hasValueElement()) {
12563        composeDecimalCore("value", element.getValueElement(), false);
12564        composeDecimalExtras("value", element.getValueElement(), false);
12565      }
12566      if (element.hasComparatorElement()) {
12567        composeEnumerationCore("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12568        composeEnumerationExtras("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12569      }
12570      if (element.hasUnitElement()) {
12571        composeStringCore("unit", element.getUnitElement(), false);
12572        composeStringExtras("unit", element.getUnitElement(), false);
12573      }
12574      if (element.hasSystemElement()) {
12575        composeUriCore("system", element.getSystemElement(), false);
12576        composeUriExtras("system", element.getSystemElement(), false);
12577      }
12578      if (element.hasCodeElement()) {
12579        composeCodeCore("code", element.getCodeElement(), false);
12580        composeCodeExtras("code", element.getCodeElement(), false);
12581      }
12582  }
12583
12584  protected void composeCount(String name, Count element) throws IOException {
12585    if (element != null) {
12586      open(name);
12587      composeCountInner(element);
12588      close();
12589    }
12590  }
12591
12592  protected void composeCountInner(Count element) throws IOException {
12593      composeElement(element);
12594      if (element.hasValueElement()) {
12595        composeDecimalCore("value", element.getValueElement(), false);
12596        composeDecimalExtras("value", element.getValueElement(), false);
12597      }
12598      if (element.hasComparatorElement()) {
12599        composeEnumerationCore("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12600        composeEnumerationExtras("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12601      }
12602      if (element.hasUnitElement()) {
12603        composeStringCore("unit", element.getUnitElement(), false);
12604        composeStringExtras("unit", element.getUnitElement(), false);
12605      }
12606      if (element.hasSystemElement()) {
12607        composeUriCore("system", element.getSystemElement(), false);
12608        composeUriExtras("system", element.getSystemElement(), false);
12609      }
12610      if (element.hasCodeElement()) {
12611        composeCodeCore("code", element.getCodeElement(), false);
12612        composeCodeExtras("code", element.getCodeElement(), false);
12613      }
12614  }
12615
12616  protected void composeDistance(String name, Distance element) throws IOException {
12617    if (element != null) {
12618      open(name);
12619      composeDistanceInner(element);
12620      close();
12621    }
12622  }
12623
12624  protected void composeDistanceInner(Distance element) throws IOException {
12625      composeElement(element);
12626      if (element.hasValueElement()) {
12627        composeDecimalCore("value", element.getValueElement(), false);
12628        composeDecimalExtras("value", element.getValueElement(), false);
12629      }
12630      if (element.hasComparatorElement()) {
12631        composeEnumerationCore("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12632        composeEnumerationExtras("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12633      }
12634      if (element.hasUnitElement()) {
12635        composeStringCore("unit", element.getUnitElement(), false);
12636        composeStringExtras("unit", element.getUnitElement(), false);
12637      }
12638      if (element.hasSystemElement()) {
12639        composeUriCore("system", element.getSystemElement(), false);
12640        composeUriExtras("system", element.getSystemElement(), false);
12641      }
12642      if (element.hasCodeElement()) {
12643        composeCodeCore("code", element.getCodeElement(), false);
12644        composeCodeExtras("code", element.getCodeElement(), false);
12645      }
12646  }
12647
12648  protected void composeAge(String name, Age element) throws IOException {
12649    if (element != null) {
12650      open(name);
12651      composeAgeInner(element);
12652      close();
12653    }
12654  }
12655
12656  protected void composeAgeInner(Age element) throws IOException {
12657      composeElement(element);
12658      if (element.hasValueElement()) {
12659        composeDecimalCore("value", element.getValueElement(), false);
12660        composeDecimalExtras("value", element.getValueElement(), false);
12661      }
12662      if (element.hasComparatorElement()) {
12663        composeEnumerationCore("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12664        composeEnumerationExtras("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12665      }
12666      if (element.hasUnitElement()) {
12667        composeStringCore("unit", element.getUnitElement(), false);
12668        composeStringExtras("unit", element.getUnitElement(), false);
12669      }
12670      if (element.hasSystemElement()) {
12671        composeUriCore("system", element.getSystemElement(), false);
12672        composeUriExtras("system", element.getSystemElement(), false);
12673      }
12674      if (element.hasCodeElement()) {
12675        composeCodeCore("code", element.getCodeElement(), false);
12676        composeCodeExtras("code", element.getCodeElement(), false);
12677      }
12678  }
12679
12680  protected void composeHumanName(String name, HumanName element) throws IOException {
12681    if (element != null) {
12682      open(name);
12683      composeHumanNameInner(element);
12684      close();
12685    }
12686  }
12687
12688  protected void composeHumanNameInner(HumanName element) throws IOException {
12689      composeElement(element);
12690      if (element.hasUseElement()) {
12691        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12692        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12693      }
12694      if (element.hasTextElement()) {
12695        composeStringCore("text", element.getTextElement(), false);
12696        composeStringExtras("text", element.getTextElement(), false);
12697      }
12698      if (element.hasFamily()) {
12699        openArray("family");
12700        for (StringType e : element.getFamily()) 
12701          composeStringCore(null, e, true);
12702        closeArray();
12703        if (anyHasExtras(element.getFamily())) {
12704          openArray("_family");
12705          for (StringType e : element.getFamily()) 
12706            composeStringExtras(null, e, true);
12707          closeArray();
12708        }
12709      };
12710      if (element.hasGiven()) {
12711        openArray("given");
12712        for (StringType e : element.getGiven()) 
12713          composeStringCore(null, e, true);
12714        closeArray();
12715        if (anyHasExtras(element.getGiven())) {
12716          openArray("_given");
12717          for (StringType e : element.getGiven()) 
12718            composeStringExtras(null, e, true);
12719          closeArray();
12720        }
12721      };
12722      if (element.hasPrefix()) {
12723        openArray("prefix");
12724        for (StringType e : element.getPrefix()) 
12725          composeStringCore(null, e, true);
12726        closeArray();
12727        if (anyHasExtras(element.getPrefix())) {
12728          openArray("_prefix");
12729          for (StringType e : element.getPrefix()) 
12730            composeStringExtras(null, e, true);
12731          closeArray();
12732        }
12733      };
12734      if (element.hasSuffix()) {
12735        openArray("suffix");
12736        for (StringType e : element.getSuffix()) 
12737          composeStringCore(null, e, true);
12738        closeArray();
12739        if (anyHasExtras(element.getSuffix())) {
12740          openArray("_suffix");
12741          for (StringType e : element.getSuffix()) 
12742            composeStringExtras(null, e, true);
12743          closeArray();
12744        }
12745      };
12746      if (element.hasPeriod()) {
12747        composePeriod("period", element.getPeriod());
12748      }
12749  }
12750
12751  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
12752    if (element != null) {
12753      open(name);
12754      composeContactPointInner(element);
12755      close();
12756    }
12757  }
12758
12759  protected void composeContactPointInner(ContactPoint element) throws IOException {
12760      composeElement(element);
12761      if (element.hasSystemElement()) {
12762        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12763        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12764      }
12765      if (element.hasValueElement()) {
12766        composeStringCore("value", element.getValueElement(), false);
12767        composeStringExtras("value", element.getValueElement(), false);
12768      }
12769      if (element.hasUseElement()) {
12770        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12771        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12772      }
12773      if (element.hasRankElement()) {
12774        composePositiveIntCore("rank", element.getRankElement(), false);
12775        composePositiveIntExtras("rank", element.getRankElement(), false);
12776      }
12777      if (element.hasPeriod()) {
12778        composePeriod("period", element.getPeriod());
12779      }
12780  }
12781
12782  protected void composeMeta(String name, Meta element) throws IOException {
12783    if (element != null) {
12784      open(name);
12785      composeMetaInner(element);
12786      close();
12787    }
12788  }
12789
12790  protected void composeMetaInner(Meta element) throws IOException {
12791      composeElement(element);
12792      if (element.hasVersionIdElement()) {
12793        composeIdCore("versionId", element.getVersionIdElement(), false);
12794        composeIdExtras("versionId", element.getVersionIdElement(), false);
12795      }
12796      if (element.hasLastUpdatedElement()) {
12797        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
12798        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
12799      }
12800      if (element.hasProfile()) {
12801        openArray("profile");
12802        for (UriType e : element.getProfile()) 
12803          composeUriCore(null, e, true);
12804        closeArray();
12805        if (anyHasExtras(element.getProfile())) {
12806          openArray("_profile");
12807          for (UriType e : element.getProfile()) 
12808            composeUriExtras(null, e, true);
12809          closeArray();
12810        }
12811      };
12812      if (element.hasSecurity()) {
12813        openArray("security");
12814        for (Coding e : element.getSecurity()) 
12815          composeCoding(null, e);
12816        closeArray();
12817      };
12818      if (element.hasTag()) {
12819        openArray("tag");
12820        for (Coding e : element.getTag()) 
12821          composeCoding(null, e);
12822        closeArray();
12823      };
12824  }
12825
12826  protected void composeAddress(String name, Address element) throws IOException {
12827    if (element != null) {
12828      open(name);
12829      composeAddressInner(element);
12830      close();
12831    }
12832  }
12833
12834  protected void composeAddressInner(Address element) throws IOException {
12835      composeElement(element);
12836      if (element.hasUseElement()) {
12837        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12838        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12839      }
12840      if (element.hasTypeElement()) {
12841        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12842        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12843      }
12844      if (element.hasTextElement()) {
12845        composeStringCore("text", element.getTextElement(), false);
12846        composeStringExtras("text", element.getTextElement(), false);
12847      }
12848      if (element.hasLine()) {
12849        openArray("line");
12850        for (StringType e : element.getLine()) 
12851          composeStringCore(null, e, true);
12852        closeArray();
12853        if (anyHasExtras(element.getLine())) {
12854          openArray("_line");
12855          for (StringType e : element.getLine()) 
12856            composeStringExtras(null, e, true);
12857          closeArray();
12858        }
12859      };
12860      if (element.hasCityElement()) {
12861        composeStringCore("city", element.getCityElement(), false);
12862        composeStringExtras("city", element.getCityElement(), false);
12863      }
12864      if (element.hasDistrictElement()) {
12865        composeStringCore("district", element.getDistrictElement(), false);
12866        composeStringExtras("district", element.getDistrictElement(), false);
12867      }
12868      if (element.hasStateElement()) {
12869        composeStringCore("state", element.getStateElement(), false);
12870        composeStringExtras("state", element.getStateElement(), false);
12871      }
12872      if (element.hasPostalCodeElement()) {
12873        composeStringCore("postalCode", element.getPostalCodeElement(), false);
12874        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
12875      }
12876      if (element.hasCountryElement()) {
12877        composeStringCore("country", element.getCountryElement(), false);
12878        composeStringExtras("country", element.getCountryElement(), false);
12879      }
12880      if (element.hasPeriod()) {
12881        composePeriod("period", element.getPeriod());
12882      }
12883  }
12884
12885  protected void composeTiming(String name, Timing element) throws IOException {
12886    if (element != null) {
12887      open(name);
12888      composeTimingInner(element);
12889      close();
12890    }
12891  }
12892
12893  protected void composeTimingInner(Timing element) throws IOException {
12894      composeElement(element);
12895      if (element.hasEvent()) {
12896        openArray("event");
12897        for (DateTimeType e : element.getEvent()) 
12898          composeDateTimeCore(null, e, true);
12899        closeArray();
12900        if (anyHasExtras(element.getEvent())) {
12901          openArray("_event");
12902          for (DateTimeType e : element.getEvent()) 
12903            composeDateTimeExtras(null, e, true);
12904          closeArray();
12905        }
12906      };
12907      if (element.hasRepeat()) {
12908        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
12909      }
12910      if (element.hasCode()) {
12911        composeCodeableConcept("code", element.getCode());
12912      }
12913  }
12914
12915  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
12916    if (element != null) {
12917      open(name);
12918      composeTimingTimingRepeatComponentInner(element);
12919      close();
12920    }
12921  }
12922
12923  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
12924      composeElement(element);
12925      if (element.hasBounds()) {
12926        composeType("bounds", element.getBounds());
12927      }
12928      if (element.hasCountElement()) {
12929        composeIntegerCore("count", element.getCountElement(), false);
12930        composeIntegerExtras("count", element.getCountElement(), false);
12931      }
12932      if (element.hasDurationElement()) {
12933        composeDecimalCore("duration", element.getDurationElement(), false);
12934        composeDecimalExtras("duration", element.getDurationElement(), false);
12935      }
12936      if (element.hasDurationMaxElement()) {
12937        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
12938        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
12939      }
12940      if (element.hasDurationUnitsElement()) {
12941        composeEnumerationCore("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12942        composeEnumerationExtras("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12943      }
12944      if (element.hasFrequencyElement()) {
12945        composeIntegerCore("frequency", element.getFrequencyElement(), false);
12946        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
12947      }
12948      if (element.hasFrequencyMaxElement()) {
12949        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
12950        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
12951      }
12952      if (element.hasPeriodElement()) {
12953        composeDecimalCore("period", element.getPeriodElement(), false);
12954        composeDecimalExtras("period", element.getPeriodElement(), false);
12955      }
12956      if (element.hasPeriodMaxElement()) {
12957        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
12958        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
12959      }
12960      if (element.hasPeriodUnitsElement()) {
12961        composeEnumerationCore("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12962        composeEnumerationExtras("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12963      }
12964      if (element.hasWhenElement()) {
12965        composeEnumerationCore("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12966        composeEnumerationExtras("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12967      }
12968  }
12969
12970  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
12971    if (element != null) {
12972      open(name);
12973      composeElementDefinitionInner(element);
12974      close();
12975    }
12976  }
12977
12978  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
12979      composeElement(element);
12980      if (element.hasPathElement()) {
12981        composeStringCore("path", element.getPathElement(), false);
12982        composeStringExtras("path", element.getPathElement(), false);
12983      }
12984      if (element.hasRepresentation()) {
12985        openArray("representation");
12986        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
12987          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
12988        closeArray();
12989        if (anyHasExtras(element.getRepresentation())) {
12990          openArray("_representation");
12991          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
12992            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
12993          closeArray();
12994        }
12995      };
12996      if (element.hasNameElement()) {
12997        composeStringCore("name", element.getNameElement(), false);
12998        composeStringExtras("name", element.getNameElement(), false);
12999      }
13000      if (element.hasLabelElement()) {
13001        composeStringCore("label", element.getLabelElement(), false);
13002        composeStringExtras("label", element.getLabelElement(), false);
13003      }
13004      if (element.hasCode()) {
13005        openArray("code");
13006        for (Coding e : element.getCode()) 
13007          composeCoding(null, e);
13008        closeArray();
13009      };
13010      if (element.hasSlicing()) {
13011        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
13012      }
13013      if (element.hasShortElement()) {
13014        composeStringCore("short", element.getShortElement(), false);
13015        composeStringExtras("short", element.getShortElement(), false);
13016      }
13017      if (element.hasDefinitionElement()) {
13018        composeMarkdownCore("definition", element.getDefinitionElement(), false);
13019        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
13020      }
13021      if (element.hasCommentsElement()) {
13022        composeMarkdownCore("comments", element.getCommentsElement(), false);
13023        composeMarkdownExtras("comments", element.getCommentsElement(), false);
13024      }
13025      if (element.hasRequirementsElement()) {
13026        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
13027        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
13028      }
13029      if (element.hasAlias()) {
13030        openArray("alias");
13031        for (StringType e : element.getAlias()) 
13032          composeStringCore(null, e, true);
13033        closeArray();
13034        if (anyHasExtras(element.getAlias())) {
13035          openArray("_alias");
13036          for (StringType e : element.getAlias()) 
13037            composeStringExtras(null, e, true);
13038          closeArray();
13039        }
13040      };
13041      if (element.hasMinElement()) {
13042        composeIntegerCore("min", element.getMinElement(), false);
13043        composeIntegerExtras("min", element.getMinElement(), false);
13044      }
13045      if (element.hasMaxElement()) {
13046        composeStringCore("max", element.getMaxElement(), false);
13047        composeStringExtras("max", element.getMaxElement(), false);
13048      }
13049      if (element.hasBase()) {
13050        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
13051      }
13052      if (element.hasType()) {
13053        openArray("type");
13054        for (ElementDefinition.TypeRefComponent e : element.getType()) 
13055          composeElementDefinitionTypeRefComponent(null, e);
13056        closeArray();
13057      };
13058      if (element.hasNameReferenceElement()) {
13059        composeStringCore("nameReference", element.getNameReferenceElement(), false);
13060        composeStringExtras("nameReference", element.getNameReferenceElement(), false);
13061      }
13062      if (element.hasDefaultValue()) {
13063        composeType("defaultValue", element.getDefaultValue());
13064      }
13065      if (element.hasMeaningWhenMissingElement()) {
13066        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13067        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13068      }
13069      if (element.hasFixed()) {
13070        composeType("fixed", element.getFixed());
13071      }
13072      if (element.hasPattern()) {
13073        composeType("pattern", element.getPattern());
13074      }
13075      if (element.hasExample()) {
13076        composeType("example", element.getExample());
13077      }
13078      if (element.hasMinValue()) {
13079        composeType("minValue", element.getMinValue());
13080      }
13081      if (element.hasMaxValue()) {
13082        composeType("maxValue", element.getMaxValue());
13083      }
13084      if (element.hasMaxLengthElement()) {
13085        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
13086        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
13087      }
13088      if (element.hasCondition()) {
13089        openArray("condition");
13090        for (IdType e : element.getCondition()) 
13091          composeIdCore(null, e, true);
13092        closeArray();
13093        if (anyHasExtras(element.getCondition())) {
13094          openArray("_condition");
13095          for (IdType e : element.getCondition()) 
13096            composeIdExtras(null, e, true);
13097          closeArray();
13098        }
13099      };
13100      if (element.hasConstraint()) {
13101        openArray("constraint");
13102        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
13103          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
13104        closeArray();
13105      };
13106      if (element.hasMustSupportElement()) {
13107        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
13108        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
13109      }
13110      if (element.hasIsModifierElement()) {
13111        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
13112        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
13113      }
13114      if (element.hasIsSummaryElement()) {
13115        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
13116        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
13117      }
13118      if (element.hasBinding()) {
13119        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
13120      }
13121      if (element.hasMapping()) {
13122        openArray("mapping");
13123        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
13124          composeElementDefinitionElementDefinitionMappingComponent(null, e);
13125        closeArray();
13126      };
13127  }
13128
13129  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13130    if (element != null) {
13131      open(name);
13132      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
13133      close();
13134    }
13135  }
13136
13137  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13138      composeElement(element);
13139      if (element.hasDiscriminator()) {
13140        openArray("discriminator");
13141        for (StringType e : element.getDiscriminator()) 
13142          composeStringCore(null, e, true);
13143        closeArray();
13144        if (anyHasExtras(element.getDiscriminator())) {
13145          openArray("_discriminator");
13146          for (StringType e : element.getDiscriminator()) 
13147            composeStringExtras(null, e, true);
13148          closeArray();
13149        }
13150      };
13151      if (element.hasDescriptionElement()) {
13152        composeStringCore("description", element.getDescriptionElement(), false);
13153        composeStringExtras("description", element.getDescriptionElement(), false);
13154      }
13155      if (element.hasOrderedElement()) {
13156        composeBooleanCore("ordered", element.getOrderedElement(), false);
13157        composeBooleanExtras("ordered", element.getOrderedElement(), false);
13158      }
13159      if (element.hasRulesElement()) {
13160        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13161        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13162      }
13163  }
13164
13165  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13166    if (element != null) {
13167      open(name);
13168      composeElementDefinitionElementDefinitionBaseComponentInner(element);
13169      close();
13170    }
13171  }
13172
13173  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13174      composeElement(element);
13175      if (element.hasPathElement()) {
13176        composeStringCore("path", element.getPathElement(), false);
13177        composeStringExtras("path", element.getPathElement(), false);
13178      }
13179      if (element.hasMinElement()) {
13180        composeIntegerCore("min", element.getMinElement(), false);
13181        composeIntegerExtras("min", element.getMinElement(), false);
13182      }
13183      if (element.hasMaxElement()) {
13184        composeStringCore("max", element.getMaxElement(), false);
13185        composeStringExtras("max", element.getMaxElement(), false);
13186      }
13187  }
13188
13189  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
13190    if (element != null) {
13191      open(name);
13192      composeElementDefinitionTypeRefComponentInner(element);
13193      close();
13194    }
13195  }
13196
13197  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
13198      composeElement(element);
13199      if (element.hasCodeElement()) {
13200        composeCodeCore("code", element.getCodeElement(), false);
13201        composeCodeExtras("code", element.getCodeElement(), false);
13202      }
13203      if (element.hasProfile()) {
13204        openArray("profile");
13205        for (UriType e : element.getProfile()) 
13206          composeUriCore(null, e, true);
13207        closeArray();
13208        if (anyHasExtras(element.getProfile())) {
13209          openArray("_profile");
13210          for (UriType e : element.getProfile()) 
13211            composeUriExtras(null, e, true);
13212          closeArray();
13213        }
13214      };
13215      if (element.hasAggregation()) {
13216        openArray("aggregation");
13217        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13218          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13219        closeArray();
13220        if (anyHasExtras(element.getAggregation())) {
13221          openArray("_aggregation");
13222          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13223            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13224          closeArray();
13225        }
13226      };
13227  }
13228
13229  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13230    if (element != null) {
13231      open(name);
13232      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
13233      close();
13234    }
13235  }
13236
13237  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13238      composeElement(element);
13239      if (element.hasKeyElement()) {
13240        composeIdCore("key", element.getKeyElement(), false);
13241        composeIdExtras("key", element.getKeyElement(), false);
13242      }
13243      if (element.hasRequirementsElement()) {
13244        composeStringCore("requirements", element.getRequirementsElement(), false);
13245        composeStringExtras("requirements", element.getRequirementsElement(), false);
13246      }
13247      if (element.hasSeverityElement()) {
13248        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13249        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13250      }
13251      if (element.hasHumanElement()) {
13252        composeStringCore("human", element.getHumanElement(), false);
13253        composeStringExtras("human", element.getHumanElement(), false);
13254      }
13255      if (element.hasXpathElement()) {
13256        composeStringCore("xpath", element.getXpathElement(), false);
13257        composeStringExtras("xpath", element.getXpathElement(), false);
13258      }
13259  }
13260
13261  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13262    if (element != null) {
13263      open(name);
13264      composeElementDefinitionElementDefinitionBindingComponentInner(element);
13265      close();
13266    }
13267  }
13268
13269  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13270      composeElement(element);
13271      if (element.hasStrengthElement()) {
13272        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13273        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13274      }
13275      if (element.hasDescriptionElement()) {
13276        composeStringCore("description", element.getDescriptionElement(), false);
13277        composeStringExtras("description", element.getDescriptionElement(), false);
13278      }
13279      if (element.hasValueSet()) {
13280        composeType("valueSet", element.getValueSet());
13281      }
13282  }
13283
13284  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13285    if (element != null) {
13286      open(name);
13287      composeElementDefinitionElementDefinitionMappingComponentInner(element);
13288      close();
13289    }
13290  }
13291
13292  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13293      composeElement(element);
13294      if (element.hasIdentityElement()) {
13295        composeIdCore("identity", element.getIdentityElement(), false);
13296        composeIdExtras("identity", element.getIdentityElement(), false);
13297      }
13298      if (element.hasLanguageElement()) {
13299        composeCodeCore("language", element.getLanguageElement(), false);
13300        composeCodeExtras("language", element.getLanguageElement(), false);
13301      }
13302      if (element.hasMapElement()) {
13303        composeStringCore("map", element.getMapElement(), false);
13304        composeStringExtras("map", element.getMapElement(), false);
13305      }
13306  }
13307
13308  protected void composeDomainResourceElements(DomainResource element) throws IOException {
13309      composeResourceElements(element);
13310      if (element.hasText()) {
13311        composeNarrative("text", element.getText());
13312      }
13313      if (element.hasContained()) {
13314        openArray("contained");
13315        for (Resource e : element.getContained()) {
13316          open(null);
13317          composeResource(e);
13318          close();
13319        }
13320        closeArray();
13321      };
13322      if (element.hasExtension()) {
13323        openArray("extension");
13324        for (Extension e : element.getExtension()) 
13325          composeExtension(null, e);
13326        closeArray();
13327      };
13328      if (element.hasModifierExtension()) {
13329        openArray("modifierExtension");
13330        for (Extension e : element.getModifierExtension()) 
13331          composeExtension(null, e);
13332        closeArray();
13333      };
13334  }
13335
13336  protected void composeParameters(String name, Parameters element) throws IOException {
13337    if (element != null) {
13338      prop("resourceType", name);
13339      composeParametersInner(element);
13340    }
13341  }
13342
13343  protected void composeParametersInner(Parameters element) throws IOException {
13344      composeResourceElements(element);
13345      if (element.hasParameter()) {
13346        openArray("parameter");
13347        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
13348          composeParametersParametersParameterComponent(null, e);
13349        closeArray();
13350      };
13351  }
13352
13353  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
13354    if (element != null) {
13355      open(name);
13356      composeParametersParametersParameterComponentInner(element);
13357      close();
13358    }
13359  }
13360
13361  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
13362      composeBackbone(element);
13363      if (element.hasNameElement()) {
13364        composeStringCore("name", element.getNameElement(), false);
13365        composeStringExtras("name", element.getNameElement(), false);
13366      }
13367      if (element.hasValue()) {
13368        composeType("value", element.getValue());
13369      }
13370        if (element.hasResource()) {
13371          open("resource");
13372          composeResource(element.getResource());
13373          close();
13374        }
13375      if (element.hasPart()) {
13376        openArray("part");
13377        for (Parameters.ParametersParameterComponent e : element.getPart()) 
13378          composeParametersParametersParameterComponent(null, e);
13379        closeArray();
13380      };
13381  }
13382
13383  protected void composeResourceElements(Resource element) throws IOException {
13384      if (element.hasIdElement()) {
13385        composeIdCore("id", element.getIdElement(), false);
13386        composeIdExtras("id", element.getIdElement(), false);
13387      }
13388      if (element.hasMeta()) {
13389        composeMeta("meta", element.getMeta());
13390      }
13391      if (element.hasImplicitRulesElement()) {
13392        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
13393        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
13394      }
13395      if (element.hasLanguageElement()) {
13396        composeCodeCore("language", element.getLanguageElement(), false);
13397        composeCodeExtras("language", element.getLanguageElement(), false);
13398      }
13399  }
13400
13401  protected void composeAccount(String name, Account element) throws IOException {
13402    if (element != null) {
13403      prop("resourceType", name);
13404      composeAccountInner(element);
13405    }
13406  }
13407
13408  protected void composeAccountInner(Account element) throws IOException {
13409      composeDomainResourceElements(element);
13410      if (element.hasIdentifier()) {
13411        openArray("identifier");
13412        for (Identifier e : element.getIdentifier()) 
13413          composeIdentifier(null, e);
13414        closeArray();
13415      };
13416      if (element.hasNameElement()) {
13417        composeStringCore("name", element.getNameElement(), false);
13418        composeStringExtras("name", element.getNameElement(), false);
13419      }
13420      if (element.hasType()) {
13421        composeCodeableConcept("type", element.getType());
13422      }
13423      if (element.hasStatusElement()) {
13424        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13425        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13426      }
13427      if (element.hasActivePeriod()) {
13428        composePeriod("activePeriod", element.getActivePeriod());
13429      }
13430      if (element.hasCurrency()) {
13431        composeCoding("currency", element.getCurrency());
13432      }
13433      if (element.hasBalance()) {
13434        composeMoney("balance", element.getBalance());
13435      }
13436      if (element.hasCoveragePeriod()) {
13437        composePeriod("coveragePeriod", element.getCoveragePeriod());
13438      }
13439      if (element.hasSubject()) {
13440        composeReference("subject", element.getSubject());
13441      }
13442      if (element.hasOwner()) {
13443        composeReference("owner", element.getOwner());
13444      }
13445      if (element.hasDescriptionElement()) {
13446        composeStringCore("description", element.getDescriptionElement(), false);
13447        composeStringExtras("description", element.getDescriptionElement(), false);
13448      }
13449  }
13450
13451  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
13452    if (element != null) {
13453      prop("resourceType", name);
13454      composeAllergyIntoleranceInner(element);
13455    }
13456  }
13457
13458  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
13459      composeDomainResourceElements(element);
13460      if (element.hasIdentifier()) {
13461        openArray("identifier");
13462        for (Identifier e : element.getIdentifier()) 
13463          composeIdentifier(null, e);
13464        closeArray();
13465      };
13466      if (element.hasOnsetElement()) {
13467        composeDateTimeCore("onset", element.getOnsetElement(), false);
13468        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13469      }
13470      if (element.hasRecordedDateElement()) {
13471        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
13472        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
13473      }
13474      if (element.hasRecorder()) {
13475        composeReference("recorder", element.getRecorder());
13476      }
13477      if (element.hasPatient()) {
13478        composeReference("patient", element.getPatient());
13479      }
13480      if (element.hasReporter()) {
13481        composeReference("reporter", element.getReporter());
13482      }
13483      if (element.hasSubstance()) {
13484        composeCodeableConcept("substance", element.getSubstance());
13485      }
13486      if (element.hasStatusElement()) {
13487        composeEnumerationCore("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13488        composeEnumerationExtras("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13489      }
13490      if (element.hasCriticalityElement()) {
13491        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13492        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13493      }
13494      if (element.hasTypeElement()) {
13495        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13496        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13497      }
13498      if (element.hasCategoryElement()) {
13499        composeEnumerationCore("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13500        composeEnumerationExtras("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13501      }
13502      if (element.hasLastOccurenceElement()) {
13503        composeDateTimeCore("lastOccurence", element.getLastOccurenceElement(), false);
13504        composeDateTimeExtras("lastOccurence", element.getLastOccurenceElement(), false);
13505      }
13506      if (element.hasNote()) {
13507        composeAnnotation("note", element.getNote());
13508      }
13509      if (element.hasReaction()) {
13510        openArray("reaction");
13511        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
13512          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
13513        closeArray();
13514      };
13515  }
13516
13517  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13518    if (element != null) {
13519      open(name);
13520      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
13521      close();
13522    }
13523  }
13524
13525  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13526      composeBackbone(element);
13527      if (element.hasSubstance()) {
13528        composeCodeableConcept("substance", element.getSubstance());
13529      }
13530      if (element.hasCertaintyElement()) {
13531        composeEnumerationCore("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13532        composeEnumerationExtras("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13533      }
13534      if (element.hasManifestation()) {
13535        openArray("manifestation");
13536        for (CodeableConcept e : element.getManifestation()) 
13537          composeCodeableConcept(null, e);
13538        closeArray();
13539      };
13540      if (element.hasDescriptionElement()) {
13541        composeStringCore("description", element.getDescriptionElement(), false);
13542        composeStringExtras("description", element.getDescriptionElement(), false);
13543      }
13544      if (element.hasOnsetElement()) {
13545        composeDateTimeCore("onset", element.getOnsetElement(), false);
13546        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13547      }
13548      if (element.hasSeverityElement()) {
13549        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13550        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13551      }
13552      if (element.hasExposureRoute()) {
13553        composeCodeableConcept("exposureRoute", element.getExposureRoute());
13554      }
13555      if (element.hasNote()) {
13556        composeAnnotation("note", element.getNote());
13557      }
13558  }
13559
13560  protected void composeAppointment(String name, Appointment element) throws IOException {
13561    if (element != null) {
13562      prop("resourceType", name);
13563      composeAppointmentInner(element);
13564    }
13565  }
13566
13567  protected void composeAppointmentInner(Appointment element) throws IOException {
13568      composeDomainResourceElements(element);
13569      if (element.hasIdentifier()) {
13570        openArray("identifier");
13571        for (Identifier e : element.getIdentifier()) 
13572          composeIdentifier(null, e);
13573        closeArray();
13574      };
13575      if (element.hasStatusElement()) {
13576        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13577        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13578      }
13579      if (element.hasType()) {
13580        composeCodeableConcept("type", element.getType());
13581      }
13582      if (element.hasReason()) {
13583        composeCodeableConcept("reason", element.getReason());
13584      }
13585      if (element.hasPriorityElement()) {
13586        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
13587        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
13588      }
13589      if (element.hasDescriptionElement()) {
13590        composeStringCore("description", element.getDescriptionElement(), false);
13591        composeStringExtras("description", element.getDescriptionElement(), false);
13592      }
13593      if (element.hasStartElement()) {
13594        composeInstantCore("start", element.getStartElement(), false);
13595        composeInstantExtras("start", element.getStartElement(), false);
13596      }
13597      if (element.hasEndElement()) {
13598        composeInstantCore("end", element.getEndElement(), false);
13599        composeInstantExtras("end", element.getEndElement(), false);
13600      }
13601      if (element.hasMinutesDurationElement()) {
13602        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
13603        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
13604      }
13605      if (element.hasSlot()) {
13606        openArray("slot");
13607        for (Reference e : element.getSlot()) 
13608          composeReference(null, e);
13609        closeArray();
13610      };
13611      if (element.hasCommentElement()) {
13612        composeStringCore("comment", element.getCommentElement(), false);
13613        composeStringExtras("comment", element.getCommentElement(), false);
13614      }
13615      if (element.hasParticipant()) {
13616        openArray("participant");
13617        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
13618          composeAppointmentAppointmentParticipantComponent(null, e);
13619        closeArray();
13620      };
13621  }
13622
13623  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
13624    if (element != null) {
13625      open(name);
13626      composeAppointmentAppointmentParticipantComponentInner(element);
13627      close();
13628    }
13629  }
13630
13631  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
13632      composeBackbone(element);
13633      if (element.hasType()) {
13634        openArray("type");
13635        for (CodeableConcept e : element.getType()) 
13636          composeCodeableConcept(null, e);
13637        closeArray();
13638      };
13639      if (element.hasActor()) {
13640        composeReference("actor", element.getActor());
13641      }
13642      if (element.hasRequiredElement()) {
13643        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13644        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13645      }
13646      if (element.hasStatusElement()) {
13647        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13648        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13649      }
13650  }
13651
13652  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
13653    if (element != null) {
13654      prop("resourceType", name);
13655      composeAppointmentResponseInner(element);
13656    }
13657  }
13658
13659  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
13660      composeDomainResourceElements(element);
13661      if (element.hasIdentifier()) {
13662        openArray("identifier");
13663        for (Identifier e : element.getIdentifier()) 
13664          composeIdentifier(null, e);
13665        closeArray();
13666      };
13667      if (element.hasAppointment()) {
13668        composeReference("appointment", element.getAppointment());
13669      }
13670      if (element.hasStartElement()) {
13671        composeInstantCore("start", element.getStartElement(), false);
13672        composeInstantExtras("start", element.getStartElement(), false);
13673      }
13674      if (element.hasEndElement()) {
13675        composeInstantCore("end", element.getEndElement(), false);
13676        composeInstantExtras("end", element.getEndElement(), false);
13677      }
13678      if (element.hasParticipantType()) {
13679        openArray("participantType");
13680        for (CodeableConcept e : element.getParticipantType()) 
13681          composeCodeableConcept(null, e);
13682        closeArray();
13683      };
13684      if (element.hasActor()) {
13685        composeReference("actor", element.getActor());
13686      }
13687      if (element.hasParticipantStatusElement()) {
13688        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13689        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13690      }
13691      if (element.hasCommentElement()) {
13692        composeStringCore("comment", element.getCommentElement(), false);
13693        composeStringExtras("comment", element.getCommentElement(), false);
13694      }
13695  }
13696
13697  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
13698    if (element != null) {
13699      prop("resourceType", name);
13700      composeAuditEventInner(element);
13701    }
13702  }
13703
13704  protected void composeAuditEventInner(AuditEvent element) throws IOException {
13705      composeDomainResourceElements(element);
13706      if (element.hasEvent()) {
13707        composeAuditEventAuditEventEventComponent("event", element.getEvent());
13708      }
13709      if (element.hasParticipant()) {
13710        openArray("participant");
13711        for (AuditEvent.AuditEventParticipantComponent e : element.getParticipant()) 
13712          composeAuditEventAuditEventParticipantComponent(null, e);
13713        closeArray();
13714      };
13715      if (element.hasSource()) {
13716        composeAuditEventAuditEventSourceComponent("source", element.getSource());
13717      }
13718      if (element.hasObject()) {
13719        openArray("object");
13720        for (AuditEvent.AuditEventObjectComponent e : element.getObject()) 
13721          composeAuditEventAuditEventObjectComponent(null, e);
13722        closeArray();
13723      };
13724  }
13725
13726  protected void composeAuditEventAuditEventEventComponent(String name, AuditEvent.AuditEventEventComponent element) throws IOException {
13727    if (element != null) {
13728      open(name);
13729      composeAuditEventAuditEventEventComponentInner(element);
13730      close();
13731    }
13732  }
13733
13734  protected void composeAuditEventAuditEventEventComponentInner(AuditEvent.AuditEventEventComponent element) throws IOException {
13735      composeBackbone(element);
13736      if (element.hasType()) {
13737        composeCoding("type", element.getType());
13738      }
13739      if (element.hasSubtype()) {
13740        openArray("subtype");
13741        for (Coding e : element.getSubtype()) 
13742          composeCoding(null, e);
13743        closeArray();
13744      };
13745      if (element.hasActionElement()) {
13746        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13747        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13748      }
13749      if (element.hasDateTimeElement()) {
13750        composeInstantCore("dateTime", element.getDateTimeElement(), false);
13751        composeInstantExtras("dateTime", element.getDateTimeElement(), false);
13752      }
13753      if (element.hasOutcomeElement()) {
13754        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13755        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13756      }
13757      if (element.hasOutcomeDescElement()) {
13758        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
13759        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
13760      }
13761      if (element.hasPurposeOfEvent()) {
13762        openArray("purposeOfEvent");
13763        for (Coding e : element.getPurposeOfEvent()) 
13764          composeCoding(null, e);
13765        closeArray();
13766      };
13767  }
13768
13769  protected void composeAuditEventAuditEventParticipantComponent(String name, AuditEvent.AuditEventParticipantComponent element) throws IOException {
13770    if (element != null) {
13771      open(name);
13772      composeAuditEventAuditEventParticipantComponentInner(element);
13773      close();
13774    }
13775  }
13776
13777  protected void composeAuditEventAuditEventParticipantComponentInner(AuditEvent.AuditEventParticipantComponent element) throws IOException {
13778      composeBackbone(element);
13779      if (element.hasRole()) {
13780        openArray("role");
13781        for (CodeableConcept e : element.getRole()) 
13782          composeCodeableConcept(null, e);
13783        closeArray();
13784      };
13785      if (element.hasReference()) {
13786        composeReference("reference", element.getReference());
13787      }
13788      if (element.hasUserId()) {
13789        composeIdentifier("userId", element.getUserId());
13790      }
13791      if (element.hasAltIdElement()) {
13792        composeStringCore("altId", element.getAltIdElement(), false);
13793        composeStringExtras("altId", element.getAltIdElement(), false);
13794      }
13795      if (element.hasNameElement()) {
13796        composeStringCore("name", element.getNameElement(), false);
13797        composeStringExtras("name", element.getNameElement(), false);
13798      }
13799      if (element.hasRequestorElement()) {
13800        composeBooleanCore("requestor", element.getRequestorElement(), false);
13801        composeBooleanExtras("requestor", element.getRequestorElement(), false);
13802      }
13803      if (element.hasLocation()) {
13804        composeReference("location", element.getLocation());
13805      }
13806      if (element.hasPolicy()) {
13807        openArray("policy");
13808        for (UriType e : element.getPolicy()) 
13809          composeUriCore(null, e, true);
13810        closeArray();
13811        if (anyHasExtras(element.getPolicy())) {
13812          openArray("_policy");
13813          for (UriType e : element.getPolicy()) 
13814            composeUriExtras(null, e, true);
13815          closeArray();
13816        }
13817      };
13818      if (element.hasMedia()) {
13819        composeCoding("media", element.getMedia());
13820      }
13821      if (element.hasNetwork()) {
13822        composeAuditEventAuditEventParticipantNetworkComponent("network", element.getNetwork());
13823      }
13824      if (element.hasPurposeOfUse()) {
13825        openArray("purposeOfUse");
13826        for (Coding e : element.getPurposeOfUse()) 
13827          composeCoding(null, e);
13828        closeArray();
13829      };
13830  }
13831
13832  protected void composeAuditEventAuditEventParticipantNetworkComponent(String name, AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13833    if (element != null) {
13834      open(name);
13835      composeAuditEventAuditEventParticipantNetworkComponentInner(element);
13836      close();
13837    }
13838  }
13839
13840  protected void composeAuditEventAuditEventParticipantNetworkComponentInner(AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13841      composeBackbone(element);
13842      if (element.hasAddressElement()) {
13843        composeStringCore("address", element.getAddressElement(), false);
13844        composeStringExtras("address", element.getAddressElement(), false);
13845      }
13846      if (element.hasTypeElement()) {
13847        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13848        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13849      }
13850  }
13851
13852  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
13853    if (element != null) {
13854      open(name);
13855      composeAuditEventAuditEventSourceComponentInner(element);
13856      close();
13857    }
13858  }
13859
13860  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
13861      composeBackbone(element);
13862      if (element.hasSiteElement()) {
13863        composeStringCore("site", element.getSiteElement(), false);
13864        composeStringExtras("site", element.getSiteElement(), false);
13865      }
13866      if (element.hasIdentifier()) {
13867        composeIdentifier("identifier", element.getIdentifier());
13868      }
13869      if (element.hasType()) {
13870        openArray("type");
13871        for (Coding e : element.getType()) 
13872          composeCoding(null, e);
13873        closeArray();
13874      };
13875  }
13876
13877  protected void composeAuditEventAuditEventObjectComponent(String name, AuditEvent.AuditEventObjectComponent element) throws IOException {
13878    if (element != null) {
13879      open(name);
13880      composeAuditEventAuditEventObjectComponentInner(element);
13881      close();
13882    }
13883  }
13884
13885  protected void composeAuditEventAuditEventObjectComponentInner(AuditEvent.AuditEventObjectComponent element) throws IOException {
13886      composeBackbone(element);
13887      if (element.hasIdentifier()) {
13888        composeIdentifier("identifier", element.getIdentifier());
13889      }
13890      if (element.hasReference()) {
13891        composeReference("reference", element.getReference());
13892      }
13893      if (element.hasType()) {
13894        composeCoding("type", element.getType());
13895      }
13896      if (element.hasRole()) {
13897        composeCoding("role", element.getRole());
13898      }
13899      if (element.hasLifecycle()) {
13900        composeCoding("lifecycle", element.getLifecycle());
13901      }
13902      if (element.hasSecurityLabel()) {
13903        openArray("securityLabel");
13904        for (Coding e : element.getSecurityLabel()) 
13905          composeCoding(null, e);
13906        closeArray();
13907      };
13908      if (element.hasNameElement()) {
13909        composeStringCore("name", element.getNameElement(), false);
13910        composeStringExtras("name", element.getNameElement(), false);
13911      }
13912      if (element.hasDescriptionElement()) {
13913        composeStringCore("description", element.getDescriptionElement(), false);
13914        composeStringExtras("description", element.getDescriptionElement(), false);
13915      }
13916      if (element.hasQueryElement()) {
13917        composeBase64BinaryCore("query", element.getQueryElement(), false);
13918        composeBase64BinaryExtras("query", element.getQueryElement(), false);
13919      }
13920      if (element.hasDetail()) {
13921        openArray("detail");
13922        for (AuditEvent.AuditEventObjectDetailComponent e : element.getDetail()) 
13923          composeAuditEventAuditEventObjectDetailComponent(null, e);
13924        closeArray();
13925      };
13926  }
13927
13928  protected void composeAuditEventAuditEventObjectDetailComponent(String name, AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13929    if (element != null) {
13930      open(name);
13931      composeAuditEventAuditEventObjectDetailComponentInner(element);
13932      close();
13933    }
13934  }
13935
13936  protected void composeAuditEventAuditEventObjectDetailComponentInner(AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13937      composeBackbone(element);
13938      if (element.hasTypeElement()) {
13939        composeStringCore("type", element.getTypeElement(), false);
13940        composeStringExtras("type", element.getTypeElement(), false);
13941      }
13942      if (element.hasValueElement()) {
13943        composeBase64BinaryCore("value", element.getValueElement(), false);
13944        composeBase64BinaryExtras("value", element.getValueElement(), false);
13945      }
13946  }
13947
13948  protected void composeBasic(String name, Basic element) throws IOException {
13949    if (element != null) {
13950      prop("resourceType", name);
13951      composeBasicInner(element);
13952    }
13953  }
13954
13955  protected void composeBasicInner(Basic element) throws IOException {
13956      composeDomainResourceElements(element);
13957      if (element.hasIdentifier()) {
13958        openArray("identifier");
13959        for (Identifier e : element.getIdentifier()) 
13960          composeIdentifier(null, e);
13961        closeArray();
13962      };
13963      if (element.hasCode()) {
13964        composeCodeableConcept("code", element.getCode());
13965      }
13966      if (element.hasSubject()) {
13967        composeReference("subject", element.getSubject());
13968      }
13969      if (element.hasAuthor()) {
13970        composeReference("author", element.getAuthor());
13971      }
13972      if (element.hasCreatedElement()) {
13973        composeDateCore("created", element.getCreatedElement(), false);
13974        composeDateExtras("created", element.getCreatedElement(), false);
13975      }
13976  }
13977
13978  protected void composeBinary(String name, Binary element) throws IOException {
13979    if (element != null) {
13980      prop("resourceType", name);
13981      composeBinaryInner(element);
13982    }
13983  }
13984
13985  protected void composeBinaryInner(Binary element) throws IOException {
13986      composeResourceElements(element);
13987      if (element.hasContentTypeElement()) {
13988        composeCodeCore("contentType", element.getContentTypeElement(), false);
13989        composeCodeExtras("contentType", element.getContentTypeElement(), false);
13990      }
13991      if (element.hasContentElement()) {
13992        composeBase64BinaryCore("content", element.getContentElement(), false);
13993        composeBase64BinaryExtras("content", element.getContentElement(), false);
13994      }
13995  }
13996
13997  protected void composeBodySite(String name, BodySite element) throws IOException {
13998    if (element != null) {
13999      prop("resourceType", name);
14000      composeBodySiteInner(element);
14001    }
14002  }
14003
14004  protected void composeBodySiteInner(BodySite element) throws IOException {
14005      composeDomainResourceElements(element);
14006      if (element.hasPatient()) {
14007        composeReference("patient", element.getPatient());
14008      }
14009      if (element.hasIdentifier()) {
14010        openArray("identifier");
14011        for (Identifier e : element.getIdentifier()) 
14012          composeIdentifier(null, e);
14013        closeArray();
14014      };
14015      if (element.hasCode()) {
14016        composeCodeableConcept("code", element.getCode());
14017      }
14018      if (element.hasModifier()) {
14019        openArray("modifier");
14020        for (CodeableConcept e : element.getModifier()) 
14021          composeCodeableConcept(null, e);
14022        closeArray();
14023      };
14024      if (element.hasDescriptionElement()) {
14025        composeStringCore("description", element.getDescriptionElement(), false);
14026        composeStringExtras("description", element.getDescriptionElement(), false);
14027      }
14028      if (element.hasImage()) {
14029        openArray("image");
14030        for (Attachment e : element.getImage()) 
14031          composeAttachment(null, e);
14032        closeArray();
14033      };
14034  }
14035
14036  protected void composeBundle(String name, Bundle element) throws IOException {
14037    if (element != null) {
14038      prop("resourceType", name);
14039      composeBundleInner(element);
14040    }
14041  }
14042
14043  protected void composeBundleInner(Bundle element) throws IOException {
14044      composeResourceElements(element);
14045      if (element.hasTypeElement()) {
14046        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14047        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14048      }
14049      if (element.hasTotalElement()) {
14050        composeUnsignedIntCore("total", element.getTotalElement(), false);
14051        composeUnsignedIntExtras("total", element.getTotalElement(), false);
14052      }
14053      if (element.hasLink()) {
14054        openArray("link");
14055        for (Bundle.BundleLinkComponent e : element.getLink()) 
14056          composeBundleBundleLinkComponent(null, e);
14057        closeArray();
14058      };
14059      if (element.hasEntry()) {
14060        openArray("entry");
14061        for (Bundle.BundleEntryComponent e : element.getEntry()) 
14062          composeBundleBundleEntryComponent(null, e);
14063        closeArray();
14064      };
14065      if (element.hasSignature()) {
14066        composeSignature("signature", element.getSignature());
14067      }
14068  }
14069
14070  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
14071    if (element != null) {
14072      open(name);
14073      composeBundleBundleLinkComponentInner(element);
14074      close();
14075    }
14076  }
14077
14078  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
14079      composeBackbone(element);
14080      if (element.hasRelationElement()) {
14081        composeStringCore("relation", element.getRelationElement(), false);
14082        composeStringExtras("relation", element.getRelationElement(), false);
14083      }
14084      if (element.hasUrlElement()) {
14085        composeUriCore("url", element.getUrlElement(), false);
14086        composeUriExtras("url", element.getUrlElement(), false);
14087      }
14088  }
14089
14090  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
14091    if (element != null) {
14092      open(name);
14093      composeBundleBundleEntryComponentInner(element);
14094      close();
14095    }
14096  }
14097
14098  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
14099      composeBackbone(element);
14100      if (element.hasLink()) {
14101        openArray("link");
14102        for (Bundle.BundleLinkComponent e : element.getLink()) 
14103          composeBundleBundleLinkComponent(null, e);
14104        closeArray();
14105      };
14106      if (element.hasFullUrlElement()) {
14107        composeUriCore("fullUrl", element.getFullUrlElement(), false);
14108        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
14109      }
14110        if (element.hasResource()) {
14111          open("resource");
14112          composeResource(element.getResource());
14113          close();
14114        }
14115      if (element.hasSearch()) {
14116        composeBundleBundleEntrySearchComponent("search", element.getSearch());
14117      }
14118      if (element.hasRequest()) {
14119        composeBundleBundleEntryRequestComponent("request", element.getRequest());
14120      }
14121      if (element.hasResponse()) {
14122        composeBundleBundleEntryResponseComponent("response", element.getResponse());
14123      }
14124  }
14125
14126  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
14127    if (element != null) {
14128      open(name);
14129      composeBundleBundleEntrySearchComponentInner(element);
14130      close();
14131    }
14132  }
14133
14134  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
14135      composeBackbone(element);
14136      if (element.hasModeElement()) {
14137        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14138        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14139      }
14140      if (element.hasScoreElement()) {
14141        composeDecimalCore("score", element.getScoreElement(), false);
14142        composeDecimalExtras("score", element.getScoreElement(), false);
14143      }
14144  }
14145
14146  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
14147    if (element != null) {
14148      open(name);
14149      composeBundleBundleEntryRequestComponentInner(element);
14150      close();
14151    }
14152  }
14153
14154  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
14155      composeBackbone(element);
14156      if (element.hasMethodElement()) {
14157        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14158        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14159      }
14160      if (element.hasUrlElement()) {
14161        composeUriCore("url", element.getUrlElement(), false);
14162        composeUriExtras("url", element.getUrlElement(), false);
14163      }
14164      if (element.hasIfNoneMatchElement()) {
14165        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
14166        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
14167      }
14168      if (element.hasIfModifiedSinceElement()) {
14169        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14170        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14171      }
14172      if (element.hasIfMatchElement()) {
14173        composeStringCore("ifMatch", element.getIfMatchElement(), false);
14174        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
14175      }
14176      if (element.hasIfNoneExistElement()) {
14177        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
14178        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
14179      }
14180  }
14181
14182  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
14183    if (element != null) {
14184      open(name);
14185      composeBundleBundleEntryResponseComponentInner(element);
14186      close();
14187    }
14188  }
14189
14190  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
14191      composeBackbone(element);
14192      if (element.hasStatusElement()) {
14193        composeStringCore("status", element.getStatusElement(), false);
14194        composeStringExtras("status", element.getStatusElement(), false);
14195      }
14196      if (element.hasLocationElement()) {
14197        composeUriCore("location", element.getLocationElement(), false);
14198        composeUriExtras("location", element.getLocationElement(), false);
14199      }
14200      if (element.hasEtagElement()) {
14201        composeStringCore("etag", element.getEtagElement(), false);
14202        composeStringExtras("etag", element.getEtagElement(), false);
14203      }
14204      if (element.hasLastModifiedElement()) {
14205        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
14206        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
14207      }
14208  }
14209
14210  protected void composeCarePlan(String name, CarePlan element) throws IOException {
14211    if (element != null) {
14212      prop("resourceType", name);
14213      composeCarePlanInner(element);
14214    }
14215  }
14216
14217  protected void composeCarePlanInner(CarePlan element) throws IOException {
14218      composeDomainResourceElements(element);
14219      if (element.hasIdentifier()) {
14220        openArray("identifier");
14221        for (Identifier e : element.getIdentifier()) 
14222          composeIdentifier(null, e);
14223        closeArray();
14224      };
14225      if (element.hasSubject()) {
14226        composeReference("subject", element.getSubject());
14227      }
14228      if (element.hasStatusElement()) {
14229        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14230        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14231      }
14232      if (element.hasContext()) {
14233        composeReference("context", element.getContext());
14234      }
14235      if (element.hasPeriod()) {
14236        composePeriod("period", element.getPeriod());
14237      }
14238      if (element.hasAuthor()) {
14239        openArray("author");
14240        for (Reference e : element.getAuthor()) 
14241          composeReference(null, e);
14242        closeArray();
14243      };
14244      if (element.hasModifiedElement()) {
14245        composeDateTimeCore("modified", element.getModifiedElement(), false);
14246        composeDateTimeExtras("modified", element.getModifiedElement(), false);
14247      }
14248      if (element.hasCategory()) {
14249        openArray("category");
14250        for (CodeableConcept e : element.getCategory()) 
14251          composeCodeableConcept(null, e);
14252        closeArray();
14253      };
14254      if (element.hasDescriptionElement()) {
14255        composeStringCore("description", element.getDescriptionElement(), false);
14256        composeStringExtras("description", element.getDescriptionElement(), false);
14257      }
14258      if (element.hasAddresses()) {
14259        openArray("addresses");
14260        for (Reference e : element.getAddresses()) 
14261          composeReference(null, e);
14262        closeArray();
14263      };
14264      if (element.hasSupport()) {
14265        openArray("support");
14266        for (Reference e : element.getSupport()) 
14267          composeReference(null, e);
14268        closeArray();
14269      };
14270      if (element.hasRelatedPlan()) {
14271        openArray("relatedPlan");
14272        for (CarePlan.CarePlanRelatedPlanComponent e : element.getRelatedPlan()) 
14273          composeCarePlanCarePlanRelatedPlanComponent(null, e);
14274        closeArray();
14275      };
14276      if (element.hasParticipant()) {
14277        openArray("participant");
14278        for (CarePlan.CarePlanParticipantComponent e : element.getParticipant()) 
14279          composeCarePlanCarePlanParticipantComponent(null, e);
14280        closeArray();
14281      };
14282      if (element.hasGoal()) {
14283        openArray("goal");
14284        for (Reference e : element.getGoal()) 
14285          composeReference(null, e);
14286        closeArray();
14287      };
14288      if (element.hasActivity()) {
14289        openArray("activity");
14290        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
14291          composeCarePlanCarePlanActivityComponent(null, e);
14292        closeArray();
14293      };
14294      if (element.hasNote()) {
14295        composeAnnotation("note", element.getNote());
14296      }
14297  }
14298
14299  protected void composeCarePlanCarePlanRelatedPlanComponent(String name, CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14300    if (element != null) {
14301      open(name);
14302      composeCarePlanCarePlanRelatedPlanComponentInner(element);
14303      close();
14304    }
14305  }
14306
14307  protected void composeCarePlanCarePlanRelatedPlanComponentInner(CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14308      composeBackbone(element);
14309      if (element.hasCodeElement()) {
14310        composeEnumerationCore("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14311        composeEnumerationExtras("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14312      }
14313      if (element.hasPlan()) {
14314        composeReference("plan", element.getPlan());
14315      }
14316  }
14317
14318  protected void composeCarePlanCarePlanParticipantComponent(String name, CarePlan.CarePlanParticipantComponent element) throws IOException {
14319    if (element != null) {
14320      open(name);
14321      composeCarePlanCarePlanParticipantComponentInner(element);
14322      close();
14323    }
14324  }
14325
14326  protected void composeCarePlanCarePlanParticipantComponentInner(CarePlan.CarePlanParticipantComponent element) throws IOException {
14327      composeBackbone(element);
14328      if (element.hasRole()) {
14329        composeCodeableConcept("role", element.getRole());
14330      }
14331      if (element.hasMember()) {
14332        composeReference("member", element.getMember());
14333      }
14334  }
14335
14336  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
14337    if (element != null) {
14338      open(name);
14339      composeCarePlanCarePlanActivityComponentInner(element);
14340      close();
14341    }
14342  }
14343
14344  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
14345      composeBackbone(element);
14346      if (element.hasActionResulting()) {
14347        openArray("actionResulting");
14348        for (Reference e : element.getActionResulting()) 
14349          composeReference(null, e);
14350        closeArray();
14351      };
14352      if (element.hasProgress()) {
14353        openArray("progress");
14354        for (Annotation e : element.getProgress()) 
14355          composeAnnotation(null, e);
14356        closeArray();
14357      };
14358      if (element.hasReference()) {
14359        composeReference("reference", element.getReference());
14360      }
14361      if (element.hasDetail()) {
14362        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
14363      }
14364  }
14365
14366  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14367    if (element != null) {
14368      open(name);
14369      composeCarePlanCarePlanActivityDetailComponentInner(element);
14370      close();
14371    }
14372  }
14373
14374  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14375      composeBackbone(element);
14376      if (element.hasCategory()) {
14377        composeCodeableConcept("category", element.getCategory());
14378      }
14379      if (element.hasCode()) {
14380        composeCodeableConcept("code", element.getCode());
14381      }
14382      if (element.hasReasonCode()) {
14383        openArray("reasonCode");
14384        for (CodeableConcept e : element.getReasonCode()) 
14385          composeCodeableConcept(null, e);
14386        closeArray();
14387      };
14388      if (element.hasReasonReference()) {
14389        openArray("reasonReference");
14390        for (Reference e : element.getReasonReference()) 
14391          composeReference(null, e);
14392        closeArray();
14393      };
14394      if (element.hasGoal()) {
14395        openArray("goal");
14396        for (Reference e : element.getGoal()) 
14397          composeReference(null, e);
14398        closeArray();
14399      };
14400      if (element.hasStatusElement()) {
14401        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14402        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14403      }
14404      if (element.hasStatusReason()) {
14405        composeCodeableConcept("statusReason", element.getStatusReason());
14406      }
14407      if (element.hasProhibitedElement()) {
14408        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
14409        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
14410      }
14411      if (element.hasScheduled()) {
14412        composeType("scheduled", element.getScheduled());
14413      }
14414      if (element.hasLocation()) {
14415        composeReference("location", element.getLocation());
14416      }
14417      if (element.hasPerformer()) {
14418        openArray("performer");
14419        for (Reference e : element.getPerformer()) 
14420          composeReference(null, e);
14421        closeArray();
14422      };
14423      if (element.hasProduct()) {
14424        composeType("product", element.getProduct());
14425      }
14426      if (element.hasDailyAmount()) {
14427        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
14428      }
14429      if (element.hasQuantity()) {
14430        composeSimpleQuantity("quantity", element.getQuantity());
14431      }
14432      if (element.hasDescriptionElement()) {
14433        composeStringCore("description", element.getDescriptionElement(), false);
14434        composeStringExtras("description", element.getDescriptionElement(), false);
14435      }
14436  }
14437
14438  protected void composeClaim(String name, Claim element) throws IOException {
14439    if (element != null) {
14440      prop("resourceType", name);
14441      composeClaimInner(element);
14442    }
14443  }
14444
14445  protected void composeClaimInner(Claim element) throws IOException {
14446      composeDomainResourceElements(element);
14447      if (element.hasTypeElement()) {
14448        composeEnumerationCore("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14449        composeEnumerationExtras("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14450      }
14451      if (element.hasIdentifier()) {
14452        openArray("identifier");
14453        for (Identifier e : element.getIdentifier()) 
14454          composeIdentifier(null, e);
14455        closeArray();
14456      };
14457      if (element.hasRuleset()) {
14458        composeCoding("ruleset", element.getRuleset());
14459      }
14460      if (element.hasOriginalRuleset()) {
14461        composeCoding("originalRuleset", element.getOriginalRuleset());
14462      }
14463      if (element.hasCreatedElement()) {
14464        composeDateTimeCore("created", element.getCreatedElement(), false);
14465        composeDateTimeExtras("created", element.getCreatedElement(), false);
14466      }
14467      if (element.hasTarget()) {
14468        composeReference("target", element.getTarget());
14469      }
14470      if (element.hasProvider()) {
14471        composeReference("provider", element.getProvider());
14472      }
14473      if (element.hasOrganization()) {
14474        composeReference("organization", element.getOrganization());
14475      }
14476      if (element.hasUseElement()) {
14477        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14478        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14479      }
14480      if (element.hasPriority()) {
14481        composeCoding("priority", element.getPriority());
14482      }
14483      if (element.hasFundsReserve()) {
14484        composeCoding("fundsReserve", element.getFundsReserve());
14485      }
14486      if (element.hasEnterer()) {
14487        composeReference("enterer", element.getEnterer());
14488      }
14489      if (element.hasFacility()) {
14490        composeReference("facility", element.getFacility());
14491      }
14492      if (element.hasPrescription()) {
14493        composeReference("prescription", element.getPrescription());
14494      }
14495      if (element.hasOriginalPrescription()) {
14496        composeReference("originalPrescription", element.getOriginalPrescription());
14497      }
14498      if (element.hasPayee()) {
14499        composeClaimPayeeComponent("payee", element.getPayee());
14500      }
14501      if (element.hasReferral()) {
14502        composeReference("referral", element.getReferral());
14503      }
14504      if (element.hasDiagnosis()) {
14505        openArray("diagnosis");
14506        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
14507          composeClaimDiagnosisComponent(null, e);
14508        closeArray();
14509      };
14510      if (element.hasCondition()) {
14511        openArray("condition");
14512        for (Coding e : element.getCondition()) 
14513          composeCoding(null, e);
14514        closeArray();
14515      };
14516      if (element.hasPatient()) {
14517        composeReference("patient", element.getPatient());
14518      }
14519      if (element.hasCoverage()) {
14520        openArray("coverage");
14521        for (Claim.CoverageComponent e : element.getCoverage()) 
14522          composeClaimCoverageComponent(null, e);
14523        closeArray();
14524      };
14525      if (element.hasException()) {
14526        openArray("exception");
14527        for (Coding e : element.getException()) 
14528          composeCoding(null, e);
14529        closeArray();
14530      };
14531      if (element.hasSchoolElement()) {
14532        composeStringCore("school", element.getSchoolElement(), false);
14533        composeStringExtras("school", element.getSchoolElement(), false);
14534      }
14535      if (element.hasAccidentElement()) {
14536        composeDateCore("accident", element.getAccidentElement(), false);
14537        composeDateExtras("accident", element.getAccidentElement(), false);
14538      }
14539      if (element.hasAccidentType()) {
14540        composeCoding("accidentType", element.getAccidentType());
14541      }
14542      if (element.hasInterventionException()) {
14543        openArray("interventionException");
14544        for (Coding e : element.getInterventionException()) 
14545          composeCoding(null, e);
14546        closeArray();
14547      };
14548      if (element.hasItem()) {
14549        openArray("item");
14550        for (Claim.ItemsComponent e : element.getItem()) 
14551          composeClaimItemsComponent(null, e);
14552        closeArray();
14553      };
14554      if (element.hasAdditionalMaterials()) {
14555        openArray("additionalMaterials");
14556        for (Coding e : element.getAdditionalMaterials()) 
14557          composeCoding(null, e);
14558        closeArray();
14559      };
14560      if (element.hasMissingTeeth()) {
14561        openArray("missingTeeth");
14562        for (Claim.MissingTeethComponent e : element.getMissingTeeth()) 
14563          composeClaimMissingTeethComponent(null, e);
14564        closeArray();
14565      };
14566  }
14567
14568  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
14569    if (element != null) {
14570      open(name);
14571      composeClaimPayeeComponentInner(element);
14572      close();
14573    }
14574  }
14575
14576  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
14577      composeBackbone(element);
14578      if (element.hasType()) {
14579        composeCoding("type", element.getType());
14580      }
14581      if (element.hasProvider()) {
14582        composeReference("provider", element.getProvider());
14583      }
14584      if (element.hasOrganization()) {
14585        composeReference("organization", element.getOrganization());
14586      }
14587      if (element.hasPerson()) {
14588        composeReference("person", element.getPerson());
14589      }
14590  }
14591
14592  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
14593    if (element != null) {
14594      open(name);
14595      composeClaimDiagnosisComponentInner(element);
14596      close();
14597    }
14598  }
14599
14600  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
14601      composeBackbone(element);
14602      if (element.hasSequenceElement()) {
14603        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14604        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14605      }
14606      if (element.hasDiagnosis()) {
14607        composeCoding("diagnosis", element.getDiagnosis());
14608      }
14609  }
14610
14611  protected void composeClaimCoverageComponent(String name, Claim.CoverageComponent element) throws IOException {
14612    if (element != null) {
14613      open(name);
14614      composeClaimCoverageComponentInner(element);
14615      close();
14616    }
14617  }
14618
14619  protected void composeClaimCoverageComponentInner(Claim.CoverageComponent element) throws IOException {
14620      composeBackbone(element);
14621      if (element.hasSequenceElement()) {
14622        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14623        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14624      }
14625      if (element.hasFocalElement()) {
14626        composeBooleanCore("focal", element.getFocalElement(), false);
14627        composeBooleanExtras("focal", element.getFocalElement(), false);
14628      }
14629      if (element.hasCoverage()) {
14630        composeReference("coverage", element.getCoverage());
14631      }
14632      if (element.hasBusinessArrangementElement()) {
14633        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
14634        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
14635      }
14636      if (element.hasRelationship()) {
14637        composeCoding("relationship", element.getRelationship());
14638      }
14639      if (element.hasPreAuthRef()) {
14640        openArray("preAuthRef");
14641        for (StringType e : element.getPreAuthRef()) 
14642          composeStringCore(null, e, true);
14643        closeArray();
14644        if (anyHasExtras(element.getPreAuthRef())) {
14645          openArray("_preAuthRef");
14646          for (StringType e : element.getPreAuthRef()) 
14647            composeStringExtras(null, e, true);
14648          closeArray();
14649        }
14650      };
14651      if (element.hasClaimResponse()) {
14652        composeReference("claimResponse", element.getClaimResponse());
14653      }
14654      if (element.hasOriginalRuleset()) {
14655        composeCoding("originalRuleset", element.getOriginalRuleset());
14656      }
14657  }
14658
14659  protected void composeClaimItemsComponent(String name, Claim.ItemsComponent element) throws IOException {
14660    if (element != null) {
14661      open(name);
14662      composeClaimItemsComponentInner(element);
14663      close();
14664    }
14665  }
14666
14667  protected void composeClaimItemsComponentInner(Claim.ItemsComponent element) throws IOException {
14668      composeBackbone(element);
14669      if (element.hasSequenceElement()) {
14670        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14671        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14672      }
14673      if (element.hasType()) {
14674        composeCoding("type", element.getType());
14675      }
14676      if (element.hasProvider()) {
14677        composeReference("provider", element.getProvider());
14678      }
14679      if (element.hasDiagnosisLinkId()) {
14680        openArray("diagnosisLinkId");
14681        for (PositiveIntType e : element.getDiagnosisLinkId()) 
14682          composePositiveIntCore(null, e, true);
14683        closeArray();
14684        if (anyHasExtras(element.getDiagnosisLinkId())) {
14685          openArray("_diagnosisLinkId");
14686          for (PositiveIntType e : element.getDiagnosisLinkId()) 
14687            composePositiveIntExtras(null, e, true);
14688          closeArray();
14689        }
14690      };
14691      if (element.hasService()) {
14692        composeCoding("service", element.getService());
14693      }
14694      if (element.hasServiceDateElement()) {
14695        composeDateCore("serviceDate", element.getServiceDateElement(), false);
14696        composeDateExtras("serviceDate", element.getServiceDateElement(), false);
14697      }
14698      if (element.hasQuantity()) {
14699        composeSimpleQuantity("quantity", element.getQuantity());
14700      }
14701      if (element.hasUnitPrice()) {
14702        composeMoney("unitPrice", element.getUnitPrice());
14703      }
14704      if (element.hasFactorElement()) {
14705        composeDecimalCore("factor", element.getFactorElement(), false);
14706        composeDecimalExtras("factor", element.getFactorElement(), false);
14707      }
14708      if (element.hasPointsElement()) {
14709        composeDecimalCore("points", element.getPointsElement(), false);
14710        composeDecimalExtras("points", element.getPointsElement(), false);
14711      }
14712      if (element.hasNet()) {
14713        composeMoney("net", element.getNet());
14714      }
14715      if (element.hasUdi()) {
14716        composeCoding("udi", element.getUdi());
14717      }
14718      if (element.hasBodySite()) {
14719        composeCoding("bodySite", element.getBodySite());
14720      }
14721      if (element.hasSubSite()) {
14722        openArray("subSite");
14723        for (Coding e : element.getSubSite()) 
14724          composeCoding(null, e);
14725        closeArray();
14726      };
14727      if (element.hasModifier()) {
14728        openArray("modifier");
14729        for (Coding e : element.getModifier()) 
14730          composeCoding(null, e);
14731        closeArray();
14732      };
14733      if (element.hasDetail()) {
14734        openArray("detail");
14735        for (Claim.DetailComponent e : element.getDetail()) 
14736          composeClaimDetailComponent(null, e);
14737        closeArray();
14738      };
14739      if (element.hasProsthesis()) {
14740        composeClaimProsthesisComponent("prosthesis", element.getProsthesis());
14741      }
14742  }
14743
14744  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
14745    if (element != null) {
14746      open(name);
14747      composeClaimDetailComponentInner(element);
14748      close();
14749    }
14750  }
14751
14752  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
14753      composeBackbone(element);
14754      if (element.hasSequenceElement()) {
14755        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14756        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14757      }
14758      if (element.hasType()) {
14759        composeCoding("type", element.getType());
14760      }
14761      if (element.hasService()) {
14762        composeCoding("service", element.getService());
14763      }
14764      if (element.hasQuantity()) {
14765        composeSimpleQuantity("quantity", element.getQuantity());
14766      }
14767      if (element.hasUnitPrice()) {
14768        composeMoney("unitPrice", element.getUnitPrice());
14769      }
14770      if (element.hasFactorElement()) {
14771        composeDecimalCore("factor", element.getFactorElement(), false);
14772        composeDecimalExtras("factor", element.getFactorElement(), false);
14773      }
14774      if (element.hasPointsElement()) {
14775        composeDecimalCore("points", element.getPointsElement(), false);
14776        composeDecimalExtras("points", element.getPointsElement(), false);
14777      }
14778      if (element.hasNet()) {
14779        composeMoney("net", element.getNet());
14780      }
14781      if (element.hasUdi()) {
14782        composeCoding("udi", element.getUdi());
14783      }
14784      if (element.hasSubDetail()) {
14785        openArray("subDetail");
14786        for (Claim.SubDetailComponent e : element.getSubDetail()) 
14787          composeClaimSubDetailComponent(null, e);
14788        closeArray();
14789      };
14790  }
14791
14792  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
14793    if (element != null) {
14794      open(name);
14795      composeClaimSubDetailComponentInner(element);
14796      close();
14797    }
14798  }
14799
14800  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
14801      composeBackbone(element);
14802      if (element.hasSequenceElement()) {
14803        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14804        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14805      }
14806      if (element.hasType()) {
14807        composeCoding("type", element.getType());
14808      }
14809      if (element.hasService()) {
14810        composeCoding("service", element.getService());
14811      }
14812      if (element.hasQuantity()) {
14813        composeSimpleQuantity("quantity", element.getQuantity());
14814      }
14815      if (element.hasUnitPrice()) {
14816        composeMoney("unitPrice", element.getUnitPrice());
14817      }
14818      if (element.hasFactorElement()) {
14819        composeDecimalCore("factor", element.getFactorElement(), false);
14820        composeDecimalExtras("factor", element.getFactorElement(), false);
14821      }
14822      if (element.hasPointsElement()) {
14823        composeDecimalCore("points", element.getPointsElement(), false);
14824        composeDecimalExtras("points", element.getPointsElement(), false);
14825      }
14826      if (element.hasNet()) {
14827        composeMoney("net", element.getNet());
14828      }
14829      if (element.hasUdi()) {
14830        composeCoding("udi", element.getUdi());
14831      }
14832  }
14833
14834  protected void composeClaimProsthesisComponent(String name, Claim.ProsthesisComponent element) throws IOException {
14835    if (element != null) {
14836      open(name);
14837      composeClaimProsthesisComponentInner(element);
14838      close();
14839    }
14840  }
14841
14842  protected void composeClaimProsthesisComponentInner(Claim.ProsthesisComponent element) throws IOException {
14843      composeBackbone(element);
14844      if (element.hasInitialElement()) {
14845        composeBooleanCore("initial", element.getInitialElement(), false);
14846        composeBooleanExtras("initial", element.getInitialElement(), false);
14847      }
14848      if (element.hasPriorDateElement()) {
14849        composeDateCore("priorDate", element.getPriorDateElement(), false);
14850        composeDateExtras("priorDate", element.getPriorDateElement(), false);
14851      }
14852      if (element.hasPriorMaterial()) {
14853        composeCoding("priorMaterial", element.getPriorMaterial());
14854      }
14855  }
14856
14857  protected void composeClaimMissingTeethComponent(String name, Claim.MissingTeethComponent element) throws IOException {
14858    if (element != null) {
14859      open(name);
14860      composeClaimMissingTeethComponentInner(element);
14861      close();
14862    }
14863  }
14864
14865  protected void composeClaimMissingTeethComponentInner(Claim.MissingTeethComponent element) throws IOException {
14866      composeBackbone(element);
14867      if (element.hasTooth()) {
14868        composeCoding("tooth", element.getTooth());
14869      }
14870      if (element.hasReason()) {
14871        composeCoding("reason", element.getReason());
14872      }
14873      if (element.hasExtractionDateElement()) {
14874        composeDateCore("extractionDate", element.getExtractionDateElement(), false);
14875        composeDateExtras("extractionDate", element.getExtractionDateElement(), false);
14876      }
14877  }
14878
14879  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
14880    if (element != null) {
14881      prop("resourceType", name);
14882      composeClaimResponseInner(element);
14883    }
14884  }
14885
14886  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
14887      composeDomainResourceElements(element);
14888      if (element.hasIdentifier()) {
14889        openArray("identifier");
14890        for (Identifier e : element.getIdentifier()) 
14891          composeIdentifier(null, e);
14892        closeArray();
14893      };
14894      if (element.hasRequest()) {
14895        composeReference("request", element.getRequest());
14896      }
14897      if (element.hasRuleset()) {
14898        composeCoding("ruleset", element.getRuleset());
14899      }
14900      if (element.hasOriginalRuleset()) {
14901        composeCoding("originalRuleset", element.getOriginalRuleset());
14902      }
14903      if (element.hasCreatedElement()) {
14904        composeDateTimeCore("created", element.getCreatedElement(), false);
14905        composeDateTimeExtras("created", element.getCreatedElement(), false);
14906      }
14907      if (element.hasOrganization()) {
14908        composeReference("organization", element.getOrganization());
14909      }
14910      if (element.hasRequestProvider()) {
14911        composeReference("requestProvider", element.getRequestProvider());
14912      }
14913      if (element.hasRequestOrganization()) {
14914        composeReference("requestOrganization", element.getRequestOrganization());
14915      }
14916      if (element.hasOutcomeElement()) {
14917        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14918        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14919      }
14920      if (element.hasDispositionElement()) {
14921        composeStringCore("disposition", element.getDispositionElement(), false);
14922        composeStringExtras("disposition", element.getDispositionElement(), false);
14923      }
14924      if (element.hasPayeeType()) {
14925        composeCoding("payeeType", element.getPayeeType());
14926      }
14927      if (element.hasItem()) {
14928        openArray("item");
14929        for (ClaimResponse.ItemsComponent e : element.getItem()) 
14930          composeClaimResponseItemsComponent(null, e);
14931        closeArray();
14932      };
14933      if (element.hasAddItem()) {
14934        openArray("addItem");
14935        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
14936          composeClaimResponseAddedItemComponent(null, e);
14937        closeArray();
14938      };
14939      if (element.hasError()) {
14940        openArray("error");
14941        for (ClaimResponse.ErrorsComponent e : element.getError()) 
14942          composeClaimResponseErrorsComponent(null, e);
14943        closeArray();
14944      };
14945      if (element.hasTotalCost()) {
14946        composeMoney("totalCost", element.getTotalCost());
14947      }
14948      if (element.hasUnallocDeductable()) {
14949        composeMoney("unallocDeductable", element.getUnallocDeductable());
14950      }
14951      if (element.hasTotalBenefit()) {
14952        composeMoney("totalBenefit", element.getTotalBenefit());
14953      }
14954      if (element.hasPaymentAdjustment()) {
14955        composeMoney("paymentAdjustment", element.getPaymentAdjustment());
14956      }
14957      if (element.hasPaymentAdjustmentReason()) {
14958        composeCoding("paymentAdjustmentReason", element.getPaymentAdjustmentReason());
14959      }
14960      if (element.hasPaymentDateElement()) {
14961        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
14962        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
14963      }
14964      if (element.hasPaymentAmount()) {
14965        composeMoney("paymentAmount", element.getPaymentAmount());
14966      }
14967      if (element.hasPaymentRef()) {
14968        composeIdentifier("paymentRef", element.getPaymentRef());
14969      }
14970      if (element.hasReserved()) {
14971        composeCoding("reserved", element.getReserved());
14972      }
14973      if (element.hasForm()) {
14974        composeCoding("form", element.getForm());
14975      }
14976      if (element.hasNote()) {
14977        openArray("note");
14978        for (ClaimResponse.NotesComponent e : element.getNote()) 
14979          composeClaimResponseNotesComponent(null, e);
14980        closeArray();
14981      };
14982      if (element.hasCoverage()) {
14983        openArray("coverage");
14984        for (ClaimResponse.CoverageComponent e : element.getCoverage()) 
14985          composeClaimResponseCoverageComponent(null, e);
14986        closeArray();
14987      };
14988  }
14989
14990  protected void composeClaimResponseItemsComponent(String name, ClaimResponse.ItemsComponent element) throws IOException {
14991    if (element != null) {
14992      open(name);
14993      composeClaimResponseItemsComponentInner(element);
14994      close();
14995    }
14996  }
14997
14998  protected void composeClaimResponseItemsComponentInner(ClaimResponse.ItemsComponent element) throws IOException {
14999      composeBackbone(element);
15000      if (element.hasSequenceLinkIdElement()) {
15001        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15002        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15003      }
15004      if (element.hasNoteNumber()) {
15005        openArray("noteNumber");
15006        for (PositiveIntType e : element.getNoteNumber()) 
15007          composePositiveIntCore(null, e, true);
15008        closeArray();
15009        if (anyHasExtras(element.getNoteNumber())) {
15010          openArray("_noteNumber");
15011          for (PositiveIntType e : element.getNoteNumber()) 
15012            composePositiveIntExtras(null, e, true);
15013          closeArray();
15014        }
15015      };
15016      if (element.hasAdjudication()) {
15017        openArray("adjudication");
15018        for (ClaimResponse.ItemAdjudicationComponent e : element.getAdjudication()) 
15019          composeClaimResponseItemAdjudicationComponent(null, e);
15020        closeArray();
15021      };
15022      if (element.hasDetail()) {
15023        openArray("detail");
15024        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
15025          composeClaimResponseItemDetailComponent(null, e);
15026        closeArray();
15027      };
15028  }
15029
15030  protected void composeClaimResponseItemAdjudicationComponent(String name, ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15031    if (element != null) {
15032      open(name);
15033      composeClaimResponseItemAdjudicationComponentInner(element);
15034      close();
15035    }
15036  }
15037
15038  protected void composeClaimResponseItemAdjudicationComponentInner(ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15039      composeBackbone(element);
15040      if (element.hasCode()) {
15041        composeCoding("code", element.getCode());
15042      }
15043      if (element.hasAmount()) {
15044        composeMoney("amount", element.getAmount());
15045      }
15046      if (element.hasValueElement()) {
15047        composeDecimalCore("value", element.getValueElement(), false);
15048        composeDecimalExtras("value", element.getValueElement(), false);
15049      }
15050  }
15051
15052  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
15053    if (element != null) {
15054      open(name);
15055      composeClaimResponseItemDetailComponentInner(element);
15056      close();
15057    }
15058  }
15059
15060  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
15061      composeBackbone(element);
15062      if (element.hasSequenceLinkIdElement()) {
15063        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15064        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15065      }
15066      if (element.hasAdjudication()) {
15067        openArray("adjudication");
15068        for (ClaimResponse.DetailAdjudicationComponent e : element.getAdjudication()) 
15069          composeClaimResponseDetailAdjudicationComponent(null, e);
15070        closeArray();
15071      };
15072      if (element.hasSubDetail()) {
15073        openArray("subDetail");
15074        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
15075          composeClaimResponseSubDetailComponent(null, e);
15076        closeArray();
15077      };
15078  }
15079
15080  protected void composeClaimResponseDetailAdjudicationComponent(String name, ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15081    if (element != null) {
15082      open(name);
15083      composeClaimResponseDetailAdjudicationComponentInner(element);
15084      close();
15085    }
15086  }
15087
15088  protected void composeClaimResponseDetailAdjudicationComponentInner(ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15089      composeBackbone(element);
15090      if (element.hasCode()) {
15091        composeCoding("code", element.getCode());
15092      }
15093      if (element.hasAmount()) {
15094        composeMoney("amount", element.getAmount());
15095      }
15096      if (element.hasValueElement()) {
15097        composeDecimalCore("value", element.getValueElement(), false);
15098        composeDecimalExtras("value", element.getValueElement(), false);
15099      }
15100  }
15101
15102  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
15103    if (element != null) {
15104      open(name);
15105      composeClaimResponseSubDetailComponentInner(element);
15106      close();
15107    }
15108  }
15109
15110  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
15111      composeBackbone(element);
15112      if (element.hasSequenceLinkIdElement()) {
15113        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15114        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15115      }
15116      if (element.hasAdjudication()) {
15117        openArray("adjudication");
15118        for (ClaimResponse.SubdetailAdjudicationComponent e : element.getAdjudication()) 
15119          composeClaimResponseSubdetailAdjudicationComponent(null, e);
15120        closeArray();
15121      };
15122  }
15123
15124  protected void composeClaimResponseSubdetailAdjudicationComponent(String name, ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15125    if (element != null) {
15126      open(name);
15127      composeClaimResponseSubdetailAdjudicationComponentInner(element);
15128      close();
15129    }
15130  }
15131
15132  protected void composeClaimResponseSubdetailAdjudicationComponentInner(ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15133      composeBackbone(element);
15134      if (element.hasCode()) {
15135        composeCoding("code", element.getCode());
15136      }
15137      if (element.hasAmount()) {
15138        composeMoney("amount", element.getAmount());
15139      }
15140      if (element.hasValueElement()) {
15141        composeDecimalCore("value", element.getValueElement(), false);
15142        composeDecimalExtras("value", element.getValueElement(), false);
15143      }
15144  }
15145
15146  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
15147    if (element != null) {
15148      open(name);
15149      composeClaimResponseAddedItemComponentInner(element);
15150      close();
15151    }
15152  }
15153
15154  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
15155      composeBackbone(element);
15156      if (element.hasSequenceLinkId()) {
15157        openArray("sequenceLinkId");
15158        for (PositiveIntType e : element.getSequenceLinkId()) 
15159          composePositiveIntCore(null, e, true);
15160        closeArray();
15161        if (anyHasExtras(element.getSequenceLinkId())) {
15162          openArray("_sequenceLinkId");
15163          for (PositiveIntType e : element.getSequenceLinkId()) 
15164            composePositiveIntExtras(null, e, true);
15165          closeArray();
15166        }
15167      };
15168      if (element.hasService()) {
15169        composeCoding("service", element.getService());
15170      }
15171      if (element.hasFee()) {
15172        composeMoney("fee", element.getFee());
15173      }
15174      if (element.hasNoteNumberLinkId()) {
15175        openArray("noteNumberLinkId");
15176        for (PositiveIntType e : element.getNoteNumberLinkId()) 
15177          composePositiveIntCore(null, e, true);
15178        closeArray();
15179        if (anyHasExtras(element.getNoteNumberLinkId())) {
15180          openArray("_noteNumberLinkId");
15181          for (PositiveIntType e : element.getNoteNumberLinkId()) 
15182            composePositiveIntExtras(null, e, true);
15183          closeArray();
15184        }
15185      };
15186      if (element.hasAdjudication()) {
15187        openArray("adjudication");
15188        for (ClaimResponse.AddedItemAdjudicationComponent e : element.getAdjudication()) 
15189          composeClaimResponseAddedItemAdjudicationComponent(null, e);
15190        closeArray();
15191      };
15192      if (element.hasDetail()) {
15193        openArray("detail");
15194        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
15195          composeClaimResponseAddedItemsDetailComponent(null, e);
15196        closeArray();
15197      };
15198  }
15199
15200  protected void composeClaimResponseAddedItemAdjudicationComponent(String name, ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15201    if (element != null) {
15202      open(name);
15203      composeClaimResponseAddedItemAdjudicationComponentInner(element);
15204      close();
15205    }
15206  }
15207
15208  protected void composeClaimResponseAddedItemAdjudicationComponentInner(ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15209      composeBackbone(element);
15210      if (element.hasCode()) {
15211        composeCoding("code", element.getCode());
15212      }
15213      if (element.hasAmount()) {
15214        composeMoney("amount", element.getAmount());
15215      }
15216      if (element.hasValueElement()) {
15217        composeDecimalCore("value", element.getValueElement(), false);
15218        composeDecimalExtras("value", element.getValueElement(), false);
15219      }
15220  }
15221
15222  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15223    if (element != null) {
15224      open(name);
15225      composeClaimResponseAddedItemsDetailComponentInner(element);
15226      close();
15227    }
15228  }
15229
15230  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15231      composeBackbone(element);
15232      if (element.hasService()) {
15233        composeCoding("service", element.getService());
15234      }
15235      if (element.hasFee()) {
15236        composeMoney("fee", element.getFee());
15237      }
15238      if (element.hasAdjudication()) {
15239        openArray("adjudication");
15240        for (ClaimResponse.AddedItemDetailAdjudicationComponent e : element.getAdjudication()) 
15241          composeClaimResponseAddedItemDetailAdjudicationComponent(null, e);
15242        closeArray();
15243      };
15244  }
15245
15246  protected void composeClaimResponseAddedItemDetailAdjudicationComponent(String name, ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15247    if (element != null) {
15248      open(name);
15249      composeClaimResponseAddedItemDetailAdjudicationComponentInner(element);
15250      close();
15251    }
15252  }
15253
15254  protected void composeClaimResponseAddedItemDetailAdjudicationComponentInner(ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15255      composeBackbone(element);
15256      if (element.hasCode()) {
15257        composeCoding("code", element.getCode());
15258      }
15259      if (element.hasAmount()) {
15260        composeMoney("amount", element.getAmount());
15261      }
15262      if (element.hasValueElement()) {
15263        composeDecimalCore("value", element.getValueElement(), false);
15264        composeDecimalExtras("value", element.getValueElement(), false);
15265      }
15266  }
15267
15268  protected void composeClaimResponseErrorsComponent(String name, ClaimResponse.ErrorsComponent element) throws IOException {
15269    if (element != null) {
15270      open(name);
15271      composeClaimResponseErrorsComponentInner(element);
15272      close();
15273    }
15274  }
15275
15276  protected void composeClaimResponseErrorsComponentInner(ClaimResponse.ErrorsComponent element) throws IOException {
15277      composeBackbone(element);
15278      if (element.hasSequenceLinkIdElement()) {
15279        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15280        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15281      }
15282      if (element.hasDetailSequenceLinkIdElement()) {
15283        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15284        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15285      }
15286      if (element.hasSubdetailSequenceLinkIdElement()) {
15287        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15288        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15289      }
15290      if (element.hasCode()) {
15291        composeCoding("code", element.getCode());
15292      }
15293  }
15294
15295  protected void composeClaimResponseNotesComponent(String name, ClaimResponse.NotesComponent element) throws IOException {
15296    if (element != null) {
15297      open(name);
15298      composeClaimResponseNotesComponentInner(element);
15299      close();
15300    }
15301  }
15302
15303  protected void composeClaimResponseNotesComponentInner(ClaimResponse.NotesComponent element) throws IOException {
15304      composeBackbone(element);
15305      if (element.hasNumberElement()) {
15306        composePositiveIntCore("number", element.getNumberElement(), false);
15307        composePositiveIntExtras("number", element.getNumberElement(), false);
15308      }
15309      if (element.hasType()) {
15310        composeCoding("type", element.getType());
15311      }
15312      if (element.hasTextElement()) {
15313        composeStringCore("text", element.getTextElement(), false);
15314        composeStringExtras("text", element.getTextElement(), false);
15315      }
15316  }
15317
15318  protected void composeClaimResponseCoverageComponent(String name, ClaimResponse.CoverageComponent element) throws IOException {
15319    if (element != null) {
15320      open(name);
15321      composeClaimResponseCoverageComponentInner(element);
15322      close();
15323    }
15324  }
15325
15326  protected void composeClaimResponseCoverageComponentInner(ClaimResponse.CoverageComponent element) throws IOException {
15327      composeBackbone(element);
15328      if (element.hasSequenceElement()) {
15329        composePositiveIntCore("sequence", element.getSequenceElement(), false);
15330        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
15331      }
15332      if (element.hasFocalElement()) {
15333        composeBooleanCore("focal", element.getFocalElement(), false);
15334        composeBooleanExtras("focal", element.getFocalElement(), false);
15335      }
15336      if (element.hasCoverage()) {
15337        composeReference("coverage", element.getCoverage());
15338      }
15339      if (element.hasBusinessArrangementElement()) {
15340        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
15341        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
15342      }
15343      if (element.hasRelationship()) {
15344        composeCoding("relationship", element.getRelationship());
15345      }
15346      if (element.hasPreAuthRef()) {
15347        openArray("preAuthRef");
15348        for (StringType e : element.getPreAuthRef()) 
15349          composeStringCore(null, e, true);
15350        closeArray();
15351        if (anyHasExtras(element.getPreAuthRef())) {
15352          openArray("_preAuthRef");
15353          for (StringType e : element.getPreAuthRef()) 
15354            composeStringExtras(null, e, true);
15355          closeArray();
15356        }
15357      };
15358      if (element.hasClaimResponse()) {
15359        composeReference("claimResponse", element.getClaimResponse());
15360      }
15361      if (element.hasOriginalRuleset()) {
15362        composeCoding("originalRuleset", element.getOriginalRuleset());
15363      }
15364  }
15365
15366  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
15367    if (element != null) {
15368      prop("resourceType", name);
15369      composeClinicalImpressionInner(element);
15370    }
15371  }
15372
15373  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
15374      composeDomainResourceElements(element);
15375      if (element.hasPatient()) {
15376        composeReference("patient", element.getPatient());
15377      }
15378      if (element.hasAssessor()) {
15379        composeReference("assessor", element.getAssessor());
15380      }
15381      if (element.hasStatusElement()) {
15382        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15383        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15384      }
15385      if (element.hasDateElement()) {
15386        composeDateTimeCore("date", element.getDateElement(), false);
15387        composeDateTimeExtras("date", element.getDateElement(), false);
15388      }
15389      if (element.hasDescriptionElement()) {
15390        composeStringCore("description", element.getDescriptionElement(), false);
15391        composeStringExtras("description", element.getDescriptionElement(), false);
15392      }
15393      if (element.hasPrevious()) {
15394        composeReference("previous", element.getPrevious());
15395      }
15396      if (element.hasProblem()) {
15397        openArray("problem");
15398        for (Reference e : element.getProblem()) 
15399          composeReference(null, e);
15400        closeArray();
15401      };
15402      if (element.hasTrigger()) {
15403        composeType("trigger", element.getTrigger());
15404      }
15405      if (element.hasInvestigations()) {
15406        openArray("investigations");
15407        for (ClinicalImpression.ClinicalImpressionInvestigationsComponent e : element.getInvestigations()) 
15408          composeClinicalImpressionClinicalImpressionInvestigationsComponent(null, e);
15409        closeArray();
15410      };
15411      if (element.hasProtocolElement()) {
15412        composeUriCore("protocol", element.getProtocolElement(), false);
15413        composeUriExtras("protocol", element.getProtocolElement(), false);
15414      }
15415      if (element.hasSummaryElement()) {
15416        composeStringCore("summary", element.getSummaryElement(), false);
15417        composeStringExtras("summary", element.getSummaryElement(), false);
15418      }
15419      if (element.hasFinding()) {
15420        openArray("finding");
15421        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
15422          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
15423        closeArray();
15424      };
15425      if (element.hasResolved()) {
15426        openArray("resolved");
15427        for (CodeableConcept e : element.getResolved()) 
15428          composeCodeableConcept(null, e);
15429        closeArray();
15430      };
15431      if (element.hasRuledOut()) {
15432        openArray("ruledOut");
15433        for (ClinicalImpression.ClinicalImpressionRuledOutComponent e : element.getRuledOut()) 
15434          composeClinicalImpressionClinicalImpressionRuledOutComponent(null, e);
15435        closeArray();
15436      };
15437      if (element.hasPrognosisElement()) {
15438        composeStringCore("prognosis", element.getPrognosisElement(), false);
15439        composeStringExtras("prognosis", element.getPrognosisElement(), false);
15440      }
15441      if (element.hasPlan()) {
15442        openArray("plan");
15443        for (Reference e : element.getPlan()) 
15444          composeReference(null, e);
15445        closeArray();
15446      };
15447      if (element.hasAction()) {
15448        openArray("action");
15449        for (Reference e : element.getAction()) 
15450          composeReference(null, e);
15451        closeArray();
15452      };
15453  }
15454
15455  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15456    if (element != null) {
15457      open(name);
15458      composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(element);
15459      close();
15460    }
15461  }
15462
15463  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15464      composeBackbone(element);
15465      if (element.hasCode()) {
15466        composeCodeableConcept("code", element.getCode());
15467      }
15468      if (element.hasItem()) {
15469        openArray("item");
15470        for (Reference e : element.getItem()) 
15471          composeReference(null, e);
15472        closeArray();
15473      };
15474  }
15475
15476  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15477    if (element != null) {
15478      open(name);
15479      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
15480      close();
15481    }
15482  }
15483
15484  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15485      composeBackbone(element);
15486      if (element.hasItem()) {
15487        composeCodeableConcept("item", element.getItem());
15488      }
15489      if (element.hasCauseElement()) {
15490        composeStringCore("cause", element.getCauseElement(), false);
15491        composeStringExtras("cause", element.getCauseElement(), false);
15492      }
15493  }
15494
15495  protected void composeClinicalImpressionClinicalImpressionRuledOutComponent(String name, ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15496    if (element != null) {
15497      open(name);
15498      composeClinicalImpressionClinicalImpressionRuledOutComponentInner(element);
15499      close();
15500    }
15501  }
15502
15503  protected void composeClinicalImpressionClinicalImpressionRuledOutComponentInner(ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15504      composeBackbone(element);
15505      if (element.hasItem()) {
15506        composeCodeableConcept("item", element.getItem());
15507      }
15508      if (element.hasReasonElement()) {
15509        composeStringCore("reason", element.getReasonElement(), false);
15510        composeStringExtras("reason", element.getReasonElement(), false);
15511      }
15512  }
15513
15514  protected void composeCommunication(String name, Communication element) throws IOException {
15515    if (element != null) {
15516      prop("resourceType", name);
15517      composeCommunicationInner(element);
15518    }
15519  }
15520
15521  protected void composeCommunicationInner(Communication element) throws IOException {
15522      composeDomainResourceElements(element);
15523      if (element.hasIdentifier()) {
15524        openArray("identifier");
15525        for (Identifier e : element.getIdentifier()) 
15526          composeIdentifier(null, e);
15527        closeArray();
15528      };
15529      if (element.hasCategory()) {
15530        composeCodeableConcept("category", element.getCategory());
15531      }
15532      if (element.hasSender()) {
15533        composeReference("sender", element.getSender());
15534      }
15535      if (element.hasRecipient()) {
15536        openArray("recipient");
15537        for (Reference e : element.getRecipient()) 
15538          composeReference(null, e);
15539        closeArray();
15540      };
15541      if (element.hasPayload()) {
15542        openArray("payload");
15543        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
15544          composeCommunicationCommunicationPayloadComponent(null, e);
15545        closeArray();
15546      };
15547      if (element.hasMedium()) {
15548        openArray("medium");
15549        for (CodeableConcept e : element.getMedium()) 
15550          composeCodeableConcept(null, e);
15551        closeArray();
15552      };
15553      if (element.hasStatusElement()) {
15554        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15555        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15556      }
15557      if (element.hasEncounter()) {
15558        composeReference("encounter", element.getEncounter());
15559      }
15560      if (element.hasSentElement()) {
15561        composeDateTimeCore("sent", element.getSentElement(), false);
15562        composeDateTimeExtras("sent", element.getSentElement(), false);
15563      }
15564      if (element.hasReceivedElement()) {
15565        composeDateTimeCore("received", element.getReceivedElement(), false);
15566        composeDateTimeExtras("received", element.getReceivedElement(), false);
15567      }
15568      if (element.hasReason()) {
15569        openArray("reason");
15570        for (CodeableConcept e : element.getReason()) 
15571          composeCodeableConcept(null, e);
15572        closeArray();
15573      };
15574      if (element.hasSubject()) {
15575        composeReference("subject", element.getSubject());
15576      }
15577      if (element.hasRequestDetail()) {
15578        composeReference("requestDetail", element.getRequestDetail());
15579      }
15580  }
15581
15582  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
15583    if (element != null) {
15584      open(name);
15585      composeCommunicationCommunicationPayloadComponentInner(element);
15586      close();
15587    }
15588  }
15589
15590  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
15591      composeBackbone(element);
15592      if (element.hasContent()) {
15593        composeType("content", element.getContent());
15594      }
15595  }
15596
15597  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
15598    if (element != null) {
15599      prop("resourceType", name);
15600      composeCommunicationRequestInner(element);
15601    }
15602  }
15603
15604  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
15605      composeDomainResourceElements(element);
15606      if (element.hasIdentifier()) {
15607        openArray("identifier");
15608        for (Identifier e : element.getIdentifier()) 
15609          composeIdentifier(null, e);
15610        closeArray();
15611      };
15612      if (element.hasCategory()) {
15613        composeCodeableConcept("category", element.getCategory());
15614      }
15615      if (element.hasSender()) {
15616        composeReference("sender", element.getSender());
15617      }
15618      if (element.hasRecipient()) {
15619        openArray("recipient");
15620        for (Reference e : element.getRecipient()) 
15621          composeReference(null, e);
15622        closeArray();
15623      };
15624      if (element.hasPayload()) {
15625        openArray("payload");
15626        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
15627          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
15628        closeArray();
15629      };
15630      if (element.hasMedium()) {
15631        openArray("medium");
15632        for (CodeableConcept e : element.getMedium()) 
15633          composeCodeableConcept(null, e);
15634        closeArray();
15635      };
15636      if (element.hasRequester()) {
15637        composeReference("requester", element.getRequester());
15638      }
15639      if (element.hasStatusElement()) {
15640        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15641        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15642      }
15643      if (element.hasEncounter()) {
15644        composeReference("encounter", element.getEncounter());
15645      }
15646      if (element.hasScheduled()) {
15647        composeType("scheduled", element.getScheduled());
15648      }
15649      if (element.hasReason()) {
15650        openArray("reason");
15651        for (CodeableConcept e : element.getReason()) 
15652          composeCodeableConcept(null, e);
15653        closeArray();
15654      };
15655      if (element.hasRequestedOnElement()) {
15656        composeDateTimeCore("requestedOn", element.getRequestedOnElement(), false);
15657        composeDateTimeExtras("requestedOn", element.getRequestedOnElement(), false);
15658      }
15659      if (element.hasSubject()) {
15660        composeReference("subject", element.getSubject());
15661      }
15662      if (element.hasPriority()) {
15663        composeCodeableConcept("priority", element.getPriority());
15664      }
15665  }
15666
15667  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15668    if (element != null) {
15669      open(name);
15670      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
15671      close();
15672    }
15673  }
15674
15675  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15676      composeBackbone(element);
15677      if (element.hasContent()) {
15678        composeType("content", element.getContent());
15679      }
15680  }
15681
15682  protected void composeComposition(String name, Composition element) throws IOException {
15683    if (element != null) {
15684      prop("resourceType", name);
15685      composeCompositionInner(element);
15686    }
15687  }
15688
15689  protected void composeCompositionInner(Composition element) throws IOException {
15690      composeDomainResourceElements(element);
15691      if (element.hasIdentifier()) {
15692        composeIdentifier("identifier", element.getIdentifier());
15693      }
15694      if (element.hasDateElement()) {
15695        composeDateTimeCore("date", element.getDateElement(), false);
15696        composeDateTimeExtras("date", element.getDateElement(), false);
15697      }
15698      if (element.hasType()) {
15699        composeCodeableConcept("type", element.getType());
15700      }
15701      if (element.hasClass_()) {
15702        composeCodeableConcept("class", element.getClass_());
15703      }
15704      if (element.hasTitleElement()) {
15705        composeStringCore("title", element.getTitleElement(), false);
15706        composeStringExtras("title", element.getTitleElement(), false);
15707      }
15708      if (element.hasStatusElement()) {
15709        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15710        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15711      }
15712      if (element.hasConfidentialityElement()) {
15713        composeCodeCore("confidentiality", element.getConfidentialityElement(), false);
15714        composeCodeExtras("confidentiality", element.getConfidentialityElement(), false);
15715      }
15716      if (element.hasSubject()) {
15717        composeReference("subject", element.getSubject());
15718      }
15719      if (element.hasAuthor()) {
15720        openArray("author");
15721        for (Reference e : element.getAuthor()) 
15722          composeReference(null, e);
15723        closeArray();
15724      };
15725      if (element.hasAttester()) {
15726        openArray("attester");
15727        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
15728          composeCompositionCompositionAttesterComponent(null, e);
15729        closeArray();
15730      };
15731      if (element.hasCustodian()) {
15732        composeReference("custodian", element.getCustodian());
15733      }
15734      if (element.hasEvent()) {
15735        openArray("event");
15736        for (Composition.CompositionEventComponent e : element.getEvent()) 
15737          composeCompositionCompositionEventComponent(null, e);
15738        closeArray();
15739      };
15740      if (element.hasEncounter()) {
15741        composeReference("encounter", element.getEncounter());
15742      }
15743      if (element.hasSection()) {
15744        openArray("section");
15745        for (Composition.SectionComponent e : element.getSection()) 
15746          composeCompositionSectionComponent(null, e);
15747        closeArray();
15748      };
15749  }
15750
15751  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
15752    if (element != null) {
15753      open(name);
15754      composeCompositionCompositionAttesterComponentInner(element);
15755      close();
15756    }
15757  }
15758
15759  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
15760      composeBackbone(element);
15761      if (element.hasMode()) {
15762        openArray("mode");
15763        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15764          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15765        closeArray();
15766        if (anyHasExtras(element.getMode())) {
15767          openArray("_mode");
15768          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15769            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15770          closeArray();
15771        }
15772      };
15773      if (element.hasTimeElement()) {
15774        composeDateTimeCore("time", element.getTimeElement(), false);
15775        composeDateTimeExtras("time", element.getTimeElement(), false);
15776      }
15777      if (element.hasParty()) {
15778        composeReference("party", element.getParty());
15779      }
15780  }
15781
15782  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
15783    if (element != null) {
15784      open(name);
15785      composeCompositionCompositionEventComponentInner(element);
15786      close();
15787    }
15788  }
15789
15790  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
15791      composeBackbone(element);
15792      if (element.hasCode()) {
15793        openArray("code");
15794        for (CodeableConcept e : element.getCode()) 
15795          composeCodeableConcept(null, e);
15796        closeArray();
15797      };
15798      if (element.hasPeriod()) {
15799        composePeriod("period", element.getPeriod());
15800      }
15801      if (element.hasDetail()) {
15802        openArray("detail");
15803        for (Reference e : element.getDetail()) 
15804          composeReference(null, e);
15805        closeArray();
15806      };
15807  }
15808
15809  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
15810    if (element != null) {
15811      open(name);
15812      composeCompositionSectionComponentInner(element);
15813      close();
15814    }
15815  }
15816
15817  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
15818      composeBackbone(element);
15819      if (element.hasTitleElement()) {
15820        composeStringCore("title", element.getTitleElement(), false);
15821        composeStringExtras("title", element.getTitleElement(), false);
15822      }
15823      if (element.hasCode()) {
15824        composeCodeableConcept("code", element.getCode());
15825      }
15826      if (element.hasText()) {
15827        composeNarrative("text", element.getText());
15828      }
15829      if (element.hasModeElement()) {
15830        composeCodeCore("mode", element.getModeElement(), false);
15831        composeCodeExtras("mode", element.getModeElement(), false);
15832      }
15833      if (element.hasOrderedBy()) {
15834        composeCodeableConcept("orderedBy", element.getOrderedBy());
15835      }
15836      if (element.hasEntry()) {
15837        openArray("entry");
15838        for (Reference e : element.getEntry()) 
15839          composeReference(null, e);
15840        closeArray();
15841      };
15842      if (element.hasEmptyReason()) {
15843        composeCodeableConcept("emptyReason", element.getEmptyReason());
15844      }
15845      if (element.hasSection()) {
15846        openArray("section");
15847        for (Composition.SectionComponent e : element.getSection()) 
15848          composeCompositionSectionComponent(null, e);
15849        closeArray();
15850      };
15851  }
15852
15853  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
15854    if (element != null) {
15855      prop("resourceType", name);
15856      composeConceptMapInner(element);
15857    }
15858  }
15859
15860  protected void composeConceptMapInner(ConceptMap element) throws IOException {
15861      composeDomainResourceElements(element);
15862      if (element.hasUrlElement()) {
15863        composeUriCore("url", element.getUrlElement(), false);
15864        composeUriExtras("url", element.getUrlElement(), false);
15865      }
15866      if (element.hasIdentifier()) {
15867        composeIdentifier("identifier", element.getIdentifier());
15868      }
15869      if (element.hasVersionElement()) {
15870        composeStringCore("version", element.getVersionElement(), false);
15871        composeStringExtras("version", element.getVersionElement(), false);
15872      }
15873      if (element.hasNameElement()) {
15874        composeStringCore("name", element.getNameElement(), false);
15875        composeStringExtras("name", element.getNameElement(), false);
15876      }
15877      if (element.hasStatusElement()) {
15878        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15879        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15880      }
15881      if (element.hasExperimentalElement()) {
15882        composeBooleanCore("experimental", element.getExperimentalElement(), false);
15883        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
15884      }
15885      if (element.hasPublisherElement()) {
15886        composeStringCore("publisher", element.getPublisherElement(), false);
15887        composeStringExtras("publisher", element.getPublisherElement(), false);
15888      }
15889      if (element.hasContact()) {
15890        openArray("contact");
15891        for (ConceptMap.ConceptMapContactComponent e : element.getContact()) 
15892          composeConceptMapConceptMapContactComponent(null, e);
15893        closeArray();
15894      };
15895      if (element.hasDateElement()) {
15896        composeDateTimeCore("date", element.getDateElement(), false);
15897        composeDateTimeExtras("date", element.getDateElement(), false);
15898      }
15899      if (element.hasDescriptionElement()) {
15900        composeStringCore("description", element.getDescriptionElement(), false);
15901        composeStringExtras("description", element.getDescriptionElement(), false);
15902      }
15903      if (element.hasUseContext()) {
15904        openArray("useContext");
15905        for (CodeableConcept e : element.getUseContext()) 
15906          composeCodeableConcept(null, e);
15907        closeArray();
15908      };
15909      if (element.hasRequirementsElement()) {
15910        composeStringCore("requirements", element.getRequirementsElement(), false);
15911        composeStringExtras("requirements", element.getRequirementsElement(), false);
15912      }
15913      if (element.hasCopyrightElement()) {
15914        composeStringCore("copyright", element.getCopyrightElement(), false);
15915        composeStringExtras("copyright", element.getCopyrightElement(), false);
15916      }
15917      if (element.hasSource()) {
15918        composeType("source", element.getSource());
15919      }
15920      if (element.hasTarget()) {
15921        composeType("target", element.getTarget());
15922      }
15923      if (element.hasElement()) {
15924        openArray("element");
15925        for (ConceptMap.SourceElementComponent e : element.getElement()) 
15926          composeConceptMapSourceElementComponent(null, e);
15927        closeArray();
15928      };
15929  }
15930
15931  protected void composeConceptMapConceptMapContactComponent(String name, ConceptMap.ConceptMapContactComponent element) throws IOException {
15932    if (element != null) {
15933      open(name);
15934      composeConceptMapConceptMapContactComponentInner(element);
15935      close();
15936    }
15937  }
15938
15939  protected void composeConceptMapConceptMapContactComponentInner(ConceptMap.ConceptMapContactComponent element) throws IOException {
15940      composeBackbone(element);
15941      if (element.hasNameElement()) {
15942        composeStringCore("name", element.getNameElement(), false);
15943        composeStringExtras("name", element.getNameElement(), false);
15944      }
15945      if (element.hasTelecom()) {
15946        openArray("telecom");
15947        for (ContactPoint e : element.getTelecom()) 
15948          composeContactPoint(null, e);
15949        closeArray();
15950      };
15951  }
15952
15953  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
15954    if (element != null) {
15955      open(name);
15956      composeConceptMapSourceElementComponentInner(element);
15957      close();
15958    }
15959  }
15960
15961  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
15962      composeBackbone(element);
15963      if (element.hasCodeSystemElement()) {
15964        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
15965        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
15966      }
15967      if (element.hasCodeElement()) {
15968        composeCodeCore("code", element.getCodeElement(), false);
15969        composeCodeExtras("code", element.getCodeElement(), false);
15970      }
15971      if (element.hasTarget()) {
15972        openArray("target");
15973        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
15974          composeConceptMapTargetElementComponent(null, e);
15975        closeArray();
15976      };
15977  }
15978
15979  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
15980    if (element != null) {
15981      open(name);
15982      composeConceptMapTargetElementComponentInner(element);
15983      close();
15984    }
15985  }
15986
15987  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
15988      composeBackbone(element);
15989      if (element.hasCodeSystemElement()) {
15990        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
15991        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
15992      }
15993      if (element.hasCodeElement()) {
15994        composeCodeCore("code", element.getCodeElement(), false);
15995        composeCodeExtras("code", element.getCodeElement(), false);
15996      }
15997      if (element.hasEquivalenceElement()) {
15998        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
15999        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
16000      }
16001      if (element.hasCommentsElement()) {
16002        composeStringCore("comments", element.getCommentsElement(), false);
16003        composeStringExtras("comments", element.getCommentsElement(), false);
16004      }
16005      if (element.hasDependsOn()) {
16006        openArray("dependsOn");
16007        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
16008          composeConceptMapOtherElementComponent(null, e);
16009        closeArray();
16010      };
16011      if (element.hasProduct()) {
16012        openArray("product");
16013        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
16014          composeConceptMapOtherElementComponent(null, e);
16015        closeArray();
16016      };
16017  }
16018
16019  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
16020    if (element != null) {
16021      open(name);
16022      composeConceptMapOtherElementComponentInner(element);
16023      close();
16024    }
16025  }
16026
16027  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
16028      composeBackbone(element);
16029      if (element.hasElementElement()) {
16030        composeUriCore("element", element.getElementElement(), false);
16031        composeUriExtras("element", element.getElementElement(), false);
16032      }
16033      if (element.hasCodeSystemElement()) {
16034        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
16035        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
16036      }
16037      if (element.hasCodeElement()) {
16038        composeStringCore("code", element.getCodeElement(), false);
16039        composeStringExtras("code", element.getCodeElement(), false);
16040      }
16041  }
16042
16043  protected void composeCondition(String name, Condition element) throws IOException {
16044    if (element != null) {
16045      prop("resourceType", name);
16046      composeConditionInner(element);
16047    }
16048  }
16049
16050  protected void composeConditionInner(Condition element) throws IOException {
16051      composeDomainResourceElements(element);
16052      if (element.hasIdentifier()) {
16053        openArray("identifier");
16054        for (Identifier e : element.getIdentifier()) 
16055          composeIdentifier(null, e);
16056        closeArray();
16057      };
16058      if (element.hasPatient()) {
16059        composeReference("patient", element.getPatient());
16060      }
16061      if (element.hasEncounter()) {
16062        composeReference("encounter", element.getEncounter());
16063      }
16064      if (element.hasAsserter()) {
16065        composeReference("asserter", element.getAsserter());
16066      }
16067      if (element.hasDateRecordedElement()) {
16068        composeDateCore("dateRecorded", element.getDateRecordedElement(), false);
16069        composeDateExtras("dateRecorded", element.getDateRecordedElement(), false);
16070      }
16071      if (element.hasCode()) {
16072        composeCodeableConcept("code", element.getCode());
16073      }
16074      if (element.hasCategory()) {
16075        composeCodeableConcept("category", element.getCategory());
16076      }
16077      if (element.hasClinicalStatusElement()) {
16078        composeCodeCore("clinicalStatus", element.getClinicalStatusElement(), false);
16079        composeCodeExtras("clinicalStatus", element.getClinicalStatusElement(), false);
16080      }
16081      if (element.hasVerificationStatusElement()) {
16082        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16083        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16084      }
16085      if (element.hasSeverity()) {
16086        composeCodeableConcept("severity", element.getSeverity());
16087      }
16088      if (element.hasOnset()) {
16089        composeType("onset", element.getOnset());
16090      }
16091      if (element.hasAbatement()) {
16092        composeType("abatement", element.getAbatement());
16093      }
16094      if (element.hasStage()) {
16095        composeConditionConditionStageComponent("stage", element.getStage());
16096      }
16097      if (element.hasEvidence()) {
16098        openArray("evidence");
16099        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
16100          composeConditionConditionEvidenceComponent(null, e);
16101        closeArray();
16102      };
16103      if (element.hasBodySite()) {
16104        openArray("bodySite");
16105        for (CodeableConcept e : element.getBodySite()) 
16106          composeCodeableConcept(null, e);
16107        closeArray();
16108      };
16109      if (element.hasNotesElement()) {
16110        composeStringCore("notes", element.getNotesElement(), false);
16111        composeStringExtras("notes", element.getNotesElement(), false);
16112      }
16113  }
16114
16115  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
16116    if (element != null) {
16117      open(name);
16118      composeConditionConditionStageComponentInner(element);
16119      close();
16120    }
16121  }
16122
16123  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
16124      composeBackbone(element);
16125      if (element.hasSummary()) {
16126        composeCodeableConcept("summary", element.getSummary());
16127      }
16128      if (element.hasAssessment()) {
16129        openArray("assessment");
16130        for (Reference e : element.getAssessment()) 
16131          composeReference(null, e);
16132        closeArray();
16133      };
16134  }
16135
16136  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
16137    if (element != null) {
16138      open(name);
16139      composeConditionConditionEvidenceComponentInner(element);
16140      close();
16141    }
16142  }
16143
16144  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
16145      composeBackbone(element);
16146      if (element.hasCode()) {
16147        composeCodeableConcept("code", element.getCode());
16148      }
16149      if (element.hasDetail()) {
16150        openArray("detail");
16151        for (Reference e : element.getDetail()) 
16152          composeReference(null, e);
16153        closeArray();
16154      };
16155  }
16156
16157  protected void composeConformance(String name, Conformance element) throws IOException {
16158    if (element != null) {
16159      prop("resourceType", name);
16160      composeConformanceInner(element);
16161    }
16162  }
16163
16164  protected void composeConformanceInner(Conformance element) throws IOException {
16165      composeDomainResourceElements(element);
16166      if (element.hasUrlElement()) {
16167        composeUriCore("url", element.getUrlElement(), false);
16168        composeUriExtras("url", element.getUrlElement(), false);
16169      }
16170      if (element.hasVersionElement()) {
16171        composeStringCore("version", element.getVersionElement(), false);
16172        composeStringExtras("version", element.getVersionElement(), false);
16173      }
16174      if (element.hasNameElement()) {
16175        composeStringCore("name", element.getNameElement(), false);
16176        composeStringExtras("name", element.getNameElement(), false);
16177      }
16178      if (element.hasStatusElement()) {
16179        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16180        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16181      }
16182      if (element.hasExperimentalElement()) {
16183        composeBooleanCore("experimental", element.getExperimentalElement(), false);
16184        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
16185      }
16186      if (element.hasPublisherElement()) {
16187        composeStringCore("publisher", element.getPublisherElement(), false);
16188        composeStringExtras("publisher", element.getPublisherElement(), false);
16189      }
16190      if (element.hasContact()) {
16191        openArray("contact");
16192        for (Conformance.ConformanceContactComponent e : element.getContact()) 
16193          composeConformanceConformanceContactComponent(null, e);
16194        closeArray();
16195      };
16196      if (element.hasDateElement()) {
16197        composeDateTimeCore("date", element.getDateElement(), false);
16198        composeDateTimeExtras("date", element.getDateElement(), false);
16199      }
16200      if (element.hasDescriptionElement()) {
16201        composeStringCore("description", element.getDescriptionElement(), false);
16202        composeStringExtras("description", element.getDescriptionElement(), false);
16203      }
16204      if (element.hasRequirementsElement()) {
16205        composeStringCore("requirements", element.getRequirementsElement(), false);
16206        composeStringExtras("requirements", element.getRequirementsElement(), false);
16207      }
16208      if (element.hasCopyrightElement()) {
16209        composeStringCore("copyright", element.getCopyrightElement(), false);
16210        composeStringExtras("copyright", element.getCopyrightElement(), false);
16211      }
16212      if (element.hasKindElement()) {
16213        composeEnumerationCore("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16214        composeEnumerationExtras("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16215      }
16216      if (element.hasSoftware()) {
16217        composeConformanceConformanceSoftwareComponent("software", element.getSoftware());
16218      }
16219      if (element.hasImplementation()) {
16220        composeConformanceConformanceImplementationComponent("implementation", element.getImplementation());
16221      }
16222      if (element.hasFhirVersionElement()) {
16223        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
16224        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
16225      }
16226      if (element.hasAcceptUnknownElement()) {
16227        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16228        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16229      }
16230      if (element.hasFormat()) {
16231        openArray("format");
16232        for (CodeType e : element.getFormat()) 
16233          composeCodeCore(null, e, true);
16234        closeArray();
16235        if (anyHasExtras(element.getFormat())) {
16236          openArray("_format");
16237          for (CodeType e : element.getFormat()) 
16238            composeCodeExtras(null, e, true);
16239          closeArray();
16240        }
16241      };
16242      if (element.hasProfile()) {
16243        openArray("profile");
16244        for (Reference e : element.getProfile()) 
16245          composeReference(null, e);
16246        closeArray();
16247      };
16248      if (element.hasRest()) {
16249        openArray("rest");
16250        for (Conformance.ConformanceRestComponent e : element.getRest()) 
16251          composeConformanceConformanceRestComponent(null, e);
16252        closeArray();
16253      };
16254      if (element.hasMessaging()) {
16255        openArray("messaging");
16256        for (Conformance.ConformanceMessagingComponent e : element.getMessaging()) 
16257          composeConformanceConformanceMessagingComponent(null, e);
16258        closeArray();
16259      };
16260      if (element.hasDocument()) {
16261        openArray("document");
16262        for (Conformance.ConformanceDocumentComponent e : element.getDocument()) 
16263          composeConformanceConformanceDocumentComponent(null, e);
16264        closeArray();
16265      };
16266  }
16267
16268  protected void composeConformanceConformanceContactComponent(String name, Conformance.ConformanceContactComponent element) throws IOException {
16269    if (element != null) {
16270      open(name);
16271      composeConformanceConformanceContactComponentInner(element);
16272      close();
16273    }
16274  }
16275
16276  protected void composeConformanceConformanceContactComponentInner(Conformance.ConformanceContactComponent element) throws IOException {
16277      composeBackbone(element);
16278      if (element.hasNameElement()) {
16279        composeStringCore("name", element.getNameElement(), false);
16280        composeStringExtras("name", element.getNameElement(), false);
16281      }
16282      if (element.hasTelecom()) {
16283        openArray("telecom");
16284        for (ContactPoint e : element.getTelecom()) 
16285          composeContactPoint(null, e);
16286        closeArray();
16287      };
16288  }
16289
16290  protected void composeConformanceConformanceSoftwareComponent(String name, Conformance.ConformanceSoftwareComponent element) throws IOException {
16291    if (element != null) {
16292      open(name);
16293      composeConformanceConformanceSoftwareComponentInner(element);
16294      close();
16295    }
16296  }
16297
16298  protected void composeConformanceConformanceSoftwareComponentInner(Conformance.ConformanceSoftwareComponent element) throws IOException {
16299      composeBackbone(element);
16300      if (element.hasNameElement()) {
16301        composeStringCore("name", element.getNameElement(), false);
16302        composeStringExtras("name", element.getNameElement(), false);
16303      }
16304      if (element.hasVersionElement()) {
16305        composeStringCore("version", element.getVersionElement(), false);
16306        composeStringExtras("version", element.getVersionElement(), false);
16307      }
16308      if (element.hasReleaseDateElement()) {
16309        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
16310        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
16311      }
16312  }
16313
16314  protected void composeConformanceConformanceImplementationComponent(String name, Conformance.ConformanceImplementationComponent element) throws IOException {
16315    if (element != null) {
16316      open(name);
16317      composeConformanceConformanceImplementationComponentInner(element);
16318      close();
16319    }
16320  }
16321
16322  protected void composeConformanceConformanceImplementationComponentInner(Conformance.ConformanceImplementationComponent element) throws IOException {
16323      composeBackbone(element);
16324      if (element.hasDescriptionElement()) {
16325        composeStringCore("description", element.getDescriptionElement(), false);
16326        composeStringExtras("description", element.getDescriptionElement(), false);
16327      }
16328      if (element.hasUrlElement()) {
16329        composeUriCore("url", element.getUrlElement(), false);
16330        composeUriExtras("url", element.getUrlElement(), false);
16331      }
16332  }
16333
16334  protected void composeConformanceConformanceRestComponent(String name, Conformance.ConformanceRestComponent element) throws IOException {
16335    if (element != null) {
16336      open(name);
16337      composeConformanceConformanceRestComponentInner(element);
16338      close();
16339    }
16340  }
16341
16342  protected void composeConformanceConformanceRestComponentInner(Conformance.ConformanceRestComponent element) throws IOException {
16343      composeBackbone(element);
16344      if (element.hasModeElement()) {
16345        composeEnumerationCore("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16346        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16347      }
16348      if (element.hasDocumentationElement()) {
16349        composeStringCore("documentation", element.getDocumentationElement(), false);
16350        composeStringExtras("documentation", element.getDocumentationElement(), false);
16351      }
16352      if (element.hasSecurity()) {
16353        composeConformanceConformanceRestSecurityComponent("security", element.getSecurity());
16354      }
16355      if (element.hasResource()) {
16356        openArray("resource");
16357        for (Conformance.ConformanceRestResourceComponent e : element.getResource()) 
16358          composeConformanceConformanceRestResourceComponent(null, e);
16359        closeArray();
16360      };
16361      if (element.hasInteraction()) {
16362        openArray("interaction");
16363        for (Conformance.SystemInteractionComponent e : element.getInteraction()) 
16364          composeConformanceSystemInteractionComponent(null, e);
16365        closeArray();
16366      };
16367      if (element.hasTransactionModeElement()) {
16368        composeEnumerationCore("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16369        composeEnumerationExtras("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16370      }
16371      if (element.hasSearchParam()) {
16372        openArray("searchParam");
16373        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16374          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16375        closeArray();
16376      };
16377      if (element.hasOperation()) {
16378        openArray("operation");
16379        for (Conformance.ConformanceRestOperationComponent e : element.getOperation()) 
16380          composeConformanceConformanceRestOperationComponent(null, e);
16381        closeArray();
16382      };
16383      if (element.hasCompartment()) {
16384        openArray("compartment");
16385        for (UriType e : element.getCompartment()) 
16386          composeUriCore(null, e, true);
16387        closeArray();
16388        if (anyHasExtras(element.getCompartment())) {
16389          openArray("_compartment");
16390          for (UriType e : element.getCompartment()) 
16391            composeUriExtras(null, e, true);
16392          closeArray();
16393        }
16394      };
16395  }
16396
16397  protected void composeConformanceConformanceRestSecurityComponent(String name, Conformance.ConformanceRestSecurityComponent element) throws IOException {
16398    if (element != null) {
16399      open(name);
16400      composeConformanceConformanceRestSecurityComponentInner(element);
16401      close();
16402    }
16403  }
16404
16405  protected void composeConformanceConformanceRestSecurityComponentInner(Conformance.ConformanceRestSecurityComponent element) throws IOException {
16406      composeBackbone(element);
16407      if (element.hasCorsElement()) {
16408        composeBooleanCore("cors", element.getCorsElement(), false);
16409        composeBooleanExtras("cors", element.getCorsElement(), false);
16410      }
16411      if (element.hasService()) {
16412        openArray("service");
16413        for (CodeableConcept e : element.getService()) 
16414          composeCodeableConcept(null, e);
16415        closeArray();
16416      };
16417      if (element.hasDescriptionElement()) {
16418        composeStringCore("description", element.getDescriptionElement(), false);
16419        composeStringExtras("description", element.getDescriptionElement(), false);
16420      }
16421      if (element.hasCertificate()) {
16422        openArray("certificate");
16423        for (Conformance.ConformanceRestSecurityCertificateComponent e : element.getCertificate()) 
16424          composeConformanceConformanceRestSecurityCertificateComponent(null, e);
16425        closeArray();
16426      };
16427  }
16428
16429  protected void composeConformanceConformanceRestSecurityCertificateComponent(String name, Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16430    if (element != null) {
16431      open(name);
16432      composeConformanceConformanceRestSecurityCertificateComponentInner(element);
16433      close();
16434    }
16435  }
16436
16437  protected void composeConformanceConformanceRestSecurityCertificateComponentInner(Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16438      composeBackbone(element);
16439      if (element.hasTypeElement()) {
16440        composeCodeCore("type", element.getTypeElement(), false);
16441        composeCodeExtras("type", element.getTypeElement(), false);
16442      }
16443      if (element.hasBlobElement()) {
16444        composeBase64BinaryCore("blob", element.getBlobElement(), false);
16445        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
16446      }
16447  }
16448
16449  protected void composeConformanceConformanceRestResourceComponent(String name, Conformance.ConformanceRestResourceComponent element) throws IOException {
16450    if (element != null) {
16451      open(name);
16452      composeConformanceConformanceRestResourceComponentInner(element);
16453      close();
16454    }
16455  }
16456
16457  protected void composeConformanceConformanceRestResourceComponentInner(Conformance.ConformanceRestResourceComponent element) throws IOException {
16458      composeBackbone(element);
16459      if (element.hasTypeElement()) {
16460        composeCodeCore("type", element.getTypeElement(), false);
16461        composeCodeExtras("type", element.getTypeElement(), false);
16462      }
16463      if (element.hasProfile()) {
16464        composeReference("profile", element.getProfile());
16465      }
16466      if (element.hasInteraction()) {
16467        openArray("interaction");
16468        for (Conformance.ResourceInteractionComponent e : element.getInteraction()) 
16469          composeConformanceResourceInteractionComponent(null, e);
16470        closeArray();
16471      };
16472      if (element.hasVersioningElement()) {
16473        composeEnumerationCore("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16474        composeEnumerationExtras("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16475      }
16476      if (element.hasReadHistoryElement()) {
16477        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
16478        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
16479      }
16480      if (element.hasUpdateCreateElement()) {
16481        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
16482        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
16483      }
16484      if (element.hasConditionalCreateElement()) {
16485        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
16486        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
16487      }
16488      if (element.hasConditionalUpdateElement()) {
16489        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
16490        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
16491      }
16492      if (element.hasConditionalDeleteElement()) {
16493        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16494        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16495      }
16496      if (element.hasSearchInclude()) {
16497        openArray("searchInclude");
16498        for (StringType e : element.getSearchInclude()) 
16499          composeStringCore(null, e, true);
16500        closeArray();
16501        if (anyHasExtras(element.getSearchInclude())) {
16502          openArray("_searchInclude");
16503          for (StringType e : element.getSearchInclude()) 
16504            composeStringExtras(null, e, true);
16505          closeArray();
16506        }
16507      };
16508      if (element.hasSearchRevInclude()) {
16509        openArray("searchRevInclude");
16510        for (StringType e : element.getSearchRevInclude()) 
16511          composeStringCore(null, e, true);
16512        closeArray();
16513        if (anyHasExtras(element.getSearchRevInclude())) {
16514          openArray("_searchRevInclude");
16515          for (StringType e : element.getSearchRevInclude()) 
16516            composeStringExtras(null, e, true);
16517          closeArray();
16518        }
16519      };
16520      if (element.hasSearchParam()) {
16521        openArray("searchParam");
16522        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16523          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16524        closeArray();
16525      };
16526  }
16527
16528  protected void composeConformanceResourceInteractionComponent(String name, Conformance.ResourceInteractionComponent element) throws IOException {
16529    if (element != null) {
16530      open(name);
16531      composeConformanceResourceInteractionComponentInner(element);
16532      close();
16533    }
16534  }
16535
16536  protected void composeConformanceResourceInteractionComponentInner(Conformance.ResourceInteractionComponent element) throws IOException {
16537      composeBackbone(element);
16538      if (element.hasCodeElement()) {
16539        composeEnumerationCore("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16540        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16541      }
16542      if (element.hasDocumentationElement()) {
16543        composeStringCore("documentation", element.getDocumentationElement(), false);
16544        composeStringExtras("documentation", element.getDocumentationElement(), false);
16545      }
16546  }
16547
16548  protected void composeConformanceConformanceRestResourceSearchParamComponent(String name, Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16549    if (element != null) {
16550      open(name);
16551      composeConformanceConformanceRestResourceSearchParamComponentInner(element);
16552      close();
16553    }
16554  }
16555
16556  protected void composeConformanceConformanceRestResourceSearchParamComponentInner(Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16557      composeBackbone(element);
16558      if (element.hasNameElement()) {
16559        composeStringCore("name", element.getNameElement(), false);
16560        composeStringExtras("name", element.getNameElement(), false);
16561      }
16562      if (element.hasDefinitionElement()) {
16563        composeUriCore("definition", element.getDefinitionElement(), false);
16564        composeUriExtras("definition", element.getDefinitionElement(), false);
16565      }
16566      if (element.hasTypeElement()) {
16567        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16568        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16569      }
16570      if (element.hasDocumentationElement()) {
16571        composeStringCore("documentation", element.getDocumentationElement(), false);
16572        composeStringExtras("documentation", element.getDocumentationElement(), false);
16573      }
16574      if (element.hasTarget()) {
16575        openArray("target");
16576        for (CodeType e : element.getTarget()) 
16577          composeCodeCore(null, e, true);
16578        closeArray();
16579        if (anyHasExtras(element.getTarget())) {
16580          openArray("_target");
16581          for (CodeType e : element.getTarget()) 
16582            composeCodeExtras(null, e, true);
16583          closeArray();
16584        }
16585      };
16586      if (element.hasModifier()) {
16587        openArray("modifier");
16588        for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16589          composeEnumerationCore(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16590        closeArray();
16591        if (anyHasExtras(element.getModifier())) {
16592          openArray("_modifier");
16593          for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16594            composeEnumerationExtras(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16595          closeArray();
16596        }
16597      };
16598      if (element.hasChain()) {
16599        openArray("chain");
16600        for (StringType e : element.getChain()) 
16601          composeStringCore(null, e, true);
16602        closeArray();
16603        if (anyHasExtras(element.getChain())) {
16604          openArray("_chain");
16605          for (StringType e : element.getChain()) 
16606            composeStringExtras(null, e, true);
16607          closeArray();
16608        }
16609      };
16610  }
16611
16612  protected void composeConformanceSystemInteractionComponent(String name, Conformance.SystemInteractionComponent element) throws IOException {
16613    if (element != null) {
16614      open(name);
16615      composeConformanceSystemInteractionComponentInner(element);
16616      close();
16617    }
16618  }
16619
16620  protected void composeConformanceSystemInteractionComponentInner(Conformance.SystemInteractionComponent element) throws IOException {
16621      composeBackbone(element);
16622      if (element.hasCodeElement()) {
16623        composeEnumerationCore("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16624        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16625      }
16626      if (element.hasDocumentationElement()) {
16627        composeStringCore("documentation", element.getDocumentationElement(), false);
16628        composeStringExtras("documentation", element.getDocumentationElement(), false);
16629      }
16630  }
16631
16632  protected void composeConformanceConformanceRestOperationComponent(String name, Conformance.ConformanceRestOperationComponent element) throws IOException {
16633    if (element != null) {
16634      open(name);
16635      composeConformanceConformanceRestOperationComponentInner(element);
16636      close();
16637    }
16638  }
16639
16640  protected void composeConformanceConformanceRestOperationComponentInner(Conformance.ConformanceRestOperationComponent element) throws IOException {
16641      composeBackbone(element);
16642      if (element.hasNameElement()) {
16643        composeStringCore("name", element.getNameElement(), false);
16644        composeStringExtras("name", element.getNameElement(), false);
16645      }
16646      if (element.hasDefinition()) {
16647        composeReference("definition", element.getDefinition());
16648      }
16649  }
16650
16651  protected void composeConformanceConformanceMessagingComponent(String name, Conformance.ConformanceMessagingComponent element) throws IOException {
16652    if (element != null) {
16653      open(name);
16654      composeConformanceConformanceMessagingComponentInner(element);
16655      close();
16656    }
16657  }
16658
16659  protected void composeConformanceConformanceMessagingComponentInner(Conformance.ConformanceMessagingComponent element) throws IOException {
16660      composeBackbone(element);
16661      if (element.hasEndpoint()) {
16662        openArray("endpoint");
16663        for (Conformance.ConformanceMessagingEndpointComponent e : element.getEndpoint()) 
16664          composeConformanceConformanceMessagingEndpointComponent(null, e);
16665        closeArray();
16666      };
16667      if (element.hasReliableCacheElement()) {
16668        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
16669        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
16670      }
16671      if (element.hasDocumentationElement()) {
16672        composeStringCore("documentation", element.getDocumentationElement(), false);
16673        composeStringExtras("documentation", element.getDocumentationElement(), false);
16674      }
16675      if (element.hasEvent()) {
16676        openArray("event");
16677        for (Conformance.ConformanceMessagingEventComponent e : element.getEvent()) 
16678          composeConformanceConformanceMessagingEventComponent(null, e);
16679        closeArray();
16680      };
16681  }
16682
16683  protected void composeConformanceConformanceMessagingEndpointComponent(String name, Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16684    if (element != null) {
16685      open(name);
16686      composeConformanceConformanceMessagingEndpointComponentInner(element);
16687      close();
16688    }
16689  }
16690
16691  protected void composeConformanceConformanceMessagingEndpointComponentInner(Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16692      composeBackbone(element);
16693      if (element.hasProtocol()) {
16694        composeCoding("protocol", element.getProtocol());
16695      }
16696      if (element.hasAddressElement()) {
16697        composeUriCore("address", element.getAddressElement(), false);
16698        composeUriExtras("address", element.getAddressElement(), false);
16699      }
16700  }
16701
16702  protected void composeConformanceConformanceMessagingEventComponent(String name, Conformance.ConformanceMessagingEventComponent element) throws IOException {
16703    if (element != null) {
16704      open(name);
16705      composeConformanceConformanceMessagingEventComponentInner(element);
16706      close();
16707    }
16708  }
16709
16710  protected void composeConformanceConformanceMessagingEventComponentInner(Conformance.ConformanceMessagingEventComponent element) throws IOException {
16711      composeBackbone(element);
16712      if (element.hasCode()) {
16713        composeCoding("code", element.getCode());
16714      }
16715      if (element.hasCategoryElement()) {
16716        composeEnumerationCore("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16717        composeEnumerationExtras("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16718      }
16719      if (element.hasModeElement()) {
16720        composeEnumerationCore("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16721        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16722      }
16723      if (element.hasFocusElement()) {
16724        composeCodeCore("focus", element.getFocusElement(), false);
16725        composeCodeExtras("focus", element.getFocusElement(), false);
16726      }
16727      if (element.hasRequest()) {
16728        composeReference("request", element.getRequest());
16729      }
16730      if (element.hasResponse()) {
16731        composeReference("response", element.getResponse());
16732      }
16733      if (element.hasDocumentationElement()) {
16734        composeStringCore("documentation", element.getDocumentationElement(), false);
16735        composeStringExtras("documentation", element.getDocumentationElement(), false);
16736      }
16737  }
16738
16739  protected void composeConformanceConformanceDocumentComponent(String name, Conformance.ConformanceDocumentComponent element) throws IOException {
16740    if (element != null) {
16741      open(name);
16742      composeConformanceConformanceDocumentComponentInner(element);
16743      close();
16744    }
16745  }
16746
16747  protected void composeConformanceConformanceDocumentComponentInner(Conformance.ConformanceDocumentComponent element) throws IOException {
16748      composeBackbone(element);
16749      if (element.hasModeElement()) {
16750        composeEnumerationCore("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16751        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16752      }
16753      if (element.hasDocumentationElement()) {
16754        composeStringCore("documentation", element.getDocumentationElement(), false);
16755        composeStringExtras("documentation", element.getDocumentationElement(), false);
16756      }
16757      if (element.hasProfile()) {
16758        composeReference("profile", element.getProfile());
16759      }
16760  }
16761
16762  protected void composeContract(String name, Contract element) throws IOException {
16763    if (element != null) {
16764      prop("resourceType", name);
16765      composeContractInner(element);
16766    }
16767  }
16768
16769  protected void composeContractInner(Contract element) throws IOException {
16770      composeDomainResourceElements(element);
16771      if (element.hasIdentifier()) {
16772        composeIdentifier("identifier", element.getIdentifier());
16773      }
16774      if (element.hasIssuedElement()) {
16775        composeDateTimeCore("issued", element.getIssuedElement(), false);
16776        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16777      }
16778      if (element.hasApplies()) {
16779        composePeriod("applies", element.getApplies());
16780      }
16781      if (element.hasSubject()) {
16782        openArray("subject");
16783        for (Reference e : element.getSubject()) 
16784          composeReference(null, e);
16785        closeArray();
16786      };
16787      if (element.hasAuthority()) {
16788        openArray("authority");
16789        for (Reference e : element.getAuthority()) 
16790          composeReference(null, e);
16791        closeArray();
16792      };
16793      if (element.hasDomain()) {
16794        openArray("domain");
16795        for (Reference e : element.getDomain()) 
16796          composeReference(null, e);
16797        closeArray();
16798      };
16799      if (element.hasType()) {
16800        composeCodeableConcept("type", element.getType());
16801      }
16802      if (element.hasSubType()) {
16803        openArray("subType");
16804        for (CodeableConcept e : element.getSubType()) 
16805          composeCodeableConcept(null, e);
16806        closeArray();
16807      };
16808      if (element.hasAction()) {
16809        openArray("action");
16810        for (CodeableConcept e : element.getAction()) 
16811          composeCodeableConcept(null, e);
16812        closeArray();
16813      };
16814      if (element.hasActionReason()) {
16815        openArray("actionReason");
16816        for (CodeableConcept e : element.getActionReason()) 
16817          composeCodeableConcept(null, e);
16818        closeArray();
16819      };
16820      if (element.hasActor()) {
16821        openArray("actor");
16822        for (Contract.ActorComponent e : element.getActor()) 
16823          composeContractActorComponent(null, e);
16824        closeArray();
16825      };
16826      if (element.hasValuedItem()) {
16827        openArray("valuedItem");
16828        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
16829          composeContractValuedItemComponent(null, e);
16830        closeArray();
16831      };
16832      if (element.hasSigner()) {
16833        openArray("signer");
16834        for (Contract.SignatoryComponent e : element.getSigner()) 
16835          composeContractSignatoryComponent(null, e);
16836        closeArray();
16837      };
16838      if (element.hasTerm()) {
16839        openArray("term");
16840        for (Contract.TermComponent e : element.getTerm()) 
16841          composeContractTermComponent(null, e);
16842        closeArray();
16843      };
16844      if (element.hasBinding()) {
16845        composeType("binding", element.getBinding());
16846      }
16847      if (element.hasFriendly()) {
16848        openArray("friendly");
16849        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
16850          composeContractFriendlyLanguageComponent(null, e);
16851        closeArray();
16852      };
16853      if (element.hasLegal()) {
16854        openArray("legal");
16855        for (Contract.LegalLanguageComponent e : element.getLegal()) 
16856          composeContractLegalLanguageComponent(null, e);
16857        closeArray();
16858      };
16859      if (element.hasRule()) {
16860        openArray("rule");
16861        for (Contract.ComputableLanguageComponent e : element.getRule()) 
16862          composeContractComputableLanguageComponent(null, e);
16863        closeArray();
16864      };
16865  }
16866
16867  protected void composeContractActorComponent(String name, Contract.ActorComponent element) throws IOException {
16868    if (element != null) {
16869      open(name);
16870      composeContractActorComponentInner(element);
16871      close();
16872    }
16873  }
16874
16875  protected void composeContractActorComponentInner(Contract.ActorComponent element) throws IOException {
16876      composeBackbone(element);
16877      if (element.hasEntity()) {
16878        composeReference("entity", element.getEntity());
16879      }
16880      if (element.hasRole()) {
16881        openArray("role");
16882        for (CodeableConcept e : element.getRole()) 
16883          composeCodeableConcept(null, e);
16884        closeArray();
16885      };
16886  }
16887
16888  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
16889    if (element != null) {
16890      open(name);
16891      composeContractValuedItemComponentInner(element);
16892      close();
16893    }
16894  }
16895
16896  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
16897      composeBackbone(element);
16898      if (element.hasEntity()) {
16899        composeType("entity", element.getEntity());
16900      }
16901      if (element.hasIdentifier()) {
16902        composeIdentifier("identifier", element.getIdentifier());
16903      }
16904      if (element.hasEffectiveTimeElement()) {
16905        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
16906        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
16907      }
16908      if (element.hasQuantity()) {
16909        composeSimpleQuantity("quantity", element.getQuantity());
16910      }
16911      if (element.hasUnitPrice()) {
16912        composeMoney("unitPrice", element.getUnitPrice());
16913      }
16914      if (element.hasFactorElement()) {
16915        composeDecimalCore("factor", element.getFactorElement(), false);
16916        composeDecimalExtras("factor", element.getFactorElement(), false);
16917      }
16918      if (element.hasPointsElement()) {
16919        composeDecimalCore("points", element.getPointsElement(), false);
16920        composeDecimalExtras("points", element.getPointsElement(), false);
16921      }
16922      if (element.hasNet()) {
16923        composeMoney("net", element.getNet());
16924      }
16925  }
16926
16927  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
16928    if (element != null) {
16929      open(name);
16930      composeContractSignatoryComponentInner(element);
16931      close();
16932    }
16933  }
16934
16935  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
16936      composeBackbone(element);
16937      if (element.hasType()) {
16938        composeCoding("type", element.getType());
16939      }
16940      if (element.hasParty()) {
16941        composeReference("party", element.getParty());
16942      }
16943      if (element.hasSignatureElement()) {
16944        composeStringCore("signature", element.getSignatureElement(), false);
16945        composeStringExtras("signature", element.getSignatureElement(), false);
16946      }
16947  }
16948
16949  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
16950    if (element != null) {
16951      open(name);
16952      composeContractTermComponentInner(element);
16953      close();
16954    }
16955  }
16956
16957  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
16958      composeBackbone(element);
16959      if (element.hasIdentifier()) {
16960        composeIdentifier("identifier", element.getIdentifier());
16961      }
16962      if (element.hasIssuedElement()) {
16963        composeDateTimeCore("issued", element.getIssuedElement(), false);
16964        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16965      }
16966      if (element.hasApplies()) {
16967        composePeriod("applies", element.getApplies());
16968      }
16969      if (element.hasType()) {
16970        composeCodeableConcept("type", element.getType());
16971      }
16972      if (element.hasSubType()) {
16973        composeCodeableConcept("subType", element.getSubType());
16974      }
16975      if (element.hasSubject()) {
16976        composeReference("subject", element.getSubject());
16977      }
16978      if (element.hasAction()) {
16979        openArray("action");
16980        for (CodeableConcept e : element.getAction()) 
16981          composeCodeableConcept(null, e);
16982        closeArray();
16983      };
16984      if (element.hasActionReason()) {
16985        openArray("actionReason");
16986        for (CodeableConcept e : element.getActionReason()) 
16987          composeCodeableConcept(null, e);
16988        closeArray();
16989      };
16990      if (element.hasActor()) {
16991        openArray("actor");
16992        for (Contract.TermActorComponent e : element.getActor()) 
16993          composeContractTermActorComponent(null, e);
16994        closeArray();
16995      };
16996      if (element.hasTextElement()) {
16997        composeStringCore("text", element.getTextElement(), false);
16998        composeStringExtras("text", element.getTextElement(), false);
16999      }
17000      if (element.hasValuedItem()) {
17001        openArray("valuedItem");
17002        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
17003          composeContractTermValuedItemComponent(null, e);
17004        closeArray();
17005      };
17006      if (element.hasGroup()) {
17007        openArray("group");
17008        for (Contract.TermComponent e : element.getGroup()) 
17009          composeContractTermComponent(null, e);
17010        closeArray();
17011      };
17012  }
17013
17014  protected void composeContractTermActorComponent(String name, Contract.TermActorComponent element) throws IOException {
17015    if (element != null) {
17016      open(name);
17017      composeContractTermActorComponentInner(element);
17018      close();
17019    }
17020  }
17021
17022  protected void composeContractTermActorComponentInner(Contract.TermActorComponent element) throws IOException {
17023      composeBackbone(element);
17024      if (element.hasEntity()) {
17025        composeReference("entity", element.getEntity());
17026      }
17027      if (element.hasRole()) {
17028        openArray("role");
17029        for (CodeableConcept e : element.getRole()) 
17030          composeCodeableConcept(null, e);
17031        closeArray();
17032      };
17033  }
17034
17035  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
17036    if (element != null) {
17037      open(name);
17038      composeContractTermValuedItemComponentInner(element);
17039      close();
17040    }
17041  }
17042
17043  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
17044      composeBackbone(element);
17045      if (element.hasEntity()) {
17046        composeType("entity", element.getEntity());
17047      }
17048      if (element.hasIdentifier()) {
17049        composeIdentifier("identifier", element.getIdentifier());
17050      }
17051      if (element.hasEffectiveTimeElement()) {
17052        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
17053        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
17054      }
17055      if (element.hasQuantity()) {
17056        composeSimpleQuantity("quantity", element.getQuantity());
17057      }
17058      if (element.hasUnitPrice()) {
17059        composeMoney("unitPrice", element.getUnitPrice());
17060      }
17061      if (element.hasFactorElement()) {
17062        composeDecimalCore("factor", element.getFactorElement(), false);
17063        composeDecimalExtras("factor", element.getFactorElement(), false);
17064      }
17065      if (element.hasPointsElement()) {
17066        composeDecimalCore("points", element.getPointsElement(), false);
17067        composeDecimalExtras("points", element.getPointsElement(), false);
17068      }
17069      if (element.hasNet()) {
17070        composeMoney("net", element.getNet());
17071      }
17072  }
17073
17074  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
17075    if (element != null) {
17076      open(name);
17077      composeContractFriendlyLanguageComponentInner(element);
17078      close();
17079    }
17080  }
17081
17082  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
17083      composeBackbone(element);
17084      if (element.hasContent()) {
17085        composeType("content", element.getContent());
17086      }
17087  }
17088
17089  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
17090    if (element != null) {
17091      open(name);
17092      composeContractLegalLanguageComponentInner(element);
17093      close();
17094    }
17095  }
17096
17097  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
17098      composeBackbone(element);
17099      if (element.hasContent()) {
17100        composeType("content", element.getContent());
17101      }
17102  }
17103
17104  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
17105    if (element != null) {
17106      open(name);
17107      composeContractComputableLanguageComponentInner(element);
17108      close();
17109    }
17110  }
17111
17112  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
17113      composeBackbone(element);
17114      if (element.hasContent()) {
17115        composeType("content", element.getContent());
17116      }
17117  }
17118
17119  protected void composeCoverage(String name, Coverage element) throws IOException {
17120    if (element != null) {
17121      prop("resourceType", name);
17122      composeCoverageInner(element);
17123    }
17124  }
17125
17126  protected void composeCoverageInner(Coverage element) throws IOException {
17127      composeDomainResourceElements(element);
17128      if (element.hasIssuer()) {
17129        composeReference("issuer", element.getIssuer());
17130      }
17131      if (element.hasBin()) {
17132        composeIdentifier("bin", element.getBin());
17133      }
17134      if (element.hasPeriod()) {
17135        composePeriod("period", element.getPeriod());
17136      }
17137      if (element.hasType()) {
17138        composeCoding("type", element.getType());
17139      }
17140      if (element.hasSubscriberId()) {
17141        composeIdentifier("subscriberId", element.getSubscriberId());
17142      }
17143      if (element.hasIdentifier()) {
17144        openArray("identifier");
17145        for (Identifier e : element.getIdentifier()) 
17146          composeIdentifier(null, e);
17147        closeArray();
17148      };
17149      if (element.hasGroupElement()) {
17150        composeStringCore("group", element.getGroupElement(), false);
17151        composeStringExtras("group", element.getGroupElement(), false);
17152      }
17153      if (element.hasPlanElement()) {
17154        composeStringCore("plan", element.getPlanElement(), false);
17155        composeStringExtras("plan", element.getPlanElement(), false);
17156      }
17157      if (element.hasSubPlanElement()) {
17158        composeStringCore("subPlan", element.getSubPlanElement(), false);
17159        composeStringExtras("subPlan", element.getSubPlanElement(), false);
17160      }
17161      if (element.hasDependentElement()) {
17162        composePositiveIntCore("dependent", element.getDependentElement(), false);
17163        composePositiveIntExtras("dependent", element.getDependentElement(), false);
17164      }
17165      if (element.hasSequenceElement()) {
17166        composePositiveIntCore("sequence", element.getSequenceElement(), false);
17167        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
17168      }
17169      if (element.hasSubscriber()) {
17170        composeReference("subscriber", element.getSubscriber());
17171      }
17172      if (element.hasNetwork()) {
17173        composeIdentifier("network", element.getNetwork());
17174      }
17175      if (element.hasContract()) {
17176        openArray("contract");
17177        for (Reference e : element.getContract()) 
17178          composeReference(null, e);
17179        closeArray();
17180      };
17181  }
17182
17183  protected void composeDataElement(String name, DataElement element) throws IOException {
17184    if (element != null) {
17185      prop("resourceType", name);
17186      composeDataElementInner(element);
17187    }
17188  }
17189
17190  protected void composeDataElementInner(DataElement element) throws IOException {
17191      composeDomainResourceElements(element);
17192      if (element.hasUrlElement()) {
17193        composeUriCore("url", element.getUrlElement(), false);
17194        composeUriExtras("url", element.getUrlElement(), false);
17195      }
17196      if (element.hasIdentifier()) {
17197        openArray("identifier");
17198        for (Identifier e : element.getIdentifier()) 
17199          composeIdentifier(null, e);
17200        closeArray();
17201      };
17202      if (element.hasVersionElement()) {
17203        composeStringCore("version", element.getVersionElement(), false);
17204        composeStringExtras("version", element.getVersionElement(), false);
17205      }
17206      if (element.hasNameElement()) {
17207        composeStringCore("name", element.getNameElement(), false);
17208        composeStringExtras("name", element.getNameElement(), false);
17209      }
17210      if (element.hasStatusElement()) {
17211        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17212        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17213      }
17214      if (element.hasExperimentalElement()) {
17215        composeBooleanCore("experimental", element.getExperimentalElement(), false);
17216        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
17217      }
17218      if (element.hasPublisherElement()) {
17219        composeStringCore("publisher", element.getPublisherElement(), false);
17220        composeStringExtras("publisher", element.getPublisherElement(), false);
17221      }
17222      if (element.hasContact()) {
17223        openArray("contact");
17224        for (DataElement.DataElementContactComponent e : element.getContact()) 
17225          composeDataElementDataElementContactComponent(null, e);
17226        closeArray();
17227      };
17228      if (element.hasDateElement()) {
17229        composeDateTimeCore("date", element.getDateElement(), false);
17230        composeDateTimeExtras("date", element.getDateElement(), false);
17231      }
17232      if (element.hasUseContext()) {
17233        openArray("useContext");
17234        for (CodeableConcept e : element.getUseContext()) 
17235          composeCodeableConcept(null, e);
17236        closeArray();
17237      };
17238      if (element.hasCopyrightElement()) {
17239        composeStringCore("copyright", element.getCopyrightElement(), false);
17240        composeStringExtras("copyright", element.getCopyrightElement(), false);
17241      }
17242      if (element.hasStringencyElement()) {
17243        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17244        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17245      }
17246      if (element.hasMapping()) {
17247        openArray("mapping");
17248        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
17249          composeDataElementDataElementMappingComponent(null, e);
17250        closeArray();
17251      };
17252      if (element.hasElement()) {
17253        openArray("element");
17254        for (ElementDefinition e : element.getElement()) 
17255          composeElementDefinition(null, e);
17256        closeArray();
17257      };
17258  }
17259
17260  protected void composeDataElementDataElementContactComponent(String name, DataElement.DataElementContactComponent element) throws IOException {
17261    if (element != null) {
17262      open(name);
17263      composeDataElementDataElementContactComponentInner(element);
17264      close();
17265    }
17266  }
17267
17268  protected void composeDataElementDataElementContactComponentInner(DataElement.DataElementContactComponent element) throws IOException {
17269      composeBackbone(element);
17270      if (element.hasNameElement()) {
17271        composeStringCore("name", element.getNameElement(), false);
17272        composeStringExtras("name", element.getNameElement(), false);
17273      }
17274      if (element.hasTelecom()) {
17275        openArray("telecom");
17276        for (ContactPoint e : element.getTelecom()) 
17277          composeContactPoint(null, e);
17278        closeArray();
17279      };
17280  }
17281
17282  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
17283    if (element != null) {
17284      open(name);
17285      composeDataElementDataElementMappingComponentInner(element);
17286      close();
17287    }
17288  }
17289
17290  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
17291      composeBackbone(element);
17292      if (element.hasIdentityElement()) {
17293        composeIdCore("identity", element.getIdentityElement(), false);
17294        composeIdExtras("identity", element.getIdentityElement(), false);
17295      }
17296      if (element.hasUriElement()) {
17297        composeUriCore("uri", element.getUriElement(), false);
17298        composeUriExtras("uri", element.getUriElement(), false);
17299      }
17300      if (element.hasNameElement()) {
17301        composeStringCore("name", element.getNameElement(), false);
17302        composeStringExtras("name", element.getNameElement(), false);
17303      }
17304      if (element.hasCommentsElement()) {
17305        composeStringCore("comments", element.getCommentsElement(), false);
17306        composeStringExtras("comments", element.getCommentsElement(), false);
17307      }
17308  }
17309
17310  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
17311    if (element != null) {
17312      prop("resourceType", name);
17313      composeDetectedIssueInner(element);
17314    }
17315  }
17316
17317  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
17318      composeDomainResourceElements(element);
17319      if (element.hasPatient()) {
17320        composeReference("patient", element.getPatient());
17321      }
17322      if (element.hasCategory()) {
17323        composeCodeableConcept("category", element.getCategory());
17324      }
17325      if (element.hasSeverityElement()) {
17326        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17327        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17328      }
17329      if (element.hasImplicated()) {
17330        openArray("implicated");
17331        for (Reference e : element.getImplicated()) 
17332          composeReference(null, e);
17333        closeArray();
17334      };
17335      if (element.hasDetailElement()) {
17336        composeStringCore("detail", element.getDetailElement(), false);
17337        composeStringExtras("detail", element.getDetailElement(), false);
17338      }
17339      if (element.hasDateElement()) {
17340        composeDateTimeCore("date", element.getDateElement(), false);
17341        composeDateTimeExtras("date", element.getDateElement(), false);
17342      }
17343      if (element.hasAuthor()) {
17344        composeReference("author", element.getAuthor());
17345      }
17346      if (element.hasIdentifier()) {
17347        composeIdentifier("identifier", element.getIdentifier());
17348      }
17349      if (element.hasReferenceElement()) {
17350        composeUriCore("reference", element.getReferenceElement(), false);
17351        composeUriExtras("reference", element.getReferenceElement(), false);
17352      }
17353      if (element.hasMitigation()) {
17354        openArray("mitigation");
17355        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
17356          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
17357        closeArray();
17358      };
17359  }
17360
17361  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17362    if (element != null) {
17363      open(name);
17364      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
17365      close();
17366    }
17367  }
17368
17369  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17370      composeBackbone(element);
17371      if (element.hasAction()) {
17372        composeCodeableConcept("action", element.getAction());
17373      }
17374      if (element.hasDateElement()) {
17375        composeDateTimeCore("date", element.getDateElement(), false);
17376        composeDateTimeExtras("date", element.getDateElement(), false);
17377      }
17378      if (element.hasAuthor()) {
17379        composeReference("author", element.getAuthor());
17380      }
17381  }
17382
17383  protected void composeDevice(String name, Device element) throws IOException {
17384    if (element != null) {
17385      prop("resourceType", name);
17386      composeDeviceInner(element);
17387    }
17388  }
17389
17390  protected void composeDeviceInner(Device element) throws IOException {
17391      composeDomainResourceElements(element);
17392      if (element.hasIdentifier()) {
17393        openArray("identifier");
17394        for (Identifier e : element.getIdentifier()) 
17395          composeIdentifier(null, e);
17396        closeArray();
17397      };
17398      if (element.hasType()) {
17399        composeCodeableConcept("type", element.getType());
17400      }
17401      if (element.hasNote()) {
17402        openArray("note");
17403        for (Annotation e : element.getNote()) 
17404          composeAnnotation(null, e);
17405        closeArray();
17406      };
17407      if (element.hasStatusElement()) {
17408        composeEnumerationCore("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17409        composeEnumerationExtras("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17410      }
17411      if (element.hasManufacturerElement()) {
17412        composeStringCore("manufacturer", element.getManufacturerElement(), false);
17413        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
17414      }
17415      if (element.hasModelElement()) {
17416        composeStringCore("model", element.getModelElement(), false);
17417        composeStringExtras("model", element.getModelElement(), false);
17418      }
17419      if (element.hasVersionElement()) {
17420        composeStringCore("version", element.getVersionElement(), false);
17421        composeStringExtras("version", element.getVersionElement(), false);
17422      }
17423      if (element.hasManufactureDateElement()) {
17424        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
17425        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
17426      }
17427      if (element.hasExpiryElement()) {
17428        composeDateTimeCore("expiry", element.getExpiryElement(), false);
17429        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
17430      }
17431      if (element.hasUdiElement()) {
17432        composeStringCore("udi", element.getUdiElement(), false);
17433        composeStringExtras("udi", element.getUdiElement(), false);
17434      }
17435      if (element.hasLotNumberElement()) {
17436        composeStringCore("lotNumber", element.getLotNumberElement(), false);
17437        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
17438      }
17439      if (element.hasOwner()) {
17440        composeReference("owner", element.getOwner());
17441      }
17442      if (element.hasLocation()) {
17443        composeReference("location", element.getLocation());
17444      }
17445      if (element.hasPatient()) {
17446        composeReference("patient", element.getPatient());
17447      }
17448      if (element.hasContact()) {
17449        openArray("contact");
17450        for (ContactPoint e : element.getContact()) 
17451          composeContactPoint(null, e);
17452        closeArray();
17453      };
17454      if (element.hasUrlElement()) {
17455        composeUriCore("url", element.getUrlElement(), false);
17456        composeUriExtras("url", element.getUrlElement(), false);
17457      }
17458  }
17459
17460  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
17461    if (element != null) {
17462      prop("resourceType", name);
17463      composeDeviceComponentInner(element);
17464    }
17465  }
17466
17467  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
17468      composeDomainResourceElements(element);
17469      if (element.hasType()) {
17470        composeCodeableConcept("type", element.getType());
17471      }
17472      if (element.hasIdentifier()) {
17473        composeIdentifier("identifier", element.getIdentifier());
17474      }
17475      if (element.hasLastSystemChangeElement()) {
17476        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
17477        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
17478      }
17479      if (element.hasSource()) {
17480        composeReference("source", element.getSource());
17481      }
17482      if (element.hasParent()) {
17483        composeReference("parent", element.getParent());
17484      }
17485      if (element.hasOperationalStatus()) {
17486        openArray("operationalStatus");
17487        for (CodeableConcept e : element.getOperationalStatus()) 
17488          composeCodeableConcept(null, e);
17489        closeArray();
17490      };
17491      if (element.hasParameterGroup()) {
17492        composeCodeableConcept("parameterGroup", element.getParameterGroup());
17493      }
17494      if (element.hasMeasurementPrincipleElement()) {
17495        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17496        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17497      }
17498      if (element.hasProductionSpecification()) {
17499        openArray("productionSpecification");
17500        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
17501          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
17502        closeArray();
17503      };
17504      if (element.hasLanguageCode()) {
17505        composeCodeableConcept("languageCode", element.getLanguageCode());
17506      }
17507  }
17508
17509  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17510    if (element != null) {
17511      open(name);
17512      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
17513      close();
17514    }
17515  }
17516
17517  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17518      composeBackbone(element);
17519      if (element.hasSpecType()) {
17520        composeCodeableConcept("specType", element.getSpecType());
17521      }
17522      if (element.hasComponentId()) {
17523        composeIdentifier("componentId", element.getComponentId());
17524      }
17525      if (element.hasProductionSpecElement()) {
17526        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
17527        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
17528      }
17529  }
17530
17531  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
17532    if (element != null) {
17533      prop("resourceType", name);
17534      composeDeviceMetricInner(element);
17535    }
17536  }
17537
17538  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
17539      composeDomainResourceElements(element);
17540      if (element.hasType()) {
17541        composeCodeableConcept("type", element.getType());
17542      }
17543      if (element.hasIdentifier()) {
17544        composeIdentifier("identifier", element.getIdentifier());
17545      }
17546      if (element.hasUnit()) {
17547        composeCodeableConcept("unit", element.getUnit());
17548      }
17549      if (element.hasSource()) {
17550        composeReference("source", element.getSource());
17551      }
17552      if (element.hasParent()) {
17553        composeReference("parent", element.getParent());
17554      }
17555      if (element.hasOperationalStatusElement()) {
17556        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17557        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17558      }
17559      if (element.hasColorElement()) {
17560        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17561        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17562      }
17563      if (element.hasCategoryElement()) {
17564        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17565        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17566      }
17567      if (element.hasMeasurementPeriod()) {
17568        composeTiming("measurementPeriod", element.getMeasurementPeriod());
17569      }
17570      if (element.hasCalibration()) {
17571        openArray("calibration");
17572        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
17573          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
17574        closeArray();
17575      };
17576  }
17577
17578  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17579    if (element != null) {
17580      open(name);
17581      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
17582      close();
17583    }
17584  }
17585
17586  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17587      composeBackbone(element);
17588      if (element.hasTypeElement()) {
17589        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17590        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17591      }
17592      if (element.hasStateElement()) {
17593        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17594        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17595      }
17596      if (element.hasTimeElement()) {
17597        composeInstantCore("time", element.getTimeElement(), false);
17598        composeInstantExtras("time", element.getTimeElement(), false);
17599      }
17600  }
17601
17602  protected void composeDeviceUseRequest(String name, DeviceUseRequest element) throws IOException {
17603    if (element != null) {
17604      prop("resourceType", name);
17605      composeDeviceUseRequestInner(element);
17606    }
17607  }
17608
17609  protected void composeDeviceUseRequestInner(DeviceUseRequest element) throws IOException {
17610      composeDomainResourceElements(element);
17611      if (element.hasBodySite()) {
17612        composeType("bodySite", element.getBodySite());
17613      }
17614      if (element.hasStatusElement()) {
17615        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17616        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17617      }
17618      if (element.hasDevice()) {
17619        composeReference("device", element.getDevice());
17620      }
17621      if (element.hasEncounter()) {
17622        composeReference("encounter", element.getEncounter());
17623      }
17624      if (element.hasIdentifier()) {
17625        openArray("identifier");
17626        for (Identifier e : element.getIdentifier()) 
17627          composeIdentifier(null, e);
17628        closeArray();
17629      };
17630      if (element.hasIndication()) {
17631        openArray("indication");
17632        for (CodeableConcept e : element.getIndication()) 
17633          composeCodeableConcept(null, e);
17634        closeArray();
17635      };
17636      if (element.hasNotes()) {
17637        openArray("notes");
17638        for (StringType e : element.getNotes()) 
17639          composeStringCore(null, e, true);
17640        closeArray();
17641        if (anyHasExtras(element.getNotes())) {
17642          openArray("_notes");
17643          for (StringType e : element.getNotes()) 
17644            composeStringExtras(null, e, true);
17645          closeArray();
17646        }
17647      };
17648      if (element.hasPrnReason()) {
17649        openArray("prnReason");
17650        for (CodeableConcept e : element.getPrnReason()) 
17651          composeCodeableConcept(null, e);
17652        closeArray();
17653      };
17654      if (element.hasOrderedOnElement()) {
17655        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
17656        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
17657      }
17658      if (element.hasRecordedOnElement()) {
17659        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17660        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17661      }
17662      if (element.hasSubject()) {
17663        composeReference("subject", element.getSubject());
17664      }
17665      if (element.hasTiming()) {
17666        composeType("timing", element.getTiming());
17667      }
17668      if (element.hasPriorityElement()) {
17669        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17670        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17671      }
17672  }
17673
17674  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
17675    if (element != null) {
17676      prop("resourceType", name);
17677      composeDeviceUseStatementInner(element);
17678    }
17679  }
17680
17681  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
17682      composeDomainResourceElements(element);
17683      if (element.hasBodySite()) {
17684        composeType("bodySite", element.getBodySite());
17685      }
17686      if (element.hasWhenUsed()) {
17687        composePeriod("whenUsed", element.getWhenUsed());
17688      }
17689      if (element.hasDevice()) {
17690        composeReference("device", element.getDevice());
17691      }
17692      if (element.hasIdentifier()) {
17693        openArray("identifier");
17694        for (Identifier e : element.getIdentifier()) 
17695          composeIdentifier(null, e);
17696        closeArray();
17697      };
17698      if (element.hasIndication()) {
17699        openArray("indication");
17700        for (CodeableConcept e : element.getIndication()) 
17701          composeCodeableConcept(null, e);
17702        closeArray();
17703      };
17704      if (element.hasNotes()) {
17705        openArray("notes");
17706        for (StringType e : element.getNotes()) 
17707          composeStringCore(null, e, true);
17708        closeArray();
17709        if (anyHasExtras(element.getNotes())) {
17710          openArray("_notes");
17711          for (StringType e : element.getNotes()) 
17712            composeStringExtras(null, e, true);
17713          closeArray();
17714        }
17715      };
17716      if (element.hasRecordedOnElement()) {
17717        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17718        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17719      }
17720      if (element.hasSubject()) {
17721        composeReference("subject", element.getSubject());
17722      }
17723      if (element.hasTiming()) {
17724        composeType("timing", element.getTiming());
17725      }
17726  }
17727
17728  protected void composeDiagnosticOrder(String name, DiagnosticOrder element) throws IOException {
17729    if (element != null) {
17730      prop("resourceType", name);
17731      composeDiagnosticOrderInner(element);
17732    }
17733  }
17734
17735  protected void composeDiagnosticOrderInner(DiagnosticOrder element) throws IOException {
17736      composeDomainResourceElements(element);
17737      if (element.hasSubject()) {
17738        composeReference("subject", element.getSubject());
17739      }
17740      if (element.hasOrderer()) {
17741        composeReference("orderer", element.getOrderer());
17742      }
17743      if (element.hasIdentifier()) {
17744        openArray("identifier");
17745        for (Identifier e : element.getIdentifier()) 
17746          composeIdentifier(null, e);
17747        closeArray();
17748      };
17749      if (element.hasEncounter()) {
17750        composeReference("encounter", element.getEncounter());
17751      }
17752      if (element.hasReason()) {
17753        openArray("reason");
17754        for (CodeableConcept e : element.getReason()) 
17755          composeCodeableConcept(null, e);
17756        closeArray();
17757      };
17758      if (element.hasSupportingInformation()) {
17759        openArray("supportingInformation");
17760        for (Reference e : element.getSupportingInformation()) 
17761          composeReference(null, e);
17762        closeArray();
17763      };
17764      if (element.hasSpecimen()) {
17765        openArray("specimen");
17766        for (Reference e : element.getSpecimen()) 
17767          composeReference(null, e);
17768        closeArray();
17769      };
17770      if (element.hasStatusElement()) {
17771        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17772        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17773      }
17774      if (element.hasPriorityElement()) {
17775        composeEnumerationCore("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17776        composeEnumerationExtras("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17777      }
17778      if (element.hasEvent()) {
17779        openArray("event");
17780        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17781          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17782        closeArray();
17783      };
17784      if (element.hasItem()) {
17785        openArray("item");
17786        for (DiagnosticOrder.DiagnosticOrderItemComponent e : element.getItem()) 
17787          composeDiagnosticOrderDiagnosticOrderItemComponent(null, e);
17788        closeArray();
17789      };
17790      if (element.hasNote()) {
17791        openArray("note");
17792        for (Annotation e : element.getNote()) 
17793          composeAnnotation(null, e);
17794        closeArray();
17795      };
17796  }
17797
17798  protected void composeDiagnosticOrderDiagnosticOrderEventComponent(String name, DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17799    if (element != null) {
17800      open(name);
17801      composeDiagnosticOrderDiagnosticOrderEventComponentInner(element);
17802      close();
17803    }
17804  }
17805
17806  protected void composeDiagnosticOrderDiagnosticOrderEventComponentInner(DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17807      composeBackbone(element);
17808      if (element.hasStatusElement()) {
17809        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17810        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17811      }
17812      if (element.hasDescription()) {
17813        composeCodeableConcept("description", element.getDescription());
17814      }
17815      if (element.hasDateTimeElement()) {
17816        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
17817        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
17818      }
17819      if (element.hasActor()) {
17820        composeReference("actor", element.getActor());
17821      }
17822  }
17823
17824  protected void composeDiagnosticOrderDiagnosticOrderItemComponent(String name, DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17825    if (element != null) {
17826      open(name);
17827      composeDiagnosticOrderDiagnosticOrderItemComponentInner(element);
17828      close();
17829    }
17830  }
17831
17832  protected void composeDiagnosticOrderDiagnosticOrderItemComponentInner(DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17833      composeBackbone(element);
17834      if (element.hasCode()) {
17835        composeCodeableConcept("code", element.getCode());
17836      }
17837      if (element.hasSpecimen()) {
17838        openArray("specimen");
17839        for (Reference e : element.getSpecimen()) 
17840          composeReference(null, e);
17841        closeArray();
17842      };
17843      if (element.hasBodySite()) {
17844        composeCodeableConcept("bodySite", element.getBodySite());
17845      }
17846      if (element.hasStatusElement()) {
17847        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17848        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17849      }
17850      if (element.hasEvent()) {
17851        openArray("event");
17852        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17853          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17854        closeArray();
17855      };
17856  }
17857
17858  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
17859    if (element != null) {
17860      prop("resourceType", name);
17861      composeDiagnosticReportInner(element);
17862    }
17863  }
17864
17865  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
17866      composeDomainResourceElements(element);
17867      if (element.hasIdentifier()) {
17868        openArray("identifier");
17869        for (Identifier e : element.getIdentifier()) 
17870          composeIdentifier(null, e);
17871        closeArray();
17872      };
17873      if (element.hasStatusElement()) {
17874        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17875        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17876      }
17877      if (element.hasCategory()) {
17878        composeCodeableConcept("category", element.getCategory());
17879      }
17880      if (element.hasCode()) {
17881        composeCodeableConcept("code", element.getCode());
17882      }
17883      if (element.hasSubject()) {
17884        composeReference("subject", element.getSubject());
17885      }
17886      if (element.hasEncounter()) {
17887        composeReference("encounter", element.getEncounter());
17888      }
17889      if (element.hasEffective()) {
17890        composeType("effective", element.getEffective());
17891      }
17892      if (element.hasIssuedElement()) {
17893        composeInstantCore("issued", element.getIssuedElement(), false);
17894        composeInstantExtras("issued", element.getIssuedElement(), false);
17895      }
17896      if (element.hasPerformer()) {
17897        composeReference("performer", element.getPerformer());
17898      }
17899      if (element.hasRequest()) {
17900        openArray("request");
17901        for (Reference e : element.getRequest()) 
17902          composeReference(null, e);
17903        closeArray();
17904      };
17905      if (element.hasSpecimen()) {
17906        openArray("specimen");
17907        for (Reference e : element.getSpecimen()) 
17908          composeReference(null, e);
17909        closeArray();
17910      };
17911      if (element.hasResult()) {
17912        openArray("result");
17913        for (Reference e : element.getResult()) 
17914          composeReference(null, e);
17915        closeArray();
17916      };
17917      if (element.hasImagingStudy()) {
17918        openArray("imagingStudy");
17919        for (Reference e : element.getImagingStudy()) 
17920          composeReference(null, e);
17921        closeArray();
17922      };
17923      if (element.hasImage()) {
17924        openArray("image");
17925        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
17926          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
17927        closeArray();
17928      };
17929      if (element.hasConclusionElement()) {
17930        composeStringCore("conclusion", element.getConclusionElement(), false);
17931        composeStringExtras("conclusion", element.getConclusionElement(), false);
17932      }
17933      if (element.hasCodedDiagnosis()) {
17934        openArray("codedDiagnosis");
17935        for (CodeableConcept e : element.getCodedDiagnosis()) 
17936          composeCodeableConcept(null, e);
17937        closeArray();
17938      };
17939      if (element.hasPresentedForm()) {
17940        openArray("presentedForm");
17941        for (Attachment e : element.getPresentedForm()) 
17942          composeAttachment(null, e);
17943        closeArray();
17944      };
17945  }
17946
17947  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17948    if (element != null) {
17949      open(name);
17950      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
17951      close();
17952    }
17953  }
17954
17955  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17956      composeBackbone(element);
17957      if (element.hasCommentElement()) {
17958        composeStringCore("comment", element.getCommentElement(), false);
17959        composeStringExtras("comment", element.getCommentElement(), false);
17960      }
17961      if (element.hasLink()) {
17962        composeReference("link", element.getLink());
17963      }
17964  }
17965
17966  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
17967    if (element != null) {
17968      prop("resourceType", name);
17969      composeDocumentManifestInner(element);
17970    }
17971  }
17972
17973  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
17974      composeDomainResourceElements(element);
17975      if (element.hasMasterIdentifier()) {
17976        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
17977      }
17978      if (element.hasIdentifier()) {
17979        openArray("identifier");
17980        for (Identifier e : element.getIdentifier()) 
17981          composeIdentifier(null, e);
17982        closeArray();
17983      };
17984      if (element.hasSubject()) {
17985        composeReference("subject", element.getSubject());
17986      }
17987      if (element.hasRecipient()) {
17988        openArray("recipient");
17989        for (Reference e : element.getRecipient()) 
17990          composeReference(null, e);
17991        closeArray();
17992      };
17993      if (element.hasType()) {
17994        composeCodeableConcept("type", element.getType());
17995      }
17996      if (element.hasAuthor()) {
17997        openArray("author");
17998        for (Reference e : element.getAuthor()) 
17999          composeReference(null, e);
18000        closeArray();
18001      };
18002      if (element.hasCreatedElement()) {
18003        composeDateTimeCore("created", element.getCreatedElement(), false);
18004        composeDateTimeExtras("created", element.getCreatedElement(), false);
18005      }
18006      if (element.hasSourceElement()) {
18007        composeUriCore("source", element.getSourceElement(), false);
18008        composeUriExtras("source", element.getSourceElement(), false);
18009      }
18010      if (element.hasStatusElement()) {
18011        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18012        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18013      }
18014      if (element.hasDescriptionElement()) {
18015        composeStringCore("description", element.getDescriptionElement(), false);
18016        composeStringExtras("description", element.getDescriptionElement(), false);
18017      }
18018      if (element.hasContent()) {
18019        openArray("content");
18020        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
18021          composeDocumentManifestDocumentManifestContentComponent(null, e);
18022        closeArray();
18023      };
18024      if (element.hasRelated()) {
18025        openArray("related");
18026        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
18027          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
18028        closeArray();
18029      };
18030  }
18031
18032  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18033    if (element != null) {
18034      open(name);
18035      composeDocumentManifestDocumentManifestContentComponentInner(element);
18036      close();
18037    }
18038  }
18039
18040  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18041      composeBackbone(element);
18042      if (element.hasP()) {
18043        composeType("p", element.getP());
18044      }
18045  }
18046
18047  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18048    if (element != null) {
18049      open(name);
18050      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
18051      close();
18052    }
18053  }
18054
18055  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18056      composeBackbone(element);
18057      if (element.hasIdentifier()) {
18058        composeIdentifier("identifier", element.getIdentifier());
18059      }
18060      if (element.hasRef()) {
18061        composeReference("ref", element.getRef());
18062      }
18063  }
18064
18065  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
18066    if (element != null) {
18067      prop("resourceType", name);
18068      composeDocumentReferenceInner(element);
18069    }
18070  }
18071
18072  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
18073      composeDomainResourceElements(element);
18074      if (element.hasMasterIdentifier()) {
18075        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
18076      }
18077      if (element.hasIdentifier()) {
18078        openArray("identifier");
18079        for (Identifier e : element.getIdentifier()) 
18080          composeIdentifier(null, e);
18081        closeArray();
18082      };
18083      if (element.hasSubject()) {
18084        composeReference("subject", element.getSubject());
18085      }
18086      if (element.hasType()) {
18087        composeCodeableConcept("type", element.getType());
18088      }
18089      if (element.hasClass_()) {
18090        composeCodeableConcept("class", element.getClass_());
18091      }
18092      if (element.hasAuthor()) {
18093        openArray("author");
18094        for (Reference e : element.getAuthor()) 
18095          composeReference(null, e);
18096        closeArray();
18097      };
18098      if (element.hasCustodian()) {
18099        composeReference("custodian", element.getCustodian());
18100      }
18101      if (element.hasAuthenticator()) {
18102        composeReference("authenticator", element.getAuthenticator());
18103      }
18104      if (element.hasCreatedElement()) {
18105        composeDateTimeCore("created", element.getCreatedElement(), false);
18106        composeDateTimeExtras("created", element.getCreatedElement(), false);
18107      }
18108      if (element.hasIndexedElement()) {
18109        composeInstantCore("indexed", element.getIndexedElement(), false);
18110        composeInstantExtras("indexed", element.getIndexedElement(), false);
18111      }
18112      if (element.hasStatusElement()) {
18113        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18114        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18115      }
18116      if (element.hasDocStatus()) {
18117        composeCodeableConcept("docStatus", element.getDocStatus());
18118      }
18119      if (element.hasRelatesTo()) {
18120        openArray("relatesTo");
18121        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
18122          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
18123        closeArray();
18124      };
18125      if (element.hasDescriptionElement()) {
18126        composeStringCore("description", element.getDescriptionElement(), false);
18127        composeStringExtras("description", element.getDescriptionElement(), false);
18128      }
18129      if (element.hasSecurityLabel()) {
18130        openArray("securityLabel");
18131        for (CodeableConcept e : element.getSecurityLabel()) 
18132          composeCodeableConcept(null, e);
18133        closeArray();
18134      };
18135      if (element.hasContent()) {
18136        openArray("content");
18137        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
18138          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
18139        closeArray();
18140      };
18141      if (element.hasContext()) {
18142        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
18143      }
18144  }
18145
18146  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18147    if (element != null) {
18148      open(name);
18149      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
18150      close();
18151    }
18152  }
18153
18154  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18155      composeBackbone(element);
18156      if (element.hasCodeElement()) {
18157        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18158        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18159      }
18160      if (element.hasTarget()) {
18161        composeReference("target", element.getTarget());
18162      }
18163  }
18164
18165  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18166    if (element != null) {
18167      open(name);
18168      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
18169      close();
18170    }
18171  }
18172
18173  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18174      composeBackbone(element);
18175      if (element.hasAttachment()) {
18176        composeAttachment("attachment", element.getAttachment());
18177      }
18178      if (element.hasFormat()) {
18179        openArray("format");
18180        for (Coding e : element.getFormat()) 
18181          composeCoding(null, e);
18182        closeArray();
18183      };
18184  }
18185
18186  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18187    if (element != null) {
18188      open(name);
18189      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
18190      close();
18191    }
18192  }
18193
18194  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18195      composeBackbone(element);
18196      if (element.hasEncounter()) {
18197        composeReference("encounter", element.getEncounter());
18198      }
18199      if (element.hasEvent()) {
18200        openArray("event");
18201        for (CodeableConcept e : element.getEvent()) 
18202          composeCodeableConcept(null, e);
18203        closeArray();
18204      };
18205      if (element.hasPeriod()) {
18206        composePeriod("period", element.getPeriod());
18207      }
18208      if (element.hasFacilityType()) {
18209        composeCodeableConcept("facilityType", element.getFacilityType());
18210      }
18211      if (element.hasPracticeSetting()) {
18212        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
18213      }
18214      if (element.hasSourcePatientInfo()) {
18215        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
18216      }
18217      if (element.hasRelated()) {
18218        openArray("related");
18219        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
18220          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
18221        closeArray();
18222      };
18223  }
18224
18225  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18226    if (element != null) {
18227      open(name);
18228      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
18229      close();
18230    }
18231  }
18232
18233  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18234      composeBackbone(element);
18235      if (element.hasIdentifier()) {
18236        composeIdentifier("identifier", element.getIdentifier());
18237      }
18238      if (element.hasRef()) {
18239        composeReference("ref", element.getRef());
18240      }
18241  }
18242
18243  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
18244    if (element != null) {
18245      prop("resourceType", name);
18246      composeEligibilityRequestInner(element);
18247    }
18248  }
18249
18250  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
18251      composeDomainResourceElements(element);
18252      if (element.hasIdentifier()) {
18253        openArray("identifier");
18254        for (Identifier e : element.getIdentifier()) 
18255          composeIdentifier(null, e);
18256        closeArray();
18257      };
18258      if (element.hasRuleset()) {
18259        composeCoding("ruleset", element.getRuleset());
18260      }
18261      if (element.hasOriginalRuleset()) {
18262        composeCoding("originalRuleset", element.getOriginalRuleset());
18263      }
18264      if (element.hasCreatedElement()) {
18265        composeDateTimeCore("created", element.getCreatedElement(), false);
18266        composeDateTimeExtras("created", element.getCreatedElement(), false);
18267      }
18268      if (element.hasTarget()) {
18269        composeReference("target", element.getTarget());
18270      }
18271      if (element.hasProvider()) {
18272        composeReference("provider", element.getProvider());
18273      }
18274      if (element.hasOrganization()) {
18275        composeReference("organization", element.getOrganization());
18276      }
18277  }
18278
18279  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
18280    if (element != null) {
18281      prop("resourceType", name);
18282      composeEligibilityResponseInner(element);
18283    }
18284  }
18285
18286  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
18287      composeDomainResourceElements(element);
18288      if (element.hasIdentifier()) {
18289        openArray("identifier");
18290        for (Identifier e : element.getIdentifier()) 
18291          composeIdentifier(null, e);
18292        closeArray();
18293      };
18294      if (element.hasRequest()) {
18295        composeReference("request", element.getRequest());
18296      }
18297      if (element.hasOutcomeElement()) {
18298        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18299        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18300      }
18301      if (element.hasDispositionElement()) {
18302        composeStringCore("disposition", element.getDispositionElement(), false);
18303        composeStringExtras("disposition", element.getDispositionElement(), false);
18304      }
18305      if (element.hasRuleset()) {
18306        composeCoding("ruleset", element.getRuleset());
18307      }
18308      if (element.hasOriginalRuleset()) {
18309        composeCoding("originalRuleset", element.getOriginalRuleset());
18310      }
18311      if (element.hasCreatedElement()) {
18312        composeDateTimeCore("created", element.getCreatedElement(), false);
18313        composeDateTimeExtras("created", element.getCreatedElement(), false);
18314      }
18315      if (element.hasOrganization()) {
18316        composeReference("organization", element.getOrganization());
18317      }
18318      if (element.hasRequestProvider()) {
18319        composeReference("requestProvider", element.getRequestProvider());
18320      }
18321      if (element.hasRequestOrganization()) {
18322        composeReference("requestOrganization", element.getRequestOrganization());
18323      }
18324  }
18325
18326  protected void composeEncounter(String name, Encounter element) throws IOException {
18327    if (element != null) {
18328      prop("resourceType", name);
18329      composeEncounterInner(element);
18330    }
18331  }
18332
18333  protected void composeEncounterInner(Encounter element) throws IOException {
18334      composeDomainResourceElements(element);
18335      if (element.hasIdentifier()) {
18336        openArray("identifier");
18337        for (Identifier e : element.getIdentifier()) 
18338          composeIdentifier(null, e);
18339        closeArray();
18340      };
18341      if (element.hasStatusElement()) {
18342        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18343        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18344      }
18345      if (element.hasStatusHistory()) {
18346        openArray("statusHistory");
18347        for (Encounter.EncounterStatusHistoryComponent e : element.getStatusHistory()) 
18348          composeEncounterEncounterStatusHistoryComponent(null, e);
18349        closeArray();
18350      };
18351      if (element.hasClass_Element()) {
18352        composeEnumerationCore("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18353        composeEnumerationExtras("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18354      }
18355      if (element.hasType()) {
18356        openArray("type");
18357        for (CodeableConcept e : element.getType()) 
18358          composeCodeableConcept(null, e);
18359        closeArray();
18360      };
18361      if (element.hasPriority()) {
18362        composeCodeableConcept("priority", element.getPriority());
18363      }
18364      if (element.hasPatient()) {
18365        composeReference("patient", element.getPatient());
18366      }
18367      if (element.hasEpisodeOfCare()) {
18368        openArray("episodeOfCare");
18369        for (Reference e : element.getEpisodeOfCare()) 
18370          composeReference(null, e);
18371        closeArray();
18372      };
18373      if (element.hasIncomingReferral()) {
18374        openArray("incomingReferral");
18375        for (Reference e : element.getIncomingReferral()) 
18376          composeReference(null, e);
18377        closeArray();
18378      };
18379      if (element.hasParticipant()) {
18380        openArray("participant");
18381        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
18382          composeEncounterEncounterParticipantComponent(null, e);
18383        closeArray();
18384      };
18385      if (element.hasAppointment()) {
18386        composeReference("appointment", element.getAppointment());
18387      }
18388      if (element.hasPeriod()) {
18389        composePeriod("period", element.getPeriod());
18390      }
18391      if (element.hasLength()) {
18392        composeDuration("length", element.getLength());
18393      }
18394      if (element.hasReason()) {
18395        openArray("reason");
18396        for (CodeableConcept e : element.getReason()) 
18397          composeCodeableConcept(null, e);
18398        closeArray();
18399      };
18400      if (element.hasIndication()) {
18401        openArray("indication");
18402        for (Reference e : element.getIndication()) 
18403          composeReference(null, e);
18404        closeArray();
18405      };
18406      if (element.hasHospitalization()) {
18407        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
18408      }
18409      if (element.hasLocation()) {
18410        openArray("location");
18411        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
18412          composeEncounterEncounterLocationComponent(null, e);
18413        closeArray();
18414      };
18415      if (element.hasServiceProvider()) {
18416        composeReference("serviceProvider", element.getServiceProvider());
18417      }
18418      if (element.hasPartOf()) {
18419        composeReference("partOf", element.getPartOf());
18420      }
18421  }
18422
18423  protected void composeEncounterEncounterStatusHistoryComponent(String name, Encounter.EncounterStatusHistoryComponent element) throws IOException {
18424    if (element != null) {
18425      open(name);
18426      composeEncounterEncounterStatusHistoryComponentInner(element);
18427      close();
18428    }
18429  }
18430
18431  protected void composeEncounterEncounterStatusHistoryComponentInner(Encounter.EncounterStatusHistoryComponent element) throws IOException {
18432      composeBackbone(element);
18433      if (element.hasStatusElement()) {
18434        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18435        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18436      }
18437      if (element.hasPeriod()) {
18438        composePeriod("period", element.getPeriod());
18439      }
18440  }
18441
18442  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
18443    if (element != null) {
18444      open(name);
18445      composeEncounterEncounterParticipantComponentInner(element);
18446      close();
18447    }
18448  }
18449
18450  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
18451      composeBackbone(element);
18452      if (element.hasType()) {
18453        openArray("type");
18454        for (CodeableConcept e : element.getType()) 
18455          composeCodeableConcept(null, e);
18456        closeArray();
18457      };
18458      if (element.hasPeriod()) {
18459        composePeriod("period", element.getPeriod());
18460      }
18461      if (element.hasIndividual()) {
18462        composeReference("individual", element.getIndividual());
18463      }
18464  }
18465
18466  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
18467    if (element != null) {
18468      open(name);
18469      composeEncounterEncounterHospitalizationComponentInner(element);
18470      close();
18471    }
18472  }
18473
18474  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
18475      composeBackbone(element);
18476      if (element.hasPreAdmissionIdentifier()) {
18477        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
18478      }
18479      if (element.hasOrigin()) {
18480        composeReference("origin", element.getOrigin());
18481      }
18482      if (element.hasAdmitSource()) {
18483        composeCodeableConcept("admitSource", element.getAdmitSource());
18484      }
18485      if (element.hasAdmittingDiagnosis()) {
18486        openArray("admittingDiagnosis");
18487        for (Reference e : element.getAdmittingDiagnosis()) 
18488          composeReference(null, e);
18489        closeArray();
18490      };
18491      if (element.hasReAdmission()) {
18492        composeCodeableConcept("reAdmission", element.getReAdmission());
18493      }
18494      if (element.hasDietPreference()) {
18495        openArray("dietPreference");
18496        for (CodeableConcept e : element.getDietPreference()) 
18497          composeCodeableConcept(null, e);
18498        closeArray();
18499      };
18500      if (element.hasSpecialCourtesy()) {
18501        openArray("specialCourtesy");
18502        for (CodeableConcept e : element.getSpecialCourtesy()) 
18503          composeCodeableConcept(null, e);
18504        closeArray();
18505      };
18506      if (element.hasSpecialArrangement()) {
18507        openArray("specialArrangement");
18508        for (CodeableConcept e : element.getSpecialArrangement()) 
18509          composeCodeableConcept(null, e);
18510        closeArray();
18511      };
18512      if (element.hasDestination()) {
18513        composeReference("destination", element.getDestination());
18514      }
18515      if (element.hasDischargeDisposition()) {
18516        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
18517      }
18518      if (element.hasDischargeDiagnosis()) {
18519        openArray("dischargeDiagnosis");
18520        for (Reference e : element.getDischargeDiagnosis()) 
18521          composeReference(null, e);
18522        closeArray();
18523      };
18524  }
18525
18526  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
18527    if (element != null) {
18528      open(name);
18529      composeEncounterEncounterLocationComponentInner(element);
18530      close();
18531    }
18532  }
18533
18534  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
18535      composeBackbone(element);
18536      if (element.hasLocation()) {
18537        composeReference("location", element.getLocation());
18538      }
18539      if (element.hasStatusElement()) {
18540        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18541        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18542      }
18543      if (element.hasPeriod()) {
18544        composePeriod("period", element.getPeriod());
18545      }
18546  }
18547
18548  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
18549    if (element != null) {
18550      prop("resourceType", name);
18551      composeEnrollmentRequestInner(element);
18552    }
18553  }
18554
18555  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
18556      composeDomainResourceElements(element);
18557      if (element.hasIdentifier()) {
18558        openArray("identifier");
18559        for (Identifier e : element.getIdentifier()) 
18560          composeIdentifier(null, e);
18561        closeArray();
18562      };
18563      if (element.hasRuleset()) {
18564        composeCoding("ruleset", element.getRuleset());
18565      }
18566      if (element.hasOriginalRuleset()) {
18567        composeCoding("originalRuleset", element.getOriginalRuleset());
18568      }
18569      if (element.hasCreatedElement()) {
18570        composeDateTimeCore("created", element.getCreatedElement(), false);
18571        composeDateTimeExtras("created", element.getCreatedElement(), false);
18572      }
18573      if (element.hasTarget()) {
18574        composeReference("target", element.getTarget());
18575      }
18576      if (element.hasProvider()) {
18577        composeReference("provider", element.getProvider());
18578      }
18579      if (element.hasOrganization()) {
18580        composeReference("organization", element.getOrganization());
18581      }
18582      if (element.hasSubject()) {
18583        composeReference("subject", element.getSubject());
18584      }
18585      if (element.hasCoverage()) {
18586        composeReference("coverage", element.getCoverage());
18587      }
18588      if (element.hasRelationship()) {
18589        composeCoding("relationship", element.getRelationship());
18590      }
18591  }
18592
18593  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
18594    if (element != null) {
18595      prop("resourceType", name);
18596      composeEnrollmentResponseInner(element);
18597    }
18598  }
18599
18600  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
18601      composeDomainResourceElements(element);
18602      if (element.hasIdentifier()) {
18603        openArray("identifier");
18604        for (Identifier e : element.getIdentifier()) 
18605          composeIdentifier(null, e);
18606        closeArray();
18607      };
18608      if (element.hasRequest()) {
18609        composeReference("request", element.getRequest());
18610      }
18611      if (element.hasOutcomeElement()) {
18612        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18613        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18614      }
18615      if (element.hasDispositionElement()) {
18616        composeStringCore("disposition", element.getDispositionElement(), false);
18617        composeStringExtras("disposition", element.getDispositionElement(), false);
18618      }
18619      if (element.hasRuleset()) {
18620        composeCoding("ruleset", element.getRuleset());
18621      }
18622      if (element.hasOriginalRuleset()) {
18623        composeCoding("originalRuleset", element.getOriginalRuleset());
18624      }
18625      if (element.hasCreatedElement()) {
18626        composeDateTimeCore("created", element.getCreatedElement(), false);
18627        composeDateTimeExtras("created", element.getCreatedElement(), false);
18628      }
18629      if (element.hasOrganization()) {
18630        composeReference("organization", element.getOrganization());
18631      }
18632      if (element.hasRequestProvider()) {
18633        composeReference("requestProvider", element.getRequestProvider());
18634      }
18635      if (element.hasRequestOrganization()) {
18636        composeReference("requestOrganization", element.getRequestOrganization());
18637      }
18638  }
18639
18640  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
18641    if (element != null) {
18642      prop("resourceType", name);
18643      composeEpisodeOfCareInner(element);
18644    }
18645  }
18646
18647  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
18648      composeDomainResourceElements(element);
18649      if (element.hasIdentifier()) {
18650        openArray("identifier");
18651        for (Identifier e : element.getIdentifier()) 
18652          composeIdentifier(null, e);
18653        closeArray();
18654      };
18655      if (element.hasStatusElement()) {
18656        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18657        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18658      }
18659      if (element.hasStatusHistory()) {
18660        openArray("statusHistory");
18661        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
18662          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
18663        closeArray();
18664      };
18665      if (element.hasType()) {
18666        openArray("type");
18667        for (CodeableConcept e : element.getType()) 
18668          composeCodeableConcept(null, e);
18669        closeArray();
18670      };
18671      if (element.hasCondition()) {
18672        openArray("condition");
18673        for (Reference e : element.getCondition()) 
18674          composeReference(null, e);
18675        closeArray();
18676      };
18677      if (element.hasPatient()) {
18678        composeReference("patient", element.getPatient());
18679      }
18680      if (element.hasManagingOrganization()) {
18681        composeReference("managingOrganization", element.getManagingOrganization());
18682      }
18683      if (element.hasPeriod()) {
18684        composePeriod("period", element.getPeriod());
18685      }
18686      if (element.hasReferralRequest()) {
18687        openArray("referralRequest");
18688        for (Reference e : element.getReferralRequest()) 
18689          composeReference(null, e);
18690        closeArray();
18691      };
18692      if (element.hasCareManager()) {
18693        composeReference("careManager", element.getCareManager());
18694      }
18695      if (element.hasCareTeam()) {
18696        openArray("careTeam");
18697        for (EpisodeOfCare.EpisodeOfCareCareTeamComponent e : element.getCareTeam()) 
18698          composeEpisodeOfCareEpisodeOfCareCareTeamComponent(null, e);
18699        closeArray();
18700      };
18701  }
18702
18703  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18704    if (element != null) {
18705      open(name);
18706      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
18707      close();
18708    }
18709  }
18710
18711  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18712      composeBackbone(element);
18713      if (element.hasStatusElement()) {
18714        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18715        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18716      }
18717      if (element.hasPeriod()) {
18718        composePeriod("period", element.getPeriod());
18719      }
18720  }
18721
18722  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponent(String name, EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18723    if (element != null) {
18724      open(name);
18725      composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(element);
18726      close();
18727    }
18728  }
18729
18730  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18731      composeBackbone(element);
18732      if (element.hasRole()) {
18733        openArray("role");
18734        for (CodeableConcept e : element.getRole()) 
18735          composeCodeableConcept(null, e);
18736        closeArray();
18737      };
18738      if (element.hasPeriod()) {
18739        composePeriod("period", element.getPeriod());
18740      }
18741      if (element.hasMember()) {
18742        composeReference("member", element.getMember());
18743      }
18744  }
18745
18746  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
18747    if (element != null) {
18748      prop("resourceType", name);
18749      composeExplanationOfBenefitInner(element);
18750    }
18751  }
18752
18753  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
18754      composeDomainResourceElements(element);
18755      if (element.hasIdentifier()) {
18756        openArray("identifier");
18757        for (Identifier e : element.getIdentifier()) 
18758          composeIdentifier(null, e);
18759        closeArray();
18760      };
18761      if (element.hasRequest()) {
18762        composeReference("request", element.getRequest());
18763      }
18764      if (element.hasOutcomeElement()) {
18765        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18766        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18767      }
18768      if (element.hasDispositionElement()) {
18769        composeStringCore("disposition", element.getDispositionElement(), false);
18770        composeStringExtras("disposition", element.getDispositionElement(), false);
18771      }
18772      if (element.hasRuleset()) {
18773        composeCoding("ruleset", element.getRuleset());
18774      }
18775      if (element.hasOriginalRuleset()) {
18776        composeCoding("originalRuleset", element.getOriginalRuleset());
18777      }
18778      if (element.hasCreatedElement()) {
18779        composeDateTimeCore("created", element.getCreatedElement(), false);
18780        composeDateTimeExtras("created", element.getCreatedElement(), false);
18781      }
18782      if (element.hasOrganization()) {
18783        composeReference("organization", element.getOrganization());
18784      }
18785      if (element.hasRequestProvider()) {
18786        composeReference("requestProvider", element.getRequestProvider());
18787      }
18788      if (element.hasRequestOrganization()) {
18789        composeReference("requestOrganization", element.getRequestOrganization());
18790      }
18791  }
18792
18793  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
18794    if (element != null) {
18795      prop("resourceType", name);
18796      composeFamilyMemberHistoryInner(element);
18797    }
18798  }
18799
18800  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
18801      composeDomainResourceElements(element);
18802      if (element.hasIdentifier()) {
18803        openArray("identifier");
18804        for (Identifier e : element.getIdentifier()) 
18805          composeIdentifier(null, e);
18806        closeArray();
18807      };
18808      if (element.hasPatient()) {
18809        composeReference("patient", element.getPatient());
18810      }
18811      if (element.hasDateElement()) {
18812        composeDateTimeCore("date", element.getDateElement(), false);
18813        composeDateTimeExtras("date", element.getDateElement(), false);
18814      }
18815      if (element.hasStatusElement()) {
18816        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18817        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18818      }
18819      if (element.hasNameElement()) {
18820        composeStringCore("name", element.getNameElement(), false);
18821        composeStringExtras("name", element.getNameElement(), false);
18822      }
18823      if (element.hasRelationship()) {
18824        composeCodeableConcept("relationship", element.getRelationship());
18825      }
18826      if (element.hasGenderElement()) {
18827        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18828        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18829      }
18830      if (element.hasBorn()) {
18831        composeType("born", element.getBorn());
18832      }
18833      if (element.hasAge()) {
18834        composeType("age", element.getAge());
18835      }
18836      if (element.hasDeceased()) {
18837        composeType("deceased", element.getDeceased());
18838      }
18839      if (element.hasNote()) {
18840        composeAnnotation("note", element.getNote());
18841      }
18842      if (element.hasCondition()) {
18843        openArray("condition");
18844        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
18845          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
18846        closeArray();
18847      };
18848  }
18849
18850  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18851    if (element != null) {
18852      open(name);
18853      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
18854      close();
18855    }
18856  }
18857
18858  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18859      composeBackbone(element);
18860      if (element.hasCode()) {
18861        composeCodeableConcept("code", element.getCode());
18862      }
18863      if (element.hasOutcome()) {
18864        composeCodeableConcept("outcome", element.getOutcome());
18865      }
18866      if (element.hasOnset()) {
18867        composeType("onset", element.getOnset());
18868      }
18869      if (element.hasNote()) {
18870        composeAnnotation("note", element.getNote());
18871      }
18872  }
18873
18874  protected void composeFlag(String name, Flag element) throws IOException {
18875    if (element != null) {
18876      prop("resourceType", name);
18877      composeFlagInner(element);
18878    }
18879  }
18880
18881  protected void composeFlagInner(Flag element) throws IOException {
18882      composeDomainResourceElements(element);
18883      if (element.hasIdentifier()) {
18884        openArray("identifier");
18885        for (Identifier e : element.getIdentifier()) 
18886          composeIdentifier(null, e);
18887        closeArray();
18888      };
18889      if (element.hasCategory()) {
18890        composeCodeableConcept("category", element.getCategory());
18891      }
18892      if (element.hasStatusElement()) {
18893        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18894        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18895      }
18896      if (element.hasPeriod()) {
18897        composePeriod("period", element.getPeriod());
18898      }
18899      if (element.hasSubject()) {
18900        composeReference("subject", element.getSubject());
18901      }
18902      if (element.hasEncounter()) {
18903        composeReference("encounter", element.getEncounter());
18904      }
18905      if (element.hasAuthor()) {
18906        composeReference("author", element.getAuthor());
18907      }
18908      if (element.hasCode()) {
18909        composeCodeableConcept("code", element.getCode());
18910      }
18911  }
18912
18913  protected void composeGoal(String name, Goal element) throws IOException {
18914    if (element != null) {
18915      prop("resourceType", name);
18916      composeGoalInner(element);
18917    }
18918  }
18919
18920  protected void composeGoalInner(Goal element) throws IOException {
18921      composeDomainResourceElements(element);
18922      if (element.hasIdentifier()) {
18923        openArray("identifier");
18924        for (Identifier e : element.getIdentifier()) 
18925          composeIdentifier(null, e);
18926        closeArray();
18927      };
18928      if (element.hasSubject()) {
18929        composeReference("subject", element.getSubject());
18930      }
18931      if (element.hasStart()) {
18932        composeType("start", element.getStart());
18933      }
18934      if (element.hasTarget()) {
18935        composeType("target", element.getTarget());
18936      }
18937      if (element.hasCategory()) {
18938        openArray("category");
18939        for (CodeableConcept e : element.getCategory()) 
18940          composeCodeableConcept(null, e);
18941        closeArray();
18942      };
18943      if (element.hasDescriptionElement()) {
18944        composeStringCore("description", element.getDescriptionElement(), false);
18945        composeStringExtras("description", element.getDescriptionElement(), false);
18946      }
18947      if (element.hasStatusElement()) {
18948        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18949        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18950      }
18951      if (element.hasStatusDateElement()) {
18952        composeDateCore("statusDate", element.getStatusDateElement(), false);
18953        composeDateExtras("statusDate", element.getStatusDateElement(), false);
18954      }
18955      if (element.hasStatusReason()) {
18956        composeCodeableConcept("statusReason", element.getStatusReason());
18957      }
18958      if (element.hasAuthor()) {
18959        composeReference("author", element.getAuthor());
18960      }
18961      if (element.hasPriority()) {
18962        composeCodeableConcept("priority", element.getPriority());
18963      }
18964      if (element.hasAddresses()) {
18965        openArray("addresses");
18966        for (Reference e : element.getAddresses()) 
18967          composeReference(null, e);
18968        closeArray();
18969      };
18970      if (element.hasNote()) {
18971        openArray("note");
18972        for (Annotation e : element.getNote()) 
18973          composeAnnotation(null, e);
18974        closeArray();
18975      };
18976      if (element.hasOutcome()) {
18977        openArray("outcome");
18978        for (Goal.GoalOutcomeComponent e : element.getOutcome()) 
18979          composeGoalGoalOutcomeComponent(null, e);
18980        closeArray();
18981      };
18982  }
18983
18984  protected void composeGoalGoalOutcomeComponent(String name, Goal.GoalOutcomeComponent element) throws IOException {
18985    if (element != null) {
18986      open(name);
18987      composeGoalGoalOutcomeComponentInner(element);
18988      close();
18989    }
18990  }
18991
18992  protected void composeGoalGoalOutcomeComponentInner(Goal.GoalOutcomeComponent element) throws IOException {
18993      composeBackbone(element);
18994      if (element.hasResult()) {
18995        composeType("result", element.getResult());
18996      }
18997  }
18998
18999  protected void composeGroup(String name, Group element) throws IOException {
19000    if (element != null) {
19001      prop("resourceType", name);
19002      composeGroupInner(element);
19003    }
19004  }
19005
19006  protected void composeGroupInner(Group element) throws IOException {
19007      composeDomainResourceElements(element);
19008      if (element.hasIdentifier()) {
19009        openArray("identifier");
19010        for (Identifier e : element.getIdentifier()) 
19011          composeIdentifier(null, e);
19012        closeArray();
19013      };
19014      if (element.hasTypeElement()) {
19015        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19016        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19017      }
19018      if (element.hasActualElement()) {
19019        composeBooleanCore("actual", element.getActualElement(), false);
19020        composeBooleanExtras("actual", element.getActualElement(), false);
19021      }
19022      if (element.hasCode()) {
19023        composeCodeableConcept("code", element.getCode());
19024      }
19025      if (element.hasNameElement()) {
19026        composeStringCore("name", element.getNameElement(), false);
19027        composeStringExtras("name", element.getNameElement(), false);
19028      }
19029      if (element.hasQuantityElement()) {
19030        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
19031        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
19032      }
19033      if (element.hasCharacteristic()) {
19034        openArray("characteristic");
19035        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
19036          composeGroupGroupCharacteristicComponent(null, e);
19037        closeArray();
19038      };
19039      if (element.hasMember()) {
19040        openArray("member");
19041        for (Group.GroupMemberComponent e : element.getMember()) 
19042          composeGroupGroupMemberComponent(null, e);
19043        closeArray();
19044      };
19045  }
19046
19047  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
19048    if (element != null) {
19049      open(name);
19050      composeGroupGroupCharacteristicComponentInner(element);
19051      close();
19052    }
19053  }
19054
19055  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
19056      composeBackbone(element);
19057      if (element.hasCode()) {
19058        composeCodeableConcept("code", element.getCode());
19059      }
19060      if (element.hasValue()) {
19061        composeType("value", element.getValue());
19062      }
19063      if (element.hasExcludeElement()) {
19064        composeBooleanCore("exclude", element.getExcludeElement(), false);
19065        composeBooleanExtras("exclude", element.getExcludeElement(), false);
19066      }
19067      if (element.hasPeriod()) {
19068        composePeriod("period", element.getPeriod());
19069      }
19070  }
19071
19072  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
19073    if (element != null) {
19074      open(name);
19075      composeGroupGroupMemberComponentInner(element);
19076      close();
19077    }
19078  }
19079
19080  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
19081      composeBackbone(element);
19082      if (element.hasEntity()) {
19083        composeReference("entity", element.getEntity());
19084      }
19085      if (element.hasPeriod()) {
19086        composePeriod("period", element.getPeriod());
19087      }
19088      if (element.hasInactiveElement()) {
19089        composeBooleanCore("inactive", element.getInactiveElement(), false);
19090        composeBooleanExtras("inactive", element.getInactiveElement(), false);
19091      }
19092  }
19093
19094  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
19095    if (element != null) {
19096      prop("resourceType", name);
19097      composeHealthcareServiceInner(element);
19098    }
19099  }
19100
19101  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
19102      composeDomainResourceElements(element);
19103      if (element.hasIdentifier()) {
19104        openArray("identifier");
19105        for (Identifier e : element.getIdentifier()) 
19106          composeIdentifier(null, e);
19107        closeArray();
19108      };
19109      if (element.hasProvidedBy()) {
19110        composeReference("providedBy", element.getProvidedBy());
19111      }
19112      if (element.hasServiceCategory()) {
19113        composeCodeableConcept("serviceCategory", element.getServiceCategory());
19114      }
19115      if (element.hasServiceType()) {
19116        openArray("serviceType");
19117        for (HealthcareService.ServiceTypeComponent e : element.getServiceType()) 
19118          composeHealthcareServiceServiceTypeComponent(null, e);
19119        closeArray();
19120      };
19121      if (element.hasLocation()) {
19122        composeReference("location", element.getLocation());
19123      }
19124      if (element.hasServiceNameElement()) {
19125        composeStringCore("serviceName", element.getServiceNameElement(), false);
19126        composeStringExtras("serviceName", element.getServiceNameElement(), false);
19127      }
19128      if (element.hasCommentElement()) {
19129        composeStringCore("comment", element.getCommentElement(), false);
19130        composeStringExtras("comment", element.getCommentElement(), false);
19131      }
19132      if (element.hasExtraDetailsElement()) {
19133        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
19134        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
19135      }
19136      if (element.hasPhoto()) {
19137        composeAttachment("photo", element.getPhoto());
19138      }
19139      if (element.hasTelecom()) {
19140        openArray("telecom");
19141        for (ContactPoint e : element.getTelecom()) 
19142          composeContactPoint(null, e);
19143        closeArray();
19144      };
19145      if (element.hasCoverageArea()) {
19146        openArray("coverageArea");
19147        for (Reference e : element.getCoverageArea()) 
19148          composeReference(null, e);
19149        closeArray();
19150      };
19151      if (element.hasServiceProvisionCode()) {
19152        openArray("serviceProvisionCode");
19153        for (CodeableConcept e : element.getServiceProvisionCode()) 
19154          composeCodeableConcept(null, e);
19155        closeArray();
19156      };
19157      if (element.hasEligibility()) {
19158        composeCodeableConcept("eligibility", element.getEligibility());
19159      }
19160      if (element.hasEligibilityNoteElement()) {
19161        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
19162        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
19163      }
19164      if (element.hasProgramName()) {
19165        openArray("programName");
19166        for (StringType e : element.getProgramName()) 
19167          composeStringCore(null, e, true);
19168        closeArray();
19169        if (anyHasExtras(element.getProgramName())) {
19170          openArray("_programName");
19171          for (StringType e : element.getProgramName()) 
19172            composeStringExtras(null, e, true);
19173          closeArray();
19174        }
19175      };
19176      if (element.hasCharacteristic()) {
19177        openArray("characteristic");
19178        for (CodeableConcept e : element.getCharacteristic()) 
19179          composeCodeableConcept(null, e);
19180        closeArray();
19181      };
19182      if (element.hasReferralMethod()) {
19183        openArray("referralMethod");
19184        for (CodeableConcept e : element.getReferralMethod()) 
19185          composeCodeableConcept(null, e);
19186        closeArray();
19187      };
19188      if (element.hasPublicKeyElement()) {
19189        composeStringCore("publicKey", element.getPublicKeyElement(), false);
19190        composeStringExtras("publicKey", element.getPublicKeyElement(), false);
19191      }
19192      if (element.hasAppointmentRequiredElement()) {
19193        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
19194        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
19195      }
19196      if (element.hasAvailableTime()) {
19197        openArray("availableTime");
19198        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
19199          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
19200        closeArray();
19201      };
19202      if (element.hasNotAvailable()) {
19203        openArray("notAvailable");
19204        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
19205          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
19206        closeArray();
19207      };
19208      if (element.hasAvailabilityExceptionsElement()) {
19209        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19210        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19211      }
19212  }
19213
19214  protected void composeHealthcareServiceServiceTypeComponent(String name, HealthcareService.ServiceTypeComponent element) throws IOException {
19215    if (element != null) {
19216      open(name);
19217      composeHealthcareServiceServiceTypeComponentInner(element);
19218      close();
19219    }
19220  }
19221
19222  protected void composeHealthcareServiceServiceTypeComponentInner(HealthcareService.ServiceTypeComponent element) throws IOException {
19223      composeBackbone(element);
19224      if (element.hasType()) {
19225        composeCodeableConcept("type", element.getType());
19226      }
19227      if (element.hasSpecialty()) {
19228        openArray("specialty");
19229        for (CodeableConcept e : element.getSpecialty()) 
19230          composeCodeableConcept(null, e);
19231        closeArray();
19232      };
19233  }
19234
19235  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19236    if (element != null) {
19237      open(name);
19238      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
19239      close();
19240    }
19241  }
19242
19243  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19244      composeBackbone(element);
19245      if (element.hasDaysOfWeek()) {
19246        openArray("daysOfWeek");
19247        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19248          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19249        closeArray();
19250        if (anyHasExtras(element.getDaysOfWeek())) {
19251          openArray("_daysOfWeek");
19252          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19253            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19254          closeArray();
19255        }
19256      };
19257      if (element.hasAllDayElement()) {
19258        composeBooleanCore("allDay", element.getAllDayElement(), false);
19259        composeBooleanExtras("allDay", element.getAllDayElement(), false);
19260      }
19261      if (element.hasAvailableStartTimeElement()) {
19262        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
19263        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
19264      }
19265      if (element.hasAvailableEndTimeElement()) {
19266        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
19267        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
19268      }
19269  }
19270
19271  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19272    if (element != null) {
19273      open(name);
19274      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
19275      close();
19276    }
19277  }
19278
19279  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19280      composeBackbone(element);
19281      if (element.hasDescriptionElement()) {
19282        composeStringCore("description", element.getDescriptionElement(), false);
19283        composeStringExtras("description", element.getDescriptionElement(), false);
19284      }
19285      if (element.hasDuring()) {
19286        composePeriod("during", element.getDuring());
19287      }
19288  }
19289
19290  protected void composeImagingObjectSelection(String name, ImagingObjectSelection element) throws IOException {
19291    if (element != null) {
19292      prop("resourceType", name);
19293      composeImagingObjectSelectionInner(element);
19294    }
19295  }
19296
19297  protected void composeImagingObjectSelectionInner(ImagingObjectSelection element) throws IOException {
19298      composeDomainResourceElements(element);
19299      if (element.hasUidElement()) {
19300        composeOidCore("uid", element.getUidElement(), false);
19301        composeOidExtras("uid", element.getUidElement(), false);
19302      }
19303      if (element.hasPatient()) {
19304        composeReference("patient", element.getPatient());
19305      }
19306      if (element.hasTitle()) {
19307        composeCodeableConcept("title", element.getTitle());
19308      }
19309      if (element.hasDescriptionElement()) {
19310        composeStringCore("description", element.getDescriptionElement(), false);
19311        composeStringExtras("description", element.getDescriptionElement(), false);
19312      }
19313      if (element.hasAuthor()) {
19314        composeReference("author", element.getAuthor());
19315      }
19316      if (element.hasAuthoringTimeElement()) {
19317        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
19318        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
19319      }
19320      if (element.hasStudy()) {
19321        openArray("study");
19322        for (ImagingObjectSelection.StudyComponent e : element.getStudy()) 
19323          composeImagingObjectSelectionStudyComponent(null, e);
19324        closeArray();
19325      };
19326  }
19327
19328  protected void composeImagingObjectSelectionStudyComponent(String name, ImagingObjectSelection.StudyComponent element) throws IOException {
19329    if (element != null) {
19330      open(name);
19331      composeImagingObjectSelectionStudyComponentInner(element);
19332      close();
19333    }
19334  }
19335
19336  protected void composeImagingObjectSelectionStudyComponentInner(ImagingObjectSelection.StudyComponent element) throws IOException {
19337      composeBackbone(element);
19338      if (element.hasUidElement()) {
19339        composeOidCore("uid", element.getUidElement(), false);
19340        composeOidExtras("uid", element.getUidElement(), false);
19341      }
19342      if (element.hasUrlElement()) {
19343        composeUriCore("url", element.getUrlElement(), false);
19344        composeUriExtras("url", element.getUrlElement(), false);
19345      }
19346      if (element.hasImagingStudy()) {
19347        composeReference("imagingStudy", element.getImagingStudy());
19348      }
19349      if (element.hasSeries()) {
19350        openArray("series");
19351        for (ImagingObjectSelection.SeriesComponent e : element.getSeries()) 
19352          composeImagingObjectSelectionSeriesComponent(null, e);
19353        closeArray();
19354      };
19355  }
19356
19357  protected void composeImagingObjectSelectionSeriesComponent(String name, ImagingObjectSelection.SeriesComponent element) throws IOException {
19358    if (element != null) {
19359      open(name);
19360      composeImagingObjectSelectionSeriesComponentInner(element);
19361      close();
19362    }
19363  }
19364
19365  protected void composeImagingObjectSelectionSeriesComponentInner(ImagingObjectSelection.SeriesComponent element) throws IOException {
19366      composeBackbone(element);
19367      if (element.hasUidElement()) {
19368        composeOidCore("uid", element.getUidElement(), false);
19369        composeOidExtras("uid", element.getUidElement(), false);
19370      }
19371      if (element.hasUrlElement()) {
19372        composeUriCore("url", element.getUrlElement(), false);
19373        composeUriExtras("url", element.getUrlElement(), false);
19374      }
19375      if (element.hasInstance()) {
19376        openArray("instance");
19377        for (ImagingObjectSelection.InstanceComponent e : element.getInstance()) 
19378          composeImagingObjectSelectionInstanceComponent(null, e);
19379        closeArray();
19380      };
19381  }
19382
19383  protected void composeImagingObjectSelectionInstanceComponent(String name, ImagingObjectSelection.InstanceComponent element) throws IOException {
19384    if (element != null) {
19385      open(name);
19386      composeImagingObjectSelectionInstanceComponentInner(element);
19387      close();
19388    }
19389  }
19390
19391  protected void composeImagingObjectSelectionInstanceComponentInner(ImagingObjectSelection.InstanceComponent element) throws IOException {
19392      composeBackbone(element);
19393      if (element.hasSopClassElement()) {
19394        composeOidCore("sopClass", element.getSopClassElement(), false);
19395        composeOidExtras("sopClass", element.getSopClassElement(), false);
19396      }
19397      if (element.hasUidElement()) {
19398        composeOidCore("uid", element.getUidElement(), false);
19399        composeOidExtras("uid", element.getUidElement(), false);
19400      }
19401      if (element.hasUrlElement()) {
19402        composeUriCore("url", element.getUrlElement(), false);
19403        composeUriExtras("url", element.getUrlElement(), false);
19404      }
19405      if (element.hasFrames()) {
19406        openArray("frames");
19407        for (ImagingObjectSelection.FramesComponent e : element.getFrames()) 
19408          composeImagingObjectSelectionFramesComponent(null, e);
19409        closeArray();
19410      };
19411  }
19412
19413  protected void composeImagingObjectSelectionFramesComponent(String name, ImagingObjectSelection.FramesComponent element) throws IOException {
19414    if (element != null) {
19415      open(name);
19416      composeImagingObjectSelectionFramesComponentInner(element);
19417      close();
19418    }
19419  }
19420
19421  protected void composeImagingObjectSelectionFramesComponentInner(ImagingObjectSelection.FramesComponent element) throws IOException {
19422      composeBackbone(element);
19423      if (element.hasFrameNumbers()) {
19424        openArray("frameNumbers");
19425        for (UnsignedIntType e : element.getFrameNumbers()) 
19426          composeUnsignedIntCore(null, e, true);
19427        closeArray();
19428        if (anyHasExtras(element.getFrameNumbers())) {
19429          openArray("_frameNumbers");
19430          for (UnsignedIntType e : element.getFrameNumbers()) 
19431            composeUnsignedIntExtras(null, e, true);
19432          closeArray();
19433        }
19434      };
19435      if (element.hasUrlElement()) {
19436        composeUriCore("url", element.getUrlElement(), false);
19437        composeUriExtras("url", element.getUrlElement(), false);
19438      }
19439  }
19440
19441  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
19442    if (element != null) {
19443      prop("resourceType", name);
19444      composeImagingStudyInner(element);
19445    }
19446  }
19447
19448  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
19449      composeDomainResourceElements(element);
19450      if (element.hasStartedElement()) {
19451        composeDateTimeCore("started", element.getStartedElement(), false);
19452        composeDateTimeExtras("started", element.getStartedElement(), false);
19453      }
19454      if (element.hasPatient()) {
19455        composeReference("patient", element.getPatient());
19456      }
19457      if (element.hasUidElement()) {
19458        composeOidCore("uid", element.getUidElement(), false);
19459        composeOidExtras("uid", element.getUidElement(), false);
19460      }
19461      if (element.hasAccession()) {
19462        composeIdentifier("accession", element.getAccession());
19463      }
19464      if (element.hasIdentifier()) {
19465        openArray("identifier");
19466        for (Identifier e : element.getIdentifier()) 
19467          composeIdentifier(null, e);
19468        closeArray();
19469      };
19470      if (element.hasOrder()) {
19471        openArray("order");
19472        for (Reference e : element.getOrder()) 
19473          composeReference(null, e);
19474        closeArray();
19475      };
19476      if (element.hasModalityList()) {
19477        openArray("modalityList");
19478        for (Coding e : element.getModalityList()) 
19479          composeCoding(null, e);
19480        closeArray();
19481      };
19482      if (element.hasReferrer()) {
19483        composeReference("referrer", element.getReferrer());
19484      }
19485      if (element.hasAvailabilityElement()) {
19486        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19487        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19488      }
19489      if (element.hasUrlElement()) {
19490        composeUriCore("url", element.getUrlElement(), false);
19491        composeUriExtras("url", element.getUrlElement(), false);
19492      }
19493      if (element.hasNumberOfSeriesElement()) {
19494        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
19495        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
19496      }
19497      if (element.hasNumberOfInstancesElement()) {
19498        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19499        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19500      }
19501      if (element.hasProcedure()) {
19502        openArray("procedure");
19503        for (Reference e : element.getProcedure()) 
19504          composeReference(null, e);
19505        closeArray();
19506      };
19507      if (element.hasInterpreter()) {
19508        composeReference("interpreter", element.getInterpreter());
19509      }
19510      if (element.hasDescriptionElement()) {
19511        composeStringCore("description", element.getDescriptionElement(), false);
19512        composeStringExtras("description", element.getDescriptionElement(), false);
19513      }
19514      if (element.hasSeries()) {
19515        openArray("series");
19516        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
19517          composeImagingStudyImagingStudySeriesComponent(null, e);
19518        closeArray();
19519      };
19520  }
19521
19522  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19523    if (element != null) {
19524      open(name);
19525      composeImagingStudyImagingStudySeriesComponentInner(element);
19526      close();
19527    }
19528  }
19529
19530  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19531      composeBackbone(element);
19532      if (element.hasNumberElement()) {
19533        composeUnsignedIntCore("number", element.getNumberElement(), false);
19534        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19535      }
19536      if (element.hasModality()) {
19537        composeCoding("modality", element.getModality());
19538      }
19539      if (element.hasUidElement()) {
19540        composeOidCore("uid", element.getUidElement(), false);
19541        composeOidExtras("uid", element.getUidElement(), false);
19542      }
19543      if (element.hasDescriptionElement()) {
19544        composeStringCore("description", element.getDescriptionElement(), false);
19545        composeStringExtras("description", element.getDescriptionElement(), false);
19546      }
19547      if (element.hasNumberOfInstancesElement()) {
19548        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19549        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19550      }
19551      if (element.hasAvailabilityElement()) {
19552        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19553        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19554      }
19555      if (element.hasUrlElement()) {
19556        composeUriCore("url", element.getUrlElement(), false);
19557        composeUriExtras("url", element.getUrlElement(), false);
19558      }
19559      if (element.hasBodySite()) {
19560        composeCoding("bodySite", element.getBodySite());
19561      }
19562      if (element.hasLaterality()) {
19563        composeCoding("laterality", element.getLaterality());
19564      }
19565      if (element.hasStartedElement()) {
19566        composeDateTimeCore("started", element.getStartedElement(), false);
19567        composeDateTimeExtras("started", element.getStartedElement(), false);
19568      }
19569      if (element.hasInstance()) {
19570        openArray("instance");
19571        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
19572          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
19573        closeArray();
19574      };
19575  }
19576
19577  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19578    if (element != null) {
19579      open(name);
19580      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
19581      close();
19582    }
19583  }
19584
19585  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19586      composeBackbone(element);
19587      if (element.hasNumberElement()) {
19588        composeUnsignedIntCore("number", element.getNumberElement(), false);
19589        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19590      }
19591      if (element.hasUidElement()) {
19592        composeOidCore("uid", element.getUidElement(), false);
19593        composeOidExtras("uid", element.getUidElement(), false);
19594      }
19595      if (element.hasSopClassElement()) {
19596        composeOidCore("sopClass", element.getSopClassElement(), false);
19597        composeOidExtras("sopClass", element.getSopClassElement(), false);
19598      }
19599      if (element.hasTypeElement()) {
19600        composeStringCore("type", element.getTypeElement(), false);
19601        composeStringExtras("type", element.getTypeElement(), false);
19602      }
19603      if (element.hasTitleElement()) {
19604        composeStringCore("title", element.getTitleElement(), false);
19605        composeStringExtras("title", element.getTitleElement(), false);
19606      }
19607      if (element.hasContent()) {
19608        openArray("content");
19609        for (Attachment e : element.getContent()) 
19610          composeAttachment(null, e);
19611        closeArray();
19612      };
19613  }
19614
19615  protected void composeImmunization(String name, Immunization element) throws IOException {
19616    if (element != null) {
19617      prop("resourceType", name);
19618      composeImmunizationInner(element);
19619    }
19620  }
19621
19622  protected void composeImmunizationInner(Immunization element) throws IOException {
19623      composeDomainResourceElements(element);
19624      if (element.hasIdentifier()) {
19625        openArray("identifier");
19626        for (Identifier e : element.getIdentifier()) 
19627          composeIdentifier(null, e);
19628        closeArray();
19629      };
19630      if (element.hasStatusElement()) {
19631        composeCodeCore("status", element.getStatusElement(), false);
19632        composeCodeExtras("status", element.getStatusElement(), false);
19633      }
19634      if (element.hasDateElement()) {
19635        composeDateTimeCore("date", element.getDateElement(), false);
19636        composeDateTimeExtras("date", element.getDateElement(), false);
19637      }
19638      if (element.hasVaccineCode()) {
19639        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19640      }
19641      if (element.hasPatient()) {
19642        composeReference("patient", element.getPatient());
19643      }
19644      if (element.hasWasNotGivenElement()) {
19645        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
19646        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
19647      }
19648      if (element.hasReportedElement()) {
19649        composeBooleanCore("reported", element.getReportedElement(), false);
19650        composeBooleanExtras("reported", element.getReportedElement(), false);
19651      }
19652      if (element.hasPerformer()) {
19653        composeReference("performer", element.getPerformer());
19654      }
19655      if (element.hasRequester()) {
19656        composeReference("requester", element.getRequester());
19657      }
19658      if (element.hasEncounter()) {
19659        composeReference("encounter", element.getEncounter());
19660      }
19661      if (element.hasManufacturer()) {
19662        composeReference("manufacturer", element.getManufacturer());
19663      }
19664      if (element.hasLocation()) {
19665        composeReference("location", element.getLocation());
19666      }
19667      if (element.hasLotNumberElement()) {
19668        composeStringCore("lotNumber", element.getLotNumberElement(), false);
19669        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
19670      }
19671      if (element.hasExpirationDateElement()) {
19672        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
19673        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
19674      }
19675      if (element.hasSite()) {
19676        composeCodeableConcept("site", element.getSite());
19677      }
19678      if (element.hasRoute()) {
19679        composeCodeableConcept("route", element.getRoute());
19680      }
19681      if (element.hasDoseQuantity()) {
19682        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
19683      }
19684      if (element.hasNote()) {
19685        openArray("note");
19686        for (Annotation e : element.getNote()) 
19687          composeAnnotation(null, e);
19688        closeArray();
19689      };
19690      if (element.hasExplanation()) {
19691        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
19692      }
19693      if (element.hasReaction()) {
19694        openArray("reaction");
19695        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
19696          composeImmunizationImmunizationReactionComponent(null, e);
19697        closeArray();
19698      };
19699      if (element.hasVaccinationProtocol()) {
19700        openArray("vaccinationProtocol");
19701        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
19702          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
19703        closeArray();
19704      };
19705  }
19706
19707  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
19708    if (element != null) {
19709      open(name);
19710      composeImmunizationImmunizationExplanationComponentInner(element);
19711      close();
19712    }
19713  }
19714
19715  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
19716      composeBackbone(element);
19717      if (element.hasReason()) {
19718        openArray("reason");
19719        for (CodeableConcept e : element.getReason()) 
19720          composeCodeableConcept(null, e);
19721        closeArray();
19722      };
19723      if (element.hasReasonNotGiven()) {
19724        openArray("reasonNotGiven");
19725        for (CodeableConcept e : element.getReasonNotGiven()) 
19726          composeCodeableConcept(null, e);
19727        closeArray();
19728      };
19729  }
19730
19731  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
19732    if (element != null) {
19733      open(name);
19734      composeImmunizationImmunizationReactionComponentInner(element);
19735      close();
19736    }
19737  }
19738
19739  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
19740      composeBackbone(element);
19741      if (element.hasDateElement()) {
19742        composeDateTimeCore("date", element.getDateElement(), false);
19743        composeDateTimeExtras("date", element.getDateElement(), false);
19744      }
19745      if (element.hasDetail()) {
19746        composeReference("detail", element.getDetail());
19747      }
19748      if (element.hasReportedElement()) {
19749        composeBooleanCore("reported", element.getReportedElement(), false);
19750        composeBooleanExtras("reported", element.getReportedElement(), false);
19751      }
19752  }
19753
19754  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19755    if (element != null) {
19756      open(name);
19757      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
19758      close();
19759    }
19760  }
19761
19762  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19763      composeBackbone(element);
19764      if (element.hasDoseSequenceElement()) {
19765        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
19766        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
19767      }
19768      if (element.hasDescriptionElement()) {
19769        composeStringCore("description", element.getDescriptionElement(), false);
19770        composeStringExtras("description", element.getDescriptionElement(), false);
19771      }
19772      if (element.hasAuthority()) {
19773        composeReference("authority", element.getAuthority());
19774      }
19775      if (element.hasSeriesElement()) {
19776        composeStringCore("series", element.getSeriesElement(), false);
19777        composeStringExtras("series", element.getSeriesElement(), false);
19778      }
19779      if (element.hasSeriesDosesElement()) {
19780        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
19781        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
19782      }
19783      if (element.hasTargetDisease()) {
19784        openArray("targetDisease");
19785        for (CodeableConcept e : element.getTargetDisease()) 
19786          composeCodeableConcept(null, e);
19787        closeArray();
19788      };
19789      if (element.hasDoseStatus()) {
19790        composeCodeableConcept("doseStatus", element.getDoseStatus());
19791      }
19792      if (element.hasDoseStatusReason()) {
19793        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
19794      }
19795  }
19796
19797  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
19798    if (element != null) {
19799      prop("resourceType", name);
19800      composeImmunizationRecommendationInner(element);
19801    }
19802  }
19803
19804  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
19805      composeDomainResourceElements(element);
19806      if (element.hasIdentifier()) {
19807        openArray("identifier");
19808        for (Identifier e : element.getIdentifier()) 
19809          composeIdentifier(null, e);
19810        closeArray();
19811      };
19812      if (element.hasPatient()) {
19813        composeReference("patient", element.getPatient());
19814      }
19815      if (element.hasRecommendation()) {
19816        openArray("recommendation");
19817        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
19818          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
19819        closeArray();
19820      };
19821  }
19822
19823  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19824    if (element != null) {
19825      open(name);
19826      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
19827      close();
19828    }
19829  }
19830
19831  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19832      composeBackbone(element);
19833      if (element.hasDateElement()) {
19834        composeDateTimeCore("date", element.getDateElement(), false);
19835        composeDateTimeExtras("date", element.getDateElement(), false);
19836      }
19837      if (element.hasVaccineCode()) {
19838        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19839      }
19840      if (element.hasDoseNumberElement()) {
19841        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
19842        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
19843      }
19844      if (element.hasForecastStatus()) {
19845        composeCodeableConcept("forecastStatus", element.getForecastStatus());
19846      }
19847      if (element.hasDateCriterion()) {
19848        openArray("dateCriterion");
19849        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
19850          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
19851        closeArray();
19852      };
19853      if (element.hasProtocol()) {
19854        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
19855      }
19856      if (element.hasSupportingImmunization()) {
19857        openArray("supportingImmunization");
19858        for (Reference e : element.getSupportingImmunization()) 
19859          composeReference(null, e);
19860        closeArray();
19861      };
19862      if (element.hasSupportingPatientInformation()) {
19863        openArray("supportingPatientInformation");
19864        for (Reference e : element.getSupportingPatientInformation()) 
19865          composeReference(null, e);
19866        closeArray();
19867      };
19868  }
19869
19870  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19871    if (element != null) {
19872      open(name);
19873      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
19874      close();
19875    }
19876  }
19877
19878  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19879      composeBackbone(element);
19880      if (element.hasCode()) {
19881        composeCodeableConcept("code", element.getCode());
19882      }
19883      if (element.hasValueElement()) {
19884        composeDateTimeCore("value", element.getValueElement(), false);
19885        composeDateTimeExtras("value", element.getValueElement(), false);
19886      }
19887  }
19888
19889  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19890    if (element != null) {
19891      open(name);
19892      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
19893      close();
19894    }
19895  }
19896
19897  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19898      composeBackbone(element);
19899      if (element.hasDoseSequenceElement()) {
19900        composeIntegerCore("doseSequence", element.getDoseSequenceElement(), false);
19901        composeIntegerExtras("doseSequence", element.getDoseSequenceElement(), false);
19902      }
19903      if (element.hasDescriptionElement()) {
19904        composeStringCore("description", element.getDescriptionElement(), false);
19905        composeStringExtras("description", element.getDescriptionElement(), false);
19906      }
19907      if (element.hasAuthority()) {
19908        composeReference("authority", element.getAuthority());
19909      }
19910      if (element.hasSeriesElement()) {
19911        composeStringCore("series", element.getSeriesElement(), false);
19912        composeStringExtras("series", element.getSeriesElement(), false);
19913      }
19914  }
19915
19916  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
19917    if (element != null) {
19918      prop("resourceType", name);
19919      composeImplementationGuideInner(element);
19920    }
19921  }
19922
19923  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
19924      composeDomainResourceElements(element);
19925      if (element.hasUrlElement()) {
19926        composeUriCore("url", element.getUrlElement(), false);
19927        composeUriExtras("url", element.getUrlElement(), false);
19928      }
19929      if (element.hasVersionElement()) {
19930        composeStringCore("version", element.getVersionElement(), false);
19931        composeStringExtras("version", element.getVersionElement(), false);
19932      }
19933      if (element.hasNameElement()) {
19934        composeStringCore("name", element.getNameElement(), false);
19935        composeStringExtras("name", element.getNameElement(), false);
19936      }
19937      if (element.hasStatusElement()) {
19938        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19939        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19940      }
19941      if (element.hasExperimentalElement()) {
19942        composeBooleanCore("experimental", element.getExperimentalElement(), false);
19943        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
19944      }
19945      if (element.hasPublisherElement()) {
19946        composeStringCore("publisher", element.getPublisherElement(), false);
19947        composeStringExtras("publisher", element.getPublisherElement(), false);
19948      }
19949      if (element.hasContact()) {
19950        openArray("contact");
19951        for (ImplementationGuide.ImplementationGuideContactComponent e : element.getContact()) 
19952          composeImplementationGuideImplementationGuideContactComponent(null, e);
19953        closeArray();
19954      };
19955      if (element.hasDateElement()) {
19956        composeDateTimeCore("date", element.getDateElement(), false);
19957        composeDateTimeExtras("date", element.getDateElement(), false);
19958      }
19959      if (element.hasDescriptionElement()) {
19960        composeStringCore("description", element.getDescriptionElement(), false);
19961        composeStringExtras("description", element.getDescriptionElement(), false);
19962      }
19963      if (element.hasUseContext()) {
19964        openArray("useContext");
19965        for (CodeableConcept e : element.getUseContext()) 
19966          composeCodeableConcept(null, e);
19967        closeArray();
19968      };
19969      if (element.hasCopyrightElement()) {
19970        composeStringCore("copyright", element.getCopyrightElement(), false);
19971        composeStringExtras("copyright", element.getCopyrightElement(), false);
19972      }
19973      if (element.hasFhirVersionElement()) {
19974        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
19975        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
19976      }
19977      if (element.hasDependency()) {
19978        openArray("dependency");
19979        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
19980          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
19981        closeArray();
19982      };
19983      if (element.hasPackage()) {
19984        openArray("package");
19985        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
19986          composeImplementationGuideImplementationGuidePackageComponent(null, e);
19987        closeArray();
19988      };
19989      if (element.hasGlobal()) {
19990        openArray("global");
19991        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
19992          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
19993        closeArray();
19994      };
19995      if (element.hasBinary()) {
19996        openArray("binary");
19997        for (UriType e : element.getBinary()) 
19998          composeUriCore(null, e, true);
19999        closeArray();
20000        if (anyHasExtras(element.getBinary())) {
20001          openArray("_binary");
20002          for (UriType e : element.getBinary()) 
20003            composeUriExtras(null, e, true);
20004          closeArray();
20005        }
20006      };
20007      if (element.hasPage()) {
20008        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
20009      }
20010  }
20011
20012  protected void composeImplementationGuideImplementationGuideContactComponent(String name, ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20013    if (element != null) {
20014      open(name);
20015      composeImplementationGuideImplementationGuideContactComponentInner(element);
20016      close();
20017    }
20018  }
20019
20020  protected void composeImplementationGuideImplementationGuideContactComponentInner(ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20021      composeBackbone(element);
20022      if (element.hasNameElement()) {
20023        composeStringCore("name", element.getNameElement(), false);
20024        composeStringExtras("name", element.getNameElement(), false);
20025      }
20026      if (element.hasTelecom()) {
20027        openArray("telecom");
20028        for (ContactPoint e : element.getTelecom()) 
20029          composeContactPoint(null, e);
20030        closeArray();
20031      };
20032  }
20033
20034  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20035    if (element != null) {
20036      open(name);
20037      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
20038      close();
20039    }
20040  }
20041
20042  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20043      composeBackbone(element);
20044      if (element.hasTypeElement()) {
20045        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20046        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20047      }
20048      if (element.hasUriElement()) {
20049        composeUriCore("uri", element.getUriElement(), false);
20050        composeUriExtras("uri", element.getUriElement(), false);
20051      }
20052  }
20053
20054  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20055    if (element != null) {
20056      open(name);
20057      composeImplementationGuideImplementationGuidePackageComponentInner(element);
20058      close();
20059    }
20060  }
20061
20062  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20063      composeBackbone(element);
20064      if (element.hasNameElement()) {
20065        composeStringCore("name", element.getNameElement(), false);
20066        composeStringExtras("name", element.getNameElement(), false);
20067      }
20068      if (element.hasDescriptionElement()) {
20069        composeStringCore("description", element.getDescriptionElement(), false);
20070        composeStringExtras("description", element.getDescriptionElement(), false);
20071      }
20072      if (element.hasResource()) {
20073        openArray("resource");
20074        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
20075          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
20076        closeArray();
20077      };
20078  }
20079
20080  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20081    if (element != null) {
20082      open(name);
20083      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
20084      close();
20085    }
20086  }
20087
20088  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20089      composeBackbone(element);
20090      if (element.hasPurposeElement()) {
20091        composeEnumerationCore("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20092        composeEnumerationExtras("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20093      }
20094      if (element.hasNameElement()) {
20095        composeStringCore("name", element.getNameElement(), false);
20096        composeStringExtras("name", element.getNameElement(), false);
20097      }
20098      if (element.hasDescriptionElement()) {
20099        composeStringCore("description", element.getDescriptionElement(), false);
20100        composeStringExtras("description", element.getDescriptionElement(), false);
20101      }
20102      if (element.hasAcronymElement()) {
20103        composeStringCore("acronym", element.getAcronymElement(), false);
20104        composeStringExtras("acronym", element.getAcronymElement(), false);
20105      }
20106      if (element.hasSource()) {
20107        composeType("source", element.getSource());
20108      }
20109      if (element.hasExampleFor()) {
20110        composeReference("exampleFor", element.getExampleFor());
20111      }
20112  }
20113
20114  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20115    if (element != null) {
20116      open(name);
20117      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
20118      close();
20119    }
20120  }
20121
20122  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20123      composeBackbone(element);
20124      if (element.hasTypeElement()) {
20125        composeCodeCore("type", element.getTypeElement(), false);
20126        composeCodeExtras("type", element.getTypeElement(), false);
20127      }
20128      if (element.hasProfile()) {
20129        composeReference("profile", element.getProfile());
20130      }
20131  }
20132
20133  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20134    if (element != null) {
20135      open(name);
20136      composeImplementationGuideImplementationGuidePageComponentInner(element);
20137      close();
20138    }
20139  }
20140
20141  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20142      composeBackbone(element);
20143      if (element.hasSourceElement()) {
20144        composeUriCore("source", element.getSourceElement(), false);
20145        composeUriExtras("source", element.getSourceElement(), false);
20146      }
20147      if (element.hasNameElement()) {
20148        composeStringCore("name", element.getNameElement(), false);
20149        composeStringExtras("name", element.getNameElement(), false);
20150      }
20151      if (element.hasKindElement()) {
20152        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20153        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20154      }
20155      if (element.hasType()) {
20156        openArray("type");
20157        for (CodeType e : element.getType()) 
20158          composeCodeCore(null, e, true);
20159        closeArray();
20160        if (anyHasExtras(element.getType())) {
20161          openArray("_type");
20162          for (CodeType e : element.getType()) 
20163            composeCodeExtras(null, e, true);
20164          closeArray();
20165        }
20166      };
20167      if (element.hasPackage()) {
20168        openArray("package");
20169        for (StringType e : element.getPackage()) 
20170          composeStringCore(null, e, true);
20171        closeArray();
20172        if (anyHasExtras(element.getPackage())) {
20173          openArray("_package");
20174          for (StringType e : element.getPackage()) 
20175            composeStringExtras(null, e, true);
20176          closeArray();
20177        }
20178      };
20179      if (element.hasFormatElement()) {
20180        composeCodeCore("format", element.getFormatElement(), false);
20181        composeCodeExtras("format", element.getFormatElement(), false);
20182      }
20183      if (element.hasPage()) {
20184        openArray("page");
20185        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
20186          composeImplementationGuideImplementationGuidePageComponent(null, e);
20187        closeArray();
20188      };
20189  }
20190
20191  protected void composeList_(String name, List_ element) throws IOException {
20192    if (element != null) {
20193      prop("resourceType", name);
20194      composeList_Inner(element);
20195    }
20196  }
20197
20198  protected void composeList_Inner(List_ element) throws IOException {
20199      composeDomainResourceElements(element);
20200      if (element.hasIdentifier()) {
20201        openArray("identifier");
20202        for (Identifier e : element.getIdentifier()) 
20203          composeIdentifier(null, e);
20204        closeArray();
20205      };
20206      if (element.hasTitleElement()) {
20207        composeStringCore("title", element.getTitleElement(), false);
20208        composeStringExtras("title", element.getTitleElement(), false);
20209      }
20210      if (element.hasCode()) {
20211        composeCodeableConcept("code", element.getCode());
20212      }
20213      if (element.hasSubject()) {
20214        composeReference("subject", element.getSubject());
20215      }
20216      if (element.hasSource()) {
20217        composeReference("source", element.getSource());
20218      }
20219      if (element.hasEncounter()) {
20220        composeReference("encounter", element.getEncounter());
20221      }
20222      if (element.hasStatusElement()) {
20223        composeEnumerationCore("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20224        composeEnumerationExtras("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20225      }
20226      if (element.hasDateElement()) {
20227        composeDateTimeCore("date", element.getDateElement(), false);
20228        composeDateTimeExtras("date", element.getDateElement(), false);
20229      }
20230      if (element.hasOrderedBy()) {
20231        composeCodeableConcept("orderedBy", element.getOrderedBy());
20232      }
20233      if (element.hasModeElement()) {
20234        composeEnumerationCore("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20235        composeEnumerationExtras("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20236      }
20237      if (element.hasNoteElement()) {
20238        composeStringCore("note", element.getNoteElement(), false);
20239        composeStringExtras("note", element.getNoteElement(), false);
20240      }
20241      if (element.hasEntry()) {
20242        openArray("entry");
20243        for (List_.ListEntryComponent e : element.getEntry()) 
20244          composeList_ListEntryComponent(null, e);
20245        closeArray();
20246      };
20247      if (element.hasEmptyReason()) {
20248        composeCodeableConcept("emptyReason", element.getEmptyReason());
20249      }
20250  }
20251
20252  protected void composeList_ListEntryComponent(String name, List_.ListEntryComponent element) throws IOException {
20253    if (element != null) {
20254      open(name);
20255      composeList_ListEntryComponentInner(element);
20256      close();
20257    }
20258  }
20259
20260  protected void composeList_ListEntryComponentInner(List_.ListEntryComponent element) throws IOException {
20261      composeBackbone(element);
20262      if (element.hasFlag()) {
20263        composeCodeableConcept("flag", element.getFlag());
20264      }
20265      if (element.hasDeletedElement()) {
20266        composeBooleanCore("deleted", element.getDeletedElement(), false);
20267        composeBooleanExtras("deleted", element.getDeletedElement(), false);
20268      }
20269      if (element.hasDateElement()) {
20270        composeDateTimeCore("date", element.getDateElement(), false);
20271        composeDateTimeExtras("date", element.getDateElement(), false);
20272      }
20273      if (element.hasItem()) {
20274        composeReference("item", element.getItem());
20275      }
20276  }
20277
20278  protected void composeLocation(String name, Location element) throws IOException {
20279    if (element != null) {
20280      prop("resourceType", name);
20281      composeLocationInner(element);
20282    }
20283  }
20284
20285  protected void composeLocationInner(Location element) throws IOException {
20286      composeDomainResourceElements(element);
20287      if (element.hasIdentifier()) {
20288        openArray("identifier");
20289        for (Identifier e : element.getIdentifier()) 
20290          composeIdentifier(null, e);
20291        closeArray();
20292      };
20293      if (element.hasStatusElement()) {
20294        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20295        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20296      }
20297      if (element.hasNameElement()) {
20298        composeStringCore("name", element.getNameElement(), false);
20299        composeStringExtras("name", element.getNameElement(), false);
20300      }
20301      if (element.hasDescriptionElement()) {
20302        composeStringCore("description", element.getDescriptionElement(), false);
20303        composeStringExtras("description", element.getDescriptionElement(), false);
20304      }
20305      if (element.hasModeElement()) {
20306        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20307        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20308      }
20309      if (element.hasType()) {
20310        composeCodeableConcept("type", element.getType());
20311      }
20312      if (element.hasTelecom()) {
20313        openArray("telecom");
20314        for (ContactPoint e : element.getTelecom()) 
20315          composeContactPoint(null, e);
20316        closeArray();
20317      };
20318      if (element.hasAddress()) {
20319        composeAddress("address", element.getAddress());
20320      }
20321      if (element.hasPhysicalType()) {
20322        composeCodeableConcept("physicalType", element.getPhysicalType());
20323      }
20324      if (element.hasPosition()) {
20325        composeLocationLocationPositionComponent("position", element.getPosition());
20326      }
20327      if (element.hasManagingOrganization()) {
20328        composeReference("managingOrganization", element.getManagingOrganization());
20329      }
20330      if (element.hasPartOf()) {
20331        composeReference("partOf", element.getPartOf());
20332      }
20333  }
20334
20335  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
20336    if (element != null) {
20337      open(name);
20338      composeLocationLocationPositionComponentInner(element);
20339      close();
20340    }
20341  }
20342
20343  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
20344      composeBackbone(element);
20345      if (element.hasLongitudeElement()) {
20346        composeDecimalCore("longitude", element.getLongitudeElement(), false);
20347        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
20348      }
20349      if (element.hasLatitudeElement()) {
20350        composeDecimalCore("latitude", element.getLatitudeElement(), false);
20351        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
20352      }
20353      if (element.hasAltitudeElement()) {
20354        composeDecimalCore("altitude", element.getAltitudeElement(), false);
20355        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
20356      }
20357  }
20358
20359  protected void composeMedia(String name, Media element) throws IOException {
20360    if (element != null) {
20361      prop("resourceType", name);
20362      composeMediaInner(element);
20363    }
20364  }
20365
20366  protected void composeMediaInner(Media element) throws IOException {
20367      composeDomainResourceElements(element);
20368      if (element.hasTypeElement()) {
20369        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20370        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20371      }
20372      if (element.hasSubtype()) {
20373        composeCodeableConcept("subtype", element.getSubtype());
20374      }
20375      if (element.hasIdentifier()) {
20376        openArray("identifier");
20377        for (Identifier e : element.getIdentifier()) 
20378          composeIdentifier(null, e);
20379        closeArray();
20380      };
20381      if (element.hasSubject()) {
20382        composeReference("subject", element.getSubject());
20383      }
20384      if (element.hasOperator()) {
20385        composeReference("operator", element.getOperator());
20386      }
20387      if (element.hasView()) {
20388        composeCodeableConcept("view", element.getView());
20389      }
20390      if (element.hasDeviceNameElement()) {
20391        composeStringCore("deviceName", element.getDeviceNameElement(), false);
20392        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
20393      }
20394      if (element.hasHeightElement()) {
20395        composePositiveIntCore("height", element.getHeightElement(), false);
20396        composePositiveIntExtras("height", element.getHeightElement(), false);
20397      }
20398      if (element.hasWidthElement()) {
20399        composePositiveIntCore("width", element.getWidthElement(), false);
20400        composePositiveIntExtras("width", element.getWidthElement(), false);
20401      }
20402      if (element.hasFramesElement()) {
20403        composePositiveIntCore("frames", element.getFramesElement(), false);
20404        composePositiveIntExtras("frames", element.getFramesElement(), false);
20405      }
20406      if (element.hasDurationElement()) {
20407        composeUnsignedIntCore("duration", element.getDurationElement(), false);
20408        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
20409      }
20410      if (element.hasContent()) {
20411        composeAttachment("content", element.getContent());
20412      }
20413  }
20414
20415  protected void composeMedication(String name, Medication element) throws IOException {
20416    if (element != null) {
20417      prop("resourceType", name);
20418      composeMedicationInner(element);
20419    }
20420  }
20421
20422  protected void composeMedicationInner(Medication element) throws IOException {
20423      composeDomainResourceElements(element);
20424      if (element.hasCode()) {
20425        composeCodeableConcept("code", element.getCode());
20426      }
20427      if (element.hasIsBrandElement()) {
20428        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
20429        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
20430      }
20431      if (element.hasManufacturer()) {
20432        composeReference("manufacturer", element.getManufacturer());
20433      }
20434      if (element.hasProduct()) {
20435        composeMedicationMedicationProductComponent("product", element.getProduct());
20436      }
20437      if (element.hasPackage()) {
20438        composeMedicationMedicationPackageComponent("package", element.getPackage());
20439      }
20440  }
20441
20442  protected void composeMedicationMedicationProductComponent(String name, Medication.MedicationProductComponent element) throws IOException {
20443    if (element != null) {
20444      open(name);
20445      composeMedicationMedicationProductComponentInner(element);
20446      close();
20447    }
20448  }
20449
20450  protected void composeMedicationMedicationProductComponentInner(Medication.MedicationProductComponent element) throws IOException {
20451      composeBackbone(element);
20452      if (element.hasForm()) {
20453        composeCodeableConcept("form", element.getForm());
20454      }
20455      if (element.hasIngredient()) {
20456        openArray("ingredient");
20457        for (Medication.MedicationProductIngredientComponent e : element.getIngredient()) 
20458          composeMedicationMedicationProductIngredientComponent(null, e);
20459        closeArray();
20460      };
20461      if (element.hasBatch()) {
20462        openArray("batch");
20463        for (Medication.MedicationProductBatchComponent e : element.getBatch()) 
20464          composeMedicationMedicationProductBatchComponent(null, e);
20465        closeArray();
20466      };
20467  }
20468
20469  protected void composeMedicationMedicationProductIngredientComponent(String name, Medication.MedicationProductIngredientComponent element) throws IOException {
20470    if (element != null) {
20471      open(name);
20472      composeMedicationMedicationProductIngredientComponentInner(element);
20473      close();
20474    }
20475  }
20476
20477  protected void composeMedicationMedicationProductIngredientComponentInner(Medication.MedicationProductIngredientComponent element) throws IOException {
20478      composeBackbone(element);
20479      if (element.hasItem()) {
20480        composeReference("item", element.getItem());
20481      }
20482      if (element.hasAmount()) {
20483        composeRatio("amount", element.getAmount());
20484      }
20485  }
20486
20487  protected void composeMedicationMedicationProductBatchComponent(String name, Medication.MedicationProductBatchComponent element) throws IOException {
20488    if (element != null) {
20489      open(name);
20490      composeMedicationMedicationProductBatchComponentInner(element);
20491      close();
20492    }
20493  }
20494
20495  protected void composeMedicationMedicationProductBatchComponentInner(Medication.MedicationProductBatchComponent element) throws IOException {
20496      composeBackbone(element);
20497      if (element.hasLotNumberElement()) {
20498        composeStringCore("lotNumber", element.getLotNumberElement(), false);
20499        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
20500      }
20501      if (element.hasExpirationDateElement()) {
20502        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
20503        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
20504      }
20505  }
20506
20507  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
20508    if (element != null) {
20509      open(name);
20510      composeMedicationMedicationPackageComponentInner(element);
20511      close();
20512    }
20513  }
20514
20515  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
20516      composeBackbone(element);
20517      if (element.hasContainer()) {
20518        composeCodeableConcept("container", element.getContainer());
20519      }
20520      if (element.hasContent()) {
20521        openArray("content");
20522        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
20523          composeMedicationMedicationPackageContentComponent(null, e);
20524        closeArray();
20525      };
20526  }
20527
20528  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
20529    if (element != null) {
20530      open(name);
20531      composeMedicationMedicationPackageContentComponentInner(element);
20532      close();
20533    }
20534  }
20535
20536  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
20537      composeBackbone(element);
20538      if (element.hasItem()) {
20539        composeReference("item", element.getItem());
20540      }
20541      if (element.hasAmount()) {
20542        composeSimpleQuantity("amount", element.getAmount());
20543      }
20544  }
20545
20546  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
20547    if (element != null) {
20548      prop("resourceType", name);
20549      composeMedicationAdministrationInner(element);
20550    }
20551  }
20552
20553  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
20554      composeDomainResourceElements(element);
20555      if (element.hasIdentifier()) {
20556        openArray("identifier");
20557        for (Identifier e : element.getIdentifier()) 
20558          composeIdentifier(null, e);
20559        closeArray();
20560      };
20561      if (element.hasStatusElement()) {
20562        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20563        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20564      }
20565      if (element.hasPatient()) {
20566        composeReference("patient", element.getPatient());
20567      }
20568      if (element.hasPractitioner()) {
20569        composeReference("practitioner", element.getPractitioner());
20570      }
20571      if (element.hasEncounter()) {
20572        composeReference("encounter", element.getEncounter());
20573      }
20574      if (element.hasPrescription()) {
20575        composeReference("prescription", element.getPrescription());
20576      }
20577      if (element.hasWasNotGivenElement()) {
20578        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
20579        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
20580      }
20581      if (element.hasReasonNotGiven()) {
20582        openArray("reasonNotGiven");
20583        for (CodeableConcept e : element.getReasonNotGiven()) 
20584          composeCodeableConcept(null, e);
20585        closeArray();
20586      };
20587      if (element.hasReasonGiven()) {
20588        openArray("reasonGiven");
20589        for (CodeableConcept e : element.getReasonGiven()) 
20590          composeCodeableConcept(null, e);
20591        closeArray();
20592      };
20593      if (element.hasEffectiveTime()) {
20594        composeType("effectiveTime", element.getEffectiveTime());
20595      }
20596      if (element.hasMedication()) {
20597        composeType("medication", element.getMedication());
20598      }
20599      if (element.hasDevice()) {
20600        openArray("device");
20601        for (Reference e : element.getDevice()) 
20602          composeReference(null, e);
20603        closeArray();
20604      };
20605      if (element.hasNoteElement()) {
20606        composeStringCore("note", element.getNoteElement(), false);
20607        composeStringExtras("note", element.getNoteElement(), false);
20608      }
20609      if (element.hasDosage()) {
20610        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
20611      }
20612  }
20613
20614  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20615    if (element != null) {
20616      open(name);
20617      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
20618      close();
20619    }
20620  }
20621
20622  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20623      composeBackbone(element);
20624      if (element.hasTextElement()) {
20625        composeStringCore("text", element.getTextElement(), false);
20626        composeStringExtras("text", element.getTextElement(), false);
20627      }
20628      if (element.hasSite()) {
20629        composeType("site", element.getSite());
20630      }
20631      if (element.hasRoute()) {
20632        composeCodeableConcept("route", element.getRoute());
20633      }
20634      if (element.hasMethod()) {
20635        composeCodeableConcept("method", element.getMethod());
20636      }
20637      if (element.hasQuantity()) {
20638        composeSimpleQuantity("quantity", element.getQuantity());
20639      }
20640      if (element.hasRate()) {
20641        composeType("rate", element.getRate());
20642      }
20643  }
20644
20645  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
20646    if (element != null) {
20647      prop("resourceType", name);
20648      composeMedicationDispenseInner(element);
20649    }
20650  }
20651
20652  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
20653      composeDomainResourceElements(element);
20654      if (element.hasIdentifier()) {
20655        composeIdentifier("identifier", element.getIdentifier());
20656      }
20657      if (element.hasStatusElement()) {
20658        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20659        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20660      }
20661      if (element.hasPatient()) {
20662        composeReference("patient", element.getPatient());
20663      }
20664      if (element.hasDispenser()) {
20665        composeReference("dispenser", element.getDispenser());
20666      }
20667      if (element.hasAuthorizingPrescription()) {
20668        openArray("authorizingPrescription");
20669        for (Reference e : element.getAuthorizingPrescription()) 
20670          composeReference(null, e);
20671        closeArray();
20672      };
20673      if (element.hasType()) {
20674        composeCodeableConcept("type", element.getType());
20675      }
20676      if (element.hasQuantity()) {
20677        composeSimpleQuantity("quantity", element.getQuantity());
20678      }
20679      if (element.hasDaysSupply()) {
20680        composeSimpleQuantity("daysSupply", element.getDaysSupply());
20681      }
20682      if (element.hasMedication()) {
20683        composeType("medication", element.getMedication());
20684      }
20685      if (element.hasWhenPreparedElement()) {
20686        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
20687        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
20688      }
20689      if (element.hasWhenHandedOverElement()) {
20690        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
20691        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
20692      }
20693      if (element.hasDestination()) {
20694        composeReference("destination", element.getDestination());
20695      }
20696      if (element.hasReceiver()) {
20697        openArray("receiver");
20698        for (Reference e : element.getReceiver()) 
20699          composeReference(null, e);
20700        closeArray();
20701      };
20702      if (element.hasNoteElement()) {
20703        composeStringCore("note", element.getNoteElement(), false);
20704        composeStringExtras("note", element.getNoteElement(), false);
20705      }
20706      if (element.hasDosageInstruction()) {
20707        openArray("dosageInstruction");
20708        for (MedicationDispense.MedicationDispenseDosageInstructionComponent e : element.getDosageInstruction()) 
20709          composeMedicationDispenseMedicationDispenseDosageInstructionComponent(null, e);
20710        closeArray();
20711      };
20712      if (element.hasSubstitution()) {
20713        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
20714      }
20715  }
20716
20717  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponent(String name, MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20718    if (element != null) {
20719      open(name);
20720      composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(element);
20721      close();
20722    }
20723  }
20724
20725  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20726      composeBackbone(element);
20727      if (element.hasTextElement()) {
20728        composeStringCore("text", element.getTextElement(), false);
20729        composeStringExtras("text", element.getTextElement(), false);
20730      }
20731      if (element.hasAdditionalInstructions()) {
20732        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20733      }
20734      if (element.hasTiming()) {
20735        composeTiming("timing", element.getTiming());
20736      }
20737      if (element.hasAsNeeded()) {
20738        composeType("asNeeded", element.getAsNeeded());
20739      }
20740      if (element.hasSite()) {
20741        composeType("site", element.getSite());
20742      }
20743      if (element.hasRoute()) {
20744        composeCodeableConcept("route", element.getRoute());
20745      }
20746      if (element.hasMethod()) {
20747        composeCodeableConcept("method", element.getMethod());
20748      }
20749      if (element.hasDose()) {
20750        composeType("dose", element.getDose());
20751      }
20752      if (element.hasRate()) {
20753        composeType("rate", element.getRate());
20754      }
20755      if (element.hasMaxDosePerPeriod()) {
20756        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20757      }
20758  }
20759
20760  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20761    if (element != null) {
20762      open(name);
20763      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
20764      close();
20765    }
20766  }
20767
20768  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20769      composeBackbone(element);
20770      if (element.hasType()) {
20771        composeCodeableConcept("type", element.getType());
20772      }
20773      if (element.hasReason()) {
20774        openArray("reason");
20775        for (CodeableConcept e : element.getReason()) 
20776          composeCodeableConcept(null, e);
20777        closeArray();
20778      };
20779      if (element.hasResponsibleParty()) {
20780        openArray("responsibleParty");
20781        for (Reference e : element.getResponsibleParty()) 
20782          composeReference(null, e);
20783        closeArray();
20784      };
20785  }
20786
20787  protected void composeMedicationOrder(String name, MedicationOrder element) throws IOException {
20788    if (element != null) {
20789      prop("resourceType", name);
20790      composeMedicationOrderInner(element);
20791    }
20792  }
20793
20794  protected void composeMedicationOrderInner(MedicationOrder element) throws IOException {
20795      composeDomainResourceElements(element);
20796      if (element.hasIdentifier()) {
20797        openArray("identifier");
20798        for (Identifier e : element.getIdentifier()) 
20799          composeIdentifier(null, e);
20800        closeArray();
20801      };
20802      if (element.hasDateWrittenElement()) {
20803        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
20804        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
20805      }
20806      if (element.hasStatusElement()) {
20807        composeEnumerationCore("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20808        composeEnumerationExtras("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20809      }
20810      if (element.hasDateEndedElement()) {
20811        composeDateTimeCore("dateEnded", element.getDateEndedElement(), false);
20812        composeDateTimeExtras("dateEnded", element.getDateEndedElement(), false);
20813      }
20814      if (element.hasReasonEnded()) {
20815        composeCodeableConcept("reasonEnded", element.getReasonEnded());
20816      }
20817      if (element.hasPatient()) {
20818        composeReference("patient", element.getPatient());
20819      }
20820      if (element.hasPrescriber()) {
20821        composeReference("prescriber", element.getPrescriber());
20822      }
20823      if (element.hasEncounter()) {
20824        composeReference("encounter", element.getEncounter());
20825      }
20826      if (element.hasReason()) {
20827        composeType("reason", element.getReason());
20828      }
20829      if (element.hasNoteElement()) {
20830        composeStringCore("note", element.getNoteElement(), false);
20831        composeStringExtras("note", element.getNoteElement(), false);
20832      }
20833      if (element.hasMedication()) {
20834        composeType("medication", element.getMedication());
20835      }
20836      if (element.hasDosageInstruction()) {
20837        openArray("dosageInstruction");
20838        for (MedicationOrder.MedicationOrderDosageInstructionComponent e : element.getDosageInstruction()) 
20839          composeMedicationOrderMedicationOrderDosageInstructionComponent(null, e);
20840        closeArray();
20841      };
20842      if (element.hasDispenseRequest()) {
20843        composeMedicationOrderMedicationOrderDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
20844      }
20845      if (element.hasSubstitution()) {
20846        composeMedicationOrderMedicationOrderSubstitutionComponent("substitution", element.getSubstitution());
20847      }
20848      if (element.hasPriorPrescription()) {
20849        composeReference("priorPrescription", element.getPriorPrescription());
20850      }
20851  }
20852
20853  protected void composeMedicationOrderMedicationOrderDosageInstructionComponent(String name, MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20854    if (element != null) {
20855      open(name);
20856      composeMedicationOrderMedicationOrderDosageInstructionComponentInner(element);
20857      close();
20858    }
20859  }
20860
20861  protected void composeMedicationOrderMedicationOrderDosageInstructionComponentInner(MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20862      composeBackbone(element);
20863      if (element.hasTextElement()) {
20864        composeStringCore("text", element.getTextElement(), false);
20865        composeStringExtras("text", element.getTextElement(), false);
20866      }
20867      if (element.hasAdditionalInstructions()) {
20868        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20869      }
20870      if (element.hasTiming()) {
20871        composeTiming("timing", element.getTiming());
20872      }
20873      if (element.hasAsNeeded()) {
20874        composeType("asNeeded", element.getAsNeeded());
20875      }
20876      if (element.hasSite()) {
20877        composeType("site", element.getSite());
20878      }
20879      if (element.hasRoute()) {
20880        composeCodeableConcept("route", element.getRoute());
20881      }
20882      if (element.hasMethod()) {
20883        composeCodeableConcept("method", element.getMethod());
20884      }
20885      if (element.hasDose()) {
20886        composeType("dose", element.getDose());
20887      }
20888      if (element.hasRate()) {
20889        composeType("rate", element.getRate());
20890      }
20891      if (element.hasMaxDosePerPeriod()) {
20892        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20893      }
20894  }
20895
20896  protected void composeMedicationOrderMedicationOrderDispenseRequestComponent(String name, MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20897    if (element != null) {
20898      open(name);
20899      composeMedicationOrderMedicationOrderDispenseRequestComponentInner(element);
20900      close();
20901    }
20902  }
20903
20904  protected void composeMedicationOrderMedicationOrderDispenseRequestComponentInner(MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20905      composeBackbone(element);
20906      if (element.hasMedication()) {
20907        composeType("medication", element.getMedication());
20908      }
20909      if (element.hasValidityPeriod()) {
20910        composePeriod("validityPeriod", element.getValidityPeriod());
20911      }
20912      if (element.hasNumberOfRepeatsAllowedElement()) {
20913        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20914        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20915      }
20916      if (element.hasQuantity()) {
20917        composeSimpleQuantity("quantity", element.getQuantity());
20918      }
20919      if (element.hasExpectedSupplyDuration()) {
20920        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
20921      }
20922  }
20923
20924  protected void composeMedicationOrderMedicationOrderSubstitutionComponent(String name, MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20925    if (element != null) {
20926      open(name);
20927      composeMedicationOrderMedicationOrderSubstitutionComponentInner(element);
20928      close();
20929    }
20930  }
20931
20932  protected void composeMedicationOrderMedicationOrderSubstitutionComponentInner(MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20933      composeBackbone(element);
20934      if (element.hasType()) {
20935        composeCodeableConcept("type", element.getType());
20936      }
20937      if (element.hasReason()) {
20938        composeCodeableConcept("reason", element.getReason());
20939      }
20940  }
20941
20942  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
20943    if (element != null) {
20944      prop("resourceType", name);
20945      composeMedicationStatementInner(element);
20946    }
20947  }
20948
20949  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
20950      composeDomainResourceElements(element);
20951      if (element.hasIdentifier()) {
20952        openArray("identifier");
20953        for (Identifier e : element.getIdentifier()) 
20954          composeIdentifier(null, e);
20955        closeArray();
20956      };
20957      if (element.hasPatient()) {
20958        composeReference("patient", element.getPatient());
20959      }
20960      if (element.hasInformationSource()) {
20961        composeReference("informationSource", element.getInformationSource());
20962      }
20963      if (element.hasDateAssertedElement()) {
20964        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
20965        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
20966      }
20967      if (element.hasStatusElement()) {
20968        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20969        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20970      }
20971      if (element.hasWasNotTakenElement()) {
20972        composeBooleanCore("wasNotTaken", element.getWasNotTakenElement(), false);
20973        composeBooleanExtras("wasNotTaken", element.getWasNotTakenElement(), false);
20974      }
20975      if (element.hasReasonNotTaken()) {
20976        openArray("reasonNotTaken");
20977        for (CodeableConcept e : element.getReasonNotTaken()) 
20978          composeCodeableConcept(null, e);
20979        closeArray();
20980      };
20981      if (element.hasReasonForUse()) {
20982        composeType("reasonForUse", element.getReasonForUse());
20983      }
20984      if (element.hasEffective()) {
20985        composeType("effective", element.getEffective());
20986      }
20987      if (element.hasNoteElement()) {
20988        composeStringCore("note", element.getNoteElement(), false);
20989        composeStringExtras("note", element.getNoteElement(), false);
20990      }
20991      if (element.hasSupportingInformation()) {
20992        openArray("supportingInformation");
20993        for (Reference e : element.getSupportingInformation()) 
20994          composeReference(null, e);
20995        closeArray();
20996      };
20997      if (element.hasMedication()) {
20998        composeType("medication", element.getMedication());
20999      }
21000      if (element.hasDosage()) {
21001        openArray("dosage");
21002        for (MedicationStatement.MedicationStatementDosageComponent e : element.getDosage()) 
21003          composeMedicationStatementMedicationStatementDosageComponent(null, e);
21004        closeArray();
21005      };
21006  }
21007
21008  protected void composeMedicationStatementMedicationStatementDosageComponent(String name, MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21009    if (element != null) {
21010      open(name);
21011      composeMedicationStatementMedicationStatementDosageComponentInner(element);
21012      close();
21013    }
21014  }
21015
21016  protected void composeMedicationStatementMedicationStatementDosageComponentInner(MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21017      composeBackbone(element);
21018      if (element.hasTextElement()) {
21019        composeStringCore("text", element.getTextElement(), false);
21020        composeStringExtras("text", element.getTextElement(), false);
21021      }
21022      if (element.hasTiming()) {
21023        composeTiming("timing", element.getTiming());
21024      }
21025      if (element.hasAsNeeded()) {
21026        composeType("asNeeded", element.getAsNeeded());
21027      }
21028      if (element.hasSite()) {
21029        composeType("site", element.getSite());
21030      }
21031      if (element.hasRoute()) {
21032        composeCodeableConcept("route", element.getRoute());
21033      }
21034      if (element.hasMethod()) {
21035        composeCodeableConcept("method", element.getMethod());
21036      }
21037      if (element.hasQuantity()) {
21038        composeType("quantity", element.getQuantity());
21039      }
21040      if (element.hasRate()) {
21041        composeType("rate", element.getRate());
21042      }
21043      if (element.hasMaxDosePerPeriod()) {
21044        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21045      }
21046  }
21047
21048  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
21049    if (element != null) {
21050      prop("resourceType", name);
21051      composeMessageHeaderInner(element);
21052    }
21053  }
21054
21055  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
21056      composeDomainResourceElements(element);
21057      if (element.hasTimestampElement()) {
21058        composeInstantCore("timestamp", element.getTimestampElement(), false);
21059        composeInstantExtras("timestamp", element.getTimestampElement(), false);
21060      }
21061      if (element.hasEvent()) {
21062        composeCoding("event", element.getEvent());
21063      }
21064      if (element.hasResponse()) {
21065        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
21066      }
21067      if (element.hasSource()) {
21068        composeMessageHeaderMessageSourceComponent("source", element.getSource());
21069      }
21070      if (element.hasDestination()) {
21071        openArray("destination");
21072        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
21073          composeMessageHeaderMessageDestinationComponent(null, e);
21074        closeArray();
21075      };
21076      if (element.hasEnterer()) {
21077        composeReference("enterer", element.getEnterer());
21078      }
21079      if (element.hasAuthor()) {
21080        composeReference("author", element.getAuthor());
21081      }
21082      if (element.hasReceiver()) {
21083        composeReference("receiver", element.getReceiver());
21084      }
21085      if (element.hasResponsible()) {
21086        composeReference("responsible", element.getResponsible());
21087      }
21088      if (element.hasReason()) {
21089        composeCodeableConcept("reason", element.getReason());
21090      }
21091      if (element.hasData()) {
21092        openArray("data");
21093        for (Reference e : element.getData()) 
21094          composeReference(null, e);
21095        closeArray();
21096      };
21097  }
21098
21099  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21100    if (element != null) {
21101      open(name);
21102      composeMessageHeaderMessageHeaderResponseComponentInner(element);
21103      close();
21104    }
21105  }
21106
21107  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21108      composeBackbone(element);
21109      if (element.hasIdentifierElement()) {
21110        composeIdCore("identifier", element.getIdentifierElement(), false);
21111        composeIdExtras("identifier", element.getIdentifierElement(), false);
21112      }
21113      if (element.hasCodeElement()) {
21114        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21115        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21116      }
21117      if (element.hasDetails()) {
21118        composeReference("details", element.getDetails());
21119      }
21120  }
21121
21122  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
21123    if (element != null) {
21124      open(name);
21125      composeMessageHeaderMessageSourceComponentInner(element);
21126      close();
21127    }
21128  }
21129
21130  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
21131      composeBackbone(element);
21132      if (element.hasNameElement()) {
21133        composeStringCore("name", element.getNameElement(), false);
21134        composeStringExtras("name", element.getNameElement(), false);
21135      }
21136      if (element.hasSoftwareElement()) {
21137        composeStringCore("software", element.getSoftwareElement(), false);
21138        composeStringExtras("software", element.getSoftwareElement(), false);
21139      }
21140      if (element.hasVersionElement()) {
21141        composeStringCore("version", element.getVersionElement(), false);
21142        composeStringExtras("version", element.getVersionElement(), false);
21143      }
21144      if (element.hasContact()) {
21145        composeContactPoint("contact", element.getContact());
21146      }
21147      if (element.hasEndpointElement()) {
21148        composeUriCore("endpoint", element.getEndpointElement(), false);
21149        composeUriExtras("endpoint", element.getEndpointElement(), false);
21150      }
21151  }
21152
21153  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
21154    if (element != null) {
21155      open(name);
21156      composeMessageHeaderMessageDestinationComponentInner(element);
21157      close();
21158    }
21159  }
21160
21161  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
21162      composeBackbone(element);
21163      if (element.hasNameElement()) {
21164        composeStringCore("name", element.getNameElement(), false);
21165        composeStringExtras("name", element.getNameElement(), false);
21166      }
21167      if (element.hasTarget()) {
21168        composeReference("target", element.getTarget());
21169      }
21170      if (element.hasEndpointElement()) {
21171        composeUriCore("endpoint", element.getEndpointElement(), false);
21172        composeUriExtras("endpoint", element.getEndpointElement(), false);
21173      }
21174  }
21175
21176  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
21177    if (element != null) {
21178      prop("resourceType", name);
21179      composeNamingSystemInner(element);
21180    }
21181  }
21182
21183  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
21184      composeDomainResourceElements(element);
21185      if (element.hasNameElement()) {
21186        composeStringCore("name", element.getNameElement(), false);
21187        composeStringExtras("name", element.getNameElement(), false);
21188      }
21189      if (element.hasStatusElement()) {
21190        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21191        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21192      }
21193      if (element.hasKindElement()) {
21194        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21195        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21196      }
21197      if (element.hasPublisherElement()) {
21198        composeStringCore("publisher", element.getPublisherElement(), false);
21199        composeStringExtras("publisher", element.getPublisherElement(), false);
21200      }
21201      if (element.hasContact()) {
21202        openArray("contact");
21203        for (NamingSystem.NamingSystemContactComponent e : element.getContact()) 
21204          composeNamingSystemNamingSystemContactComponent(null, e);
21205        closeArray();
21206      };
21207      if (element.hasResponsibleElement()) {
21208        composeStringCore("responsible", element.getResponsibleElement(), false);
21209        composeStringExtras("responsible", element.getResponsibleElement(), false);
21210      }
21211      if (element.hasDateElement()) {
21212        composeDateTimeCore("date", element.getDateElement(), false);
21213        composeDateTimeExtras("date", element.getDateElement(), false);
21214      }
21215      if (element.hasType()) {
21216        composeCodeableConcept("type", element.getType());
21217      }
21218      if (element.hasDescriptionElement()) {
21219        composeStringCore("description", element.getDescriptionElement(), false);
21220        composeStringExtras("description", element.getDescriptionElement(), false);
21221      }
21222      if (element.hasUseContext()) {
21223        openArray("useContext");
21224        for (CodeableConcept e : element.getUseContext()) 
21225          composeCodeableConcept(null, e);
21226        closeArray();
21227      };
21228      if (element.hasUsageElement()) {
21229        composeStringCore("usage", element.getUsageElement(), false);
21230        composeStringExtras("usage", element.getUsageElement(), false);
21231      }
21232      if (element.hasUniqueId()) {
21233        openArray("uniqueId");
21234        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
21235          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
21236        closeArray();
21237      };
21238      if (element.hasReplacedBy()) {
21239        composeReference("replacedBy", element.getReplacedBy());
21240      }
21241  }
21242
21243  protected void composeNamingSystemNamingSystemContactComponent(String name, NamingSystem.NamingSystemContactComponent element) throws IOException {
21244    if (element != null) {
21245      open(name);
21246      composeNamingSystemNamingSystemContactComponentInner(element);
21247      close();
21248    }
21249  }
21250
21251  protected void composeNamingSystemNamingSystemContactComponentInner(NamingSystem.NamingSystemContactComponent element) throws IOException {
21252      composeBackbone(element);
21253      if (element.hasNameElement()) {
21254        composeStringCore("name", element.getNameElement(), false);
21255        composeStringExtras("name", element.getNameElement(), false);
21256      }
21257      if (element.hasTelecom()) {
21258        openArray("telecom");
21259        for (ContactPoint e : element.getTelecom()) 
21260          composeContactPoint(null, e);
21261        closeArray();
21262      };
21263  }
21264
21265  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21266    if (element != null) {
21267      open(name);
21268      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
21269      close();
21270    }
21271  }
21272
21273  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21274      composeBackbone(element);
21275      if (element.hasTypeElement()) {
21276        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21277        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21278      }
21279      if (element.hasValueElement()) {
21280        composeStringCore("value", element.getValueElement(), false);
21281        composeStringExtras("value", element.getValueElement(), false);
21282      }
21283      if (element.hasPreferredElement()) {
21284        composeBooleanCore("preferred", element.getPreferredElement(), false);
21285        composeBooleanExtras("preferred", element.getPreferredElement(), false);
21286      }
21287      if (element.hasPeriod()) {
21288        composePeriod("period", element.getPeriod());
21289      }
21290  }
21291
21292  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
21293    if (element != null) {
21294      prop("resourceType", name);
21295      composeNutritionOrderInner(element);
21296    }
21297  }
21298
21299  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
21300      composeDomainResourceElements(element);
21301      if (element.hasPatient()) {
21302        composeReference("patient", element.getPatient());
21303      }
21304      if (element.hasOrderer()) {
21305        composeReference("orderer", element.getOrderer());
21306      }
21307      if (element.hasIdentifier()) {
21308        openArray("identifier");
21309        for (Identifier e : element.getIdentifier()) 
21310          composeIdentifier(null, e);
21311        closeArray();
21312      };
21313      if (element.hasEncounter()) {
21314        composeReference("encounter", element.getEncounter());
21315      }
21316      if (element.hasDateTimeElement()) {
21317        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
21318        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
21319      }
21320      if (element.hasStatusElement()) {
21321        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21322        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21323      }
21324      if (element.hasAllergyIntolerance()) {
21325        openArray("allergyIntolerance");
21326        for (Reference e : element.getAllergyIntolerance()) 
21327          composeReference(null, e);
21328        closeArray();
21329      };
21330      if (element.hasFoodPreferenceModifier()) {
21331        openArray("foodPreferenceModifier");
21332        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
21333          composeCodeableConcept(null, e);
21334        closeArray();
21335      };
21336      if (element.hasExcludeFoodModifier()) {
21337        openArray("excludeFoodModifier");
21338        for (CodeableConcept e : element.getExcludeFoodModifier()) 
21339          composeCodeableConcept(null, e);
21340        closeArray();
21341      };
21342      if (element.hasOralDiet()) {
21343        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
21344      }
21345      if (element.hasSupplement()) {
21346        openArray("supplement");
21347        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
21348          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
21349        closeArray();
21350      };
21351      if (element.hasEnteralFormula()) {
21352        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
21353      }
21354  }
21355
21356  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21357    if (element != null) {
21358      open(name);
21359      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
21360      close();
21361    }
21362  }
21363
21364  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21365      composeBackbone(element);
21366      if (element.hasType()) {
21367        openArray("type");
21368        for (CodeableConcept e : element.getType()) 
21369          composeCodeableConcept(null, e);
21370        closeArray();
21371      };
21372      if (element.hasSchedule()) {
21373        openArray("schedule");
21374        for (Timing e : element.getSchedule()) 
21375          composeTiming(null, e);
21376        closeArray();
21377      };
21378      if (element.hasNutrient()) {
21379        openArray("nutrient");
21380        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
21381          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
21382        closeArray();
21383      };
21384      if (element.hasTexture()) {
21385        openArray("texture");
21386        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
21387          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
21388        closeArray();
21389      };
21390      if (element.hasFluidConsistencyType()) {
21391        openArray("fluidConsistencyType");
21392        for (CodeableConcept e : element.getFluidConsistencyType()) 
21393          composeCodeableConcept(null, e);
21394        closeArray();
21395      };
21396      if (element.hasInstructionElement()) {
21397        composeStringCore("instruction", element.getInstructionElement(), false);
21398        composeStringExtras("instruction", element.getInstructionElement(), false);
21399      }
21400  }
21401
21402  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21403    if (element != null) {
21404      open(name);
21405      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
21406      close();
21407    }
21408  }
21409
21410  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21411      composeBackbone(element);
21412      if (element.hasModifier()) {
21413        composeCodeableConcept("modifier", element.getModifier());
21414      }
21415      if (element.hasAmount()) {
21416        composeSimpleQuantity("amount", element.getAmount());
21417      }
21418  }
21419
21420  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21421    if (element != null) {
21422      open(name);
21423      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
21424      close();
21425    }
21426  }
21427
21428  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21429      composeBackbone(element);
21430      if (element.hasModifier()) {
21431        composeCodeableConcept("modifier", element.getModifier());
21432      }
21433      if (element.hasFoodType()) {
21434        composeCodeableConcept("foodType", element.getFoodType());
21435      }
21436  }
21437
21438  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21439    if (element != null) {
21440      open(name);
21441      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
21442      close();
21443    }
21444  }
21445
21446  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21447      composeBackbone(element);
21448      if (element.hasType()) {
21449        composeCodeableConcept("type", element.getType());
21450      }
21451      if (element.hasProductNameElement()) {
21452        composeStringCore("productName", element.getProductNameElement(), false);
21453        composeStringExtras("productName", element.getProductNameElement(), false);
21454      }
21455      if (element.hasSchedule()) {
21456        openArray("schedule");
21457        for (Timing e : element.getSchedule()) 
21458          composeTiming(null, e);
21459        closeArray();
21460      };
21461      if (element.hasQuantity()) {
21462        composeSimpleQuantity("quantity", element.getQuantity());
21463      }
21464      if (element.hasInstructionElement()) {
21465        composeStringCore("instruction", element.getInstructionElement(), false);
21466        composeStringExtras("instruction", element.getInstructionElement(), false);
21467      }
21468  }
21469
21470  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21471    if (element != null) {
21472      open(name);
21473      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
21474      close();
21475    }
21476  }
21477
21478  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21479      composeBackbone(element);
21480      if (element.hasBaseFormulaType()) {
21481        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
21482      }
21483      if (element.hasBaseFormulaProductNameElement()) {
21484        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21485        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21486      }
21487      if (element.hasAdditiveType()) {
21488        composeCodeableConcept("additiveType", element.getAdditiveType());
21489      }
21490      if (element.hasAdditiveProductNameElement()) {
21491        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
21492        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
21493      }
21494      if (element.hasCaloricDensity()) {
21495        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
21496      }
21497      if (element.hasRouteofAdministration()) {
21498        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
21499      }
21500      if (element.hasAdministration()) {
21501        openArray("administration");
21502        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
21503          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
21504        closeArray();
21505      };
21506      if (element.hasMaxVolumeToDeliver()) {
21507        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
21508      }
21509      if (element.hasAdministrationInstructionElement()) {
21510        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
21511        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
21512      }
21513  }
21514
21515  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21516    if (element != null) {
21517      open(name);
21518      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
21519      close();
21520    }
21521  }
21522
21523  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21524      composeBackbone(element);
21525      if (element.hasSchedule()) {
21526        composeTiming("schedule", element.getSchedule());
21527      }
21528      if (element.hasQuantity()) {
21529        composeSimpleQuantity("quantity", element.getQuantity());
21530      }
21531      if (element.hasRate()) {
21532        composeType("rate", element.getRate());
21533      }
21534  }
21535
21536  protected void composeObservation(String name, Observation element) throws IOException {
21537    if (element != null) {
21538      prop("resourceType", name);
21539      composeObservationInner(element);
21540    }
21541  }
21542
21543  protected void composeObservationInner(Observation element) throws IOException {
21544      composeDomainResourceElements(element);
21545      if (element.hasIdentifier()) {
21546        openArray("identifier");
21547        for (Identifier e : element.getIdentifier()) 
21548          composeIdentifier(null, e);
21549        closeArray();
21550      };
21551      if (element.hasStatusElement()) {
21552        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21553        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21554      }
21555      if (element.hasCategory()) {
21556        composeCodeableConcept("category", element.getCategory());
21557      }
21558      if (element.hasCode()) {
21559        composeCodeableConcept("code", element.getCode());
21560      }
21561      if (element.hasSubject()) {
21562        composeReference("subject", element.getSubject());
21563      }
21564      if (element.hasEncounter()) {
21565        composeReference("encounter", element.getEncounter());
21566      }
21567      if (element.hasEffective()) {
21568        composeType("effective", element.getEffective());
21569      }
21570      if (element.hasIssuedElement()) {
21571        composeInstantCore("issued", element.getIssuedElement(), false);
21572        composeInstantExtras("issued", element.getIssuedElement(), false);
21573      }
21574      if (element.hasPerformer()) {
21575        openArray("performer");
21576        for (Reference e : element.getPerformer()) 
21577          composeReference(null, e);
21578        closeArray();
21579      };
21580      if (element.hasValue()) {
21581        composeType("value", element.getValue());
21582      }
21583      if (element.hasDataAbsentReason()) {
21584        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21585      }
21586      if (element.hasInterpretation()) {
21587        composeCodeableConcept("interpretation", element.getInterpretation());
21588      }
21589      if (element.hasCommentsElement()) {
21590        composeStringCore("comments", element.getCommentsElement(), false);
21591        composeStringExtras("comments", element.getCommentsElement(), false);
21592      }
21593      if (element.hasBodySite()) {
21594        composeCodeableConcept("bodySite", element.getBodySite());
21595      }
21596      if (element.hasMethod()) {
21597        composeCodeableConcept("method", element.getMethod());
21598      }
21599      if (element.hasSpecimen()) {
21600        composeReference("specimen", element.getSpecimen());
21601      }
21602      if (element.hasDevice()) {
21603        composeReference("device", element.getDevice());
21604      }
21605      if (element.hasReferenceRange()) {
21606        openArray("referenceRange");
21607        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21608          composeObservationObservationReferenceRangeComponent(null, e);
21609        closeArray();
21610      };
21611      if (element.hasRelated()) {
21612        openArray("related");
21613        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
21614          composeObservationObservationRelatedComponent(null, e);
21615        closeArray();
21616      };
21617      if (element.hasComponent()) {
21618        openArray("component");
21619        for (Observation.ObservationComponentComponent e : element.getComponent()) 
21620          composeObservationObservationComponentComponent(null, e);
21621        closeArray();
21622      };
21623  }
21624
21625  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
21626    if (element != null) {
21627      open(name);
21628      composeObservationObservationReferenceRangeComponentInner(element);
21629      close();
21630    }
21631  }
21632
21633  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
21634      composeBackbone(element);
21635      if (element.hasLow()) {
21636        composeSimpleQuantity("low", element.getLow());
21637      }
21638      if (element.hasHigh()) {
21639        composeSimpleQuantity("high", element.getHigh());
21640      }
21641      if (element.hasMeaning()) {
21642        composeCodeableConcept("meaning", element.getMeaning());
21643      }
21644      if (element.hasAge()) {
21645        composeRange("age", element.getAge());
21646      }
21647      if (element.hasTextElement()) {
21648        composeStringCore("text", element.getTextElement(), false);
21649        composeStringExtras("text", element.getTextElement(), false);
21650      }
21651  }
21652
21653  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
21654    if (element != null) {
21655      open(name);
21656      composeObservationObservationRelatedComponentInner(element);
21657      close();
21658    }
21659  }
21660
21661  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
21662      composeBackbone(element);
21663      if (element.hasTypeElement()) {
21664        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21665        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21666      }
21667      if (element.hasTarget()) {
21668        composeReference("target", element.getTarget());
21669      }
21670  }
21671
21672  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
21673    if (element != null) {
21674      open(name);
21675      composeObservationObservationComponentComponentInner(element);
21676      close();
21677    }
21678  }
21679
21680  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
21681      composeBackbone(element);
21682      if (element.hasCode()) {
21683        composeCodeableConcept("code", element.getCode());
21684      }
21685      if (element.hasValue()) {
21686        composeType("value", element.getValue());
21687      }
21688      if (element.hasDataAbsentReason()) {
21689        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21690      }
21691      if (element.hasReferenceRange()) {
21692        openArray("referenceRange");
21693        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21694          composeObservationObservationReferenceRangeComponent(null, e);
21695        closeArray();
21696      };
21697  }
21698
21699  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
21700    if (element != null) {
21701      prop("resourceType", name);
21702      composeOperationDefinitionInner(element);
21703    }
21704  }
21705
21706  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
21707      composeDomainResourceElements(element);
21708      if (element.hasUrlElement()) {
21709        composeUriCore("url", element.getUrlElement(), false);
21710        composeUriExtras("url", element.getUrlElement(), false);
21711      }
21712      if (element.hasVersionElement()) {
21713        composeStringCore("version", element.getVersionElement(), false);
21714        composeStringExtras("version", element.getVersionElement(), false);
21715      }
21716      if (element.hasNameElement()) {
21717        composeStringCore("name", element.getNameElement(), false);
21718        composeStringExtras("name", element.getNameElement(), false);
21719      }
21720      if (element.hasStatusElement()) {
21721        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21722        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21723      }
21724      if (element.hasKindElement()) {
21725        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21726        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21727      }
21728      if (element.hasExperimentalElement()) {
21729        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21730        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21731      }
21732      if (element.hasPublisherElement()) {
21733        composeStringCore("publisher", element.getPublisherElement(), false);
21734        composeStringExtras("publisher", element.getPublisherElement(), false);
21735      }
21736      if (element.hasContact()) {
21737        openArray("contact");
21738        for (OperationDefinition.OperationDefinitionContactComponent e : element.getContact()) 
21739          composeOperationDefinitionOperationDefinitionContactComponent(null, e);
21740        closeArray();
21741      };
21742      if (element.hasDateElement()) {
21743        composeDateTimeCore("date", element.getDateElement(), false);
21744        composeDateTimeExtras("date", element.getDateElement(), false);
21745      }
21746      if (element.hasDescriptionElement()) {
21747        composeStringCore("description", element.getDescriptionElement(), false);
21748        composeStringExtras("description", element.getDescriptionElement(), false);
21749      }
21750      if (element.hasRequirementsElement()) {
21751        composeStringCore("requirements", element.getRequirementsElement(), false);
21752        composeStringExtras("requirements", element.getRequirementsElement(), false);
21753      }
21754      if (element.hasIdempotentElement()) {
21755        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
21756        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
21757      }
21758      if (element.hasCodeElement()) {
21759        composeCodeCore("code", element.getCodeElement(), false);
21760        composeCodeExtras("code", element.getCodeElement(), false);
21761      }
21762      if (element.hasNotesElement()) {
21763        composeStringCore("notes", element.getNotesElement(), false);
21764        composeStringExtras("notes", element.getNotesElement(), false);
21765      }
21766      if (element.hasBase()) {
21767        composeReference("base", element.getBase());
21768      }
21769      if (element.hasSystemElement()) {
21770        composeBooleanCore("system", element.getSystemElement(), false);
21771        composeBooleanExtras("system", element.getSystemElement(), false);
21772      }
21773      if (element.hasType()) {
21774        openArray("type");
21775        for (CodeType e : element.getType()) 
21776          composeCodeCore(null, e, true);
21777        closeArray();
21778        if (anyHasExtras(element.getType())) {
21779          openArray("_type");
21780          for (CodeType e : element.getType()) 
21781            composeCodeExtras(null, e, true);
21782          closeArray();
21783        }
21784      };
21785      if (element.hasInstanceElement()) {
21786        composeBooleanCore("instance", element.getInstanceElement(), false);
21787        composeBooleanExtras("instance", element.getInstanceElement(), false);
21788      }
21789      if (element.hasParameter()) {
21790        openArray("parameter");
21791        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
21792          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21793        closeArray();
21794      };
21795  }
21796
21797  protected void composeOperationDefinitionOperationDefinitionContactComponent(String name, OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21798    if (element != null) {
21799      open(name);
21800      composeOperationDefinitionOperationDefinitionContactComponentInner(element);
21801      close();
21802    }
21803  }
21804
21805  protected void composeOperationDefinitionOperationDefinitionContactComponentInner(OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21806      composeBackbone(element);
21807      if (element.hasNameElement()) {
21808        composeStringCore("name", element.getNameElement(), false);
21809        composeStringExtras("name", element.getNameElement(), false);
21810      }
21811      if (element.hasTelecom()) {
21812        openArray("telecom");
21813        for (ContactPoint e : element.getTelecom()) 
21814          composeContactPoint(null, e);
21815        closeArray();
21816      };
21817  }
21818
21819  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21820    if (element != null) {
21821      open(name);
21822      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
21823      close();
21824    }
21825  }
21826
21827  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21828      composeBackbone(element);
21829      if (element.hasNameElement()) {
21830        composeCodeCore("name", element.getNameElement(), false);
21831        composeCodeExtras("name", element.getNameElement(), false);
21832      }
21833      if (element.hasUseElement()) {
21834        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21835        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21836      }
21837      if (element.hasMinElement()) {
21838        composeIntegerCore("min", element.getMinElement(), false);
21839        composeIntegerExtras("min", element.getMinElement(), false);
21840      }
21841      if (element.hasMaxElement()) {
21842        composeStringCore("max", element.getMaxElement(), false);
21843        composeStringExtras("max", element.getMaxElement(), false);
21844      }
21845      if (element.hasDocumentationElement()) {
21846        composeStringCore("documentation", element.getDocumentationElement(), false);
21847        composeStringExtras("documentation", element.getDocumentationElement(), false);
21848      }
21849      if (element.hasTypeElement()) {
21850        composeCodeCore("type", element.getTypeElement(), false);
21851        composeCodeExtras("type", element.getTypeElement(), false);
21852      }
21853      if (element.hasProfile()) {
21854        composeReference("profile", element.getProfile());
21855      }
21856      if (element.hasBinding()) {
21857        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
21858      }
21859      if (element.hasPart()) {
21860        openArray("part");
21861        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
21862          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21863        closeArray();
21864      };
21865  }
21866
21867  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21868    if (element != null) {
21869      open(name);
21870      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
21871      close();
21872    }
21873  }
21874
21875  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21876      composeBackbone(element);
21877      if (element.hasStrengthElement()) {
21878        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21879        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21880      }
21881      if (element.hasValueSet()) {
21882        composeType("valueSet", element.getValueSet());
21883      }
21884  }
21885
21886  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
21887    if (element != null) {
21888      prop("resourceType", name);
21889      composeOperationOutcomeInner(element);
21890    }
21891  }
21892
21893  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
21894      composeDomainResourceElements(element);
21895      if (element.hasIssue()) {
21896        openArray("issue");
21897        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
21898          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
21899        closeArray();
21900      };
21901  }
21902
21903  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21904    if (element != null) {
21905      open(name);
21906      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
21907      close();
21908    }
21909  }
21910
21911  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21912      composeBackbone(element);
21913      if (element.hasSeverityElement()) {
21914        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21915        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21916      }
21917      if (element.hasCodeElement()) {
21918        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21919        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21920      }
21921      if (element.hasDetails()) {
21922        composeCodeableConcept("details", element.getDetails());
21923      }
21924      if (element.hasDiagnosticsElement()) {
21925        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
21926        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
21927      }
21928      if (element.hasLocation()) {
21929        openArray("location");
21930        for (StringType e : element.getLocation()) 
21931          composeStringCore(null, e, true);
21932        closeArray();
21933        if (anyHasExtras(element.getLocation())) {
21934          openArray("_location");
21935          for (StringType e : element.getLocation()) 
21936            composeStringExtras(null, e, true);
21937          closeArray();
21938        }
21939      };
21940  }
21941
21942  protected void composeOrder(String name, Order element) throws IOException {
21943    if (element != null) {
21944      prop("resourceType", name);
21945      composeOrderInner(element);
21946    }
21947  }
21948
21949  protected void composeOrderInner(Order element) throws IOException {
21950      composeDomainResourceElements(element);
21951      if (element.hasIdentifier()) {
21952        openArray("identifier");
21953        for (Identifier e : element.getIdentifier()) 
21954          composeIdentifier(null, e);
21955        closeArray();
21956      };
21957      if (element.hasDateElement()) {
21958        composeDateTimeCore("date", element.getDateElement(), false);
21959        composeDateTimeExtras("date", element.getDateElement(), false);
21960      }
21961      if (element.hasSubject()) {
21962        composeReference("subject", element.getSubject());
21963      }
21964      if (element.hasSource()) {
21965        composeReference("source", element.getSource());
21966      }
21967      if (element.hasTarget()) {
21968        composeReference("target", element.getTarget());
21969      }
21970      if (element.hasReason()) {
21971        composeType("reason", element.getReason());
21972      }
21973      if (element.hasWhen()) {
21974        composeOrderOrderWhenComponent("when", element.getWhen());
21975      }
21976      if (element.hasDetail()) {
21977        openArray("detail");
21978        for (Reference e : element.getDetail()) 
21979          composeReference(null, e);
21980        closeArray();
21981      };
21982  }
21983
21984  protected void composeOrderOrderWhenComponent(String name, Order.OrderWhenComponent element) throws IOException {
21985    if (element != null) {
21986      open(name);
21987      composeOrderOrderWhenComponentInner(element);
21988      close();
21989    }
21990  }
21991
21992  protected void composeOrderOrderWhenComponentInner(Order.OrderWhenComponent element) throws IOException {
21993      composeBackbone(element);
21994      if (element.hasCode()) {
21995        composeCodeableConcept("code", element.getCode());
21996      }
21997      if (element.hasSchedule()) {
21998        composeTiming("schedule", element.getSchedule());
21999      }
22000  }
22001
22002  protected void composeOrderResponse(String name, OrderResponse element) throws IOException {
22003    if (element != null) {
22004      prop("resourceType", name);
22005      composeOrderResponseInner(element);
22006    }
22007  }
22008
22009  protected void composeOrderResponseInner(OrderResponse element) throws IOException {
22010      composeDomainResourceElements(element);
22011      if (element.hasIdentifier()) {
22012        openArray("identifier");
22013        for (Identifier e : element.getIdentifier()) 
22014          composeIdentifier(null, e);
22015        closeArray();
22016      };
22017      if (element.hasRequest()) {
22018        composeReference("request", element.getRequest());
22019      }
22020      if (element.hasDateElement()) {
22021        composeDateTimeCore("date", element.getDateElement(), false);
22022        composeDateTimeExtras("date", element.getDateElement(), false);
22023      }
22024      if (element.hasWho()) {
22025        composeReference("who", element.getWho());
22026      }
22027      if (element.hasOrderStatusElement()) {
22028        composeEnumerationCore("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22029        composeEnumerationExtras("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22030      }
22031      if (element.hasDescriptionElement()) {
22032        composeStringCore("description", element.getDescriptionElement(), false);
22033        composeStringExtras("description", element.getDescriptionElement(), false);
22034      }
22035      if (element.hasFulfillment()) {
22036        openArray("fulfillment");
22037        for (Reference e : element.getFulfillment()) 
22038          composeReference(null, e);
22039        closeArray();
22040      };
22041  }
22042
22043  protected void composeOrganization(String name, Organization element) throws IOException {
22044    if (element != null) {
22045      prop("resourceType", name);
22046      composeOrganizationInner(element);
22047    }
22048  }
22049
22050  protected void composeOrganizationInner(Organization element) throws IOException {
22051      composeDomainResourceElements(element);
22052      if (element.hasIdentifier()) {
22053        openArray("identifier");
22054        for (Identifier e : element.getIdentifier()) 
22055          composeIdentifier(null, e);
22056        closeArray();
22057      };
22058      if (element.hasActiveElement()) {
22059        composeBooleanCore("active", element.getActiveElement(), false);
22060        composeBooleanExtras("active", element.getActiveElement(), false);
22061      }
22062      if (element.hasType()) {
22063        composeCodeableConcept("type", element.getType());
22064      }
22065      if (element.hasNameElement()) {
22066        composeStringCore("name", element.getNameElement(), false);
22067        composeStringExtras("name", element.getNameElement(), false);
22068      }
22069      if (element.hasTelecom()) {
22070        openArray("telecom");
22071        for (ContactPoint e : element.getTelecom()) 
22072          composeContactPoint(null, e);
22073        closeArray();
22074      };
22075      if (element.hasAddress()) {
22076        openArray("address");
22077        for (Address e : element.getAddress()) 
22078          composeAddress(null, e);
22079        closeArray();
22080      };
22081      if (element.hasPartOf()) {
22082        composeReference("partOf", element.getPartOf());
22083      }
22084      if (element.hasContact()) {
22085        openArray("contact");
22086        for (Organization.OrganizationContactComponent e : element.getContact()) 
22087          composeOrganizationOrganizationContactComponent(null, e);
22088        closeArray();
22089      };
22090  }
22091
22092  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
22093    if (element != null) {
22094      open(name);
22095      composeOrganizationOrganizationContactComponentInner(element);
22096      close();
22097    }
22098  }
22099
22100  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
22101      composeBackbone(element);
22102      if (element.hasPurpose()) {
22103        composeCodeableConcept("purpose", element.getPurpose());
22104      }
22105      if (element.hasName()) {
22106        composeHumanName("name", element.getName());
22107      }
22108      if (element.hasTelecom()) {
22109        openArray("telecom");
22110        for (ContactPoint e : element.getTelecom()) 
22111          composeContactPoint(null, e);
22112        closeArray();
22113      };
22114      if (element.hasAddress()) {
22115        composeAddress("address", element.getAddress());
22116      }
22117  }
22118
22119  protected void composePatient(String name, Patient element) throws IOException {
22120    if (element != null) {
22121      prop("resourceType", name);
22122      composePatientInner(element);
22123    }
22124  }
22125
22126  protected void composePatientInner(Patient element) throws IOException {
22127      composeDomainResourceElements(element);
22128      if (element.hasIdentifier()) {
22129        openArray("identifier");
22130        for (Identifier e : element.getIdentifier()) 
22131          composeIdentifier(null, e);
22132        closeArray();
22133      };
22134      if (element.hasActiveElement()) {
22135        composeBooleanCore("active", element.getActiveElement(), false);
22136        composeBooleanExtras("active", element.getActiveElement(), false);
22137      }
22138      if (element.hasName()) {
22139        openArray("name");
22140        for (HumanName e : element.getName()) 
22141          composeHumanName(null, e);
22142        closeArray();
22143      };
22144      if (element.hasTelecom()) {
22145        openArray("telecom");
22146        for (ContactPoint e : element.getTelecom()) 
22147          composeContactPoint(null, e);
22148        closeArray();
22149      };
22150      if (element.hasGenderElement()) {
22151        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22152        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22153      }
22154      if (element.hasBirthDateElement()) {
22155        composeDateCore("birthDate", element.getBirthDateElement(), false);
22156        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22157      }
22158      if (element.hasDeceased()) {
22159        composeType("deceased", element.getDeceased());
22160      }
22161      if (element.hasAddress()) {
22162        openArray("address");
22163        for (Address e : element.getAddress()) 
22164          composeAddress(null, e);
22165        closeArray();
22166      };
22167      if (element.hasMaritalStatus()) {
22168        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
22169      }
22170      if (element.hasMultipleBirth()) {
22171        composeType("multipleBirth", element.getMultipleBirth());
22172      }
22173      if (element.hasPhoto()) {
22174        openArray("photo");
22175        for (Attachment e : element.getPhoto()) 
22176          composeAttachment(null, e);
22177        closeArray();
22178      };
22179      if (element.hasContact()) {
22180        openArray("contact");
22181        for (Patient.ContactComponent e : element.getContact()) 
22182          composePatientContactComponent(null, e);
22183        closeArray();
22184      };
22185      if (element.hasAnimal()) {
22186        composePatientAnimalComponent("animal", element.getAnimal());
22187      }
22188      if (element.hasCommunication()) {
22189        openArray("communication");
22190        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
22191          composePatientPatientCommunicationComponent(null, e);
22192        closeArray();
22193      };
22194      if (element.hasCareProvider()) {
22195        openArray("careProvider");
22196        for (Reference e : element.getCareProvider()) 
22197          composeReference(null, e);
22198        closeArray();
22199      };
22200      if (element.hasManagingOrganization()) {
22201        composeReference("managingOrganization", element.getManagingOrganization());
22202      }
22203      if (element.hasLink()) {
22204        openArray("link");
22205        for (Patient.PatientLinkComponent e : element.getLink()) 
22206          composePatientPatientLinkComponent(null, e);
22207        closeArray();
22208      };
22209  }
22210
22211  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
22212    if (element != null) {
22213      open(name);
22214      composePatientContactComponentInner(element);
22215      close();
22216    }
22217  }
22218
22219  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
22220      composeBackbone(element);
22221      if (element.hasRelationship()) {
22222        openArray("relationship");
22223        for (CodeableConcept e : element.getRelationship()) 
22224          composeCodeableConcept(null, e);
22225        closeArray();
22226      };
22227      if (element.hasName()) {
22228        composeHumanName("name", element.getName());
22229      }
22230      if (element.hasTelecom()) {
22231        openArray("telecom");
22232        for (ContactPoint e : element.getTelecom()) 
22233          composeContactPoint(null, e);
22234        closeArray();
22235      };
22236      if (element.hasAddress()) {
22237        composeAddress("address", element.getAddress());
22238      }
22239      if (element.hasGenderElement()) {
22240        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22241        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22242      }
22243      if (element.hasOrganization()) {
22244        composeReference("organization", element.getOrganization());
22245      }
22246      if (element.hasPeriod()) {
22247        composePeriod("period", element.getPeriod());
22248      }
22249  }
22250
22251  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
22252    if (element != null) {
22253      open(name);
22254      composePatientAnimalComponentInner(element);
22255      close();
22256    }
22257  }
22258
22259  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
22260      composeBackbone(element);
22261      if (element.hasSpecies()) {
22262        composeCodeableConcept("species", element.getSpecies());
22263      }
22264      if (element.hasBreed()) {
22265        composeCodeableConcept("breed", element.getBreed());
22266      }
22267      if (element.hasGenderStatus()) {
22268        composeCodeableConcept("genderStatus", element.getGenderStatus());
22269      }
22270  }
22271
22272  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
22273    if (element != null) {
22274      open(name);
22275      composePatientPatientCommunicationComponentInner(element);
22276      close();
22277    }
22278  }
22279
22280  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
22281      composeBackbone(element);
22282      if (element.hasLanguage()) {
22283        composeCodeableConcept("language", element.getLanguage());
22284      }
22285      if (element.hasPreferredElement()) {
22286        composeBooleanCore("preferred", element.getPreferredElement(), false);
22287        composeBooleanExtras("preferred", element.getPreferredElement(), false);
22288      }
22289  }
22290
22291  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
22292    if (element != null) {
22293      open(name);
22294      composePatientPatientLinkComponentInner(element);
22295      close();
22296    }
22297  }
22298
22299  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
22300      composeBackbone(element);
22301      if (element.hasOther()) {
22302        composeReference("other", element.getOther());
22303      }
22304      if (element.hasTypeElement()) {
22305        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22306        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22307      }
22308  }
22309
22310  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
22311    if (element != null) {
22312      prop("resourceType", name);
22313      composePaymentNoticeInner(element);
22314    }
22315  }
22316
22317  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
22318      composeDomainResourceElements(element);
22319      if (element.hasIdentifier()) {
22320        openArray("identifier");
22321        for (Identifier e : element.getIdentifier()) 
22322          composeIdentifier(null, e);
22323        closeArray();
22324      };
22325      if (element.hasRuleset()) {
22326        composeCoding("ruleset", element.getRuleset());
22327      }
22328      if (element.hasOriginalRuleset()) {
22329        composeCoding("originalRuleset", element.getOriginalRuleset());
22330      }
22331      if (element.hasCreatedElement()) {
22332        composeDateTimeCore("created", element.getCreatedElement(), false);
22333        composeDateTimeExtras("created", element.getCreatedElement(), false);
22334      }
22335      if (element.hasTarget()) {
22336        composeReference("target", element.getTarget());
22337      }
22338      if (element.hasProvider()) {
22339        composeReference("provider", element.getProvider());
22340      }
22341      if (element.hasOrganization()) {
22342        composeReference("organization", element.getOrganization());
22343      }
22344      if (element.hasRequest()) {
22345        composeReference("request", element.getRequest());
22346      }
22347      if (element.hasResponse()) {
22348        composeReference("response", element.getResponse());
22349      }
22350      if (element.hasPaymentStatus()) {
22351        composeCoding("paymentStatus", element.getPaymentStatus());
22352      }
22353  }
22354
22355  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
22356    if (element != null) {
22357      prop("resourceType", name);
22358      composePaymentReconciliationInner(element);
22359    }
22360  }
22361
22362  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
22363      composeDomainResourceElements(element);
22364      if (element.hasIdentifier()) {
22365        openArray("identifier");
22366        for (Identifier e : element.getIdentifier()) 
22367          composeIdentifier(null, e);
22368        closeArray();
22369      };
22370      if (element.hasRequest()) {
22371        composeReference("request", element.getRequest());
22372      }
22373      if (element.hasOutcomeElement()) {
22374        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22375        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22376      }
22377      if (element.hasDispositionElement()) {
22378        composeStringCore("disposition", element.getDispositionElement(), false);
22379        composeStringExtras("disposition", element.getDispositionElement(), false);
22380      }
22381      if (element.hasRuleset()) {
22382        composeCoding("ruleset", element.getRuleset());
22383      }
22384      if (element.hasOriginalRuleset()) {
22385        composeCoding("originalRuleset", element.getOriginalRuleset());
22386      }
22387      if (element.hasCreatedElement()) {
22388        composeDateTimeCore("created", element.getCreatedElement(), false);
22389        composeDateTimeExtras("created", element.getCreatedElement(), false);
22390      }
22391      if (element.hasPeriod()) {
22392        composePeriod("period", element.getPeriod());
22393      }
22394      if (element.hasOrganization()) {
22395        composeReference("organization", element.getOrganization());
22396      }
22397      if (element.hasRequestProvider()) {
22398        composeReference("requestProvider", element.getRequestProvider());
22399      }
22400      if (element.hasRequestOrganization()) {
22401        composeReference("requestOrganization", element.getRequestOrganization());
22402      }
22403      if (element.hasDetail()) {
22404        openArray("detail");
22405        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
22406          composePaymentReconciliationDetailsComponent(null, e);
22407        closeArray();
22408      };
22409      if (element.hasForm()) {
22410        composeCoding("form", element.getForm());
22411      }
22412      if (element.hasTotal()) {
22413        composeMoney("total", element.getTotal());
22414      }
22415      if (element.hasNote()) {
22416        openArray("note");
22417        for (PaymentReconciliation.NotesComponent e : element.getNote()) 
22418          composePaymentReconciliationNotesComponent(null, e);
22419        closeArray();
22420      };
22421  }
22422
22423  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
22424    if (element != null) {
22425      open(name);
22426      composePaymentReconciliationDetailsComponentInner(element);
22427      close();
22428    }
22429  }
22430
22431  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
22432      composeBackbone(element);
22433      if (element.hasType()) {
22434        composeCoding("type", element.getType());
22435      }
22436      if (element.hasRequest()) {
22437        composeReference("request", element.getRequest());
22438      }
22439      if (element.hasResponce()) {
22440        composeReference("responce", element.getResponce());
22441      }
22442      if (element.hasSubmitter()) {
22443        composeReference("submitter", element.getSubmitter());
22444      }
22445      if (element.hasPayee()) {
22446        composeReference("payee", element.getPayee());
22447      }
22448      if (element.hasDateElement()) {
22449        composeDateCore("date", element.getDateElement(), false);
22450        composeDateExtras("date", element.getDateElement(), false);
22451      }
22452      if (element.hasAmount()) {
22453        composeMoney("amount", element.getAmount());
22454      }
22455  }
22456
22457  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
22458    if (element != null) {
22459      open(name);
22460      composePaymentReconciliationNotesComponentInner(element);
22461      close();
22462    }
22463  }
22464
22465  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
22466      composeBackbone(element);
22467      if (element.hasType()) {
22468        composeCoding("type", element.getType());
22469      }
22470      if (element.hasTextElement()) {
22471        composeStringCore("text", element.getTextElement(), false);
22472        composeStringExtras("text", element.getTextElement(), false);
22473      }
22474  }
22475
22476  protected void composePerson(String name, Person element) throws IOException {
22477    if (element != null) {
22478      prop("resourceType", name);
22479      composePersonInner(element);
22480    }
22481  }
22482
22483  protected void composePersonInner(Person element) throws IOException {
22484      composeDomainResourceElements(element);
22485      if (element.hasIdentifier()) {
22486        openArray("identifier");
22487        for (Identifier e : element.getIdentifier()) 
22488          composeIdentifier(null, e);
22489        closeArray();
22490      };
22491      if (element.hasName()) {
22492        openArray("name");
22493        for (HumanName e : element.getName()) 
22494          composeHumanName(null, e);
22495        closeArray();
22496      };
22497      if (element.hasTelecom()) {
22498        openArray("telecom");
22499        for (ContactPoint e : element.getTelecom()) 
22500          composeContactPoint(null, e);
22501        closeArray();
22502      };
22503      if (element.hasGenderElement()) {
22504        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22505        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22506      }
22507      if (element.hasBirthDateElement()) {
22508        composeDateCore("birthDate", element.getBirthDateElement(), false);
22509        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22510      }
22511      if (element.hasAddress()) {
22512        openArray("address");
22513        for (Address e : element.getAddress()) 
22514          composeAddress(null, e);
22515        closeArray();
22516      };
22517      if (element.hasPhoto()) {
22518        composeAttachment("photo", element.getPhoto());
22519      }
22520      if (element.hasManagingOrganization()) {
22521        composeReference("managingOrganization", element.getManagingOrganization());
22522      }
22523      if (element.hasActiveElement()) {
22524        composeBooleanCore("active", element.getActiveElement(), false);
22525        composeBooleanExtras("active", element.getActiveElement(), false);
22526      }
22527      if (element.hasLink()) {
22528        openArray("link");
22529        for (Person.PersonLinkComponent e : element.getLink()) 
22530          composePersonPersonLinkComponent(null, e);
22531        closeArray();
22532      };
22533  }
22534
22535  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
22536    if (element != null) {
22537      open(name);
22538      composePersonPersonLinkComponentInner(element);
22539      close();
22540    }
22541  }
22542
22543  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
22544      composeBackbone(element);
22545      if (element.hasTarget()) {
22546        composeReference("target", element.getTarget());
22547      }
22548      if (element.hasAssuranceElement()) {
22549        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22550        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22551      }
22552  }
22553
22554  protected void composePractitioner(String name, Practitioner element) throws IOException {
22555    if (element != null) {
22556      prop("resourceType", name);
22557      composePractitionerInner(element);
22558    }
22559  }
22560
22561  protected void composePractitionerInner(Practitioner element) throws IOException {
22562      composeDomainResourceElements(element);
22563      if (element.hasIdentifier()) {
22564        openArray("identifier");
22565        for (Identifier e : element.getIdentifier()) 
22566          composeIdentifier(null, e);
22567        closeArray();
22568      };
22569      if (element.hasActiveElement()) {
22570        composeBooleanCore("active", element.getActiveElement(), false);
22571        composeBooleanExtras("active", element.getActiveElement(), false);
22572      }
22573      if (element.hasName()) {
22574        composeHumanName("name", element.getName());
22575      }
22576      if (element.hasTelecom()) {
22577        openArray("telecom");
22578        for (ContactPoint e : element.getTelecom()) 
22579          composeContactPoint(null, e);
22580        closeArray();
22581      };
22582      if (element.hasAddress()) {
22583        openArray("address");
22584        for (Address e : element.getAddress()) 
22585          composeAddress(null, e);
22586        closeArray();
22587      };
22588      if (element.hasGenderElement()) {
22589        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22590        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22591      }
22592      if (element.hasBirthDateElement()) {
22593        composeDateCore("birthDate", element.getBirthDateElement(), false);
22594        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22595      }
22596      if (element.hasPhoto()) {
22597        openArray("photo");
22598        for (Attachment e : element.getPhoto()) 
22599          composeAttachment(null, e);
22600        closeArray();
22601      };
22602      if (element.hasPractitionerRole()) {
22603        openArray("practitionerRole");
22604        for (Practitioner.PractitionerPractitionerRoleComponent e : element.getPractitionerRole()) 
22605          composePractitionerPractitionerPractitionerRoleComponent(null, e);
22606        closeArray();
22607      };
22608      if (element.hasQualification()) {
22609        openArray("qualification");
22610        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
22611          composePractitionerPractitionerQualificationComponent(null, e);
22612        closeArray();
22613      };
22614      if (element.hasCommunication()) {
22615        openArray("communication");
22616        for (CodeableConcept e : element.getCommunication()) 
22617          composeCodeableConcept(null, e);
22618        closeArray();
22619      };
22620  }
22621
22622  protected void composePractitionerPractitionerPractitionerRoleComponent(String name, Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22623    if (element != null) {
22624      open(name);
22625      composePractitionerPractitionerPractitionerRoleComponentInner(element);
22626      close();
22627    }
22628  }
22629
22630  protected void composePractitionerPractitionerPractitionerRoleComponentInner(Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22631      composeBackbone(element);
22632      if (element.hasManagingOrganization()) {
22633        composeReference("managingOrganization", element.getManagingOrganization());
22634      }
22635      if (element.hasRole()) {
22636        composeCodeableConcept("role", element.getRole());
22637      }
22638      if (element.hasSpecialty()) {
22639        openArray("specialty");
22640        for (CodeableConcept e : element.getSpecialty()) 
22641          composeCodeableConcept(null, e);
22642        closeArray();
22643      };
22644      if (element.hasPeriod()) {
22645        composePeriod("period", element.getPeriod());
22646      }
22647      if (element.hasLocation()) {
22648        openArray("location");
22649        for (Reference e : element.getLocation()) 
22650          composeReference(null, e);
22651        closeArray();
22652      };
22653      if (element.hasHealthcareService()) {
22654        openArray("healthcareService");
22655        for (Reference e : element.getHealthcareService()) 
22656          composeReference(null, e);
22657        closeArray();
22658      };
22659  }
22660
22661  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
22662    if (element != null) {
22663      open(name);
22664      composePractitionerPractitionerQualificationComponentInner(element);
22665      close();
22666    }
22667  }
22668
22669  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
22670      composeBackbone(element);
22671      if (element.hasIdentifier()) {
22672        openArray("identifier");
22673        for (Identifier e : element.getIdentifier()) 
22674          composeIdentifier(null, e);
22675        closeArray();
22676      };
22677      if (element.hasCode()) {
22678        composeCodeableConcept("code", element.getCode());
22679      }
22680      if (element.hasPeriod()) {
22681        composePeriod("period", element.getPeriod());
22682      }
22683      if (element.hasIssuer()) {
22684        composeReference("issuer", element.getIssuer());
22685      }
22686  }
22687
22688  protected void composeProcedure(String name, Procedure element) throws IOException {
22689    if (element != null) {
22690      prop("resourceType", name);
22691      composeProcedureInner(element);
22692    }
22693  }
22694
22695  protected void composeProcedureInner(Procedure element) throws IOException {
22696      composeDomainResourceElements(element);
22697      if (element.hasIdentifier()) {
22698        openArray("identifier");
22699        for (Identifier e : element.getIdentifier()) 
22700          composeIdentifier(null, e);
22701        closeArray();
22702      };
22703      if (element.hasSubject()) {
22704        composeReference("subject", element.getSubject());
22705      }
22706      if (element.hasStatusElement()) {
22707        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22708        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22709      }
22710      if (element.hasCategory()) {
22711        composeCodeableConcept("category", element.getCategory());
22712      }
22713      if (element.hasCode()) {
22714        composeCodeableConcept("code", element.getCode());
22715      }
22716      if (element.hasNotPerformedElement()) {
22717        composeBooleanCore("notPerformed", element.getNotPerformedElement(), false);
22718        composeBooleanExtras("notPerformed", element.getNotPerformedElement(), false);
22719      }
22720      if (element.hasReasonNotPerformed()) {
22721        openArray("reasonNotPerformed");
22722        for (CodeableConcept e : element.getReasonNotPerformed()) 
22723          composeCodeableConcept(null, e);
22724        closeArray();
22725      };
22726      if (element.hasBodySite()) {
22727        openArray("bodySite");
22728        for (CodeableConcept e : element.getBodySite()) 
22729          composeCodeableConcept(null, e);
22730        closeArray();
22731      };
22732      if (element.hasReason()) {
22733        composeType("reason", element.getReason());
22734      }
22735      if (element.hasPerformer()) {
22736        openArray("performer");
22737        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
22738          composeProcedureProcedurePerformerComponent(null, e);
22739        closeArray();
22740      };
22741      if (element.hasPerformed()) {
22742        composeType("performed", element.getPerformed());
22743      }
22744      if (element.hasEncounter()) {
22745        composeReference("encounter", element.getEncounter());
22746      }
22747      if (element.hasLocation()) {
22748        composeReference("location", element.getLocation());
22749      }
22750      if (element.hasOutcome()) {
22751        composeCodeableConcept("outcome", element.getOutcome());
22752      }
22753      if (element.hasReport()) {
22754        openArray("report");
22755        for (Reference e : element.getReport()) 
22756          composeReference(null, e);
22757        closeArray();
22758      };
22759      if (element.hasComplication()) {
22760        openArray("complication");
22761        for (CodeableConcept e : element.getComplication()) 
22762          composeCodeableConcept(null, e);
22763        closeArray();
22764      };
22765      if (element.hasFollowUp()) {
22766        openArray("followUp");
22767        for (CodeableConcept e : element.getFollowUp()) 
22768          composeCodeableConcept(null, e);
22769        closeArray();
22770      };
22771      if (element.hasRequest()) {
22772        composeReference("request", element.getRequest());
22773      }
22774      if (element.hasNotes()) {
22775        openArray("notes");
22776        for (Annotation e : element.getNotes()) 
22777          composeAnnotation(null, e);
22778        closeArray();
22779      };
22780      if (element.hasFocalDevice()) {
22781        openArray("focalDevice");
22782        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
22783          composeProcedureProcedureFocalDeviceComponent(null, e);
22784        closeArray();
22785      };
22786      if (element.hasUsed()) {
22787        openArray("used");
22788        for (Reference e : element.getUsed()) 
22789          composeReference(null, e);
22790        closeArray();
22791      };
22792  }
22793
22794  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
22795    if (element != null) {
22796      open(name);
22797      composeProcedureProcedurePerformerComponentInner(element);
22798      close();
22799    }
22800  }
22801
22802  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
22803      composeBackbone(element);
22804      if (element.hasActor()) {
22805        composeReference("actor", element.getActor());
22806      }
22807      if (element.hasRole()) {
22808        composeCodeableConcept("role", element.getRole());
22809      }
22810  }
22811
22812  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22813    if (element != null) {
22814      open(name);
22815      composeProcedureProcedureFocalDeviceComponentInner(element);
22816      close();
22817    }
22818  }
22819
22820  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22821      composeBackbone(element);
22822      if (element.hasAction()) {
22823        composeCodeableConcept("action", element.getAction());
22824      }
22825      if (element.hasManipulated()) {
22826        composeReference("manipulated", element.getManipulated());
22827      }
22828  }
22829
22830  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
22831    if (element != null) {
22832      prop("resourceType", name);
22833      composeProcedureRequestInner(element);
22834    }
22835  }
22836
22837  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
22838      composeDomainResourceElements(element);
22839      if (element.hasIdentifier()) {
22840        openArray("identifier");
22841        for (Identifier e : element.getIdentifier()) 
22842          composeIdentifier(null, e);
22843        closeArray();
22844      };
22845      if (element.hasSubject()) {
22846        composeReference("subject", element.getSubject());
22847      }
22848      if (element.hasCode()) {
22849        composeCodeableConcept("code", element.getCode());
22850      }
22851      if (element.hasBodySite()) {
22852        openArray("bodySite");
22853        for (CodeableConcept e : element.getBodySite()) 
22854          composeCodeableConcept(null, e);
22855        closeArray();
22856      };
22857      if (element.hasReason()) {
22858        composeType("reason", element.getReason());
22859      }
22860      if (element.hasScheduled()) {
22861        composeType("scheduled", element.getScheduled());
22862      }
22863      if (element.hasEncounter()) {
22864        composeReference("encounter", element.getEncounter());
22865      }
22866      if (element.hasPerformer()) {
22867        composeReference("performer", element.getPerformer());
22868      }
22869      if (element.hasStatusElement()) {
22870        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22871        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22872      }
22873      if (element.hasNotes()) {
22874        openArray("notes");
22875        for (Annotation e : element.getNotes()) 
22876          composeAnnotation(null, e);
22877        closeArray();
22878      };
22879      if (element.hasAsNeeded()) {
22880        composeType("asNeeded", element.getAsNeeded());
22881      }
22882      if (element.hasOrderedOnElement()) {
22883        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
22884        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
22885      }
22886      if (element.hasOrderer()) {
22887        composeReference("orderer", element.getOrderer());
22888      }
22889      if (element.hasPriorityElement()) {
22890        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22891        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22892      }
22893  }
22894
22895  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
22896    if (element != null) {
22897      prop("resourceType", name);
22898      composeProcessRequestInner(element);
22899    }
22900  }
22901
22902  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
22903      composeDomainResourceElements(element);
22904      if (element.hasActionElement()) {
22905        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22906        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22907      }
22908      if (element.hasIdentifier()) {
22909        openArray("identifier");
22910        for (Identifier e : element.getIdentifier()) 
22911          composeIdentifier(null, e);
22912        closeArray();
22913      };
22914      if (element.hasRuleset()) {
22915        composeCoding("ruleset", element.getRuleset());
22916      }
22917      if (element.hasOriginalRuleset()) {
22918        composeCoding("originalRuleset", element.getOriginalRuleset());
22919      }
22920      if (element.hasCreatedElement()) {
22921        composeDateTimeCore("created", element.getCreatedElement(), false);
22922        composeDateTimeExtras("created", element.getCreatedElement(), false);
22923      }
22924      if (element.hasTarget()) {
22925        composeReference("target", element.getTarget());
22926      }
22927      if (element.hasProvider()) {
22928        composeReference("provider", element.getProvider());
22929      }
22930      if (element.hasOrganization()) {
22931        composeReference("organization", element.getOrganization());
22932      }
22933      if (element.hasRequest()) {
22934        composeReference("request", element.getRequest());
22935      }
22936      if (element.hasResponse()) {
22937        composeReference("response", element.getResponse());
22938      }
22939      if (element.hasNullifyElement()) {
22940        composeBooleanCore("nullify", element.getNullifyElement(), false);
22941        composeBooleanExtras("nullify", element.getNullifyElement(), false);
22942      }
22943      if (element.hasReferenceElement()) {
22944        composeStringCore("reference", element.getReferenceElement(), false);
22945        composeStringExtras("reference", element.getReferenceElement(), false);
22946      }
22947      if (element.hasItem()) {
22948        openArray("item");
22949        for (ProcessRequest.ItemsComponent e : element.getItem()) 
22950          composeProcessRequestItemsComponent(null, e);
22951        closeArray();
22952      };
22953      if (element.hasInclude()) {
22954        openArray("include");
22955        for (StringType e : element.getInclude()) 
22956          composeStringCore(null, e, true);
22957        closeArray();
22958        if (anyHasExtras(element.getInclude())) {
22959          openArray("_include");
22960          for (StringType e : element.getInclude()) 
22961            composeStringExtras(null, e, true);
22962          closeArray();
22963        }
22964      };
22965      if (element.hasExclude()) {
22966        openArray("exclude");
22967        for (StringType e : element.getExclude()) 
22968          composeStringCore(null, e, true);
22969        closeArray();
22970        if (anyHasExtras(element.getExclude())) {
22971          openArray("_exclude");
22972          for (StringType e : element.getExclude()) 
22973            composeStringExtras(null, e, true);
22974          closeArray();
22975        }
22976      };
22977      if (element.hasPeriod()) {
22978        composePeriod("period", element.getPeriod());
22979      }
22980  }
22981
22982  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
22983    if (element != null) {
22984      open(name);
22985      composeProcessRequestItemsComponentInner(element);
22986      close();
22987    }
22988  }
22989
22990  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
22991      composeBackbone(element);
22992      if (element.hasSequenceLinkIdElement()) {
22993        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
22994        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
22995      }
22996  }
22997
22998  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
22999    if (element != null) {
23000      prop("resourceType", name);
23001      composeProcessResponseInner(element);
23002    }
23003  }
23004
23005  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
23006      composeDomainResourceElements(element);
23007      if (element.hasIdentifier()) {
23008        openArray("identifier");
23009        for (Identifier e : element.getIdentifier()) 
23010          composeIdentifier(null, e);
23011        closeArray();
23012      };
23013      if (element.hasRequest()) {
23014        composeReference("request", element.getRequest());
23015      }
23016      if (element.hasOutcome()) {
23017        composeCoding("outcome", element.getOutcome());
23018      }
23019      if (element.hasDispositionElement()) {
23020        composeStringCore("disposition", element.getDispositionElement(), false);
23021        composeStringExtras("disposition", element.getDispositionElement(), false);
23022      }
23023      if (element.hasRuleset()) {
23024        composeCoding("ruleset", element.getRuleset());
23025      }
23026      if (element.hasOriginalRuleset()) {
23027        composeCoding("originalRuleset", element.getOriginalRuleset());
23028      }
23029      if (element.hasCreatedElement()) {
23030        composeDateTimeCore("created", element.getCreatedElement(), false);
23031        composeDateTimeExtras("created", element.getCreatedElement(), false);
23032      }
23033      if (element.hasOrganization()) {
23034        composeReference("organization", element.getOrganization());
23035      }
23036      if (element.hasRequestProvider()) {
23037        composeReference("requestProvider", element.getRequestProvider());
23038      }
23039      if (element.hasRequestOrganization()) {
23040        composeReference("requestOrganization", element.getRequestOrganization());
23041      }
23042      if (element.hasForm()) {
23043        composeCoding("form", element.getForm());
23044      }
23045      if (element.hasNotes()) {
23046        openArray("notes");
23047        for (ProcessResponse.ProcessResponseNotesComponent e : element.getNotes()) 
23048          composeProcessResponseProcessResponseNotesComponent(null, e);
23049        closeArray();
23050      };
23051      if (element.hasError()) {
23052        openArray("error");
23053        for (Coding e : element.getError()) 
23054          composeCoding(null, e);
23055        closeArray();
23056      };
23057  }
23058
23059  protected void composeProcessResponseProcessResponseNotesComponent(String name, ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23060    if (element != null) {
23061      open(name);
23062      composeProcessResponseProcessResponseNotesComponentInner(element);
23063      close();
23064    }
23065  }
23066
23067  protected void composeProcessResponseProcessResponseNotesComponentInner(ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23068      composeBackbone(element);
23069      if (element.hasType()) {
23070        composeCoding("type", element.getType());
23071      }
23072      if (element.hasTextElement()) {
23073        composeStringCore("text", element.getTextElement(), false);
23074        composeStringExtras("text", element.getTextElement(), false);
23075      }
23076  }
23077
23078  protected void composeProvenance(String name, Provenance element) throws IOException {
23079    if (element != null) {
23080      prop("resourceType", name);
23081      composeProvenanceInner(element);
23082    }
23083  }
23084
23085  protected void composeProvenanceInner(Provenance element) throws IOException {
23086      composeDomainResourceElements(element);
23087      if (element.hasTarget()) {
23088        openArray("target");
23089        for (Reference e : element.getTarget()) 
23090          composeReference(null, e);
23091        closeArray();
23092      };
23093      if (element.hasPeriod()) {
23094        composePeriod("period", element.getPeriod());
23095      }
23096      if (element.hasRecordedElement()) {
23097        composeInstantCore("recorded", element.getRecordedElement(), false);
23098        composeInstantExtras("recorded", element.getRecordedElement(), false);
23099      }
23100      if (element.hasReason()) {
23101        openArray("reason");
23102        for (CodeableConcept e : element.getReason()) 
23103          composeCodeableConcept(null, e);
23104        closeArray();
23105      };
23106      if (element.hasActivity()) {
23107        composeCodeableConcept("activity", element.getActivity());
23108      }
23109      if (element.hasLocation()) {
23110        composeReference("location", element.getLocation());
23111      }
23112      if (element.hasPolicy()) {
23113        openArray("policy");
23114        for (UriType e : element.getPolicy()) 
23115          composeUriCore(null, e, true);
23116        closeArray();
23117        if (anyHasExtras(element.getPolicy())) {
23118          openArray("_policy");
23119          for (UriType e : element.getPolicy()) 
23120            composeUriExtras(null, e, true);
23121          closeArray();
23122        }
23123      };
23124      if (element.hasAgent()) {
23125        openArray("agent");
23126        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
23127          composeProvenanceProvenanceAgentComponent(null, e);
23128        closeArray();
23129      };
23130      if (element.hasEntity()) {
23131        openArray("entity");
23132        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
23133          composeProvenanceProvenanceEntityComponent(null, e);
23134        closeArray();
23135      };
23136      if (element.hasSignature()) {
23137        openArray("signature");
23138        for (Signature e : element.getSignature()) 
23139          composeSignature(null, e);
23140        closeArray();
23141      };
23142  }
23143
23144  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
23145    if (element != null) {
23146      open(name);
23147      composeProvenanceProvenanceAgentComponentInner(element);
23148      close();
23149    }
23150  }
23151
23152  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
23153      composeBackbone(element);
23154      if (element.hasRole()) {
23155        composeCoding("role", element.getRole());
23156      }
23157      if (element.hasActor()) {
23158        composeReference("actor", element.getActor());
23159      }
23160      if (element.hasUserId()) {
23161        composeIdentifier("userId", element.getUserId());
23162      }
23163      if (element.hasRelatedAgent()) {
23164        openArray("relatedAgent");
23165        for (Provenance.ProvenanceAgentRelatedAgentComponent e : element.getRelatedAgent()) 
23166          composeProvenanceProvenanceAgentRelatedAgentComponent(null, e);
23167        closeArray();
23168      };
23169  }
23170
23171  protected void composeProvenanceProvenanceAgentRelatedAgentComponent(String name, Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23172    if (element != null) {
23173      open(name);
23174      composeProvenanceProvenanceAgentRelatedAgentComponentInner(element);
23175      close();
23176    }
23177  }
23178
23179  protected void composeProvenanceProvenanceAgentRelatedAgentComponentInner(Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23180      composeBackbone(element);
23181      if (element.hasType()) {
23182        composeCodeableConcept("type", element.getType());
23183      }
23184      if (element.hasTargetElement()) {
23185        composeUriCore("target", element.getTargetElement(), false);
23186        composeUriExtras("target", element.getTargetElement(), false);
23187      }
23188  }
23189
23190  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
23191    if (element != null) {
23192      open(name);
23193      composeProvenanceProvenanceEntityComponentInner(element);
23194      close();
23195    }
23196  }
23197
23198  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
23199      composeBackbone(element);
23200      if (element.hasRoleElement()) {
23201        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23202        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23203      }
23204      if (element.hasType()) {
23205        composeCoding("type", element.getType());
23206      }
23207      if (element.hasReferenceElement()) {
23208        composeUriCore("reference", element.getReferenceElement(), false);
23209        composeUriExtras("reference", element.getReferenceElement(), false);
23210      }
23211      if (element.hasDisplayElement()) {
23212        composeStringCore("display", element.getDisplayElement(), false);
23213        composeStringExtras("display", element.getDisplayElement(), false);
23214      }
23215      if (element.hasAgent()) {
23216        composeProvenanceProvenanceAgentComponent("agent", element.getAgent());
23217      }
23218  }
23219
23220  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
23221    if (element != null) {
23222      prop("resourceType", name);
23223      composeQuestionnaireInner(element);
23224    }
23225  }
23226
23227  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
23228      composeDomainResourceElements(element);
23229      if (element.hasIdentifier()) {
23230        openArray("identifier");
23231        for (Identifier e : element.getIdentifier()) 
23232          composeIdentifier(null, e);
23233        closeArray();
23234      };
23235      if (element.hasVersionElement()) {
23236        composeStringCore("version", element.getVersionElement(), false);
23237        composeStringExtras("version", element.getVersionElement(), false);
23238      }
23239      if (element.hasStatusElement()) {
23240        composeEnumerationCore("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23241        composeEnumerationExtras("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23242      }
23243      if (element.hasDateElement()) {
23244        composeDateTimeCore("date", element.getDateElement(), false);
23245        composeDateTimeExtras("date", element.getDateElement(), false);
23246      }
23247      if (element.hasPublisherElement()) {
23248        composeStringCore("publisher", element.getPublisherElement(), false);
23249        composeStringExtras("publisher", element.getPublisherElement(), false);
23250      }
23251      if (element.hasTelecom()) {
23252        openArray("telecom");
23253        for (ContactPoint e : element.getTelecom()) 
23254          composeContactPoint(null, e);
23255        closeArray();
23256      };
23257      if (element.hasSubjectType()) {
23258        openArray("subjectType");
23259        for (CodeType e : element.getSubjectType()) 
23260          composeCodeCore(null, e, true);
23261        closeArray();
23262        if (anyHasExtras(element.getSubjectType())) {
23263          openArray("_subjectType");
23264          for (CodeType e : element.getSubjectType()) 
23265            composeCodeExtras(null, e, true);
23266          closeArray();
23267        }
23268      };
23269      if (element.hasGroup()) {
23270        composeQuestionnaireGroupComponent("group", element.getGroup());
23271      }
23272  }
23273
23274  protected void composeQuestionnaireGroupComponent(String name, Questionnaire.GroupComponent element) throws IOException {
23275    if (element != null) {
23276      open(name);
23277      composeQuestionnaireGroupComponentInner(element);
23278      close();
23279    }
23280  }
23281
23282  protected void composeQuestionnaireGroupComponentInner(Questionnaire.GroupComponent element) throws IOException {
23283      composeBackbone(element);
23284      if (element.hasLinkIdElement()) {
23285        composeStringCore("linkId", element.getLinkIdElement(), false);
23286        composeStringExtras("linkId", element.getLinkIdElement(), false);
23287      }
23288      if (element.hasTitleElement()) {
23289        composeStringCore("title", element.getTitleElement(), false);
23290        composeStringExtras("title", element.getTitleElement(), false);
23291      }
23292      if (element.hasConcept()) {
23293        openArray("concept");
23294        for (Coding e : element.getConcept()) 
23295          composeCoding(null, e);
23296        closeArray();
23297      };
23298      if (element.hasTextElement()) {
23299        composeStringCore("text", element.getTextElement(), false);
23300        composeStringExtras("text", element.getTextElement(), false);
23301      }
23302      if (element.hasRequiredElement()) {
23303        composeBooleanCore("required", element.getRequiredElement(), false);
23304        composeBooleanExtras("required", element.getRequiredElement(), false);
23305      }
23306      if (element.hasRepeatsElement()) {
23307        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23308        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23309      }
23310      if (element.hasGroup()) {
23311        openArray("group");
23312        for (Questionnaire.GroupComponent e : element.getGroup()) 
23313          composeQuestionnaireGroupComponent(null, e);
23314        closeArray();
23315      };
23316      if (element.hasQuestion()) {
23317        openArray("question");
23318        for (Questionnaire.QuestionComponent e : element.getQuestion()) 
23319          composeQuestionnaireQuestionComponent(null, e);
23320        closeArray();
23321      };
23322  }
23323
23324  protected void composeQuestionnaireQuestionComponent(String name, Questionnaire.QuestionComponent element) throws IOException {
23325    if (element != null) {
23326      open(name);
23327      composeQuestionnaireQuestionComponentInner(element);
23328      close();
23329    }
23330  }
23331
23332  protected void composeQuestionnaireQuestionComponentInner(Questionnaire.QuestionComponent element) throws IOException {
23333      composeBackbone(element);
23334      if (element.hasLinkIdElement()) {
23335        composeStringCore("linkId", element.getLinkIdElement(), false);
23336        composeStringExtras("linkId", element.getLinkIdElement(), false);
23337      }
23338      if (element.hasConcept()) {
23339        openArray("concept");
23340        for (Coding e : element.getConcept()) 
23341          composeCoding(null, e);
23342        closeArray();
23343      };
23344      if (element.hasTextElement()) {
23345        composeStringCore("text", element.getTextElement(), false);
23346        composeStringExtras("text", element.getTextElement(), false);
23347      }
23348      if (element.hasTypeElement()) {
23349        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23350        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23351      }
23352      if (element.hasRequiredElement()) {
23353        composeBooleanCore("required", element.getRequiredElement(), false);
23354        composeBooleanExtras("required", element.getRequiredElement(), false);
23355      }
23356      if (element.hasRepeatsElement()) {
23357        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23358        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23359      }
23360      if (element.hasOptions()) {
23361        composeReference("options", element.getOptions());
23362      }
23363      if (element.hasOption()) {
23364        openArray("option");
23365        for (Coding e : element.getOption()) 
23366          composeCoding(null, e);
23367        closeArray();
23368      };
23369      if (element.hasGroup()) {
23370        openArray("group");
23371        for (Questionnaire.GroupComponent e : element.getGroup()) 
23372          composeQuestionnaireGroupComponent(null, e);
23373        closeArray();
23374      };
23375  }
23376
23377  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
23378    if (element != null) {
23379      prop("resourceType", name);
23380      composeQuestionnaireResponseInner(element);
23381    }
23382  }
23383
23384  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
23385      composeDomainResourceElements(element);
23386      if (element.hasIdentifier()) {
23387        composeIdentifier("identifier", element.getIdentifier());
23388      }
23389      if (element.hasQuestionnaire()) {
23390        composeReference("questionnaire", element.getQuestionnaire());
23391      }
23392      if (element.hasStatusElement()) {
23393        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23394        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23395      }
23396      if (element.hasSubject()) {
23397        composeReference("subject", element.getSubject());
23398      }
23399      if (element.hasAuthor()) {
23400        composeReference("author", element.getAuthor());
23401      }
23402      if (element.hasAuthoredElement()) {
23403        composeDateTimeCore("authored", element.getAuthoredElement(), false);
23404        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
23405      }
23406      if (element.hasSource()) {
23407        composeReference("source", element.getSource());
23408      }
23409      if (element.hasEncounter()) {
23410        composeReference("encounter", element.getEncounter());
23411      }
23412      if (element.hasGroup()) {
23413        composeQuestionnaireResponseGroupComponent("group", element.getGroup());
23414      }
23415  }
23416
23417  protected void composeQuestionnaireResponseGroupComponent(String name, QuestionnaireResponse.GroupComponent element) throws IOException {
23418    if (element != null) {
23419      open(name);
23420      composeQuestionnaireResponseGroupComponentInner(element);
23421      close();
23422    }
23423  }
23424
23425  protected void composeQuestionnaireResponseGroupComponentInner(QuestionnaireResponse.GroupComponent element) throws IOException {
23426      composeBackbone(element);
23427      if (element.hasLinkIdElement()) {
23428        composeStringCore("linkId", element.getLinkIdElement(), false);
23429        composeStringExtras("linkId", element.getLinkIdElement(), false);
23430      }
23431      if (element.hasTitleElement()) {
23432        composeStringCore("title", element.getTitleElement(), false);
23433        composeStringExtras("title", element.getTitleElement(), false);
23434      }
23435      if (element.hasTextElement()) {
23436        composeStringCore("text", element.getTextElement(), false);
23437        composeStringExtras("text", element.getTextElement(), false);
23438      }
23439      if (element.hasSubject()) {
23440        composeReference("subject", element.getSubject());
23441      }
23442      if (element.hasGroup()) {
23443        openArray("group");
23444        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23445          composeQuestionnaireResponseGroupComponent(null, e);
23446        closeArray();
23447      };
23448      if (element.hasQuestion()) {
23449        openArray("question");
23450        for (QuestionnaireResponse.QuestionComponent e : element.getQuestion()) 
23451          composeQuestionnaireResponseQuestionComponent(null, e);
23452        closeArray();
23453      };
23454  }
23455
23456  protected void composeQuestionnaireResponseQuestionComponent(String name, QuestionnaireResponse.QuestionComponent element) throws IOException {
23457    if (element != null) {
23458      open(name);
23459      composeQuestionnaireResponseQuestionComponentInner(element);
23460      close();
23461    }
23462  }
23463
23464  protected void composeQuestionnaireResponseQuestionComponentInner(QuestionnaireResponse.QuestionComponent element) throws IOException {
23465      composeBackbone(element);
23466      if (element.hasLinkIdElement()) {
23467        composeStringCore("linkId", element.getLinkIdElement(), false);
23468        composeStringExtras("linkId", element.getLinkIdElement(), false);
23469      }
23470      if (element.hasTextElement()) {
23471        composeStringCore("text", element.getTextElement(), false);
23472        composeStringExtras("text", element.getTextElement(), false);
23473      }
23474      if (element.hasAnswer()) {
23475        openArray("answer");
23476        for (QuestionnaireResponse.QuestionAnswerComponent e : element.getAnswer()) 
23477          composeQuestionnaireResponseQuestionAnswerComponent(null, e);
23478        closeArray();
23479      };
23480  }
23481
23482  protected void composeQuestionnaireResponseQuestionAnswerComponent(String name, QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23483    if (element != null) {
23484      open(name);
23485      composeQuestionnaireResponseQuestionAnswerComponentInner(element);
23486      close();
23487    }
23488  }
23489
23490  protected void composeQuestionnaireResponseQuestionAnswerComponentInner(QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23491      composeBackbone(element);
23492      if (element.hasValue()) {
23493        composeType("value", element.getValue());
23494      }
23495      if (element.hasGroup()) {
23496        openArray("group");
23497        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23498          composeQuestionnaireResponseGroupComponent(null, e);
23499        closeArray();
23500      };
23501  }
23502
23503  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
23504    if (element != null) {
23505      prop("resourceType", name);
23506      composeReferralRequestInner(element);
23507    }
23508  }
23509
23510  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
23511      composeDomainResourceElements(element);
23512      if (element.hasStatusElement()) {
23513        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23514        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23515      }
23516      if (element.hasIdentifier()) {
23517        openArray("identifier");
23518        for (Identifier e : element.getIdentifier()) 
23519          composeIdentifier(null, e);
23520        closeArray();
23521      };
23522      if (element.hasDateElement()) {
23523        composeDateTimeCore("date", element.getDateElement(), false);
23524        composeDateTimeExtras("date", element.getDateElement(), false);
23525      }
23526      if (element.hasType()) {
23527        composeCodeableConcept("type", element.getType());
23528      }
23529      if (element.hasSpecialty()) {
23530        composeCodeableConcept("specialty", element.getSpecialty());
23531      }
23532      if (element.hasPriority()) {
23533        composeCodeableConcept("priority", element.getPriority());
23534      }
23535      if (element.hasPatient()) {
23536        composeReference("patient", element.getPatient());
23537      }
23538      if (element.hasRequester()) {
23539        composeReference("requester", element.getRequester());
23540      }
23541      if (element.hasRecipient()) {
23542        openArray("recipient");
23543        for (Reference e : element.getRecipient()) 
23544          composeReference(null, e);
23545        closeArray();
23546      };
23547      if (element.hasEncounter()) {
23548        composeReference("encounter", element.getEncounter());
23549      }
23550      if (element.hasDateSentElement()) {
23551        composeDateTimeCore("dateSent", element.getDateSentElement(), false);
23552        composeDateTimeExtras("dateSent", element.getDateSentElement(), false);
23553      }
23554      if (element.hasReason()) {
23555        composeCodeableConcept("reason", element.getReason());
23556      }
23557      if (element.hasDescriptionElement()) {
23558        composeStringCore("description", element.getDescriptionElement(), false);
23559        composeStringExtras("description", element.getDescriptionElement(), false);
23560      }
23561      if (element.hasServiceRequested()) {
23562        openArray("serviceRequested");
23563        for (CodeableConcept e : element.getServiceRequested()) 
23564          composeCodeableConcept(null, e);
23565        closeArray();
23566      };
23567      if (element.hasSupportingInformation()) {
23568        openArray("supportingInformation");
23569        for (Reference e : element.getSupportingInformation()) 
23570          composeReference(null, e);
23571        closeArray();
23572      };
23573      if (element.hasFulfillmentTime()) {
23574        composePeriod("fulfillmentTime", element.getFulfillmentTime());
23575      }
23576  }
23577
23578  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
23579    if (element != null) {
23580      prop("resourceType", name);
23581      composeRelatedPersonInner(element);
23582    }
23583  }
23584
23585  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
23586      composeDomainResourceElements(element);
23587      if (element.hasIdentifier()) {
23588        openArray("identifier");
23589        for (Identifier e : element.getIdentifier()) 
23590          composeIdentifier(null, e);
23591        closeArray();
23592      };
23593      if (element.hasPatient()) {
23594        composeReference("patient", element.getPatient());
23595      }
23596      if (element.hasRelationship()) {
23597        composeCodeableConcept("relationship", element.getRelationship());
23598      }
23599      if (element.hasName()) {
23600        composeHumanName("name", element.getName());
23601      }
23602      if (element.hasTelecom()) {
23603        openArray("telecom");
23604        for (ContactPoint e : element.getTelecom()) 
23605          composeContactPoint(null, e);
23606        closeArray();
23607      };
23608      if (element.hasGenderElement()) {
23609        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23610        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23611      }
23612      if (element.hasBirthDateElement()) {
23613        composeDateCore("birthDate", element.getBirthDateElement(), false);
23614        composeDateExtras("birthDate", element.getBirthDateElement(), false);
23615      }
23616      if (element.hasAddress()) {
23617        openArray("address");
23618        for (Address e : element.getAddress()) 
23619          composeAddress(null, e);
23620        closeArray();
23621      };
23622      if (element.hasPhoto()) {
23623        openArray("photo");
23624        for (Attachment e : element.getPhoto()) 
23625          composeAttachment(null, e);
23626        closeArray();
23627      };
23628      if (element.hasPeriod()) {
23629        composePeriod("period", element.getPeriod());
23630      }
23631  }
23632
23633  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
23634    if (element != null) {
23635      prop("resourceType", name);
23636      composeRiskAssessmentInner(element);
23637    }
23638  }
23639
23640  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
23641      composeDomainResourceElements(element);
23642      if (element.hasSubject()) {
23643        composeReference("subject", element.getSubject());
23644      }
23645      if (element.hasDateElement()) {
23646        composeDateTimeCore("date", element.getDateElement(), false);
23647        composeDateTimeExtras("date", element.getDateElement(), false);
23648      }
23649      if (element.hasCondition()) {
23650        composeReference("condition", element.getCondition());
23651      }
23652      if (element.hasEncounter()) {
23653        composeReference("encounter", element.getEncounter());
23654      }
23655      if (element.hasPerformer()) {
23656        composeReference("performer", element.getPerformer());
23657      }
23658      if (element.hasIdentifier()) {
23659        composeIdentifier("identifier", element.getIdentifier());
23660      }
23661      if (element.hasMethod()) {
23662        composeCodeableConcept("method", element.getMethod());
23663      }
23664      if (element.hasBasis()) {
23665        openArray("basis");
23666        for (Reference e : element.getBasis()) 
23667          composeReference(null, e);
23668        closeArray();
23669      };
23670      if (element.hasPrediction()) {
23671        openArray("prediction");
23672        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
23673          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
23674        closeArray();
23675      };
23676      if (element.hasMitigationElement()) {
23677        composeStringCore("mitigation", element.getMitigationElement(), false);
23678        composeStringExtras("mitigation", element.getMitigationElement(), false);
23679      }
23680  }
23681
23682  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23683    if (element != null) {
23684      open(name);
23685      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
23686      close();
23687    }
23688  }
23689
23690  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23691      composeBackbone(element);
23692      if (element.hasOutcome()) {
23693        composeCodeableConcept("outcome", element.getOutcome());
23694      }
23695      if (element.hasProbability()) {
23696        composeType("probability", element.getProbability());
23697      }
23698      if (element.hasRelativeRiskElement()) {
23699        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
23700        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
23701      }
23702      if (element.hasWhen()) {
23703        composeType("when", element.getWhen());
23704      }
23705      if (element.hasRationaleElement()) {
23706        composeStringCore("rationale", element.getRationaleElement(), false);
23707        composeStringExtras("rationale", element.getRationaleElement(), false);
23708      }
23709  }
23710
23711  protected void composeSchedule(String name, Schedule element) throws IOException {
23712    if (element != null) {
23713      prop("resourceType", name);
23714      composeScheduleInner(element);
23715    }
23716  }
23717
23718  protected void composeScheduleInner(Schedule element) throws IOException {
23719      composeDomainResourceElements(element);
23720      if (element.hasIdentifier()) {
23721        openArray("identifier");
23722        for (Identifier e : element.getIdentifier()) 
23723          composeIdentifier(null, e);
23724        closeArray();
23725      };
23726      if (element.hasType()) {
23727        openArray("type");
23728        for (CodeableConcept e : element.getType()) 
23729          composeCodeableConcept(null, e);
23730        closeArray();
23731      };
23732      if (element.hasActor()) {
23733        composeReference("actor", element.getActor());
23734      }
23735      if (element.hasPlanningHorizon()) {
23736        composePeriod("planningHorizon", element.getPlanningHorizon());
23737      }
23738      if (element.hasCommentElement()) {
23739        composeStringCore("comment", element.getCommentElement(), false);
23740        composeStringExtras("comment", element.getCommentElement(), false);
23741      }
23742  }
23743
23744  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
23745    if (element != null) {
23746      prop("resourceType", name);
23747      composeSearchParameterInner(element);
23748    }
23749  }
23750
23751  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
23752      composeDomainResourceElements(element);
23753      if (element.hasUrlElement()) {
23754        composeUriCore("url", element.getUrlElement(), false);
23755        composeUriExtras("url", element.getUrlElement(), false);
23756      }
23757      if (element.hasNameElement()) {
23758        composeStringCore("name", element.getNameElement(), false);
23759        composeStringExtras("name", element.getNameElement(), false);
23760      }
23761      if (element.hasStatusElement()) {
23762        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23763        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23764      }
23765      if (element.hasExperimentalElement()) {
23766        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23767        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23768      }
23769      if (element.hasPublisherElement()) {
23770        composeStringCore("publisher", element.getPublisherElement(), false);
23771        composeStringExtras("publisher", element.getPublisherElement(), false);
23772      }
23773      if (element.hasContact()) {
23774        openArray("contact");
23775        for (SearchParameter.SearchParameterContactComponent e : element.getContact()) 
23776          composeSearchParameterSearchParameterContactComponent(null, e);
23777        closeArray();
23778      };
23779      if (element.hasDateElement()) {
23780        composeDateTimeCore("date", element.getDateElement(), false);
23781        composeDateTimeExtras("date", element.getDateElement(), false);
23782      }
23783      if (element.hasRequirementsElement()) {
23784        composeStringCore("requirements", element.getRequirementsElement(), false);
23785        composeStringExtras("requirements", element.getRequirementsElement(), false);
23786      }
23787      if (element.hasCodeElement()) {
23788        composeCodeCore("code", element.getCodeElement(), false);
23789        composeCodeExtras("code", element.getCodeElement(), false);
23790      }
23791      if (element.hasBaseElement()) {
23792        composeCodeCore("base", element.getBaseElement(), false);
23793        composeCodeExtras("base", element.getBaseElement(), false);
23794      }
23795      if (element.hasTypeElement()) {
23796        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23797        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23798      }
23799      if (element.hasDescriptionElement()) {
23800        composeStringCore("description", element.getDescriptionElement(), false);
23801        composeStringExtras("description", element.getDescriptionElement(), false);
23802      }
23803      if (element.hasXpathElement()) {
23804        composeStringCore("xpath", element.getXpathElement(), false);
23805        composeStringExtras("xpath", element.getXpathElement(), false);
23806      }
23807      if (element.hasXpathUsageElement()) {
23808        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23809        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23810      }
23811      if (element.hasTarget()) {
23812        openArray("target");
23813        for (CodeType e : element.getTarget()) 
23814          composeCodeCore(null, e, true);
23815        closeArray();
23816        if (anyHasExtras(element.getTarget())) {
23817          openArray("_target");
23818          for (CodeType e : element.getTarget()) 
23819            composeCodeExtras(null, e, true);
23820          closeArray();
23821        }
23822      };
23823  }
23824
23825  protected void composeSearchParameterSearchParameterContactComponent(String name, SearchParameter.SearchParameterContactComponent element) throws IOException {
23826    if (element != null) {
23827      open(name);
23828      composeSearchParameterSearchParameterContactComponentInner(element);
23829      close();
23830    }
23831  }
23832
23833  protected void composeSearchParameterSearchParameterContactComponentInner(SearchParameter.SearchParameterContactComponent element) throws IOException {
23834      composeBackbone(element);
23835      if (element.hasNameElement()) {
23836        composeStringCore("name", element.getNameElement(), false);
23837        composeStringExtras("name", element.getNameElement(), false);
23838      }
23839      if (element.hasTelecom()) {
23840        openArray("telecom");
23841        for (ContactPoint e : element.getTelecom()) 
23842          composeContactPoint(null, e);
23843        closeArray();
23844      };
23845  }
23846
23847  protected void composeSlot(String name, Slot element) throws IOException {
23848    if (element != null) {
23849      prop("resourceType", name);
23850      composeSlotInner(element);
23851    }
23852  }
23853
23854  protected void composeSlotInner(Slot element) throws IOException {
23855      composeDomainResourceElements(element);
23856      if (element.hasIdentifier()) {
23857        openArray("identifier");
23858        for (Identifier e : element.getIdentifier()) 
23859          composeIdentifier(null, e);
23860        closeArray();
23861      };
23862      if (element.hasType()) {
23863        composeCodeableConcept("type", element.getType());
23864      }
23865      if (element.hasSchedule()) {
23866        composeReference("schedule", element.getSchedule());
23867      }
23868      if (element.hasFreeBusyTypeElement()) {
23869        composeEnumerationCore("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23870        composeEnumerationExtras("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23871      }
23872      if (element.hasStartElement()) {
23873        composeInstantCore("start", element.getStartElement(), false);
23874        composeInstantExtras("start", element.getStartElement(), false);
23875      }
23876      if (element.hasEndElement()) {
23877        composeInstantCore("end", element.getEndElement(), false);
23878        composeInstantExtras("end", element.getEndElement(), false);
23879      }
23880      if (element.hasOverbookedElement()) {
23881        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
23882        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
23883      }
23884      if (element.hasCommentElement()) {
23885        composeStringCore("comment", element.getCommentElement(), false);
23886        composeStringExtras("comment", element.getCommentElement(), false);
23887      }
23888  }
23889
23890  protected void composeSpecimen(String name, Specimen element) throws IOException {
23891    if (element != null) {
23892      prop("resourceType", name);
23893      composeSpecimenInner(element);
23894    }
23895  }
23896
23897  protected void composeSpecimenInner(Specimen element) throws IOException {
23898      composeDomainResourceElements(element);
23899      if (element.hasIdentifier()) {
23900        openArray("identifier");
23901        for (Identifier e : element.getIdentifier()) 
23902          composeIdentifier(null, e);
23903        closeArray();
23904      };
23905      if (element.hasStatusElement()) {
23906        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23907        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23908      }
23909      if (element.hasType()) {
23910        composeCodeableConcept("type", element.getType());
23911      }
23912      if (element.hasParent()) {
23913        openArray("parent");
23914        for (Reference e : element.getParent()) 
23915          composeReference(null, e);
23916        closeArray();
23917      };
23918      if (element.hasSubject()) {
23919        composeReference("subject", element.getSubject());
23920      }
23921      if (element.hasAccessionIdentifier()) {
23922        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
23923      }
23924      if (element.hasReceivedTimeElement()) {
23925        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
23926        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
23927      }
23928      if (element.hasCollection()) {
23929        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
23930      }
23931      if (element.hasTreatment()) {
23932        openArray("treatment");
23933        for (Specimen.SpecimenTreatmentComponent e : element.getTreatment()) 
23934          composeSpecimenSpecimenTreatmentComponent(null, e);
23935        closeArray();
23936      };
23937      if (element.hasContainer()) {
23938        openArray("container");
23939        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
23940          composeSpecimenSpecimenContainerComponent(null, e);
23941        closeArray();
23942      };
23943  }
23944
23945  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
23946    if (element != null) {
23947      open(name);
23948      composeSpecimenSpecimenCollectionComponentInner(element);
23949      close();
23950    }
23951  }
23952
23953  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
23954      composeBackbone(element);
23955      if (element.hasCollector()) {
23956        composeReference("collector", element.getCollector());
23957      }
23958      if (element.hasComment()) {
23959        openArray("comment");
23960        for (StringType e : element.getComment()) 
23961          composeStringCore(null, e, true);
23962        closeArray();
23963        if (anyHasExtras(element.getComment())) {
23964          openArray("_comment");
23965          for (StringType e : element.getComment()) 
23966            composeStringExtras(null, e, true);
23967          closeArray();
23968        }
23969      };
23970      if (element.hasCollected()) {
23971        composeType("collected", element.getCollected());
23972      }
23973      if (element.hasQuantity()) {
23974        composeSimpleQuantity("quantity", element.getQuantity());
23975      }
23976      if (element.hasMethod()) {
23977        composeCodeableConcept("method", element.getMethod());
23978      }
23979      if (element.hasBodySite()) {
23980        composeCodeableConcept("bodySite", element.getBodySite());
23981      }
23982  }
23983
23984  protected void composeSpecimenSpecimenTreatmentComponent(String name, Specimen.SpecimenTreatmentComponent element) throws IOException {
23985    if (element != null) {
23986      open(name);
23987      composeSpecimenSpecimenTreatmentComponentInner(element);
23988      close();
23989    }
23990  }
23991
23992  protected void composeSpecimenSpecimenTreatmentComponentInner(Specimen.SpecimenTreatmentComponent element) throws IOException {
23993      composeBackbone(element);
23994      if (element.hasDescriptionElement()) {
23995        composeStringCore("description", element.getDescriptionElement(), false);
23996        composeStringExtras("description", element.getDescriptionElement(), false);
23997      }
23998      if (element.hasProcedure()) {
23999        composeCodeableConcept("procedure", element.getProcedure());
24000      }
24001      if (element.hasAdditive()) {
24002        openArray("additive");
24003        for (Reference e : element.getAdditive()) 
24004          composeReference(null, e);
24005        closeArray();
24006      };
24007  }
24008
24009  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
24010    if (element != null) {
24011      open(name);
24012      composeSpecimenSpecimenContainerComponentInner(element);
24013      close();
24014    }
24015  }
24016
24017  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
24018      composeBackbone(element);
24019      if (element.hasIdentifier()) {
24020        openArray("identifier");
24021        for (Identifier e : element.getIdentifier()) 
24022          composeIdentifier(null, e);
24023        closeArray();
24024      };
24025      if (element.hasDescriptionElement()) {
24026        composeStringCore("description", element.getDescriptionElement(), false);
24027        composeStringExtras("description", element.getDescriptionElement(), false);
24028      }
24029      if (element.hasType()) {
24030        composeCodeableConcept("type", element.getType());
24031      }
24032      if (element.hasCapacity()) {
24033        composeSimpleQuantity("capacity", element.getCapacity());
24034      }
24035      if (element.hasSpecimenQuantity()) {
24036        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
24037      }
24038      if (element.hasAdditive()) {
24039        composeType("additive", element.getAdditive());
24040      }
24041  }
24042
24043  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
24044    if (element != null) {
24045      prop("resourceType", name);
24046      composeStructureDefinitionInner(element);
24047    }
24048  }
24049
24050  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
24051      composeDomainResourceElements(element);
24052      if (element.hasUrlElement()) {
24053        composeUriCore("url", element.getUrlElement(), false);
24054        composeUriExtras("url", element.getUrlElement(), false);
24055      }
24056      if (element.hasIdentifier()) {
24057        openArray("identifier");
24058        for (Identifier e : element.getIdentifier()) 
24059          composeIdentifier(null, e);
24060        closeArray();
24061      };
24062      if (element.hasVersionElement()) {
24063        composeStringCore("version", element.getVersionElement(), false);
24064        composeStringExtras("version", element.getVersionElement(), false);
24065      }
24066      if (element.hasNameElement()) {
24067        composeStringCore("name", element.getNameElement(), false);
24068        composeStringExtras("name", element.getNameElement(), false);
24069      }
24070      if (element.hasDisplayElement()) {
24071        composeStringCore("display", element.getDisplayElement(), false);
24072        composeStringExtras("display", element.getDisplayElement(), false);
24073      }
24074      if (element.hasStatusElement()) {
24075        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24076        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24077      }
24078      if (element.hasExperimentalElement()) {
24079        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24080        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24081      }
24082      if (element.hasPublisherElement()) {
24083        composeStringCore("publisher", element.getPublisherElement(), false);
24084        composeStringExtras("publisher", element.getPublisherElement(), false);
24085      }
24086      if (element.hasContact()) {
24087        openArray("contact");
24088        for (StructureDefinition.StructureDefinitionContactComponent e : element.getContact()) 
24089          composeStructureDefinitionStructureDefinitionContactComponent(null, e);
24090        closeArray();
24091      };
24092      if (element.hasDateElement()) {
24093        composeDateTimeCore("date", element.getDateElement(), false);
24094        composeDateTimeExtras("date", element.getDateElement(), false);
24095      }
24096      if (element.hasDescriptionElement()) {
24097        composeStringCore("description", element.getDescriptionElement(), false);
24098        composeStringExtras("description", element.getDescriptionElement(), false);
24099      }
24100      if (element.hasUseContext()) {
24101        openArray("useContext");
24102        for (CodeableConcept e : element.getUseContext()) 
24103          composeCodeableConcept(null, e);
24104        closeArray();
24105      };
24106      if (element.hasRequirementsElement()) {
24107        composeStringCore("requirements", element.getRequirementsElement(), false);
24108        composeStringExtras("requirements", element.getRequirementsElement(), false);
24109      }
24110      if (element.hasCopyrightElement()) {
24111        composeStringCore("copyright", element.getCopyrightElement(), false);
24112        composeStringExtras("copyright", element.getCopyrightElement(), false);
24113      }
24114      if (element.hasCode()) {
24115        openArray("code");
24116        for (Coding e : element.getCode()) 
24117          composeCoding(null, e);
24118        closeArray();
24119      };
24120      if (element.hasFhirVersionElement()) {
24121        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
24122        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
24123      }
24124      if (element.hasMapping()) {
24125        openArray("mapping");
24126        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
24127          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
24128        closeArray();
24129      };
24130      if (element.hasKindElement()) {
24131        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24132        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24133      }
24134      if (element.hasConstrainedTypeElement()) {
24135        composeCodeCore("constrainedType", element.getConstrainedTypeElement(), false);
24136        composeCodeExtras("constrainedType", element.getConstrainedTypeElement(), false);
24137      }
24138      if (element.hasAbstractElement()) {
24139        composeBooleanCore("abstract", element.getAbstractElement(), false);
24140        composeBooleanExtras("abstract", element.getAbstractElement(), false);
24141      }
24142      if (element.hasContextTypeElement()) {
24143        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24144        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24145      }
24146      if (element.hasContext()) {
24147        openArray("context");
24148        for (StringType e : element.getContext()) 
24149          composeStringCore(null, e, true);
24150        closeArray();
24151        if (anyHasExtras(element.getContext())) {
24152          openArray("_context");
24153          for (StringType e : element.getContext()) 
24154            composeStringExtras(null, e, true);
24155          closeArray();
24156        }
24157      };
24158      if (element.hasBaseElement()) {
24159        composeUriCore("base", element.getBaseElement(), false);
24160        composeUriExtras("base", element.getBaseElement(), false);
24161      }
24162      if (element.hasSnapshot()) {
24163        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
24164      }
24165      if (element.hasDifferential()) {
24166        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
24167      }
24168  }
24169
24170  protected void composeStructureDefinitionStructureDefinitionContactComponent(String name, StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24171    if (element != null) {
24172      open(name);
24173      composeStructureDefinitionStructureDefinitionContactComponentInner(element);
24174      close();
24175    }
24176  }
24177
24178  protected void composeStructureDefinitionStructureDefinitionContactComponentInner(StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24179      composeBackbone(element);
24180      if (element.hasNameElement()) {
24181        composeStringCore("name", element.getNameElement(), false);
24182        composeStringExtras("name", element.getNameElement(), false);
24183      }
24184      if (element.hasTelecom()) {
24185        openArray("telecom");
24186        for (ContactPoint e : element.getTelecom()) 
24187          composeContactPoint(null, e);
24188        closeArray();
24189      };
24190  }
24191
24192  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24193    if (element != null) {
24194      open(name);
24195      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
24196      close();
24197    }
24198  }
24199
24200  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24201      composeBackbone(element);
24202      if (element.hasIdentityElement()) {
24203        composeIdCore("identity", element.getIdentityElement(), false);
24204        composeIdExtras("identity", element.getIdentityElement(), false);
24205      }
24206      if (element.hasUriElement()) {
24207        composeUriCore("uri", element.getUriElement(), false);
24208        composeUriExtras("uri", element.getUriElement(), false);
24209      }
24210      if (element.hasNameElement()) {
24211        composeStringCore("name", element.getNameElement(), false);
24212        composeStringExtras("name", element.getNameElement(), false);
24213      }
24214      if (element.hasCommentsElement()) {
24215        composeStringCore("comments", element.getCommentsElement(), false);
24216        composeStringExtras("comments", element.getCommentsElement(), false);
24217      }
24218  }
24219
24220  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24221    if (element != null) {
24222      open(name);
24223      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
24224      close();
24225    }
24226  }
24227
24228  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24229      composeBackbone(element);
24230      if (element.hasElement()) {
24231        openArray("element");
24232        for (ElementDefinition e : element.getElement()) 
24233          composeElementDefinition(null, e);
24234        closeArray();
24235      };
24236  }
24237
24238  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24239    if (element != null) {
24240      open(name);
24241      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
24242      close();
24243    }
24244  }
24245
24246  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24247      composeBackbone(element);
24248      if (element.hasElement()) {
24249        openArray("element");
24250        for (ElementDefinition e : element.getElement()) 
24251          composeElementDefinition(null, e);
24252        closeArray();
24253      };
24254  }
24255
24256  protected void composeSubscription(String name, Subscription element) throws IOException {
24257    if (element != null) {
24258      prop("resourceType", name);
24259      composeSubscriptionInner(element);
24260    }
24261  }
24262
24263  protected void composeSubscriptionInner(Subscription element) throws IOException {
24264      composeDomainResourceElements(element);
24265      if (element.hasCriteriaElement()) {
24266        composeStringCore("criteria", element.getCriteriaElement(), false);
24267        composeStringExtras("criteria", element.getCriteriaElement(), false);
24268      }
24269      if (element.hasContact()) {
24270        openArray("contact");
24271        for (ContactPoint e : element.getContact()) 
24272          composeContactPoint(null, e);
24273        closeArray();
24274      };
24275      if (element.hasReasonElement()) {
24276        composeStringCore("reason", element.getReasonElement(), false);
24277        composeStringExtras("reason", element.getReasonElement(), false);
24278      }
24279      if (element.hasStatusElement()) {
24280        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24281        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24282      }
24283      if (element.hasErrorElement()) {
24284        composeStringCore("error", element.getErrorElement(), false);
24285        composeStringExtras("error", element.getErrorElement(), false);
24286      }
24287      if (element.hasChannel()) {
24288        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
24289      }
24290      if (element.hasEndElement()) {
24291        composeInstantCore("end", element.getEndElement(), false);
24292        composeInstantExtras("end", element.getEndElement(), false);
24293      }
24294      if (element.hasTag()) {
24295        openArray("tag");
24296        for (Coding e : element.getTag()) 
24297          composeCoding(null, e);
24298        closeArray();
24299      };
24300  }
24301
24302  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
24303    if (element != null) {
24304      open(name);
24305      composeSubscriptionSubscriptionChannelComponentInner(element);
24306      close();
24307    }
24308  }
24309
24310  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
24311      composeBackbone(element);
24312      if (element.hasTypeElement()) {
24313        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24314        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24315      }
24316      if (element.hasEndpointElement()) {
24317        composeUriCore("endpoint", element.getEndpointElement(), false);
24318        composeUriExtras("endpoint", element.getEndpointElement(), false);
24319      }
24320      if (element.hasPayloadElement()) {
24321        composeStringCore("payload", element.getPayloadElement(), false);
24322        composeStringExtras("payload", element.getPayloadElement(), false);
24323      }
24324      if (element.hasHeaderElement()) {
24325        composeStringCore("header", element.getHeaderElement(), false);
24326        composeStringExtras("header", element.getHeaderElement(), false);
24327      }
24328  }
24329
24330  protected void composeSubstance(String name, Substance element) throws IOException {
24331    if (element != null) {
24332      prop("resourceType", name);
24333      composeSubstanceInner(element);
24334    }
24335  }
24336
24337  protected void composeSubstanceInner(Substance element) throws IOException {
24338      composeDomainResourceElements(element);
24339      if (element.hasIdentifier()) {
24340        openArray("identifier");
24341        for (Identifier e : element.getIdentifier()) 
24342          composeIdentifier(null, e);
24343        closeArray();
24344      };
24345      if (element.hasCategory()) {
24346        openArray("category");
24347        for (CodeableConcept e : element.getCategory()) 
24348          composeCodeableConcept(null, e);
24349        closeArray();
24350      };
24351      if (element.hasCode()) {
24352        composeCodeableConcept("code", element.getCode());
24353      }
24354      if (element.hasDescriptionElement()) {
24355        composeStringCore("description", element.getDescriptionElement(), false);
24356        composeStringExtras("description", element.getDescriptionElement(), false);
24357      }
24358      if (element.hasInstance()) {
24359        openArray("instance");
24360        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
24361          composeSubstanceSubstanceInstanceComponent(null, e);
24362        closeArray();
24363      };
24364      if (element.hasIngredient()) {
24365        openArray("ingredient");
24366        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
24367          composeSubstanceSubstanceIngredientComponent(null, e);
24368        closeArray();
24369      };
24370  }
24371
24372  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
24373    if (element != null) {
24374      open(name);
24375      composeSubstanceSubstanceInstanceComponentInner(element);
24376      close();
24377    }
24378  }
24379
24380  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
24381      composeBackbone(element);
24382      if (element.hasIdentifier()) {
24383        composeIdentifier("identifier", element.getIdentifier());
24384      }
24385      if (element.hasExpiryElement()) {
24386        composeDateTimeCore("expiry", element.getExpiryElement(), false);
24387        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
24388      }
24389      if (element.hasQuantity()) {
24390        composeSimpleQuantity("quantity", element.getQuantity());
24391      }
24392  }
24393
24394  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
24395    if (element != null) {
24396      open(name);
24397      composeSubstanceSubstanceIngredientComponentInner(element);
24398      close();
24399    }
24400  }
24401
24402  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
24403      composeBackbone(element);
24404      if (element.hasQuantity()) {
24405        composeRatio("quantity", element.getQuantity());
24406      }
24407      if (element.hasSubstance()) {
24408        composeReference("substance", element.getSubstance());
24409      }
24410  }
24411
24412  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
24413    if (element != null) {
24414      prop("resourceType", name);
24415      composeSupplyDeliveryInner(element);
24416    }
24417  }
24418
24419  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
24420      composeDomainResourceElements(element);
24421      if (element.hasIdentifier()) {
24422        composeIdentifier("identifier", element.getIdentifier());
24423      }
24424      if (element.hasStatusElement()) {
24425        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24426        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24427      }
24428      if (element.hasPatient()) {
24429        composeReference("patient", element.getPatient());
24430      }
24431      if (element.hasType()) {
24432        composeCodeableConcept("type", element.getType());
24433      }
24434      if (element.hasQuantity()) {
24435        composeSimpleQuantity("quantity", element.getQuantity());
24436      }
24437      if (element.hasSuppliedItem()) {
24438        composeReference("suppliedItem", element.getSuppliedItem());
24439      }
24440      if (element.hasSupplier()) {
24441        composeReference("supplier", element.getSupplier());
24442      }
24443      if (element.hasWhenPrepared()) {
24444        composePeriod("whenPrepared", element.getWhenPrepared());
24445      }
24446      if (element.hasTimeElement()) {
24447        composeDateTimeCore("time", element.getTimeElement(), false);
24448        composeDateTimeExtras("time", element.getTimeElement(), false);
24449      }
24450      if (element.hasDestination()) {
24451        composeReference("destination", element.getDestination());
24452      }
24453      if (element.hasReceiver()) {
24454        openArray("receiver");
24455        for (Reference e : element.getReceiver()) 
24456          composeReference(null, e);
24457        closeArray();
24458      };
24459  }
24460
24461  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
24462    if (element != null) {
24463      prop("resourceType", name);
24464      composeSupplyRequestInner(element);
24465    }
24466  }
24467
24468  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
24469      composeDomainResourceElements(element);
24470      if (element.hasPatient()) {
24471        composeReference("patient", element.getPatient());
24472      }
24473      if (element.hasSource()) {
24474        composeReference("source", element.getSource());
24475      }
24476      if (element.hasDateElement()) {
24477        composeDateTimeCore("date", element.getDateElement(), false);
24478        composeDateTimeExtras("date", element.getDateElement(), false);
24479      }
24480      if (element.hasIdentifier()) {
24481        composeIdentifier("identifier", element.getIdentifier());
24482      }
24483      if (element.hasStatusElement()) {
24484        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24485        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24486      }
24487      if (element.hasKind()) {
24488        composeCodeableConcept("kind", element.getKind());
24489      }
24490      if (element.hasOrderedItem()) {
24491        composeReference("orderedItem", element.getOrderedItem());
24492      }
24493      if (element.hasSupplier()) {
24494        openArray("supplier");
24495        for (Reference e : element.getSupplier()) 
24496          composeReference(null, e);
24497        closeArray();
24498      };
24499      if (element.hasReason()) {
24500        composeType("reason", element.getReason());
24501      }
24502      if (element.hasWhen()) {
24503        composeSupplyRequestSupplyRequestWhenComponent("when", element.getWhen());
24504      }
24505  }
24506
24507  protected void composeSupplyRequestSupplyRequestWhenComponent(String name, SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24508    if (element != null) {
24509      open(name);
24510      composeSupplyRequestSupplyRequestWhenComponentInner(element);
24511      close();
24512    }
24513  }
24514
24515  protected void composeSupplyRequestSupplyRequestWhenComponentInner(SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24516      composeBackbone(element);
24517      if (element.hasCode()) {
24518        composeCodeableConcept("code", element.getCode());
24519      }
24520      if (element.hasSchedule()) {
24521        composeTiming("schedule", element.getSchedule());
24522      }
24523  }
24524
24525  protected void composeTestScript(String name, TestScript element) throws IOException {
24526    if (element != null) {
24527      prop("resourceType", name);
24528      composeTestScriptInner(element);
24529    }
24530  }
24531
24532  protected void composeTestScriptInner(TestScript element) throws IOException {
24533      composeDomainResourceElements(element);
24534      if (element.hasUrlElement()) {
24535        composeUriCore("url", element.getUrlElement(), false);
24536        composeUriExtras("url", element.getUrlElement(), false);
24537      }
24538      if (element.hasVersionElement()) {
24539        composeStringCore("version", element.getVersionElement(), false);
24540        composeStringExtras("version", element.getVersionElement(), false);
24541      }
24542      if (element.hasNameElement()) {
24543        composeStringCore("name", element.getNameElement(), false);
24544        composeStringExtras("name", element.getNameElement(), false);
24545      }
24546      if (element.hasStatusElement()) {
24547        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24548        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24549      }
24550      if (element.hasIdentifier()) {
24551        composeIdentifier("identifier", element.getIdentifier());
24552      }
24553      if (element.hasExperimentalElement()) {
24554        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24555        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24556      }
24557      if (element.hasPublisherElement()) {
24558        composeStringCore("publisher", element.getPublisherElement(), false);
24559        composeStringExtras("publisher", element.getPublisherElement(), false);
24560      }
24561      if (element.hasContact()) {
24562        openArray("contact");
24563        for (TestScript.TestScriptContactComponent e : element.getContact()) 
24564          composeTestScriptTestScriptContactComponent(null, e);
24565        closeArray();
24566      };
24567      if (element.hasDateElement()) {
24568        composeDateTimeCore("date", element.getDateElement(), false);
24569        composeDateTimeExtras("date", element.getDateElement(), false);
24570      }
24571      if (element.hasDescriptionElement()) {
24572        composeStringCore("description", element.getDescriptionElement(), false);
24573        composeStringExtras("description", element.getDescriptionElement(), false);
24574      }
24575      if (element.hasUseContext()) {
24576        openArray("useContext");
24577        for (CodeableConcept e : element.getUseContext()) 
24578          composeCodeableConcept(null, e);
24579        closeArray();
24580      };
24581      if (element.hasRequirementsElement()) {
24582        composeStringCore("requirements", element.getRequirementsElement(), false);
24583        composeStringExtras("requirements", element.getRequirementsElement(), false);
24584      }
24585      if (element.hasCopyrightElement()) {
24586        composeStringCore("copyright", element.getCopyrightElement(), false);
24587        composeStringExtras("copyright", element.getCopyrightElement(), false);
24588      }
24589      if (element.hasMetadata()) {
24590        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24591      }
24592      if (element.hasMultiserverElement()) {
24593        composeBooleanCore("multiserver", element.getMultiserverElement(), false);
24594        composeBooleanExtras("multiserver", element.getMultiserverElement(), false);
24595      }
24596      if (element.hasFixture()) {
24597        openArray("fixture");
24598        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
24599          composeTestScriptTestScriptFixtureComponent(null, e);
24600        closeArray();
24601      };
24602      if (element.hasProfile()) {
24603        openArray("profile");
24604        for (Reference e : element.getProfile()) 
24605          composeReference(null, e);
24606        closeArray();
24607      };
24608      if (element.hasVariable()) {
24609        openArray("variable");
24610        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
24611          composeTestScriptTestScriptVariableComponent(null, e);
24612        closeArray();
24613      };
24614      if (element.hasSetup()) {
24615        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
24616      }
24617      if (element.hasTest()) {
24618        openArray("test");
24619        for (TestScript.TestScriptTestComponent e : element.getTest()) 
24620          composeTestScriptTestScriptTestComponent(null, e);
24621        closeArray();
24622      };
24623      if (element.hasTeardown()) {
24624        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
24625      }
24626  }
24627
24628  protected void composeTestScriptTestScriptContactComponent(String name, TestScript.TestScriptContactComponent element) throws IOException {
24629    if (element != null) {
24630      open(name);
24631      composeTestScriptTestScriptContactComponentInner(element);
24632      close();
24633    }
24634  }
24635
24636  protected void composeTestScriptTestScriptContactComponentInner(TestScript.TestScriptContactComponent element) throws IOException {
24637      composeBackbone(element);
24638      if (element.hasNameElement()) {
24639        composeStringCore("name", element.getNameElement(), false);
24640        composeStringExtras("name", element.getNameElement(), false);
24641      }
24642      if (element.hasTelecom()) {
24643        openArray("telecom");
24644        for (ContactPoint e : element.getTelecom()) 
24645          composeContactPoint(null, e);
24646        closeArray();
24647      };
24648  }
24649
24650  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
24651    if (element != null) {
24652      open(name);
24653      composeTestScriptTestScriptMetadataComponentInner(element);
24654      close();
24655    }
24656  }
24657
24658  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
24659      composeBackbone(element);
24660      if (element.hasLink()) {
24661        openArray("link");
24662        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
24663          composeTestScriptTestScriptMetadataLinkComponent(null, e);
24664        closeArray();
24665      };
24666      if (element.hasCapability()) {
24667        openArray("capability");
24668        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
24669          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
24670        closeArray();
24671      };
24672  }
24673
24674  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24675    if (element != null) {
24676      open(name);
24677      composeTestScriptTestScriptMetadataLinkComponentInner(element);
24678      close();
24679    }
24680  }
24681
24682  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24683      composeBackbone(element);
24684      if (element.hasUrlElement()) {
24685        composeUriCore("url", element.getUrlElement(), false);
24686        composeUriExtras("url", element.getUrlElement(), false);
24687      }
24688      if (element.hasDescriptionElement()) {
24689        composeStringCore("description", element.getDescriptionElement(), false);
24690        composeStringExtras("description", element.getDescriptionElement(), false);
24691      }
24692  }
24693
24694  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24695    if (element != null) {
24696      open(name);
24697      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
24698      close();
24699    }
24700  }
24701
24702  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24703      composeBackbone(element);
24704      if (element.hasRequiredElement()) {
24705        composeBooleanCore("required", element.getRequiredElement(), false);
24706        composeBooleanExtras("required", element.getRequiredElement(), false);
24707      }
24708      if (element.hasValidatedElement()) {
24709        composeBooleanCore("validated", element.getValidatedElement(), false);
24710        composeBooleanExtras("validated", element.getValidatedElement(), false);
24711      }
24712      if (element.hasDescriptionElement()) {
24713        composeStringCore("description", element.getDescriptionElement(), false);
24714        composeStringExtras("description", element.getDescriptionElement(), false);
24715      }
24716      if (element.hasDestinationElement()) {
24717        composeIntegerCore("destination", element.getDestinationElement(), false);
24718        composeIntegerExtras("destination", element.getDestinationElement(), false);
24719      }
24720      if (element.hasLink()) {
24721        openArray("link");
24722        for (UriType e : element.getLink()) 
24723          composeUriCore(null, e, true);
24724        closeArray();
24725        if (anyHasExtras(element.getLink())) {
24726          openArray("_link");
24727          for (UriType e : element.getLink()) 
24728            composeUriExtras(null, e, true);
24729          closeArray();
24730        }
24731      };
24732      if (element.hasConformance()) {
24733        composeReference("conformance", element.getConformance());
24734      }
24735  }
24736
24737  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
24738    if (element != null) {
24739      open(name);
24740      composeTestScriptTestScriptFixtureComponentInner(element);
24741      close();
24742    }
24743  }
24744
24745  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
24746      composeBackbone(element);
24747      if (element.hasAutocreateElement()) {
24748        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
24749        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
24750      }
24751      if (element.hasAutodeleteElement()) {
24752        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
24753        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
24754      }
24755      if (element.hasResource()) {
24756        composeReference("resource", element.getResource());
24757      }
24758  }
24759
24760  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
24761    if (element != null) {
24762      open(name);
24763      composeTestScriptTestScriptVariableComponentInner(element);
24764      close();
24765    }
24766  }
24767
24768  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
24769      composeBackbone(element);
24770      if (element.hasNameElement()) {
24771        composeStringCore("name", element.getNameElement(), false);
24772        composeStringExtras("name", element.getNameElement(), false);
24773      }
24774      if (element.hasHeaderFieldElement()) {
24775        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24776        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24777      }
24778      if (element.hasPathElement()) {
24779        composeStringCore("path", element.getPathElement(), false);
24780        composeStringExtras("path", element.getPathElement(), false);
24781      }
24782      if (element.hasSourceIdElement()) {
24783        composeIdCore("sourceId", element.getSourceIdElement(), false);
24784        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24785      }
24786  }
24787
24788  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
24789    if (element != null) {
24790      open(name);
24791      composeTestScriptTestScriptSetupComponentInner(element);
24792      close();
24793    }
24794  }
24795
24796  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
24797      composeBackbone(element);
24798      if (element.hasMetadata()) {
24799        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24800      }
24801      if (element.hasAction()) {
24802        openArray("action");
24803        for (TestScript.TestScriptSetupActionComponent e : element.getAction()) 
24804          composeTestScriptTestScriptSetupActionComponent(null, e);
24805        closeArray();
24806      };
24807  }
24808
24809  protected void composeTestScriptTestScriptSetupActionComponent(String name, TestScript.TestScriptSetupActionComponent element) throws IOException {
24810    if (element != null) {
24811      open(name);
24812      composeTestScriptTestScriptSetupActionComponentInner(element);
24813      close();
24814    }
24815  }
24816
24817  protected void composeTestScriptTestScriptSetupActionComponentInner(TestScript.TestScriptSetupActionComponent element) throws IOException {
24818      composeBackbone(element);
24819      if (element.hasOperation()) {
24820        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
24821      }
24822      if (element.hasAssert()) {
24823        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
24824      }
24825  }
24826
24827  protected void composeTestScriptTestScriptSetupActionOperationComponent(String name, TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24828    if (element != null) {
24829      open(name);
24830      composeTestScriptTestScriptSetupActionOperationComponentInner(element);
24831      close();
24832    }
24833  }
24834
24835  protected void composeTestScriptTestScriptSetupActionOperationComponentInner(TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24836      composeBackbone(element);
24837      if (element.hasType()) {
24838        composeCoding("type", element.getType());
24839      }
24840      if (element.hasResourceElement()) {
24841        composeCodeCore("resource", element.getResourceElement(), false);
24842        composeCodeExtras("resource", element.getResourceElement(), false);
24843      }
24844      if (element.hasLabelElement()) {
24845        composeStringCore("label", element.getLabelElement(), false);
24846        composeStringExtras("label", element.getLabelElement(), false);
24847      }
24848      if (element.hasDescriptionElement()) {
24849        composeStringCore("description", element.getDescriptionElement(), false);
24850        composeStringExtras("description", element.getDescriptionElement(), false);
24851      }
24852      if (element.hasAcceptElement()) {
24853        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24854        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24855      }
24856      if (element.hasContentTypeElement()) {
24857        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24858        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24859      }
24860      if (element.hasDestinationElement()) {
24861        composeIntegerCore("destination", element.getDestinationElement(), false);
24862        composeIntegerExtras("destination", element.getDestinationElement(), false);
24863      }
24864      if (element.hasEncodeRequestUrlElement()) {
24865        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24866        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24867      }
24868      if (element.hasParamsElement()) {
24869        composeStringCore("params", element.getParamsElement(), false);
24870        composeStringExtras("params", element.getParamsElement(), false);
24871      }
24872      if (element.hasRequestHeader()) {
24873        openArray("requestHeader");
24874        for (TestScript.TestScriptSetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
24875          composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(null, e);
24876        closeArray();
24877      };
24878      if (element.hasResponseIdElement()) {
24879        composeIdCore("responseId", element.getResponseIdElement(), false);
24880        composeIdExtras("responseId", element.getResponseIdElement(), false);
24881      }
24882      if (element.hasSourceIdElement()) {
24883        composeIdCore("sourceId", element.getSourceIdElement(), false);
24884        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24885      }
24886      if (element.hasTargetIdElement()) {
24887        composeIdCore("targetId", element.getTargetIdElement(), false);
24888        composeIdExtras("targetId", element.getTargetIdElement(), false);
24889      }
24890      if (element.hasUrlElement()) {
24891        composeStringCore("url", element.getUrlElement(), false);
24892        composeStringExtras("url", element.getUrlElement(), false);
24893      }
24894  }
24895
24896  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24897    if (element != null) {
24898      open(name);
24899      composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(element);
24900      close();
24901    }
24902  }
24903
24904  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24905      composeBackbone(element);
24906      if (element.hasFieldElement()) {
24907        composeStringCore("field", element.getFieldElement(), false);
24908        composeStringExtras("field", element.getFieldElement(), false);
24909      }
24910      if (element.hasValueElement()) {
24911        composeStringCore("value", element.getValueElement(), false);
24912        composeStringExtras("value", element.getValueElement(), false);
24913      }
24914  }
24915
24916  protected void composeTestScriptTestScriptSetupActionAssertComponent(String name, TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24917    if (element != null) {
24918      open(name);
24919      composeTestScriptTestScriptSetupActionAssertComponentInner(element);
24920      close();
24921    }
24922  }
24923
24924  protected void composeTestScriptTestScriptSetupActionAssertComponentInner(TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24925      composeBackbone(element);
24926      if (element.hasLabelElement()) {
24927        composeStringCore("label", element.getLabelElement(), false);
24928        composeStringExtras("label", element.getLabelElement(), false);
24929      }
24930      if (element.hasDescriptionElement()) {
24931        composeStringCore("description", element.getDescriptionElement(), false);
24932        composeStringExtras("description", element.getDescriptionElement(), false);
24933      }
24934      if (element.hasDirectionElement()) {
24935        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24936        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24937      }
24938      if (element.hasCompareToSourceIdElement()) {
24939        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
24940        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
24941      }
24942      if (element.hasCompareToSourcePathElement()) {
24943        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24944        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24945      }
24946      if (element.hasContentTypeElement()) {
24947        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24948        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24949      }
24950      if (element.hasHeaderFieldElement()) {
24951        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24952        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24953      }
24954      if (element.hasMinimumIdElement()) {
24955        composeStringCore("minimumId", element.getMinimumIdElement(), false);
24956        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
24957      }
24958      if (element.hasNavigationLinksElement()) {
24959        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
24960        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
24961      }
24962      if (element.hasOperatorElement()) {
24963        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24964        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24965      }
24966      if (element.hasPathElement()) {
24967        composeStringCore("path", element.getPathElement(), false);
24968        composeStringExtras("path", element.getPathElement(), false);
24969      }
24970      if (element.hasResourceElement()) {
24971        composeCodeCore("resource", element.getResourceElement(), false);
24972        composeCodeExtras("resource", element.getResourceElement(), false);
24973      }
24974      if (element.hasResponseElement()) {
24975        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24976        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24977      }
24978      if (element.hasResponseCodeElement()) {
24979        composeStringCore("responseCode", element.getResponseCodeElement(), false);
24980        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
24981      }
24982      if (element.hasSourceIdElement()) {
24983        composeIdCore("sourceId", element.getSourceIdElement(), false);
24984        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24985      }
24986      if (element.hasValidateProfileIdElement()) {
24987        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
24988        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
24989      }
24990      if (element.hasValueElement()) {
24991        composeStringCore("value", element.getValueElement(), false);
24992        composeStringExtras("value", element.getValueElement(), false);
24993      }
24994      if (element.hasWarningOnlyElement()) {
24995        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
24996        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
24997      }
24998  }
24999
25000  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
25001    if (element != null) {
25002      open(name);
25003      composeTestScriptTestScriptTestComponentInner(element);
25004      close();
25005    }
25006  }
25007
25008  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
25009      composeBackbone(element);
25010      if (element.hasNameElement()) {
25011        composeStringCore("name", element.getNameElement(), false);
25012        composeStringExtras("name", element.getNameElement(), false);
25013      }
25014      if (element.hasDescriptionElement()) {
25015        composeStringCore("description", element.getDescriptionElement(), false);
25016        composeStringExtras("description", element.getDescriptionElement(), false);
25017      }
25018      if (element.hasMetadata()) {
25019        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
25020      }
25021      if (element.hasAction()) {
25022        openArray("action");
25023        for (TestScript.TestScriptTestActionComponent e : element.getAction()) 
25024          composeTestScriptTestScriptTestActionComponent(null, e);
25025        closeArray();
25026      };
25027  }
25028
25029  protected void composeTestScriptTestScriptTestActionComponent(String name, TestScript.TestScriptTestActionComponent element) throws IOException {
25030    if (element != null) {
25031      open(name);
25032      composeTestScriptTestScriptTestActionComponentInner(element);
25033      close();
25034    }
25035  }
25036
25037  protected void composeTestScriptTestScriptTestActionComponentInner(TestScript.TestScriptTestActionComponent element) throws IOException {
25038      composeBackbone(element);
25039      if (element.hasOperation()) {
25040        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25041      }
25042      if (element.hasAssert()) {
25043        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
25044      }
25045  }
25046
25047  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
25048    if (element != null) {
25049      open(name);
25050      composeTestScriptTestScriptTeardownComponentInner(element);
25051      close();
25052    }
25053  }
25054
25055  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
25056      composeBackbone(element);
25057      if (element.hasAction()) {
25058        openArray("action");
25059        for (TestScript.TestScriptTeardownActionComponent e : element.getAction()) 
25060          composeTestScriptTestScriptTeardownActionComponent(null, e);
25061        closeArray();
25062      };
25063  }
25064
25065  protected void composeTestScriptTestScriptTeardownActionComponent(String name, TestScript.TestScriptTeardownActionComponent element) throws IOException {
25066    if (element != null) {
25067      open(name);
25068      composeTestScriptTestScriptTeardownActionComponentInner(element);
25069      close();
25070    }
25071  }
25072
25073  protected void composeTestScriptTestScriptTeardownActionComponentInner(TestScript.TestScriptTeardownActionComponent element) throws IOException {
25074      composeBackbone(element);
25075      if (element.hasOperation()) {
25076        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25077      }
25078  }
25079
25080  protected void composeValueSet(String name, ValueSet element) throws IOException {
25081    if (element != null) {
25082      prop("resourceType", name);
25083      composeValueSetInner(element);
25084    }
25085  }
25086
25087  protected void composeValueSetInner(ValueSet element) throws IOException {
25088      composeDomainResourceElements(element);
25089      if (element.hasUrlElement()) {
25090        composeUriCore("url", element.getUrlElement(), false);
25091        composeUriExtras("url", element.getUrlElement(), false);
25092      }
25093      if (element.hasIdentifier()) {
25094        composeIdentifier("identifier", element.getIdentifier());
25095      }
25096      if (element.hasVersionElement()) {
25097        composeStringCore("version", element.getVersionElement(), false);
25098        composeStringExtras("version", element.getVersionElement(), false);
25099      }
25100      if (element.hasNameElement()) {
25101        composeStringCore("name", element.getNameElement(), false);
25102        composeStringExtras("name", element.getNameElement(), false);
25103      }
25104      if (element.hasStatusElement()) {
25105        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25106        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25107      }
25108      if (element.hasExperimentalElement()) {
25109        composeBooleanCore("experimental", element.getExperimentalElement(), false);
25110        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
25111      }
25112      if (element.hasPublisherElement()) {
25113        composeStringCore("publisher", element.getPublisherElement(), false);
25114        composeStringExtras("publisher", element.getPublisherElement(), false);
25115      }
25116      if (element.hasContact()) {
25117        openArray("contact");
25118        for (ValueSet.ValueSetContactComponent e : element.getContact()) 
25119          composeValueSetValueSetContactComponent(null, e);
25120        closeArray();
25121      };
25122      if (element.hasDateElement()) {
25123        composeDateTimeCore("date", element.getDateElement(), false);
25124        composeDateTimeExtras("date", element.getDateElement(), false);
25125      }
25126      if (element.hasLockedDateElement()) {
25127        composeDateCore("lockedDate", element.getLockedDateElement(), false);
25128        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
25129      }
25130      if (element.hasDescriptionElement()) {
25131        composeStringCore("description", element.getDescriptionElement(), false);
25132        composeStringExtras("description", element.getDescriptionElement(), false);
25133      }
25134      if (element.hasUseContext()) {
25135        openArray("useContext");
25136        for (CodeableConcept e : element.getUseContext()) 
25137          composeCodeableConcept(null, e);
25138        closeArray();
25139      };
25140      if (element.hasImmutableElement()) {
25141        composeBooleanCore("immutable", element.getImmutableElement(), false);
25142        composeBooleanExtras("immutable", element.getImmutableElement(), false);
25143      }
25144      if (element.hasRequirementsElement()) {
25145        composeStringCore("requirements", element.getRequirementsElement(), false);
25146        composeStringExtras("requirements", element.getRequirementsElement(), false);
25147      }
25148      if (element.hasCopyrightElement()) {
25149        composeStringCore("copyright", element.getCopyrightElement(), false);
25150        composeStringExtras("copyright", element.getCopyrightElement(), false);
25151      }
25152      if (element.hasExtensibleElement()) {
25153        composeBooleanCore("extensible", element.getExtensibleElement(), false);
25154        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
25155      }
25156      if (element.hasCodeSystem()) {
25157        composeValueSetValueSetCodeSystemComponent("codeSystem", element.getCodeSystem());
25158      }
25159      if (element.hasCompose()) {
25160        composeValueSetValueSetComposeComponent("compose", element.getCompose());
25161      }
25162      if (element.hasExpansion()) {
25163        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
25164      }
25165  }
25166
25167  protected void composeValueSetValueSetContactComponent(String name, ValueSet.ValueSetContactComponent element) throws IOException {
25168    if (element != null) {
25169      open(name);
25170      composeValueSetValueSetContactComponentInner(element);
25171      close();
25172    }
25173  }
25174
25175  protected void composeValueSetValueSetContactComponentInner(ValueSet.ValueSetContactComponent element) throws IOException {
25176      composeBackbone(element);
25177      if (element.hasNameElement()) {
25178        composeStringCore("name", element.getNameElement(), false);
25179        composeStringExtras("name", element.getNameElement(), false);
25180      }
25181      if (element.hasTelecom()) {
25182        openArray("telecom");
25183        for (ContactPoint e : element.getTelecom()) 
25184          composeContactPoint(null, e);
25185        closeArray();
25186      };
25187  }
25188
25189  protected void composeValueSetValueSetCodeSystemComponent(String name, ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25190    if (element != null) {
25191      open(name);
25192      composeValueSetValueSetCodeSystemComponentInner(element);
25193      close();
25194    }
25195  }
25196
25197  protected void composeValueSetValueSetCodeSystemComponentInner(ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25198      composeBackbone(element);
25199      if (element.hasSystemElement()) {
25200        composeUriCore("system", element.getSystemElement(), false);
25201        composeUriExtras("system", element.getSystemElement(), false);
25202      }
25203      if (element.hasVersionElement()) {
25204        composeStringCore("version", element.getVersionElement(), false);
25205        composeStringExtras("version", element.getVersionElement(), false);
25206      }
25207      if (element.hasCaseSensitiveElement()) {
25208        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
25209        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
25210      }
25211      if (element.hasConcept()) {
25212        openArray("concept");
25213        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25214          composeValueSetConceptDefinitionComponent(null, e);
25215        closeArray();
25216      };
25217  }
25218
25219  protected void composeValueSetConceptDefinitionComponent(String name, ValueSet.ConceptDefinitionComponent element) throws IOException {
25220    if (element != null) {
25221      open(name);
25222      composeValueSetConceptDefinitionComponentInner(element);
25223      close();
25224    }
25225  }
25226
25227  protected void composeValueSetConceptDefinitionComponentInner(ValueSet.ConceptDefinitionComponent element) throws IOException {
25228      composeBackbone(element);
25229      if (element.hasCodeElement()) {
25230        composeCodeCore("code", element.getCodeElement(), false);
25231        composeCodeExtras("code", element.getCodeElement(), false);
25232      }
25233      if (element.hasAbstractElement()) {
25234        composeBooleanCore("abstract", element.getAbstractElement(), false);
25235        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25236      }
25237      if (element.hasDisplayElement()) {
25238        composeStringCore("display", element.getDisplayElement(), false);
25239        composeStringExtras("display", element.getDisplayElement(), false);
25240      }
25241      if (element.hasDefinitionElement()) {
25242        composeStringCore("definition", element.getDefinitionElement(), false);
25243        composeStringExtras("definition", element.getDefinitionElement(), false);
25244      }
25245      if (element.hasDesignation()) {
25246        openArray("designation");
25247        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25248          composeValueSetConceptDefinitionDesignationComponent(null, e);
25249        closeArray();
25250      };
25251      if (element.hasConcept()) {
25252        openArray("concept");
25253        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25254          composeValueSetConceptDefinitionComponent(null, e);
25255        closeArray();
25256      };
25257  }
25258
25259  protected void composeValueSetConceptDefinitionDesignationComponent(String name, ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25260    if (element != null) {
25261      open(name);
25262      composeValueSetConceptDefinitionDesignationComponentInner(element);
25263      close();
25264    }
25265  }
25266
25267  protected void composeValueSetConceptDefinitionDesignationComponentInner(ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25268      composeBackbone(element);
25269      if (element.hasLanguageElement()) {
25270        composeCodeCore("language", element.getLanguageElement(), false);
25271        composeCodeExtras("language", element.getLanguageElement(), false);
25272      }
25273      if (element.hasUse()) {
25274        composeCoding("use", element.getUse());
25275      }
25276      if (element.hasValueElement()) {
25277        composeStringCore("value", element.getValueElement(), false);
25278        composeStringExtras("value", element.getValueElement(), false);
25279      }
25280  }
25281
25282  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
25283    if (element != null) {
25284      open(name);
25285      composeValueSetValueSetComposeComponentInner(element);
25286      close();
25287    }
25288  }
25289
25290  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
25291      composeBackbone(element);
25292      if (element.hasImport()) {
25293        openArray("import");
25294        for (UriType e : element.getImport()) 
25295          composeUriCore(null, e, true);
25296        closeArray();
25297        if (anyHasExtras(element.getImport())) {
25298          openArray("_import");
25299          for (UriType e : element.getImport()) 
25300            composeUriExtras(null, e, true);
25301          closeArray();
25302        }
25303      };
25304      if (element.hasInclude()) {
25305        openArray("include");
25306        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
25307          composeValueSetConceptSetComponent(null, e);
25308        closeArray();
25309      };
25310      if (element.hasExclude()) {
25311        openArray("exclude");
25312        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
25313          composeValueSetConceptSetComponent(null, e);
25314        closeArray();
25315      };
25316  }
25317
25318  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
25319    if (element != null) {
25320      open(name);
25321      composeValueSetConceptSetComponentInner(element);
25322      close();
25323    }
25324  }
25325
25326  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
25327      composeBackbone(element);
25328      if (element.hasSystemElement()) {
25329        composeUriCore("system", element.getSystemElement(), false);
25330        composeUriExtras("system", element.getSystemElement(), false);
25331      }
25332      if (element.hasVersionElement()) {
25333        composeStringCore("version", element.getVersionElement(), false);
25334        composeStringExtras("version", element.getVersionElement(), false);
25335      }
25336      if (element.hasConcept()) {
25337        openArray("concept");
25338        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
25339          composeValueSetConceptReferenceComponent(null, e);
25340        closeArray();
25341      };
25342      if (element.hasFilter()) {
25343        openArray("filter");
25344        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
25345          composeValueSetConceptSetFilterComponent(null, e);
25346        closeArray();
25347      };
25348  }
25349
25350  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
25351    if (element != null) {
25352      open(name);
25353      composeValueSetConceptReferenceComponentInner(element);
25354      close();
25355    }
25356  }
25357
25358  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
25359      composeBackbone(element);
25360      if (element.hasCodeElement()) {
25361        composeCodeCore("code", element.getCodeElement(), false);
25362        composeCodeExtras("code", element.getCodeElement(), false);
25363      }
25364      if (element.hasDisplayElement()) {
25365        composeStringCore("display", element.getDisplayElement(), false);
25366        composeStringExtras("display", element.getDisplayElement(), false);
25367      }
25368      if (element.hasDesignation()) {
25369        openArray("designation");
25370        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25371          composeValueSetConceptDefinitionDesignationComponent(null, e);
25372        closeArray();
25373      };
25374  }
25375
25376  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
25377    if (element != null) {
25378      open(name);
25379      composeValueSetConceptSetFilterComponentInner(element);
25380      close();
25381    }
25382  }
25383
25384  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
25385      composeBackbone(element);
25386      if (element.hasPropertyElement()) {
25387        composeCodeCore("property", element.getPropertyElement(), false);
25388        composeCodeExtras("property", element.getPropertyElement(), false);
25389      }
25390      if (element.hasOpElement()) {
25391        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25392        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25393      }
25394      if (element.hasValueElement()) {
25395        composeCodeCore("value", element.getValueElement(), false);
25396        composeCodeExtras("value", element.getValueElement(), false);
25397      }
25398  }
25399
25400  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
25401    if (element != null) {
25402      open(name);
25403      composeValueSetValueSetExpansionComponentInner(element);
25404      close();
25405    }
25406  }
25407
25408  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
25409      composeBackbone(element);
25410      if (element.hasIdentifierElement()) {
25411        composeUriCore("identifier", element.getIdentifierElement(), false);
25412        composeUriExtras("identifier", element.getIdentifierElement(), false);
25413      }
25414      if (element.hasTimestampElement()) {
25415        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
25416        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
25417      }
25418      if (element.hasTotalElement()) {
25419        composeIntegerCore("total", element.getTotalElement(), false);
25420        composeIntegerExtras("total", element.getTotalElement(), false);
25421      }
25422      if (element.hasOffsetElement()) {
25423        composeIntegerCore("offset", element.getOffsetElement(), false);
25424        composeIntegerExtras("offset", element.getOffsetElement(), false);
25425      }
25426      if (element.hasParameter()) {
25427        openArray("parameter");
25428        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
25429          composeValueSetValueSetExpansionParameterComponent(null, e);
25430        closeArray();
25431      };
25432      if (element.hasContains()) {
25433        openArray("contains");
25434        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25435          composeValueSetValueSetExpansionContainsComponent(null, e);
25436        closeArray();
25437      };
25438  }
25439
25440  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25441    if (element != null) {
25442      open(name);
25443      composeValueSetValueSetExpansionParameterComponentInner(element);
25444      close();
25445    }
25446  }
25447
25448  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25449      composeBackbone(element);
25450      if (element.hasNameElement()) {
25451        composeStringCore("name", element.getNameElement(), false);
25452        composeStringExtras("name", element.getNameElement(), false);
25453      }
25454      if (element.hasValue()) {
25455        composeType("value", element.getValue());
25456      }
25457  }
25458
25459  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25460    if (element != null) {
25461      open(name);
25462      composeValueSetValueSetExpansionContainsComponentInner(element);
25463      close();
25464    }
25465  }
25466
25467  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25468      composeBackbone(element);
25469      if (element.hasSystemElement()) {
25470        composeUriCore("system", element.getSystemElement(), false);
25471        composeUriExtras("system", element.getSystemElement(), false);
25472      }
25473      if (element.hasAbstractElement()) {
25474        composeBooleanCore("abstract", element.getAbstractElement(), false);
25475        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25476      }
25477      if (element.hasVersionElement()) {
25478        composeStringCore("version", element.getVersionElement(), false);
25479        composeStringExtras("version", element.getVersionElement(), false);
25480      }
25481      if (element.hasCodeElement()) {
25482        composeCodeCore("code", element.getCodeElement(), false);
25483        composeCodeExtras("code", element.getCodeElement(), false);
25484      }
25485      if (element.hasDisplayElement()) {
25486        composeStringCore("display", element.getDisplayElement(), false);
25487        composeStringExtras("display", element.getDisplayElement(), false);
25488      }
25489      if (element.hasContains()) {
25490        openArray("contains");
25491        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25492          composeValueSetValueSetExpansionContainsComponent(null, e);
25493        closeArray();
25494      };
25495  }
25496
25497  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
25498    if (element != null) {
25499      prop("resourceType", name);
25500      composeVisionPrescriptionInner(element);
25501    }
25502  }
25503
25504  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
25505      composeDomainResourceElements(element);
25506      if (element.hasIdentifier()) {
25507        openArray("identifier");
25508        for (Identifier e : element.getIdentifier()) 
25509          composeIdentifier(null, e);
25510        closeArray();
25511      };
25512      if (element.hasDateWrittenElement()) {
25513        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
25514        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
25515      }
25516      if (element.hasPatient()) {
25517        composeReference("patient", element.getPatient());
25518      }
25519      if (element.hasPrescriber()) {
25520        composeReference("prescriber", element.getPrescriber());
25521      }
25522      if (element.hasEncounter()) {
25523        composeReference("encounter", element.getEncounter());
25524      }
25525      if (element.hasReason()) {
25526        composeType("reason", element.getReason());
25527      }
25528      if (element.hasDispense()) {
25529        openArray("dispense");
25530        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
25531          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
25532        closeArray();
25533      };
25534  }
25535
25536  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25537    if (element != null) {
25538      open(name);
25539      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
25540      close();
25541    }
25542  }
25543
25544  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25545      composeBackbone(element);
25546      if (element.hasProduct()) {
25547        composeCoding("product", element.getProduct());
25548      }
25549      if (element.hasEyeElement()) {
25550        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25551        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25552      }
25553      if (element.hasSphereElement()) {
25554        composeDecimalCore("sphere", element.getSphereElement(), false);
25555        composeDecimalExtras("sphere", element.getSphereElement(), false);
25556      }
25557      if (element.hasCylinderElement()) {
25558        composeDecimalCore("cylinder", element.getCylinderElement(), false);
25559        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
25560      }
25561      if (element.hasAxisElement()) {
25562        composeIntegerCore("axis", element.getAxisElement(), false);
25563        composeIntegerExtras("axis", element.getAxisElement(), false);
25564      }
25565      if (element.hasPrismElement()) {
25566        composeDecimalCore("prism", element.getPrismElement(), false);
25567        composeDecimalExtras("prism", element.getPrismElement(), false);
25568      }
25569      if (element.hasBaseElement()) {
25570        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25571        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25572      }
25573      if (element.hasAddElement()) {
25574        composeDecimalCore("add", element.getAddElement(), false);
25575        composeDecimalExtras("add", element.getAddElement(), false);
25576      }
25577      if (element.hasPowerElement()) {
25578        composeDecimalCore("power", element.getPowerElement(), false);
25579        composeDecimalExtras("power", element.getPowerElement(), false);
25580      }
25581      if (element.hasBackCurveElement()) {
25582        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
25583        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
25584      }
25585      if (element.hasDiameterElement()) {
25586        composeDecimalCore("diameter", element.getDiameterElement(), false);
25587        composeDecimalExtras("diameter", element.getDiameterElement(), false);
25588      }
25589      if (element.hasDuration()) {
25590        composeSimpleQuantity("duration", element.getDuration());
25591      }
25592      if (element.hasColorElement()) {
25593        composeStringCore("color", element.getColorElement(), false);
25594        composeStringExtras("color", element.getColorElement(), false);
25595      }
25596      if (element.hasBrandElement()) {
25597        composeStringCore("brand", element.getBrandElement(), false);
25598        composeStringExtras("brand", element.getBrandElement(), false);
25599      }
25600      if (element.hasNotesElement()) {
25601        composeStringCore("notes", element.getNotesElement(), false);
25602        composeStringExtras("notes", element.getNotesElement(), false);
25603      }
25604  }
25605
25606  @Override
25607  protected void composeResource(Resource resource) throws IOException {
25608    if (resource instanceof Parameters)
25609      composeParameters("Parameters", (Parameters)resource);
25610    else if (resource instanceof Account)
25611      composeAccount("Account", (Account)resource);
25612    else if (resource instanceof AllergyIntolerance)
25613      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
25614    else if (resource instanceof Appointment)
25615      composeAppointment("Appointment", (Appointment)resource);
25616    else if (resource instanceof AppointmentResponse)
25617      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
25618    else if (resource instanceof AuditEvent)
25619      composeAuditEvent("AuditEvent", (AuditEvent)resource);
25620    else if (resource instanceof Basic)
25621      composeBasic("Basic", (Basic)resource);
25622    else if (resource instanceof Binary)
25623      composeBinary("Binary", (Binary)resource);
25624    else if (resource instanceof BodySite)
25625      composeBodySite("BodySite", (BodySite)resource);
25626    else if (resource instanceof Bundle)
25627      composeBundle("Bundle", (Bundle)resource);
25628    else if (resource instanceof CarePlan)
25629      composeCarePlan("CarePlan", (CarePlan)resource);
25630    else if (resource instanceof Claim)
25631      composeClaim("Claim", (Claim)resource);
25632    else if (resource instanceof ClaimResponse)
25633      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
25634    else if (resource instanceof ClinicalImpression)
25635      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
25636    else if (resource instanceof Communication)
25637      composeCommunication("Communication", (Communication)resource);
25638    else if (resource instanceof CommunicationRequest)
25639      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
25640    else if (resource instanceof Composition)
25641      composeComposition("Composition", (Composition)resource);
25642    else if (resource instanceof ConceptMap)
25643      composeConceptMap("ConceptMap", (ConceptMap)resource);
25644    else if (resource instanceof Condition)
25645      composeCondition("Condition", (Condition)resource);
25646    else if (resource instanceof Conformance)
25647      composeConformance("Conformance", (Conformance)resource);
25648    else if (resource instanceof Contract)
25649      composeContract("Contract", (Contract)resource);
25650    else if (resource instanceof Coverage)
25651      composeCoverage("Coverage", (Coverage)resource);
25652    else if (resource instanceof DataElement)
25653      composeDataElement("DataElement", (DataElement)resource);
25654    else if (resource instanceof DetectedIssue)
25655      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
25656    else if (resource instanceof Device)
25657      composeDevice("Device", (Device)resource);
25658    else if (resource instanceof DeviceComponent)
25659      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
25660    else if (resource instanceof DeviceMetric)
25661      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
25662    else if (resource instanceof DeviceUseRequest)
25663      composeDeviceUseRequest("DeviceUseRequest", (DeviceUseRequest)resource);
25664    else if (resource instanceof DeviceUseStatement)
25665      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
25666    else if (resource instanceof DiagnosticOrder)
25667      composeDiagnosticOrder("DiagnosticOrder", (DiagnosticOrder)resource);
25668    else if (resource instanceof DiagnosticReport)
25669      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
25670    else if (resource instanceof DocumentManifest)
25671      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
25672    else if (resource instanceof DocumentReference)
25673      composeDocumentReference("DocumentReference", (DocumentReference)resource);
25674    else if (resource instanceof EligibilityRequest)
25675      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
25676    else if (resource instanceof EligibilityResponse)
25677      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
25678    else if (resource instanceof Encounter)
25679      composeEncounter("Encounter", (Encounter)resource);
25680    else if (resource instanceof EnrollmentRequest)
25681      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
25682    else if (resource instanceof EnrollmentResponse)
25683      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
25684    else if (resource instanceof EpisodeOfCare)
25685      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
25686    else if (resource instanceof ExplanationOfBenefit)
25687      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
25688    else if (resource instanceof FamilyMemberHistory)
25689      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
25690    else if (resource instanceof Flag)
25691      composeFlag("Flag", (Flag)resource);
25692    else if (resource instanceof Goal)
25693      composeGoal("Goal", (Goal)resource);
25694    else if (resource instanceof Group)
25695      composeGroup("Group", (Group)resource);
25696    else if (resource instanceof HealthcareService)
25697      composeHealthcareService("HealthcareService", (HealthcareService)resource);
25698    else if (resource instanceof ImagingObjectSelection)
25699      composeImagingObjectSelection("ImagingObjectSelection", (ImagingObjectSelection)resource);
25700    else if (resource instanceof ImagingStudy)
25701      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
25702    else if (resource instanceof Immunization)
25703      composeImmunization("Immunization", (Immunization)resource);
25704    else if (resource instanceof ImmunizationRecommendation)
25705      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
25706    else if (resource instanceof ImplementationGuide)
25707      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
25708    else if (resource instanceof List_)
25709      composeList_("List", (List_)resource);
25710    else if (resource instanceof Location)
25711      composeLocation("Location", (Location)resource);
25712    else if (resource instanceof Media)
25713      composeMedia("Media", (Media)resource);
25714    else if (resource instanceof Medication)
25715      composeMedication("Medication", (Medication)resource);
25716    else if (resource instanceof MedicationAdministration)
25717      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
25718    else if (resource instanceof MedicationDispense)
25719      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
25720    else if (resource instanceof MedicationOrder)
25721      composeMedicationOrder("MedicationOrder", (MedicationOrder)resource);
25722    else if (resource instanceof MedicationStatement)
25723      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
25724    else if (resource instanceof MessageHeader)
25725      composeMessageHeader("MessageHeader", (MessageHeader)resource);
25726    else if (resource instanceof NamingSystem)
25727      composeNamingSystem("NamingSystem", (NamingSystem)resource);
25728    else if (resource instanceof NutritionOrder)
25729      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
25730    else if (resource instanceof Observation)
25731      composeObservation("Observation", (Observation)resource);
25732    else if (resource instanceof OperationDefinition)
25733      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
25734    else if (resource instanceof OperationOutcome)
25735      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
25736    else if (resource instanceof Order)
25737      composeOrder("Order", (Order)resource);
25738    else if (resource instanceof OrderResponse)
25739      composeOrderResponse("OrderResponse", (OrderResponse)resource);
25740    else if (resource instanceof Organization)
25741      composeOrganization("Organization", (Organization)resource);
25742    else if (resource instanceof Patient)
25743      composePatient("Patient", (Patient)resource);
25744    else if (resource instanceof PaymentNotice)
25745      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
25746    else if (resource instanceof PaymentReconciliation)
25747      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
25748    else if (resource instanceof Person)
25749      composePerson("Person", (Person)resource);
25750    else if (resource instanceof Practitioner)
25751      composePractitioner("Practitioner", (Practitioner)resource);
25752    else if (resource instanceof Procedure)
25753      composeProcedure("Procedure", (Procedure)resource);
25754    else if (resource instanceof ProcedureRequest)
25755      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
25756    else if (resource instanceof ProcessRequest)
25757      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
25758    else if (resource instanceof ProcessResponse)
25759      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
25760    else if (resource instanceof Provenance)
25761      composeProvenance("Provenance", (Provenance)resource);
25762    else if (resource instanceof Questionnaire)
25763      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
25764    else if (resource instanceof QuestionnaireResponse)
25765      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
25766    else if (resource instanceof ReferralRequest)
25767      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
25768    else if (resource instanceof RelatedPerson)
25769      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
25770    else if (resource instanceof RiskAssessment)
25771      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
25772    else if (resource instanceof Schedule)
25773      composeSchedule("Schedule", (Schedule)resource);
25774    else if (resource instanceof SearchParameter)
25775      composeSearchParameter("SearchParameter", (SearchParameter)resource);
25776    else if (resource instanceof Slot)
25777      composeSlot("Slot", (Slot)resource);
25778    else if (resource instanceof Specimen)
25779      composeSpecimen("Specimen", (Specimen)resource);
25780    else if (resource instanceof StructureDefinition)
25781      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
25782    else if (resource instanceof Subscription)
25783      composeSubscription("Subscription", (Subscription)resource);
25784    else if (resource instanceof Substance)
25785      composeSubstance("Substance", (Substance)resource);
25786    else if (resource instanceof SupplyDelivery)
25787      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
25788    else if (resource instanceof SupplyRequest)
25789      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
25790    else if (resource instanceof TestScript)
25791      composeTestScript("TestScript", (TestScript)resource);
25792    else if (resource instanceof ValueSet)
25793      composeValueSet("ValueSet", (ValueSet)resource);
25794    else if (resource instanceof VisionPrescription)
25795      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
25796    else if (resource instanceof Binary)
25797      composeBinary("Binary", (Binary)resource);
25798    else
25799      throw new Error("Unhandled resource type "+resource.getClass().getName());
25800  }
25801
25802  protected void composeNamedReference(String name, Resource resource) throws IOException {
25803    if (resource instanceof Parameters)
25804      composeParameters(name, (Parameters)resource);
25805    else if (resource instanceof Account)
25806      composeAccount(name, (Account)resource);
25807    else if (resource instanceof AllergyIntolerance)
25808      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
25809    else if (resource instanceof Appointment)
25810      composeAppointment(name, (Appointment)resource);
25811    else if (resource instanceof AppointmentResponse)
25812      composeAppointmentResponse(name, (AppointmentResponse)resource);
25813    else if (resource instanceof AuditEvent)
25814      composeAuditEvent(name, (AuditEvent)resource);
25815    else if (resource instanceof Basic)
25816      composeBasic(name, (Basic)resource);
25817    else if (resource instanceof Binary)
25818      composeBinary(name, (Binary)resource);
25819    else if (resource instanceof BodySite)
25820      composeBodySite(name, (BodySite)resource);
25821    else if (resource instanceof Bundle)
25822      composeBundle(name, (Bundle)resource);
25823    else if (resource instanceof CarePlan)
25824      composeCarePlan(name, (CarePlan)resource);
25825    else if (resource instanceof Claim)
25826      composeClaim(name, (Claim)resource);
25827    else if (resource instanceof ClaimResponse)
25828      composeClaimResponse(name, (ClaimResponse)resource);
25829    else if (resource instanceof ClinicalImpression)
25830      composeClinicalImpression(name, (ClinicalImpression)resource);
25831    else if (resource instanceof Communication)
25832      composeCommunication(name, (Communication)resource);
25833    else if (resource instanceof CommunicationRequest)
25834      composeCommunicationRequest(name, (CommunicationRequest)resource);
25835    else if (resource instanceof Composition)
25836      composeComposition(name, (Composition)resource);
25837    else if (resource instanceof ConceptMap)
25838      composeConceptMap(name, (ConceptMap)resource);
25839    else if (resource instanceof Condition)
25840      composeCondition(name, (Condition)resource);
25841    else if (resource instanceof Conformance)
25842      composeConformance(name, (Conformance)resource);
25843    else if (resource instanceof Contract)
25844      composeContract(name, (Contract)resource);
25845    else if (resource instanceof Coverage)
25846      composeCoverage(name, (Coverage)resource);
25847    else if (resource instanceof DataElement)
25848      composeDataElement(name, (DataElement)resource);
25849    else if (resource instanceof DetectedIssue)
25850      composeDetectedIssue(name, (DetectedIssue)resource);
25851    else if (resource instanceof Device)
25852      composeDevice(name, (Device)resource);
25853    else if (resource instanceof DeviceComponent)
25854      composeDeviceComponent(name, (DeviceComponent)resource);
25855    else if (resource instanceof DeviceMetric)
25856      composeDeviceMetric(name, (DeviceMetric)resource);
25857    else if (resource instanceof DeviceUseRequest)
25858      composeDeviceUseRequest(name, (DeviceUseRequest)resource);
25859    else if (resource instanceof DeviceUseStatement)
25860      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
25861    else if (resource instanceof DiagnosticOrder)
25862      composeDiagnosticOrder(name, (DiagnosticOrder)resource);
25863    else if (resource instanceof DiagnosticReport)
25864      composeDiagnosticReport(name, (DiagnosticReport)resource);
25865    else if (resource instanceof DocumentManifest)
25866      composeDocumentManifest(name, (DocumentManifest)resource);
25867    else if (resource instanceof DocumentReference)
25868      composeDocumentReference(name, (DocumentReference)resource);
25869    else if (resource instanceof EligibilityRequest)
25870      composeEligibilityRequest(name, (EligibilityRequest)resource);
25871    else if (resource instanceof EligibilityResponse)
25872      composeEligibilityResponse(name, (EligibilityResponse)resource);
25873    else if (resource instanceof Encounter)
25874      composeEncounter(name, (Encounter)resource);
25875    else if (resource instanceof EnrollmentRequest)
25876      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
25877    else if (resource instanceof EnrollmentResponse)
25878      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
25879    else if (resource instanceof EpisodeOfCare)
25880      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
25881    else if (resource instanceof ExplanationOfBenefit)
25882      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
25883    else if (resource instanceof FamilyMemberHistory)
25884      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
25885    else if (resource instanceof Flag)
25886      composeFlag(name, (Flag)resource);
25887    else if (resource instanceof Goal)
25888      composeGoal(name, (Goal)resource);
25889    else if (resource instanceof Group)
25890      composeGroup(name, (Group)resource);
25891    else if (resource instanceof HealthcareService)
25892      composeHealthcareService(name, (HealthcareService)resource);
25893    else if (resource instanceof ImagingObjectSelection)
25894      composeImagingObjectSelection(name, (ImagingObjectSelection)resource);
25895    else if (resource instanceof ImagingStudy)
25896      composeImagingStudy(name, (ImagingStudy)resource);
25897    else if (resource instanceof Immunization)
25898      composeImmunization(name, (Immunization)resource);
25899    else if (resource instanceof ImmunizationRecommendation)
25900      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
25901    else if (resource instanceof ImplementationGuide)
25902      composeImplementationGuide(name, (ImplementationGuide)resource);
25903    else if (resource instanceof List_)
25904      composeList_(name, (List_)resource);
25905    else if (resource instanceof Location)
25906      composeLocation(name, (Location)resource);
25907    else if (resource instanceof Media)
25908      composeMedia(name, (Media)resource);
25909    else if (resource instanceof Medication)
25910      composeMedication(name, (Medication)resource);
25911    else if (resource instanceof MedicationAdministration)
25912      composeMedicationAdministration(name, (MedicationAdministration)resource);
25913    else if (resource instanceof MedicationDispense)
25914      composeMedicationDispense(name, (MedicationDispense)resource);
25915    else if (resource instanceof MedicationOrder)
25916      composeMedicationOrder(name, (MedicationOrder)resource);
25917    else if (resource instanceof MedicationStatement)
25918      composeMedicationStatement(name, (MedicationStatement)resource);
25919    else if (resource instanceof MessageHeader)
25920      composeMessageHeader(name, (MessageHeader)resource);
25921    else if (resource instanceof NamingSystem)
25922      composeNamingSystem(name, (NamingSystem)resource);
25923    else if (resource instanceof NutritionOrder)
25924      composeNutritionOrder(name, (NutritionOrder)resource);
25925    else if (resource instanceof Observation)
25926      composeObservation(name, (Observation)resource);
25927    else if (resource instanceof OperationDefinition)
25928      composeOperationDefinition(name, (OperationDefinition)resource);
25929    else if (resource instanceof OperationOutcome)
25930      composeOperationOutcome(name, (OperationOutcome)resource);
25931    else if (resource instanceof Order)
25932      composeOrder(name, (Order)resource);
25933    else if (resource instanceof OrderResponse)
25934      composeOrderResponse(name, (OrderResponse)resource);
25935    else if (resource instanceof Organization)
25936      composeOrganization(name, (Organization)resource);
25937    else if (resource instanceof Patient)
25938      composePatient(name, (Patient)resource);
25939    else if (resource instanceof PaymentNotice)
25940      composePaymentNotice(name, (PaymentNotice)resource);
25941    else if (resource instanceof PaymentReconciliation)
25942      composePaymentReconciliation(name, (PaymentReconciliation)resource);
25943    else if (resource instanceof Person)
25944      composePerson(name, (Person)resource);
25945    else if (resource instanceof Practitioner)
25946      composePractitioner(name, (Practitioner)resource);
25947    else if (resource instanceof Procedure)
25948      composeProcedure(name, (Procedure)resource);
25949    else if (resource instanceof ProcedureRequest)
25950      composeProcedureRequest(name, (ProcedureRequest)resource);
25951    else if (resource instanceof ProcessRequest)
25952      composeProcessRequest(name, (ProcessRequest)resource);
25953    else if (resource instanceof ProcessResponse)
25954      composeProcessResponse(name, (ProcessResponse)resource);
25955    else if (resource instanceof Provenance)
25956      composeProvenance(name, (Provenance)resource);
25957    else if (resource instanceof Questionnaire)
25958      composeQuestionnaire(name, (Questionnaire)resource);
25959    else if (resource instanceof QuestionnaireResponse)
25960      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
25961    else if (resource instanceof ReferralRequest)
25962      composeReferralRequest(name, (ReferralRequest)resource);
25963    else if (resource instanceof RelatedPerson)
25964      composeRelatedPerson(name, (RelatedPerson)resource);
25965    else if (resource instanceof RiskAssessment)
25966      composeRiskAssessment(name, (RiskAssessment)resource);
25967    else if (resource instanceof Schedule)
25968      composeSchedule(name, (Schedule)resource);
25969    else if (resource instanceof SearchParameter)
25970      composeSearchParameter(name, (SearchParameter)resource);
25971    else if (resource instanceof Slot)
25972      composeSlot(name, (Slot)resource);
25973    else if (resource instanceof Specimen)
25974      composeSpecimen(name, (Specimen)resource);
25975    else if (resource instanceof StructureDefinition)
25976      composeStructureDefinition(name, (StructureDefinition)resource);
25977    else if (resource instanceof Subscription)
25978      composeSubscription(name, (Subscription)resource);
25979    else if (resource instanceof Substance)
25980      composeSubstance(name, (Substance)resource);
25981    else if (resource instanceof SupplyDelivery)
25982      composeSupplyDelivery(name, (SupplyDelivery)resource);
25983    else if (resource instanceof SupplyRequest)
25984      composeSupplyRequest(name, (SupplyRequest)resource);
25985    else if (resource instanceof TestScript)
25986      composeTestScript(name, (TestScript)resource);
25987    else if (resource instanceof ValueSet)
25988      composeValueSet(name, (ValueSet)resource);
25989    else if (resource instanceof VisionPrescription)
25990      composeVisionPrescription(name, (VisionPrescription)resource);
25991    else if (resource instanceof Binary)
25992      composeBinary(name, (Binary)resource);
25993    else
25994      throw new Error("Unhandled resource type "+resource.getClass().getName());
25995  }
25996
25997  protected void composeType(String prefix, Type type) throws IOException {
25998    if (type == null)
25999      ;
26000    else if (type instanceof Money)
26001       composeMoney(prefix+"Money", (Money) type);
26002    else if (type instanceof SimpleQuantity)
26003       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
26004    else if (type instanceof Duration)
26005       composeDuration(prefix+"Duration", (Duration) type);
26006    else if (type instanceof Count)
26007       composeCount(prefix+"Count", (Count) type);
26008    else if (type instanceof Distance)
26009       composeDistance(prefix+"Distance", (Distance) type);
26010    else if (type instanceof Age)
26011       composeAge(prefix+"Age", (Age) type);
26012    else if (type instanceof Identifier)
26013       composeIdentifier(prefix+"Identifier", (Identifier) type);
26014    else if (type instanceof Coding)
26015       composeCoding(prefix+"Coding", (Coding) type);
26016    else if (type instanceof Reference)
26017       composeReference(prefix+"Reference", (Reference) type);
26018    else if (type instanceof Signature)
26019       composeSignature(prefix+"Signature", (Signature) type);
26020    else if (type instanceof SampledData)
26021       composeSampledData(prefix+"SampledData", (SampledData) type);
26022    else if (type instanceof Quantity)
26023       composeQuantity(prefix+"Quantity", (Quantity) type);
26024    else if (type instanceof Period)
26025       composePeriod(prefix+"Period", (Period) type);
26026    else if (type instanceof Attachment)
26027       composeAttachment(prefix+"Attachment", (Attachment) type);
26028    else if (type instanceof Ratio)
26029       composeRatio(prefix+"Ratio", (Ratio) type);
26030    else if (type instanceof Range)
26031       composeRange(prefix+"Range", (Range) type);
26032    else if (type instanceof Annotation)
26033       composeAnnotation(prefix+"Annotation", (Annotation) type);
26034    else if (type instanceof CodeableConcept)
26035       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
26036    else if (type instanceof HumanName)
26037       composeHumanName(prefix+"HumanName", (HumanName) type);
26038    else if (type instanceof ContactPoint)
26039       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
26040    else if (type instanceof Meta)
26041       composeMeta(prefix+"Meta", (Meta) type);
26042    else if (type instanceof Address)
26043       composeAddress(prefix+"Address", (Address) type);
26044    else if (type instanceof Timing)
26045       composeTiming(prefix+"Timing", (Timing) type);
26046    else if (type instanceof ElementDefinition)
26047       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
26048    else if (type instanceof DateType) {
26049      composeDateCore(prefix+"Date", (DateType) type, false);
26050      composeDateExtras(prefix+"Date", (DateType) type, false);
26051    }
26052    else if (type instanceof DateTimeType) {
26053      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
26054      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
26055    }
26056    else if (type instanceof CodeType) {
26057      composeCodeCore(prefix+"Code", (CodeType) type, false);
26058      composeCodeExtras(prefix+"Code", (CodeType) type, false);
26059    }
26060    else if (type instanceof StringType) {
26061      composeStringCore(prefix+"String", (StringType) type, false);
26062      composeStringExtras(prefix+"String", (StringType) type, false);
26063    }
26064    else if (type instanceof IntegerType) {
26065      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
26066      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
26067    }
26068    else if (type instanceof OidType) {
26069      composeOidCore(prefix+"Oid", (OidType) type, false);
26070      composeOidExtras(prefix+"Oid", (OidType) type, false);
26071    }
26072    else if (type instanceof UriType) {
26073      composeUriCore(prefix+"Uri", (UriType) type, false);
26074      composeUriExtras(prefix+"Uri", (UriType) type, false);
26075    }
26076    else if (type instanceof UuidType) {
26077      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
26078      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
26079    }
26080    else if (type instanceof InstantType) {
26081      composeInstantCore(prefix+"Instant", (InstantType) type, false);
26082      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
26083    }
26084    else if (type instanceof BooleanType) {
26085      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
26086      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
26087    }
26088    else if (type instanceof Base64BinaryType) {
26089      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
26090      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
26091    }
26092    else if (type instanceof UnsignedIntType) {
26093      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26094      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26095    }
26096    else if (type instanceof MarkdownType) {
26097      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
26098      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
26099    }
26100    else if (type instanceof TimeType) {
26101      composeTimeCore(prefix+"Time", (TimeType) type, false);
26102      composeTimeExtras(prefix+"Time", (TimeType) type, false);
26103    }
26104    else if (type instanceof IdType) {
26105      composeIdCore(prefix+"Id", (IdType) type, false);
26106      composeIdExtras(prefix+"Id", (IdType) type, false);
26107    }
26108    else if (type instanceof PositiveIntType) {
26109      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
26110      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
26111    }
26112    else if (type instanceof DecimalType) {
26113      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
26114      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
26115    }
26116    else
26117      throw new Error("Unhandled type");
26118  }
26119
26120  protected void composeTypeInner(Type type) throws IOException {
26121    if (type == null)
26122      ;
26123    else if (type instanceof Identifier)
26124       composeIdentifierInner((Identifier) type);
26125    else if (type instanceof Coding)
26126       composeCodingInner((Coding) type);
26127    else if (type instanceof Reference)
26128       composeReferenceInner((Reference) type);
26129    else if (type instanceof Signature)
26130       composeSignatureInner((Signature) type);
26131    else if (type instanceof SampledData)
26132       composeSampledDataInner((SampledData) type);
26133    else if (type instanceof Quantity)
26134       composeQuantityInner((Quantity) type);
26135    else if (type instanceof Period)
26136       composePeriodInner((Period) type);
26137    else if (type instanceof Attachment)
26138       composeAttachmentInner((Attachment) type);
26139    else if (type instanceof Ratio)
26140       composeRatioInner((Ratio) type);
26141    else if (type instanceof Range)
26142       composeRangeInner((Range) type);
26143    else if (type instanceof Annotation)
26144       composeAnnotationInner((Annotation) type);
26145    else if (type instanceof CodeableConcept)
26146       composeCodeableConceptInner((CodeableConcept) type);
26147    else if (type instanceof Money)
26148       composeMoneyInner((Money) type);
26149    else if (type instanceof SimpleQuantity)
26150       composeSimpleQuantityInner((SimpleQuantity) type);
26151    else if (type instanceof Duration)
26152       composeDurationInner((Duration) type);
26153    else if (type instanceof Count)
26154       composeCountInner((Count) type);
26155    else if (type instanceof Distance)
26156       composeDistanceInner((Distance) type);
26157    else if (type instanceof Age)
26158       composeAgeInner((Age) type);
26159    else if (type instanceof HumanName)
26160       composeHumanNameInner((HumanName) type);
26161    else if (type instanceof ContactPoint)
26162       composeContactPointInner((ContactPoint) type);
26163    else if (type instanceof Meta)
26164       composeMetaInner((Meta) type);
26165    else if (type instanceof Address)
26166       composeAddressInner((Address) type);
26167    else if (type instanceof Timing)
26168       composeTimingInner((Timing) type);
26169    else if (type instanceof ElementDefinition)
26170       composeElementDefinitionInner((ElementDefinition) type);
26171    else
26172      throw new Error("Unhandled type");
26173  }
26174
26175}