001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
038import org.hl7.fhir.dstu2016may.model.*;
039import org.hl7.fhir.exceptions.FHIRFormatError;
040import org.hl7.fhir.utilities.Utilities;
041import org.hl7.fhir.utilities.xhtml.XhtmlNode;
042
043import com.google.gson.JsonArray;
044import com.google.gson.JsonObject;
045
046public class JsonParser extends JsonParserBase {
047
048  public JsonParser() {
049    super();
050  }
051
052  public JsonParser(boolean allowUnknownContent) {
053    super();
054    setAllowUnknownContent(allowUnknownContent);
055  }
056
057
058  
059  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
060    super.parseElementProperties(json, element);
061    if (json.has("extension")) {
062      JsonArray array = json.getAsJsonArray("extension");
063      for (int i = 0; i < array.size(); i++) {
064        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
065      }
066    };
067  }
068
069  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
070    parseElementProperties(json, element);
071    if (json.has("modifierExtension")) {
072      JsonArray array = json.getAsJsonArray("modifierExtension");
073      for (int i = 0; i < array.size(); i++) {
074        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
075      }
076    }
077  }
078
079  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
080    parseElementProperties(json, element);
081  }
082
083  @SuppressWarnings("unchecked")
084  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
085    Enumeration<E> res = new Enumeration<E>(e);
086    if (s != null)
087      res.setValue((E) e.fromCode(s));
088    return res;
089  }
090
091  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
092    MarkdownType res = new MarkdownType(v);
093    return res;
094  }
095
096  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
097    IntegerType res = new IntegerType(v);
098    return res;
099  }
100
101  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
102    DateTimeType res = new DateTimeType(v);
103    return res;
104  }
105
106  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
107    UnsignedIntType res = new UnsignedIntType(v);
108    return res;
109  }
110
111  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
112    CodeType res = new CodeType(v);
113    return res;
114  }
115
116  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
117    DateType res = new DateType(v);
118    return res;
119  }
120
121  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
122    DecimalType res = new DecimalType(v);
123    return res;
124  }
125
126  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
127    UriType res = new UriType(v);
128    return res;
129  }
130
131  protected IdType parseId(String v) throws IOException, FHIRFormatError {
132    IdType res = new IdType(v);
133    return res;
134  }
135
136  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
137    Base64BinaryType res = new Base64BinaryType(v);
138    return res;
139  }
140
141  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
142    TimeType res = new TimeType(v);
143    return res;
144  }
145
146  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
147    OidType res = new OidType(v);
148    return res;
149  }
150
151  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
152    PositiveIntType res = new PositiveIntType(v);
153    return res;
154  }
155
156  protected StringType parseString(String v) throws IOException, FHIRFormatError {
157    StringType res = new StringType(v);
158    return res;
159  }
160
161  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
162    BooleanType res = new BooleanType(v);
163    return res;
164  }
165
166  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
167    UuidType res = new UuidType(v);
168    return res;
169  }
170
171  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
172    InstantType res = new InstantType(v);
173    return res;
174  }
175
176  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
177    Extension res = new Extension();
178    parseElementProperties(json, res);
179    if (json.has("url"))
180      res.setUrlElement(parseUri(json.get("url").getAsString()));
181    if (json.has("_url"))
182      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
183    Type value = parseType("value", json);
184    if (value != null)
185      res.setValue(value);
186    return res;
187  }
188
189  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
190    Narrative res = new Narrative();
191    parseElementProperties(json, res);
192    if (json.has("status"))
193      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
194    if (json.has("_status"))
195      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
196    if (json.has("div"))
197      res.setDiv(parseXhtml(json.get("div").getAsString()));
198    return res;
199  }
200
201  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
202    Period res = new Period();
203    parseTypeProperties(json, res);
204    if (json.has("start"))
205      res.setStartElement(parseDateTime(json.get("start").getAsString()));
206    if (json.has("_start"))
207      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
208    if (json.has("end"))
209      res.setEndElement(parseDateTime(json.get("end").getAsString()));
210    if (json.has("_end"))
211      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
212    return res;
213  }
214
215  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
216    Coding res = new Coding();
217    parseTypeProperties(json, res);
218    if (json.has("system"))
219      res.setSystemElement(parseUri(json.get("system").getAsString()));
220    if (json.has("_system"))
221      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
222    if (json.has("version"))
223      res.setVersionElement(parseString(json.get("version").getAsString()));
224    if (json.has("_version"))
225      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
226    if (json.has("code"))
227      res.setCodeElement(parseCode(json.get("code").getAsString()));
228    if (json.has("_code"))
229      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
230    if (json.has("display"))
231      res.setDisplayElement(parseString(json.get("display").getAsString()));
232    if (json.has("_display"))
233      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
234    if (json.has("userSelected"))
235      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
236    if (json.has("_userSelected"))
237      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
238    return res;
239  }
240
241  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
242    Range res = new Range();
243    parseTypeProperties(json, res);
244    if (json.has("low"))
245      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
246    if (json.has("high"))
247      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
248    return res;
249  }
250
251  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
252    Quantity res = new Quantity();
253    parseTypeProperties(json, res);
254    if (json.has("value"))
255      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
256    if (json.has("_value"))
257      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
258    if (json.has("comparator"))
259      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
260    if (json.has("_comparator"))
261      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
262    if (json.has("unit"))
263      res.setUnitElement(parseString(json.get("unit").getAsString()));
264    if (json.has("_unit"))
265      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
266    if (json.has("system"))
267      res.setSystemElement(parseUri(json.get("system").getAsString()));
268    if (json.has("_system"))
269      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
270    if (json.has("code"))
271      res.setCodeElement(parseCode(json.get("code").getAsString()));
272    if (json.has("_code"))
273      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
274    return res;
275  }
276
277  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
278    Attachment res = new Attachment();
279    parseTypeProperties(json, res);
280    if (json.has("contentType"))
281      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
282    if (json.has("_contentType"))
283      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
284    if (json.has("language"))
285      res.setLanguageElement(parseCode(json.get("language").getAsString()));
286    if (json.has("_language"))
287      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
288    if (json.has("data"))
289      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
290    if (json.has("_data"))
291      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
292    if (json.has("url"))
293      res.setUrlElement(parseUri(json.get("url").getAsString()));
294    if (json.has("_url"))
295      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
296    if (json.has("size"))
297      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
298    if (json.has("_size"))
299      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
300    if (json.has("hash"))
301      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
302    if (json.has("_hash"))
303      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
304    if (json.has("title"))
305      res.setTitleElement(parseString(json.get("title").getAsString()));
306    if (json.has("_title"))
307      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
308    if (json.has("creation"))
309      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
310    if (json.has("_creation"))
311      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
312    return res;
313  }
314
315  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
316    Ratio res = new Ratio();
317    parseTypeProperties(json, res);
318    if (json.has("numerator"))
319      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
320    if (json.has("denominator"))
321      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
322    return res;
323  }
324
325  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
326    Annotation res = new Annotation();
327    parseTypeProperties(json, res);
328    Type author = parseType("author", json);
329    if (author != null)
330      res.setAuthor(author);
331    if (json.has("time"))
332      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
333    if (json.has("_time"))
334      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
335    if (json.has("text"))
336      res.setTextElement(parseString(json.get("text").getAsString()));
337    if (json.has("_text"))
338      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
339    return res;
340  }
341
342  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
343    SampledData res = new SampledData();
344    parseTypeProperties(json, res);
345    if (json.has("origin"))
346      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
347    if (json.has("period"))
348      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
349    if (json.has("_period"))
350      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
351    if (json.has("factor"))
352      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
353    if (json.has("_factor"))
354      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
355    if (json.has("lowerLimit"))
356      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
357    if (json.has("_lowerLimit"))
358      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
359    if (json.has("upperLimit"))
360      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
361    if (json.has("_upperLimit"))
362      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
363    if (json.has("dimensions"))
364      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
365    if (json.has("_dimensions"))
366      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
367    if (json.has("data"))
368      res.setDataElement(parseString(json.get("data").getAsString()));
369    if (json.has("_data"))
370      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
371    return res;
372  }
373
374  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
375    Reference res = new Reference();
376    parseTypeProperties(json, res);
377    if (json.has("reference"))
378      res.setReferenceElement(parseString(json.get("reference").getAsString()));
379    if (json.has("_reference"))
380      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
381    if (json.has("display"))
382      res.setDisplayElement(parseString(json.get("display").getAsString()));
383    if (json.has("_display"))
384      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
385    return res;
386  }
387
388  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
389    CodeableConcept res = new CodeableConcept();
390    parseTypeProperties(json, res);
391    if (json.has("coding")) {
392      JsonArray array = json.getAsJsonArray("coding");
393      for (int i = 0; i < array.size(); i++) {
394        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
395      }
396    };
397    if (json.has("text"))
398      res.setTextElement(parseString(json.get("text").getAsString()));
399    if (json.has("_text"))
400      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
401    return res;
402  }
403
404  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
405    Identifier res = new Identifier();
406    parseTypeProperties(json, res);
407    if (json.has("use"))
408      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
409    if (json.has("_use"))
410      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
411    if (json.has("type"))
412      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
413    if (json.has("system"))
414      res.setSystemElement(parseUri(json.get("system").getAsString()));
415    if (json.has("_system"))
416      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
417    if (json.has("value"))
418      res.setValueElement(parseString(json.get("value").getAsString()));
419    if (json.has("_value"))
420      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
421    if (json.has("period"))
422      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
423    if (json.has("assigner"))
424      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
425    return res;
426  }
427
428  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
429    Signature res = new Signature();
430    parseTypeProperties(json, res);
431    if (json.has("type")) {
432      JsonArray array = json.getAsJsonArray("type");
433      for (int i = 0; i < array.size(); i++) {
434        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
435      }
436    };
437    if (json.has("when"))
438      res.setWhenElement(parseInstant(json.get("when").getAsString()));
439    if (json.has("_when"))
440      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
441    Type who = parseType("who", json);
442    if (who != null)
443      res.setWho(who);
444    if (json.has("contentType"))
445      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
446    if (json.has("_contentType"))
447      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
448    if (json.has("blob"))
449      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
450    if (json.has("_blob"))
451      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
452    return res;
453  }
454
455  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
456    Age res = new Age();
457    parseElementProperties(json, res);
458    if (json.has("value"))
459      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
460    if (json.has("_value"))
461      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
462    if (json.has("comparator"))
463      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
464    if (json.has("_comparator"))
465      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
466    if (json.has("unit"))
467      res.setUnitElement(parseString(json.get("unit").getAsString()));
468    if (json.has("_unit"))
469      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
470    if (json.has("system"))
471      res.setSystemElement(parseUri(json.get("system").getAsString()));
472    if (json.has("_system"))
473      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
474    if (json.has("code"))
475      res.setCodeElement(parseCode(json.get("code").getAsString()));
476    if (json.has("_code"))
477      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
478    return res;
479  }
480
481  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
482    Count res = new Count();
483    parseElementProperties(json, res);
484    if (json.has("value"))
485      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
486    if (json.has("_value"))
487      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
488    if (json.has("comparator"))
489      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
490    if (json.has("_comparator"))
491      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
492    if (json.has("unit"))
493      res.setUnitElement(parseString(json.get("unit").getAsString()));
494    if (json.has("_unit"))
495      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
496    if (json.has("system"))
497      res.setSystemElement(parseUri(json.get("system").getAsString()));
498    if (json.has("_system"))
499      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
500    if (json.has("code"))
501      res.setCodeElement(parseCode(json.get("code").getAsString()));
502    if (json.has("_code"))
503      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
504    return res;
505  }
506
507  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
508    Money res = new Money();
509    parseElementProperties(json, res);
510    if (json.has("value"))
511      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
512    if (json.has("_value"))
513      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
514    if (json.has("comparator"))
515      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
516    if (json.has("_comparator"))
517      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
518    if (json.has("unit"))
519      res.setUnitElement(parseString(json.get("unit").getAsString()));
520    if (json.has("_unit"))
521      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
522    if (json.has("system"))
523      res.setSystemElement(parseUri(json.get("system").getAsString()));
524    if (json.has("_system"))
525      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
526    if (json.has("code"))
527      res.setCodeElement(parseCode(json.get("code").getAsString()));
528    if (json.has("_code"))
529      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
530    return res;
531  }
532
533  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
534    Distance res = new Distance();
535    parseElementProperties(json, res);
536    if (json.has("value"))
537      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
538    if (json.has("_value"))
539      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
540    if (json.has("comparator"))
541      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
542    if (json.has("_comparator"))
543      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
544    if (json.has("unit"))
545      res.setUnitElement(parseString(json.get("unit").getAsString()));
546    if (json.has("_unit"))
547      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
548    if (json.has("system"))
549      res.setSystemElement(parseUri(json.get("system").getAsString()));
550    if (json.has("_system"))
551      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
552    if (json.has("code"))
553      res.setCodeElement(parseCode(json.get("code").getAsString()));
554    if (json.has("_code"))
555      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
556    return res;
557  }
558
559  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
560    Duration res = new Duration();
561    parseElementProperties(json, res);
562    if (json.has("value"))
563      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
564    if (json.has("_value"))
565      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
566    if (json.has("comparator"))
567      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
568    if (json.has("_comparator"))
569      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
570    if (json.has("unit"))
571      res.setUnitElement(parseString(json.get("unit").getAsString()));
572    if (json.has("_unit"))
573      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
574    if (json.has("system"))
575      res.setSystemElement(parseUri(json.get("system").getAsString()));
576    if (json.has("_system"))
577      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
578    if (json.has("code"))
579      res.setCodeElement(parseCode(json.get("code").getAsString()));
580    if (json.has("_code"))
581      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
582    return res;
583  }
584
585  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
586    SimpleQuantity res = new SimpleQuantity();
587    parseElementProperties(json, res);
588    if (json.has("value"))
589      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
590    if (json.has("_value"))
591      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
592    if (json.has("comparator"))
593      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
594    if (json.has("_comparator"))
595      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
596    if (json.has("unit"))
597      res.setUnitElement(parseString(json.get("unit").getAsString()));
598    if (json.has("_unit"))
599      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
600    if (json.has("system"))
601      res.setSystemElement(parseUri(json.get("system").getAsString()));
602    if (json.has("_system"))
603      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
604    if (json.has("code"))
605      res.setCodeElement(parseCode(json.get("code").getAsString()));
606    if (json.has("_code"))
607      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
608    return res;
609  }
610
611  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
612    TriggerDefinition res = new TriggerDefinition();
613    parseElementProperties(json, res);
614    if (json.has("type"))
615      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
616    if (json.has("_type"))
617      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
618    if (json.has("eventName"))
619      res.setEventNameElement(parseString(json.get("eventName").getAsString()));
620    if (json.has("_eventName"))
621      parseElementProperties(json.getAsJsonObject("_eventName"), res.getEventNameElement());
622    Type eventTiming = parseType("eventTiming", json);
623    if (eventTiming != null)
624      res.setEventTiming(eventTiming);
625    if (json.has("eventData"))
626      res.setEventData(parseDataRequirement(json.getAsJsonObject("eventData")));
627    return res;
628  }
629
630  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
631    ElementDefinition res = new ElementDefinition();
632    parseElementProperties(json, res);
633    if (json.has("path"))
634      res.setPathElement(parseString(json.get("path").getAsString()));
635    if (json.has("_path"))
636      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
637    if (json.has("representation")) {
638      JsonArray array = json.getAsJsonArray("representation");
639      for (int i = 0; i < array.size(); i++) {
640        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
641      }
642    };
643    if (json.has("_representation")) {
644      JsonArray array = json.getAsJsonArray("_representation");
645      for (int i = 0; i < array.size(); i++) {
646        if (i == res.getRepresentation().size())
647          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
648        if (array.get(i) instanceof JsonObject) 
649          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
650      }
651    };
652    if (json.has("name"))
653      res.setNameElement(parseString(json.get("name").getAsString()));
654    if (json.has("_name"))
655      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
656    if (json.has("label"))
657      res.setLabelElement(parseString(json.get("label").getAsString()));
658    if (json.has("_label"))
659      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
660    if (json.has("code")) {
661      JsonArray array = json.getAsJsonArray("code");
662      for (int i = 0; i < array.size(); i++) {
663        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
664      }
665    };
666    if (json.has("slicing"))
667      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
668    if (json.has("short"))
669      res.setShortElement(parseString(json.get("short").getAsString()));
670    if (json.has("_short"))
671      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
672    if (json.has("definition"))
673      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
674    if (json.has("_definition"))
675      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
676    if (json.has("comments"))
677      res.setCommentsElement(parseMarkdown(json.get("comments").getAsString()));
678    if (json.has("_comments"))
679      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
680    if (json.has("requirements"))
681      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
682    if (json.has("_requirements"))
683      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
684    if (json.has("alias")) {
685      JsonArray array = json.getAsJsonArray("alias");
686      for (int i = 0; i < array.size(); i++) {
687        res.getAlias().add(parseString(array.get(i).getAsString()));
688      }
689    };
690    if (json.has("_alias")) {
691      JsonArray array = json.getAsJsonArray("_alias");
692      for (int i = 0; i < array.size(); i++) {
693        if (i == res.getAlias().size())
694          res.getAlias().add(parseString(null));
695        if (array.get(i) instanceof JsonObject) 
696          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
697      }
698    };
699    if (json.has("min"))
700      res.setMinElement(parseInteger(json.get("min").getAsLong()));
701    if (json.has("_min"))
702      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
703    if (json.has("max"))
704      res.setMaxElement(parseString(json.get("max").getAsString()));
705    if (json.has("_max"))
706      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
707    if (json.has("base"))
708      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
709    if (json.has("contentReference"))
710      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
711    if (json.has("_contentReference"))
712      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
713    if (json.has("type")) {
714      JsonArray array = json.getAsJsonArray("type");
715      for (int i = 0; i < array.size(); i++) {
716        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
717      }
718    };
719    Type defaultValue = parseType("defaultValue", json);
720    if (defaultValue != null)
721      res.setDefaultValue(defaultValue);
722    if (json.has("meaningWhenMissing"))
723      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
724    if (json.has("_meaningWhenMissing"))
725      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
726    Type fixed = parseType("fixed", json);
727    if (fixed != null)
728      res.setFixed(fixed);
729    Type pattern = parseType("pattern", json);
730    if (pattern != null)
731      res.setPattern(pattern);
732    Type example = parseType("example", json);
733    if (example != null)
734      res.setExample(example);
735    Type minValue = parseType("minValue", json);
736    if (minValue != null)
737      res.setMinValue(minValue);
738    Type maxValue = parseType("maxValue", json);
739    if (maxValue != null)
740      res.setMaxValue(maxValue);
741    if (json.has("maxLength"))
742      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
743    if (json.has("_maxLength"))
744      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
745    if (json.has("condition")) {
746      JsonArray array = json.getAsJsonArray("condition");
747      for (int i = 0; i < array.size(); i++) {
748        res.getCondition().add(parseId(array.get(i).getAsString()));
749      }
750    };
751    if (json.has("_condition")) {
752      JsonArray array = json.getAsJsonArray("_condition");
753      for (int i = 0; i < array.size(); i++) {
754        if (i == res.getCondition().size())
755          res.getCondition().add(parseId(null));
756        if (array.get(i) instanceof JsonObject) 
757          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
758      }
759    };
760    if (json.has("constraint")) {
761      JsonArray array = json.getAsJsonArray("constraint");
762      for (int i = 0; i < array.size(); i++) {
763        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
764      }
765    };
766    if (json.has("mustSupport"))
767      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
768    if (json.has("_mustSupport"))
769      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
770    if (json.has("isModifier"))
771      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
772    if (json.has("_isModifier"))
773      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
774    if (json.has("isSummary"))
775      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
776    if (json.has("_isSummary"))
777      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
778    if (json.has("binding"))
779      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
780    if (json.has("mapping")) {
781      JsonArray array = json.getAsJsonArray("mapping");
782      for (int i = 0; i < array.size(); i++) {
783        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
784      }
785    };
786    return res;
787  }
788
789  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
790    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
791    parseElementProperties(json, res);
792    if (json.has("discriminator")) {
793      JsonArray array = json.getAsJsonArray("discriminator");
794      for (int i = 0; i < array.size(); i++) {
795        res.getDiscriminator().add(parseString(array.get(i).getAsString()));
796      }
797    };
798    if (json.has("_discriminator")) {
799      JsonArray array = json.getAsJsonArray("_discriminator");
800      for (int i = 0; i < array.size(); i++) {
801        if (i == res.getDiscriminator().size())
802          res.getDiscriminator().add(parseString(null));
803        if (array.get(i) instanceof JsonObject) 
804          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiscriminator().get(i));
805      }
806    };
807    if (json.has("description"))
808      res.setDescriptionElement(parseString(json.get("description").getAsString()));
809    if (json.has("_description"))
810      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
811    if (json.has("ordered"))
812      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
813    if (json.has("_ordered"))
814      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
815    if (json.has("rules"))
816      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
817    if (json.has("_rules"))
818      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
819    return res;
820  }
821
822  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
823    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
824    parseElementProperties(json, res);
825    if (json.has("path"))
826      res.setPathElement(parseString(json.get("path").getAsString()));
827    if (json.has("_path"))
828      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
829    if (json.has("min"))
830      res.setMinElement(parseInteger(json.get("min").getAsLong()));
831    if (json.has("_min"))
832      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
833    if (json.has("max"))
834      res.setMaxElement(parseString(json.get("max").getAsString()));
835    if (json.has("_max"))
836      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
837    return res;
838  }
839
840  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
841    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
842    parseElementProperties(json, res);
843    if (json.has("code"))
844      res.setCodeElement(parseCode(json.get("code").getAsString()));
845    if (json.has("_code"))
846      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
847    if (json.has("profile")) {
848      JsonArray array = json.getAsJsonArray("profile");
849      for (int i = 0; i < array.size(); i++) {
850        res.getProfile().add(parseUri(array.get(i).getAsString()));
851      }
852    };
853    if (json.has("_profile")) {
854      JsonArray array = json.getAsJsonArray("_profile");
855      for (int i = 0; i < array.size(); i++) {
856        if (i == res.getProfile().size())
857          res.getProfile().add(parseUri(null));
858        if (array.get(i) instanceof JsonObject) 
859          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
860      }
861    };
862    if (json.has("aggregation")) {
863      JsonArray array = json.getAsJsonArray("aggregation");
864      for (int i = 0; i < array.size(); i++) {
865        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
866      }
867    };
868    if (json.has("_aggregation")) {
869      JsonArray array = json.getAsJsonArray("_aggregation");
870      for (int i = 0; i < array.size(); i++) {
871        if (i == res.getAggregation().size())
872          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
873        if (array.get(i) instanceof JsonObject) 
874          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
875      }
876    };
877    if (json.has("versioning"))
878      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
879    if (json.has("_versioning"))
880      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
881    return res;
882  }
883
884  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
885    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
886    parseElementProperties(json, res);
887    if (json.has("key"))
888      res.setKeyElement(parseId(json.get("key").getAsString()));
889    if (json.has("_key"))
890      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
891    if (json.has("requirements"))
892      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
893    if (json.has("_requirements"))
894      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
895    if (json.has("severity"))
896      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
897    if (json.has("_severity"))
898      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
899    if (json.has("human"))
900      res.setHumanElement(parseString(json.get("human").getAsString()));
901    if (json.has("_human"))
902      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
903    if (json.has("expression"))
904      res.setExpressionElement(parseString(json.get("expression").getAsString()));
905    if (json.has("_expression"))
906      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
907    if (json.has("xpath"))
908      res.setXpathElement(parseString(json.get("xpath").getAsString()));
909    if (json.has("_xpath"))
910      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
911    return res;
912  }
913
914  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
915    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
916    parseElementProperties(json, res);
917    if (json.has("strength"))
918      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
919    if (json.has("_strength"))
920      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
921    if (json.has("description"))
922      res.setDescriptionElement(parseString(json.get("description").getAsString()));
923    if (json.has("_description"))
924      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
925    Type valueSet = parseType("valueSet", json);
926    if (valueSet != null)
927      res.setValueSet(valueSet);
928    return res;
929  }
930
931  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
932    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
933    parseElementProperties(json, res);
934    if (json.has("identity"))
935      res.setIdentityElement(parseId(json.get("identity").getAsString()));
936    if (json.has("_identity"))
937      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
938    if (json.has("language"))
939      res.setLanguageElement(parseCode(json.get("language").getAsString()));
940    if (json.has("_language"))
941      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
942    if (json.has("map"))
943      res.setMapElement(parseString(json.get("map").getAsString()));
944    if (json.has("_map"))
945      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
946    return res;
947  }
948
949  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
950    Timing res = new Timing();
951    parseElementProperties(json, res);
952    if (json.has("event")) {
953      JsonArray array = json.getAsJsonArray("event");
954      for (int i = 0; i < array.size(); i++) {
955        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
956      }
957    };
958    if (json.has("_event")) {
959      JsonArray array = json.getAsJsonArray("_event");
960      for (int i = 0; i < array.size(); i++) {
961        if (i == res.getEvent().size())
962          res.getEvent().add(parseDateTime(null));
963        if (array.get(i) instanceof JsonObject) 
964          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
965      }
966    };
967    if (json.has("repeat"))
968      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
969    if (json.has("code"))
970      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
971    return res;
972  }
973
974  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
975    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
976    parseElementProperties(json, res);
977    Type bounds = parseType("bounds", json);
978    if (bounds != null)
979      res.setBounds(bounds);
980    if (json.has("count"))
981      res.setCountElement(parseInteger(json.get("count").getAsLong()));
982    if (json.has("_count"))
983      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
984    if (json.has("countMax"))
985      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
986    if (json.has("_countMax"))
987      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
988    if (json.has("duration"))
989      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
990    if (json.has("_duration"))
991      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
992    if (json.has("durationMax"))
993      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
994    if (json.has("_durationMax"))
995      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
996    if (json.has("durationUnit"))
997      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
998    if (json.has("_durationUnit"))
999      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1000    if (json.has("frequency"))
1001      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1002    if (json.has("_frequency"))
1003      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1004    if (json.has("frequencyMax"))
1005      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1006    if (json.has("_frequencyMax"))
1007      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1008    if (json.has("period"))
1009      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1010    if (json.has("_period"))
1011      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1012    if (json.has("periodMax"))
1013      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1014    if (json.has("_periodMax"))
1015      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1016    if (json.has("periodUnit"))
1017      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1018    if (json.has("_periodUnit"))
1019      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1020    if (json.has("when"))
1021      res.setWhenElement(parseEnumeration(json.get("when").getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1022    if (json.has("_when"))
1023      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1024    if (json.has("offset"))
1025      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1026    if (json.has("_offset"))
1027      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1028    return res;
1029  }
1030
1031  protected ModuleMetadata parseModuleMetadata(JsonObject json) throws IOException, FHIRFormatError {
1032    ModuleMetadata res = new ModuleMetadata();
1033    parseElementProperties(json, res);
1034    if (json.has("url"))
1035      res.setUrlElement(parseUri(json.get("url").getAsString()));
1036    if (json.has("_url"))
1037      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1038    if (json.has("identifier")) {
1039      JsonArray array = json.getAsJsonArray("identifier");
1040      for (int i = 0; i < array.size(); i++) {
1041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1042      }
1043    };
1044    if (json.has("version"))
1045      res.setVersionElement(parseString(json.get("version").getAsString()));
1046    if (json.has("_version"))
1047      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
1048    if (json.has("name"))
1049      res.setNameElement(parseString(json.get("name").getAsString()));
1050    if (json.has("_name"))
1051      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1052    if (json.has("title"))
1053      res.setTitleElement(parseString(json.get("title").getAsString()));
1054    if (json.has("_title"))
1055      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
1056    if (json.has("type"))
1057      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ModuleMetadata.ModuleMetadataType.NULL, new ModuleMetadata.ModuleMetadataTypeEnumFactory()));
1058    if (json.has("_type"))
1059      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1060    if (json.has("status"))
1061      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ModuleMetadata.ModuleMetadataStatus.NULL, new ModuleMetadata.ModuleMetadataStatusEnumFactory()));
1062    if (json.has("_status"))
1063      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1064    if (json.has("experimental"))
1065      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
1066    if (json.has("_experimental"))
1067      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
1068    if (json.has("description"))
1069      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1070    if (json.has("_description"))
1071      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1072    if (json.has("purpose"))
1073      res.setPurposeElement(parseString(json.get("purpose").getAsString()));
1074    if (json.has("_purpose"))
1075      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
1076    if (json.has("usage"))
1077      res.setUsageElement(parseString(json.get("usage").getAsString()));
1078    if (json.has("_usage"))
1079      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
1080    if (json.has("publicationDate"))
1081      res.setPublicationDateElement(parseDate(json.get("publicationDate").getAsString()));
1082    if (json.has("_publicationDate"))
1083      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
1084    if (json.has("lastReviewDate"))
1085      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
1086    if (json.has("_lastReviewDate"))
1087      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
1088    if (json.has("effectivePeriod"))
1089      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
1090    if (json.has("coverage")) {
1091      JsonArray array = json.getAsJsonArray("coverage");
1092      for (int i = 0; i < array.size(); i++) {
1093        res.getCoverage().add(parseModuleMetadataModuleMetadataCoverageComponent(array.get(i).getAsJsonObject(), res));
1094      }
1095    };
1096    if (json.has("topic")) {
1097      JsonArray array = json.getAsJsonArray("topic");
1098      for (int i = 0; i < array.size(); i++) {
1099        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1100      }
1101    };
1102    if (json.has("contributor")) {
1103      JsonArray array = json.getAsJsonArray("contributor");
1104      for (int i = 0; i < array.size(); i++) {
1105        res.getContributor().add(parseModuleMetadataModuleMetadataContributorComponent(array.get(i).getAsJsonObject(), res));
1106      }
1107    };
1108    if (json.has("publisher"))
1109      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
1110    if (json.has("_publisher"))
1111      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
1112    if (json.has("contact")) {
1113      JsonArray array = json.getAsJsonArray("contact");
1114      for (int i = 0; i < array.size(); i++) {
1115        res.getContact().add(parseModuleMetadataModuleMetadataContactComponent(array.get(i).getAsJsonObject(), res));
1116      }
1117    };
1118    if (json.has("copyright"))
1119      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
1120    if (json.has("_copyright"))
1121      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
1122    if (json.has("relatedResource")) {
1123      JsonArray array = json.getAsJsonArray("relatedResource");
1124      for (int i = 0; i < array.size(); i++) {
1125        res.getRelatedResource().add(parseModuleMetadataModuleMetadataRelatedResourceComponent(array.get(i).getAsJsonObject(), res));
1126      }
1127    };
1128    return res;
1129  }
1130
1131  protected ModuleMetadata.ModuleMetadataCoverageComponent parseModuleMetadataModuleMetadataCoverageComponent(JsonObject json, ModuleMetadata owner) throws IOException, FHIRFormatError {
1132    ModuleMetadata.ModuleMetadataCoverageComponent res = new ModuleMetadata.ModuleMetadataCoverageComponent();
1133    parseElementProperties(json, res);
1134    if (json.has("focus"))
1135      res.setFocus(parseCoding(json.getAsJsonObject("focus")));
1136    if (json.has("value"))
1137      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
1138    return res;
1139  }
1140
1141  protected ModuleMetadata.ModuleMetadataContributorComponent parseModuleMetadataModuleMetadataContributorComponent(JsonObject json, ModuleMetadata owner) throws IOException, FHIRFormatError {
1142    ModuleMetadata.ModuleMetadataContributorComponent res = new ModuleMetadata.ModuleMetadataContributorComponent();
1143    parseElementProperties(json, res);
1144    if (json.has("type"))
1145      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ModuleMetadata.ModuleMetadataContributorType.NULL, new ModuleMetadata.ModuleMetadataContributorTypeEnumFactory()));
1146    if (json.has("_type"))
1147      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1148    if (json.has("name"))
1149      res.setNameElement(parseString(json.get("name").getAsString()));
1150    if (json.has("_name"))
1151      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1152    if (json.has("contact")) {
1153      JsonArray array = json.getAsJsonArray("contact");
1154      for (int i = 0; i < array.size(); i++) {
1155        res.getContact().add(parseModuleMetadataModuleMetadataContributorContactComponent(array.get(i).getAsJsonObject(), owner));
1156      }
1157    };
1158    return res;
1159  }
1160
1161  protected ModuleMetadata.ModuleMetadataContributorContactComponent parseModuleMetadataModuleMetadataContributorContactComponent(JsonObject json, ModuleMetadata owner) throws IOException, FHIRFormatError {
1162    ModuleMetadata.ModuleMetadataContributorContactComponent res = new ModuleMetadata.ModuleMetadataContributorContactComponent();
1163    parseElementProperties(json, res);
1164    if (json.has("name"))
1165      res.setNameElement(parseString(json.get("name").getAsString()));
1166    if (json.has("_name"))
1167      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1168    if (json.has("telecom")) {
1169      JsonArray array = json.getAsJsonArray("telecom");
1170      for (int i = 0; i < array.size(); i++) {
1171        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1172      }
1173    };
1174    return res;
1175  }
1176
1177  protected ModuleMetadata.ModuleMetadataContactComponent parseModuleMetadataModuleMetadataContactComponent(JsonObject json, ModuleMetadata owner) throws IOException, FHIRFormatError {
1178    ModuleMetadata.ModuleMetadataContactComponent res = new ModuleMetadata.ModuleMetadataContactComponent();
1179    parseElementProperties(json, res);
1180    if (json.has("name"))
1181      res.setNameElement(parseString(json.get("name").getAsString()));
1182    if (json.has("_name"))
1183      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1184    if (json.has("telecom")) {
1185      JsonArray array = json.getAsJsonArray("telecom");
1186      for (int i = 0; i < array.size(); i++) {
1187        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1188      }
1189    };
1190    return res;
1191  }
1192
1193  protected ModuleMetadata.ModuleMetadataRelatedResourceComponent parseModuleMetadataModuleMetadataRelatedResourceComponent(JsonObject json, ModuleMetadata owner) throws IOException, FHIRFormatError {
1194    ModuleMetadata.ModuleMetadataRelatedResourceComponent res = new ModuleMetadata.ModuleMetadataRelatedResourceComponent();
1195    parseElementProperties(json, res);
1196    if (json.has("type"))
1197      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ModuleMetadata.ModuleMetadataResourceType.NULL, new ModuleMetadata.ModuleMetadataResourceTypeEnumFactory()));
1198    if (json.has("_type"))
1199      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1200    if (json.has("document"))
1201      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1202    if (json.has("resource"))
1203      res.setResource(parseReference(json.getAsJsonObject("resource")));
1204    return res;
1205  }
1206
1207  protected ActionDefinition parseActionDefinition(JsonObject json) throws IOException, FHIRFormatError {
1208    ActionDefinition res = new ActionDefinition();
1209    parseElementProperties(json, res);
1210    if (json.has("actionIdentifier"))
1211      res.setActionIdentifier(parseIdentifier(json.getAsJsonObject("actionIdentifier")));
1212    if (json.has("label"))
1213      res.setLabelElement(parseString(json.get("label").getAsString()));
1214    if (json.has("_label"))
1215      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1216    if (json.has("title"))
1217      res.setTitleElement(parseString(json.get("title").getAsString()));
1218    if (json.has("_title"))
1219      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
1220    if (json.has("description"))
1221      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1222    if (json.has("_description"))
1223      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1224    if (json.has("textEquivalent"))
1225      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
1226    if (json.has("_textEquivalent"))
1227      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
1228    if (json.has("concept")) {
1229      JsonArray array = json.getAsJsonArray("concept");
1230      for (int i = 0; i < array.size(); i++) {
1231        res.getConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1232      }
1233    };
1234    if (json.has("supportingEvidence")) {
1235      JsonArray array = json.getAsJsonArray("supportingEvidence");
1236      for (int i = 0; i < array.size(); i++) {
1237        res.getSupportingEvidence().add(parseAttachment(array.get(i).getAsJsonObject()));
1238      }
1239    };
1240    if (json.has("documentation")) {
1241      JsonArray array = json.getAsJsonArray("documentation");
1242      for (int i = 0; i < array.size(); i++) {
1243        res.getDocumentation().add(parseAttachment(array.get(i).getAsJsonObject()));
1244      }
1245    };
1246    if (json.has("relatedAction"))
1247      res.setRelatedAction(parseActionDefinitionActionDefinitionRelatedActionComponent(json.getAsJsonObject("relatedAction"), res));
1248    if (json.has("participantType")) {
1249      JsonArray array = json.getAsJsonArray("participantType");
1250      for (int i = 0; i < array.size(); i++) {
1251        res.getParticipantType().add(parseEnumeration(array.get(i).getAsString(), ActionDefinition.ParticipantType.NULL, new ActionDefinition.ParticipantTypeEnumFactory()));
1252      }
1253    };
1254    if (json.has("_participantType")) {
1255      JsonArray array = json.getAsJsonArray("_participantType");
1256      for (int i = 0; i < array.size(); i++) {
1257        if (i == res.getParticipantType().size())
1258          res.getParticipantType().add(parseEnumeration(null, ActionDefinition.ParticipantType.NULL, new ActionDefinition.ParticipantTypeEnumFactory()));
1259        if (array.get(i) instanceof JsonObject) 
1260          parseElementProperties(array.get(i).getAsJsonObject(), res.getParticipantType().get(i));
1261      }
1262    };
1263    if (json.has("type"))
1264      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActionDefinition.ActionType.NULL, new ActionDefinition.ActionTypeEnumFactory()));
1265    if (json.has("_type"))
1266      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1267    if (json.has("behavior")) {
1268      JsonArray array = json.getAsJsonArray("behavior");
1269      for (int i = 0; i < array.size(); i++) {
1270        res.getBehavior().add(parseActionDefinitionActionDefinitionBehaviorComponent(array.get(i).getAsJsonObject(), res));
1271      }
1272    };
1273    if (json.has("resource"))
1274      res.setResource(parseReference(json.getAsJsonObject("resource")));
1275    if (json.has("customization")) {
1276      JsonArray array = json.getAsJsonArray("customization");
1277      for (int i = 0; i < array.size(); i++) {
1278        res.getCustomization().add(parseActionDefinitionActionDefinitionCustomizationComponent(array.get(i).getAsJsonObject(), res));
1279      }
1280    };
1281    if (json.has("action")) {
1282      JsonArray array = json.getAsJsonArray("action");
1283      for (int i = 0; i < array.size(); i++) {
1284        res.getAction().add(parseActionDefinition(array.get(i).getAsJsonObject()));
1285      }
1286    };
1287    return res;
1288  }
1289
1290  protected ActionDefinition.ActionDefinitionRelatedActionComponent parseActionDefinitionActionDefinitionRelatedActionComponent(JsonObject json, ActionDefinition owner) throws IOException, FHIRFormatError {
1291    ActionDefinition.ActionDefinitionRelatedActionComponent res = new ActionDefinition.ActionDefinitionRelatedActionComponent();
1292    parseElementProperties(json, res);
1293    if (json.has("actionIdentifier"))
1294      res.setActionIdentifier(parseIdentifier(json.getAsJsonObject("actionIdentifier")));
1295    if (json.has("relationship"))
1296      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), ActionDefinition.ActionRelationshipType.NULL, new ActionDefinition.ActionRelationshipTypeEnumFactory()));
1297    if (json.has("_relationship"))
1298      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
1299    Type offset = parseType("offset", json);
1300    if (offset != null)
1301      res.setOffset(offset);
1302    if (json.has("anchor"))
1303      res.setAnchorElement(parseEnumeration(json.get("anchor").getAsString(), ActionDefinition.ActionRelationshipAnchor.NULL, new ActionDefinition.ActionRelationshipAnchorEnumFactory()));
1304    if (json.has("_anchor"))
1305      parseElementProperties(json.getAsJsonObject("_anchor"), res.getAnchorElement());
1306    return res;
1307  }
1308
1309  protected ActionDefinition.ActionDefinitionBehaviorComponent parseActionDefinitionActionDefinitionBehaviorComponent(JsonObject json, ActionDefinition owner) throws IOException, FHIRFormatError {
1310    ActionDefinition.ActionDefinitionBehaviorComponent res = new ActionDefinition.ActionDefinitionBehaviorComponent();
1311    parseElementProperties(json, res);
1312    if (json.has("type"))
1313      res.setType(parseCoding(json.getAsJsonObject("type")));
1314    if (json.has("value"))
1315      res.setValue(parseCoding(json.getAsJsonObject("value")));
1316    return res;
1317  }
1318
1319  protected ActionDefinition.ActionDefinitionCustomizationComponent parseActionDefinitionActionDefinitionCustomizationComponent(JsonObject json, ActionDefinition owner) throws IOException, FHIRFormatError {
1320    ActionDefinition.ActionDefinitionCustomizationComponent res = new ActionDefinition.ActionDefinitionCustomizationComponent();
1321    parseElementProperties(json, res);
1322    if (json.has("path"))
1323      res.setPathElement(parseString(json.get("path").getAsString()));
1324    if (json.has("_path"))
1325      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1326    if (json.has("expression"))
1327      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1328    if (json.has("_expression"))
1329      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1330    return res;
1331  }
1332
1333  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
1334    Address res = new Address();
1335    parseElementProperties(json, res);
1336    if (json.has("use"))
1337      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
1338    if (json.has("_use"))
1339      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1340    if (json.has("type"))
1341      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
1342    if (json.has("_type"))
1343      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1344    if (json.has("text"))
1345      res.setTextElement(parseString(json.get("text").getAsString()));
1346    if (json.has("_text"))
1347      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1348    if (json.has("line")) {
1349      JsonArray array = json.getAsJsonArray("line");
1350      for (int i = 0; i < array.size(); i++) {
1351        res.getLine().add(parseString(array.get(i).getAsString()));
1352      }
1353    };
1354    if (json.has("_line")) {
1355      JsonArray array = json.getAsJsonArray("_line");
1356      for (int i = 0; i < array.size(); i++) {
1357        if (i == res.getLine().size())
1358          res.getLine().add(parseString(null));
1359        if (array.get(i) instanceof JsonObject) 
1360          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
1361      }
1362    };
1363    if (json.has("city"))
1364      res.setCityElement(parseString(json.get("city").getAsString()));
1365    if (json.has("_city"))
1366      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
1367    if (json.has("district"))
1368      res.setDistrictElement(parseString(json.get("district").getAsString()));
1369    if (json.has("_district"))
1370      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
1371    if (json.has("state"))
1372      res.setStateElement(parseString(json.get("state").getAsString()));
1373    if (json.has("_state"))
1374      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
1375    if (json.has("postalCode"))
1376      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
1377    if (json.has("_postalCode"))
1378      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
1379    if (json.has("country"))
1380      res.setCountryElement(parseString(json.get("country").getAsString()));
1381    if (json.has("_country"))
1382      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
1383    if (json.has("period"))
1384      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1385    return res;
1386  }
1387
1388  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1389    HumanName res = new HumanName();
1390    parseElementProperties(json, res);
1391    if (json.has("use"))
1392      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1393    if (json.has("_use"))
1394      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1395    if (json.has("text"))
1396      res.setTextElement(parseString(json.get("text").getAsString()));
1397    if (json.has("_text"))
1398      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1399    if (json.has("family")) {
1400      JsonArray array = json.getAsJsonArray("family");
1401      for (int i = 0; i < array.size(); i++) {
1402        res.getFamily().add(parseString(array.get(i).getAsString()));
1403      }
1404    };
1405    if (json.has("_family")) {
1406      JsonArray array = json.getAsJsonArray("_family");
1407      for (int i = 0; i < array.size(); i++) {
1408        if (i == res.getFamily().size())
1409          res.getFamily().add(parseString(null));
1410        if (array.get(i) instanceof JsonObject) 
1411          parseElementProperties(array.get(i).getAsJsonObject(), res.getFamily().get(i));
1412      }
1413    };
1414    if (json.has("given")) {
1415      JsonArray array = json.getAsJsonArray("given");
1416      for (int i = 0; i < array.size(); i++) {
1417        res.getGiven().add(parseString(array.get(i).getAsString()));
1418      }
1419    };
1420    if (json.has("_given")) {
1421      JsonArray array = json.getAsJsonArray("_given");
1422      for (int i = 0; i < array.size(); i++) {
1423        if (i == res.getGiven().size())
1424          res.getGiven().add(parseString(null));
1425        if (array.get(i) instanceof JsonObject) 
1426          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1427      }
1428    };
1429    if (json.has("prefix")) {
1430      JsonArray array = json.getAsJsonArray("prefix");
1431      for (int i = 0; i < array.size(); i++) {
1432        res.getPrefix().add(parseString(array.get(i).getAsString()));
1433      }
1434    };
1435    if (json.has("_prefix")) {
1436      JsonArray array = json.getAsJsonArray("_prefix");
1437      for (int i = 0; i < array.size(); i++) {
1438        if (i == res.getPrefix().size())
1439          res.getPrefix().add(parseString(null));
1440        if (array.get(i) instanceof JsonObject) 
1441          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1442      }
1443    };
1444    if (json.has("suffix")) {
1445      JsonArray array = json.getAsJsonArray("suffix");
1446      for (int i = 0; i < array.size(); i++) {
1447        res.getSuffix().add(parseString(array.get(i).getAsString()));
1448      }
1449    };
1450    if (json.has("_suffix")) {
1451      JsonArray array = json.getAsJsonArray("_suffix");
1452      for (int i = 0; i < array.size(); i++) {
1453        if (i == res.getSuffix().size())
1454          res.getSuffix().add(parseString(null));
1455        if (array.get(i) instanceof JsonObject) 
1456          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1457      }
1458    };
1459    if (json.has("period"))
1460      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1461    return res;
1462  }
1463
1464  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
1465    DataRequirement res = new DataRequirement();
1466    parseElementProperties(json, res);
1467    if (json.has("type"))
1468      res.setTypeElement(parseCode(json.get("type").getAsString()));
1469    if (json.has("_type"))
1470      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1471    if (json.has("profile"))
1472      res.setProfile(parseReference(json.getAsJsonObject("profile")));
1473    if (json.has("mustSupport")) {
1474      JsonArray array = json.getAsJsonArray("mustSupport");
1475      for (int i = 0; i < array.size(); i++) {
1476        res.getMustSupport().add(parseString(array.get(i).getAsString()));
1477      }
1478    };
1479    if (json.has("_mustSupport")) {
1480      JsonArray array = json.getAsJsonArray("_mustSupport");
1481      for (int i = 0; i < array.size(); i++) {
1482        if (i == res.getMustSupport().size())
1483          res.getMustSupport().add(parseString(null));
1484        if (array.get(i) instanceof JsonObject) 
1485          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
1486      }
1487    };
1488    if (json.has("codeFilter")) {
1489      JsonArray array = json.getAsJsonArray("codeFilter");
1490      for (int i = 0; i < array.size(); i++) {
1491        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
1492      }
1493    };
1494    if (json.has("dateFilter")) {
1495      JsonArray array = json.getAsJsonArray("dateFilter");
1496      for (int i = 0; i < array.size(); i++) {
1497        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
1498      }
1499    };
1500    return res;
1501  }
1502
1503  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
1504    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
1505    parseElementProperties(json, res);
1506    if (json.has("path"))
1507      res.setPathElement(parseString(json.get("path").getAsString()));
1508    if (json.has("_path"))
1509      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1510    Type valueSet = parseType("valueSet", json);
1511    if (valueSet != null)
1512      res.setValueSet(valueSet);
1513    if (json.has("valueCode")) {
1514      JsonArray array = json.getAsJsonArray("valueCode");
1515      for (int i = 0; i < array.size(); i++) {
1516        res.getValueCode().add(parseCode(array.get(i).getAsString()));
1517      }
1518    };
1519    if (json.has("_valueCode")) {
1520      JsonArray array = json.getAsJsonArray("_valueCode");
1521      for (int i = 0; i < array.size(); i++) {
1522        if (i == res.getValueCode().size())
1523          res.getValueCode().add(parseCode(null));
1524        if (array.get(i) instanceof JsonObject) 
1525          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueCode().get(i));
1526      }
1527    };
1528    if (json.has("valueCoding")) {
1529      JsonArray array = json.getAsJsonArray("valueCoding");
1530      for (int i = 0; i < array.size(); i++) {
1531        res.getValueCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1532      }
1533    };
1534    if (json.has("valueCodeableConcept")) {
1535      JsonArray array = json.getAsJsonArray("valueCodeableConcept");
1536      for (int i = 0; i < array.size(); i++) {
1537        res.getValueCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1538      }
1539    };
1540    return res;
1541  }
1542
1543  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
1544    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
1545    parseElementProperties(json, res);
1546    if (json.has("path"))
1547      res.setPathElement(parseString(json.get("path").getAsString()));
1548    if (json.has("_path"))
1549      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1550    Type value = parseType("value", json);
1551    if (value != null)
1552      res.setValue(value);
1553    return res;
1554  }
1555
1556  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1557    Meta res = new Meta();
1558    parseElementProperties(json, res);
1559    if (json.has("versionId"))
1560      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1561    if (json.has("_versionId"))
1562      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
1563    if (json.has("lastUpdated"))
1564      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1565    if (json.has("_lastUpdated"))
1566      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
1567    if (json.has("profile")) {
1568      JsonArray array = json.getAsJsonArray("profile");
1569      for (int i = 0; i < array.size(); i++) {
1570        res.getProfile().add(parseUri(array.get(i).getAsString()));
1571      }
1572    };
1573    if (json.has("_profile")) {
1574      JsonArray array = json.getAsJsonArray("_profile");
1575      for (int i = 0; i < array.size(); i++) {
1576        if (i == res.getProfile().size())
1577          res.getProfile().add(parseUri(null));
1578        if (array.get(i) instanceof JsonObject) 
1579          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1580      }
1581    };
1582    if (json.has("security")) {
1583      JsonArray array = json.getAsJsonArray("security");
1584      for (int i = 0; i < array.size(); i++) {
1585        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1586      }
1587    };
1588    if (json.has("tag")) {
1589      JsonArray array = json.getAsJsonArray("tag");
1590      for (int i = 0; i < array.size(); i++) {
1591        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1592      }
1593    };
1594    return res;
1595  }
1596
1597  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1598    ParameterDefinition res = new ParameterDefinition();
1599    parseElementProperties(json, res);
1600    if (json.has("name"))
1601      res.setNameElement(parseCode(json.get("name").getAsString()));
1602    if (json.has("_name"))
1603      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1604    if (json.has("use"))
1605      res.setUseElement(parseCode(json.get("use").getAsString()));
1606    if (json.has("_use"))
1607      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1608    if (json.has("min"))
1609      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1610    if (json.has("_min"))
1611      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1612    if (json.has("max"))
1613      res.setMaxElement(parseString(json.get("max").getAsString()));
1614    if (json.has("_max"))
1615      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1616    if (json.has("documentation"))
1617      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1618    if (json.has("_documentation"))
1619      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1620    if (json.has("type"))
1621      res.setTypeElement(parseCode(json.get("type").getAsString()));
1622    if (json.has("_type"))
1623      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1624    if (json.has("profile"))
1625      res.setProfile(parseReference(json.getAsJsonObject("profile")));
1626    return res;
1627  }
1628
1629  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
1630    ContactPoint res = new ContactPoint();
1631    parseElementProperties(json, res);
1632    if (json.has("system"))
1633      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
1634    if (json.has("_system"))
1635      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1636    if (json.has("value"))
1637      res.setValueElement(parseString(json.get("value").getAsString()));
1638    if (json.has("_value"))
1639      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1640    if (json.has("use"))
1641      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
1642    if (json.has("_use"))
1643      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1644    if (json.has("rank"))
1645      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
1646    if (json.has("_rank"))
1647      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
1648    if (json.has("period"))
1649      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1650    return res;
1651  }
1652
1653  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1654    Parameters res = new Parameters();
1655    parseResourceProperties(json, res);
1656    if (json.has("parameter")) {
1657      JsonArray array = json.getAsJsonArray("parameter");
1658      for (int i = 0; i < array.size(); i++) {
1659        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1660      }
1661    };
1662    return res;
1663  }
1664
1665  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1666    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1667    parseBackboneProperties(json, res);
1668    if (json.has("name"))
1669      res.setNameElement(parseString(json.get("name").getAsString()));
1670    if (json.has("_name"))
1671      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1672    Type value = parseType("value", json);
1673    if (value != null)
1674      res.setValue(value);
1675    if (json.has("resource"))
1676      res.setResource(parseResource(json.getAsJsonObject("resource")));
1677    if (json.has("part")) {
1678      JsonArray array = json.getAsJsonArray("part");
1679      for (int i = 0; i < array.size(); i++) {
1680        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1681      }
1682    };
1683    return res;
1684  }
1685
1686  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1687    if (json.has("id"))
1688      res.setIdElement(parseId(json.get("id").getAsString()));
1689    if (json.has("_id"))
1690      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1691    if (json.has("meta"))
1692      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1693    if (json.has("implicitRules"))
1694      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1695    if (json.has("_implicitRules"))
1696      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1697    if (json.has("language"))
1698      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1699    if (json.has("_language"))
1700      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1701  }
1702
1703  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1704    parseResourceProperties(json, res);
1705    if (json.has("text"))
1706      res.setText(parseNarrative(json.getAsJsonObject("text")));
1707    if (json.has("contained")) {
1708      JsonArray array = json.getAsJsonArray("contained");
1709      for (int i = 0; i < array.size(); i++) {
1710        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1711      }
1712    };
1713    if (json.has("extension")) {
1714      JsonArray array = json.getAsJsonArray("extension");
1715      for (int i = 0; i < array.size(); i++) {
1716        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1717      }
1718    };
1719    if (json.has("modifierExtension")) {
1720      JsonArray array = json.getAsJsonArray("modifierExtension");
1721      for (int i = 0; i < array.size(); i++) {
1722        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1723      }
1724    };
1725  }
1726
1727  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1728    Account res = new Account();
1729    parseDomainResourceProperties(json, res);
1730    if (json.has("identifier")) {
1731      JsonArray array = json.getAsJsonArray("identifier");
1732      for (int i = 0; i < array.size(); i++) {
1733        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1734      }
1735    };
1736    if (json.has("name"))
1737      res.setNameElement(parseString(json.get("name").getAsString()));
1738    if (json.has("_name"))
1739      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1740    if (json.has("type"))
1741      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1742    if (json.has("status"))
1743      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1744    if (json.has("_status"))
1745      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1746    if (json.has("activePeriod"))
1747      res.setActivePeriod(parsePeriod(json.getAsJsonObject("activePeriod")));
1748    if (json.has("currency"))
1749      res.setCurrency(parseCoding(json.getAsJsonObject("currency")));
1750    if (json.has("balance"))
1751      res.setBalance(parseMoney(json.getAsJsonObject("balance")));
1752    if (json.has("coveragePeriod"))
1753      res.setCoveragePeriod(parsePeriod(json.getAsJsonObject("coveragePeriod")));
1754    if (json.has("subject"))
1755      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1756    if (json.has("owner"))
1757      res.setOwner(parseReference(json.getAsJsonObject("owner")));
1758    if (json.has("description"))
1759      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1760    if (json.has("_description"))
1761      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1762    return res;
1763  }
1764
1765  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
1766    AllergyIntolerance res = new AllergyIntolerance();
1767    parseDomainResourceProperties(json, res);
1768    if (json.has("identifier")) {
1769      JsonArray array = json.getAsJsonArray("identifier");
1770      for (int i = 0; i < array.size(); i++) {
1771        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1772      }
1773    };
1774    if (json.has("status"))
1775      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AllergyIntolerance.AllergyIntoleranceStatus.NULL, new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory()));
1776    if (json.has("_status"))
1777      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1778    if (json.has("type"))
1779      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
1780    if (json.has("_type"))
1781      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1782    if (json.has("category"))
1783      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
1784    if (json.has("_category"))
1785      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
1786    if (json.has("criticality"))
1787      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
1788    if (json.has("_criticality"))
1789      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
1790    if (json.has("substance"))
1791      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1792    if (json.has("patient"))
1793      res.setPatient(parseReference(json.getAsJsonObject("patient")));
1794    if (json.has("recordedDate"))
1795      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
1796    if (json.has("_recordedDate"))
1797      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
1798    if (json.has("recorder"))
1799      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
1800    if (json.has("reporter"))
1801      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
1802    if (json.has("onset"))
1803      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1804    if (json.has("_onset"))
1805      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1806    if (json.has("lastOccurence"))
1807      res.setLastOccurenceElement(parseDateTime(json.get("lastOccurence").getAsString()));
1808    if (json.has("_lastOccurence"))
1809      parseElementProperties(json.getAsJsonObject("_lastOccurence"), res.getLastOccurenceElement());
1810    if (json.has("note")) {
1811      JsonArray array = json.getAsJsonArray("note");
1812      for (int i = 0; i < array.size(); i++) {
1813        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1814      }
1815    };
1816    if (json.has("reaction")) {
1817      JsonArray array = json.getAsJsonArray("reaction");
1818      for (int i = 0; i < array.size(); i++) {
1819        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
1820      }
1821    };
1822    return res;
1823  }
1824
1825  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
1826    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
1827    parseBackboneProperties(json, res);
1828    if (json.has("substance"))
1829      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1830    if (json.has("certainty"))
1831      res.setCertaintyElement(parseEnumeration(json.get("certainty").getAsString(), AllergyIntolerance.AllergyIntoleranceCertainty.NULL, new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory()));
1832    if (json.has("_certainty"))
1833      parseElementProperties(json.getAsJsonObject("_certainty"), res.getCertaintyElement());
1834    if (json.has("manifestation")) {
1835      JsonArray array = json.getAsJsonArray("manifestation");
1836      for (int i = 0; i < array.size(); i++) {
1837        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1838      }
1839    };
1840    if (json.has("description"))
1841      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1842    if (json.has("_description"))
1843      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1844    if (json.has("onset"))
1845      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1846    if (json.has("_onset"))
1847      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1848    if (json.has("severity"))
1849      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
1850    if (json.has("_severity"))
1851      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1852    if (json.has("exposureRoute"))
1853      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
1854    if (json.has("note")) {
1855      JsonArray array = json.getAsJsonArray("note");
1856      for (int i = 0; i < array.size(); i++) {
1857        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1858      }
1859    };
1860    return res;
1861  }
1862
1863  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
1864    Appointment res = new Appointment();
1865    parseDomainResourceProperties(json, res);
1866    if (json.has("identifier")) {
1867      JsonArray array = json.getAsJsonArray("identifier");
1868      for (int i = 0; i < array.size(); i++) {
1869        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1870      }
1871    };
1872    if (json.has("status"))
1873      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
1874    if (json.has("_status"))
1875      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1876    if (json.has("serviceCategory"))
1877      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
1878    if (json.has("serviceType")) {
1879      JsonArray array = json.getAsJsonArray("serviceType");
1880      for (int i = 0; i < array.size(); i++) {
1881        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1882      }
1883    };
1884    if (json.has("specialty")) {
1885      JsonArray array = json.getAsJsonArray("specialty");
1886      for (int i = 0; i < array.size(); i++) {
1887        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1888      }
1889    };
1890    if (json.has("appointmentType"))
1891      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
1892    if (json.has("reason"))
1893      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
1894    if (json.has("priority"))
1895      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
1896    if (json.has("_priority"))
1897      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
1898    if (json.has("description"))
1899      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1900    if (json.has("_description"))
1901      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1902    if (json.has("start"))
1903      res.setStartElement(parseInstant(json.get("start").getAsString()));
1904    if (json.has("_start"))
1905      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1906    if (json.has("end"))
1907      res.setEndElement(parseInstant(json.get("end").getAsString()));
1908    if (json.has("_end"))
1909      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1910    if (json.has("minutesDuration"))
1911      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
1912    if (json.has("_minutesDuration"))
1913      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
1914    if (json.has("slot")) {
1915      JsonArray array = json.getAsJsonArray("slot");
1916      for (int i = 0; i < array.size(); i++) {
1917        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
1918      }
1919    };
1920    if (json.has("created"))
1921      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
1922    if (json.has("_created"))
1923      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
1924    if (json.has("comment"))
1925      res.setCommentElement(parseString(json.get("comment").getAsString()));
1926    if (json.has("_comment"))
1927      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1928    if (json.has("participant")) {
1929      JsonArray array = json.getAsJsonArray("participant");
1930      for (int i = 0; i < array.size(); i++) {
1931        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
1932      }
1933    };
1934    return res;
1935  }
1936
1937  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
1938    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
1939    parseBackboneProperties(json, res);
1940    if (json.has("type")) {
1941      JsonArray array = json.getAsJsonArray("type");
1942      for (int i = 0; i < array.size(); i++) {
1943        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1944      }
1945    };
1946    if (json.has("actor"))
1947      res.setActor(parseReference(json.getAsJsonObject("actor")));
1948    if (json.has("required"))
1949      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
1950    if (json.has("_required"))
1951      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
1952    if (json.has("status"))
1953      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
1954    if (json.has("_status"))
1955      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1956    return res;
1957  }
1958
1959  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
1960    AppointmentResponse res = new AppointmentResponse();
1961    parseDomainResourceProperties(json, res);
1962    if (json.has("identifier")) {
1963      JsonArray array = json.getAsJsonArray("identifier");
1964      for (int i = 0; i < array.size(); i++) {
1965        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1966      }
1967    };
1968    if (json.has("appointment"))
1969      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
1970    if (json.has("start"))
1971      res.setStartElement(parseInstant(json.get("start").getAsString()));
1972    if (json.has("_start"))
1973      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1974    if (json.has("end"))
1975      res.setEndElement(parseInstant(json.get("end").getAsString()));
1976    if (json.has("_end"))
1977      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1978    if (json.has("participantType")) {
1979      JsonArray array = json.getAsJsonArray("participantType");
1980      for (int i = 0; i < array.size(); i++) {
1981        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1982      }
1983    };
1984    if (json.has("actor"))
1985      res.setActor(parseReference(json.getAsJsonObject("actor")));
1986    if (json.has("participantStatus"))
1987      res.setParticipantStatusElement(parseCode(json.get("participantStatus").getAsString()));
1988    if (json.has("_participantStatus"))
1989      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
1990    if (json.has("comment"))
1991      res.setCommentElement(parseString(json.get("comment").getAsString()));
1992    if (json.has("_comment"))
1993      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1994    return res;
1995  }
1996
1997  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
1998    AuditEvent res = new AuditEvent();
1999    parseDomainResourceProperties(json, res);
2000    if (json.has("type"))
2001      res.setType(parseCoding(json.getAsJsonObject("type")));
2002    if (json.has("subtype")) {
2003      JsonArray array = json.getAsJsonArray("subtype");
2004      for (int i = 0; i < array.size(); i++) {
2005        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2006      }
2007    };
2008    if (json.has("action"))
2009      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2010    if (json.has("_action"))
2011      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2012    if (json.has("recorded"))
2013      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2014    if (json.has("_recorded"))
2015      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2016    if (json.has("outcome"))
2017      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2018    if (json.has("_outcome"))
2019      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2020    if (json.has("outcomeDesc"))
2021      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2022    if (json.has("_outcomeDesc"))
2023      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2024    if (json.has("purposeOfEvent")) {
2025      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2026      for (int i = 0; i < array.size(); i++) {
2027        res.getPurposeOfEvent().add(parseCoding(array.get(i).getAsJsonObject()));
2028      }
2029    };
2030    if (json.has("agent")) {
2031      JsonArray array = json.getAsJsonArray("agent");
2032      for (int i = 0; i < array.size(); i++) {
2033        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2034      }
2035    };
2036    if (json.has("source"))
2037      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2038    if (json.has("entity")) {
2039      JsonArray array = json.getAsJsonArray("entity");
2040      for (int i = 0; i < array.size(); i++) {
2041        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2042      }
2043    };
2044    return res;
2045  }
2046
2047  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2048    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2049    parseBackboneProperties(json, res);
2050    if (json.has("role")) {
2051      JsonArray array = json.getAsJsonArray("role");
2052      for (int i = 0; i < array.size(); i++) {
2053        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2054      }
2055    };
2056    if (json.has("reference"))
2057      res.setReference(parseReference(json.getAsJsonObject("reference")));
2058    if (json.has("userId"))
2059      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
2060    if (json.has("altId"))
2061      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2062    if (json.has("_altId"))
2063      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2064    if (json.has("name"))
2065      res.setNameElement(parseString(json.get("name").getAsString()));
2066    if (json.has("_name"))
2067      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2068    if (json.has("requestor"))
2069      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2070    if (json.has("_requestor"))
2071      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2072    if (json.has("location"))
2073      res.setLocation(parseReference(json.getAsJsonObject("location")));
2074    if (json.has("policy")) {
2075      JsonArray array = json.getAsJsonArray("policy");
2076      for (int i = 0; i < array.size(); i++) {
2077        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2078      }
2079    };
2080    if (json.has("_policy")) {
2081      JsonArray array = json.getAsJsonArray("_policy");
2082      for (int i = 0; i < array.size(); i++) {
2083        if (i == res.getPolicy().size())
2084          res.getPolicy().add(parseUri(null));
2085        if (array.get(i) instanceof JsonObject) 
2086          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2087      }
2088    };
2089    if (json.has("media"))
2090      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2091    if (json.has("network"))
2092      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2093    if (json.has("purposeOfUse")) {
2094      JsonArray array = json.getAsJsonArray("purposeOfUse");
2095      for (int i = 0; i < array.size(); i++) {
2096        res.getPurposeOfUse().add(parseCoding(array.get(i).getAsJsonObject()));
2097      }
2098    };
2099    return res;
2100  }
2101
2102  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2103    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2104    parseBackboneProperties(json, res);
2105    if (json.has("address"))
2106      res.setAddressElement(parseString(json.get("address").getAsString()));
2107    if (json.has("_address"))
2108      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2109    if (json.has("type"))
2110      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventParticipantNetworkType.NULL, new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory()));
2111    if (json.has("_type"))
2112      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2113    return res;
2114  }
2115
2116  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2117    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2118    parseBackboneProperties(json, res);
2119    if (json.has("site"))
2120      res.setSiteElement(parseString(json.get("site").getAsString()));
2121    if (json.has("_site"))
2122      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2123    if (json.has("identifier"))
2124      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2125    if (json.has("type")) {
2126      JsonArray array = json.getAsJsonArray("type");
2127      for (int i = 0; i < array.size(); i++) {
2128        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2129      }
2130    };
2131    return res;
2132  }
2133
2134  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2135    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2136    parseBackboneProperties(json, res);
2137    if (json.has("identifier"))
2138      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2139    if (json.has("reference"))
2140      res.setReference(parseReference(json.getAsJsonObject("reference")));
2141    if (json.has("type"))
2142      res.setType(parseCoding(json.getAsJsonObject("type")));
2143    if (json.has("role"))
2144      res.setRole(parseCoding(json.getAsJsonObject("role")));
2145    if (json.has("lifecycle"))
2146      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2147    if (json.has("securityLabel")) {
2148      JsonArray array = json.getAsJsonArray("securityLabel");
2149      for (int i = 0; i < array.size(); i++) {
2150        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2151      }
2152    };
2153    if (json.has("name"))
2154      res.setNameElement(parseString(json.get("name").getAsString()));
2155    if (json.has("_name"))
2156      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2157    if (json.has("description"))
2158      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2159    if (json.has("_description"))
2160      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2161    if (json.has("query"))
2162      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2163    if (json.has("_query"))
2164      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2165    if (json.has("detail")) {
2166      JsonArray array = json.getAsJsonArray("detail");
2167      for (int i = 0; i < array.size(); i++) {
2168        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2169      }
2170    };
2171    return res;
2172  }
2173
2174  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2175    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2176    parseBackboneProperties(json, res);
2177    if (json.has("type"))
2178      res.setTypeElement(parseString(json.get("type").getAsString()));
2179    if (json.has("_type"))
2180      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2181    if (json.has("value"))
2182      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
2183    if (json.has("_value"))
2184      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2185    return res;
2186  }
2187
2188  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2189    Basic res = new Basic();
2190    parseDomainResourceProperties(json, res);
2191    if (json.has("identifier")) {
2192      JsonArray array = json.getAsJsonArray("identifier");
2193      for (int i = 0; i < array.size(); i++) {
2194        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2195      }
2196    };
2197    if (json.has("code"))
2198      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2199    if (json.has("subject"))
2200      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2201    if (json.has("created"))
2202      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2203    if (json.has("_created"))
2204      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2205    if (json.has("author"))
2206      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2207    return res;
2208  }
2209
2210  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2211    Binary res = new Binary();
2212    parseResourceProperties(json, res);
2213    if (json.has("contentType"))
2214      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2215    if (json.has("_contentType"))
2216      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
2217    if (json.has("content"))
2218      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2219    if (json.has("_content"))
2220      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
2221    return res;
2222  }
2223
2224  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
2225    BodySite res = new BodySite();
2226    parseDomainResourceProperties(json, res);
2227    if (json.has("patient"))
2228      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2229    if (json.has("identifier")) {
2230      JsonArray array = json.getAsJsonArray("identifier");
2231      for (int i = 0; i < array.size(); i++) {
2232        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2233      }
2234    };
2235    if (json.has("code"))
2236      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2237    if (json.has("modifier")) {
2238      JsonArray array = json.getAsJsonArray("modifier");
2239      for (int i = 0; i < array.size(); i++) {
2240        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2241      }
2242    };
2243    if (json.has("description"))
2244      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2245    if (json.has("_description"))
2246      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2247    if (json.has("image")) {
2248      JsonArray array = json.getAsJsonArray("image");
2249      for (int i = 0; i < array.size(); i++) {
2250        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
2251      }
2252    };
2253    return res;
2254  }
2255
2256  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
2257    Bundle res = new Bundle();
2258    parseResourceProperties(json, res);
2259    if (json.has("type"))
2260      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
2261    if (json.has("_type"))
2262      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2263    if (json.has("total"))
2264      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
2265    if (json.has("_total"))
2266      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
2267    if (json.has("link")) {
2268      JsonArray array = json.getAsJsonArray("link");
2269      for (int i = 0; i < array.size(); i++) {
2270        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
2271      }
2272    };
2273    if (json.has("entry")) {
2274      JsonArray array = json.getAsJsonArray("entry");
2275      for (int i = 0; i < array.size(); i++) {
2276        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
2277      }
2278    };
2279    if (json.has("signature"))
2280      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
2281    return res;
2282  }
2283
2284  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2285    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
2286    parseBackboneProperties(json, res);
2287    if (json.has("relation"))
2288      res.setRelationElement(parseString(json.get("relation").getAsString()));
2289    if (json.has("_relation"))
2290      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
2291    if (json.has("url"))
2292      res.setUrlElement(parseUri(json.get("url").getAsString()));
2293    if (json.has("_url"))
2294      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2295    return res;
2296  }
2297
2298  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2299    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
2300    parseBackboneProperties(json, res);
2301    if (json.has("link")) {
2302      JsonArray array = json.getAsJsonArray("link");
2303      for (int i = 0; i < array.size(); i++) {
2304        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
2305      }
2306    };
2307    if (json.has("fullUrl"))
2308      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
2309    if (json.has("_fullUrl"))
2310      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
2311    if (json.has("resource"))
2312      res.setResource(parseResource(json.getAsJsonObject("resource")));
2313    if (json.has("search"))
2314      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
2315    if (json.has("request"))
2316      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
2317    if (json.has("response"))
2318      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
2319    return res;
2320  }
2321
2322  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2323    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
2324    parseBackboneProperties(json, res);
2325    if (json.has("mode"))
2326      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
2327    if (json.has("_mode"))
2328      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
2329    if (json.has("score"))
2330      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
2331    if (json.has("_score"))
2332      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
2333    return res;
2334  }
2335
2336  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2337    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
2338    parseBackboneProperties(json, res);
2339    if (json.has("method"))
2340      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
2341    if (json.has("_method"))
2342      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
2343    if (json.has("url"))
2344      res.setUrlElement(parseUri(json.get("url").getAsString()));
2345    if (json.has("_url"))
2346      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2347    if (json.has("ifNoneMatch"))
2348      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
2349    if (json.has("_ifNoneMatch"))
2350      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
2351    if (json.has("ifModifiedSince"))
2352      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
2353    if (json.has("_ifModifiedSince"))
2354      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
2355    if (json.has("ifMatch"))
2356      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
2357    if (json.has("_ifMatch"))
2358      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
2359    if (json.has("ifNoneExist"))
2360      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
2361    if (json.has("_ifNoneExist"))
2362      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
2363    return res;
2364  }
2365
2366  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2367    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
2368    parseBackboneProperties(json, res);
2369    if (json.has("status"))
2370      res.setStatusElement(parseString(json.get("status").getAsString()));
2371    if (json.has("_status"))
2372      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2373    if (json.has("location"))
2374      res.setLocationElement(parseUri(json.get("location").getAsString()));
2375    if (json.has("_location"))
2376      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
2377    if (json.has("etag"))
2378      res.setEtagElement(parseString(json.get("etag").getAsString()));
2379    if (json.has("_etag"))
2380      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
2381    if (json.has("lastModified"))
2382      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
2383    if (json.has("_lastModified"))
2384      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
2385    return res;
2386  }
2387
2388  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
2389    CarePlan res = new CarePlan();
2390    parseDomainResourceProperties(json, res);
2391    if (json.has("identifier")) {
2392      JsonArray array = json.getAsJsonArray("identifier");
2393      for (int i = 0; i < array.size(); i++) {
2394        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2395      }
2396    };
2397    if (json.has("subject"))
2398      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2399    if (json.has("status"))
2400      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
2401    if (json.has("_status"))
2402      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2403    if (json.has("context"))
2404      res.setContext(parseReference(json.getAsJsonObject("context")));
2405    if (json.has("period"))
2406      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2407    if (json.has("author")) {
2408      JsonArray array = json.getAsJsonArray("author");
2409      for (int i = 0; i < array.size(); i++) {
2410        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
2411      }
2412    };
2413    if (json.has("modified"))
2414      res.setModifiedElement(parseDateTime(json.get("modified").getAsString()));
2415    if (json.has("_modified"))
2416      parseElementProperties(json.getAsJsonObject("_modified"), res.getModifiedElement());
2417    if (json.has("category")) {
2418      JsonArray array = json.getAsJsonArray("category");
2419      for (int i = 0; i < array.size(); i++) {
2420        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2421      }
2422    };
2423    if (json.has("description"))
2424      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2425    if (json.has("_description"))
2426      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2427    if (json.has("addresses")) {
2428      JsonArray array = json.getAsJsonArray("addresses");
2429      for (int i = 0; i < array.size(); i++) {
2430        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
2431      }
2432    };
2433    if (json.has("support")) {
2434      JsonArray array = json.getAsJsonArray("support");
2435      for (int i = 0; i < array.size(); i++) {
2436        res.getSupport().add(parseReference(array.get(i).getAsJsonObject()));
2437      }
2438    };
2439    if (json.has("relatedPlan")) {
2440      JsonArray array = json.getAsJsonArray("relatedPlan");
2441      for (int i = 0; i < array.size(); i++) {
2442        res.getRelatedPlan().add(parseCarePlanCarePlanRelatedPlanComponent(array.get(i).getAsJsonObject(), res));
2443      }
2444    };
2445    if (json.has("participant")) {
2446      JsonArray array = json.getAsJsonArray("participant");
2447      for (int i = 0; i < array.size(); i++) {
2448        res.getParticipant().add(parseCarePlanCarePlanParticipantComponent(array.get(i).getAsJsonObject(), res));
2449      }
2450    };
2451    if (json.has("goal")) {
2452      JsonArray array = json.getAsJsonArray("goal");
2453      for (int i = 0; i < array.size(); i++) {
2454        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
2455      }
2456    };
2457    if (json.has("activity")) {
2458      JsonArray array = json.getAsJsonArray("activity");
2459      for (int i = 0; i < array.size(); i++) {
2460        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
2461      }
2462    };
2463    if (json.has("note"))
2464      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
2465    return res;
2466  }
2467
2468  protected CarePlan.CarePlanRelatedPlanComponent parseCarePlanCarePlanRelatedPlanComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2469    CarePlan.CarePlanRelatedPlanComponent res = new CarePlan.CarePlanRelatedPlanComponent();
2470    parseBackboneProperties(json, res);
2471    if (json.has("code"))
2472      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CarePlan.CarePlanRelationship.NULL, new CarePlan.CarePlanRelationshipEnumFactory()));
2473    if (json.has("_code"))
2474      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
2475    if (json.has("plan"))
2476      res.setPlan(parseReference(json.getAsJsonObject("plan")));
2477    return res;
2478  }
2479
2480  protected CarePlan.CarePlanParticipantComponent parseCarePlanCarePlanParticipantComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2481    CarePlan.CarePlanParticipantComponent res = new CarePlan.CarePlanParticipantComponent();
2482    parseBackboneProperties(json, res);
2483    if (json.has("role"))
2484      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2485    if (json.has("member"))
2486      res.setMember(parseReference(json.getAsJsonObject("member")));
2487    return res;
2488  }
2489
2490  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2491    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
2492    parseBackboneProperties(json, res);
2493    if (json.has("actionResulting")) {
2494      JsonArray array = json.getAsJsonArray("actionResulting");
2495      for (int i = 0; i < array.size(); i++) {
2496        res.getActionResulting().add(parseReference(array.get(i).getAsJsonObject()));
2497      }
2498    };
2499    if (json.has("progress")) {
2500      JsonArray array = json.getAsJsonArray("progress");
2501      for (int i = 0; i < array.size(); i++) {
2502        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
2503      }
2504    };
2505    if (json.has("reference"))
2506      res.setReference(parseReference(json.getAsJsonObject("reference")));
2507    if (json.has("detail"))
2508      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
2509    return res;
2510  }
2511
2512  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2513    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
2514    parseBackboneProperties(json, res);
2515    if (json.has("category"))
2516      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
2517    if (json.has("code"))
2518      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2519    if (json.has("reasonCode")) {
2520      JsonArray array = json.getAsJsonArray("reasonCode");
2521      for (int i = 0; i < array.size(); i++) {
2522        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2523      }
2524    };
2525    if (json.has("reasonReference")) {
2526      JsonArray array = json.getAsJsonArray("reasonReference");
2527      for (int i = 0; i < array.size(); i++) {
2528        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2529      }
2530    };
2531    if (json.has("goal")) {
2532      JsonArray array = json.getAsJsonArray("goal");
2533      for (int i = 0; i < array.size(); i++) {
2534        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
2535      }
2536    };
2537    if (json.has("status"))
2538      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
2539    if (json.has("_status"))
2540      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2541    if (json.has("statusReason"))
2542      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
2543    if (json.has("prohibited"))
2544      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
2545    if (json.has("_prohibited"))
2546      parseElementProperties(json.getAsJsonObject("_prohibited"), res.getProhibitedElement());
2547    Type scheduled = parseType("scheduled", json);
2548    if (scheduled != null)
2549      res.setScheduled(scheduled);
2550    if (json.has("location"))
2551      res.setLocation(parseReference(json.getAsJsonObject("location")));
2552    if (json.has("performer")) {
2553      JsonArray array = json.getAsJsonArray("performer");
2554      for (int i = 0; i < array.size(); i++) {
2555        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
2556      }
2557    };
2558    Type product = parseType("product", json);
2559    if (product != null)
2560      res.setProduct(product);
2561    if (json.has("dailyAmount"))
2562      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
2563    if (json.has("quantity"))
2564      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2565    if (json.has("description"))
2566      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2567    if (json.has("_description"))
2568      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2569    return res;
2570  }
2571
2572  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
2573    CareTeam res = new CareTeam();
2574    parseDomainResourceProperties(json, res);
2575    if (json.has("identifier")) {
2576      JsonArray array = json.getAsJsonArray("identifier");
2577      for (int i = 0; i < array.size(); i++) {
2578        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2579      }
2580    };
2581    if (json.has("status"))
2582      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
2583    if (json.has("type")) {
2584      JsonArray array = json.getAsJsonArray("type");
2585      for (int i = 0; i < array.size(); i++) {
2586        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2587      }
2588    };
2589    if (json.has("name"))
2590      res.setNameElement(parseString(json.get("name").getAsString()));
2591    if (json.has("_name"))
2592      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2593    if (json.has("subject"))
2594      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2595    if (json.has("period"))
2596      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2597    if (json.has("participant")) {
2598      JsonArray array = json.getAsJsonArray("participant");
2599      for (int i = 0; i < array.size(); i++) {
2600        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
2601      }
2602    };
2603    if (json.has("managingOrganization"))
2604      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
2605    return res;
2606  }
2607
2608  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
2609    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
2610    parseBackboneProperties(json, res);
2611    if (json.has("role"))
2612      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2613    if (json.has("member"))
2614      res.setMember(parseReference(json.getAsJsonObject("member")));
2615    if (json.has("period"))
2616      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2617    return res;
2618  }
2619
2620  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
2621    Claim res = new Claim();
2622    parseDomainResourceProperties(json, res);
2623    if (json.has("type"))
2624      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Claim.ClaimType.NULL, new Claim.ClaimTypeEnumFactory()));
2625    if (json.has("_type"))
2626      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2627    if (json.has("subType")) {
2628      JsonArray array = json.getAsJsonArray("subType");
2629      for (int i = 0; i < array.size(); i++) {
2630        res.getSubType().add(parseCoding(array.get(i).getAsJsonObject()));
2631      }
2632    };
2633    if (json.has("identifier")) {
2634      JsonArray array = json.getAsJsonArray("identifier");
2635      for (int i = 0; i < array.size(); i++) {
2636        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2637      }
2638    };
2639    if (json.has("ruleset"))
2640      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
2641    if (json.has("originalRuleset"))
2642      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2643    if (json.has("created"))
2644      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2645    if (json.has("_created"))
2646      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2647    if (json.has("billablePeriod"))
2648      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
2649    Type target = parseType("target", json);
2650    if (target != null)
2651      res.setTarget(target);
2652    Type provider = parseType("provider", json);
2653    if (provider != null)
2654      res.setProvider(provider);
2655    Type organization = parseType("organization", json);
2656    if (organization != null)
2657      res.setOrganization(organization);
2658    if (json.has("use"))
2659      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
2660    if (json.has("_use"))
2661      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
2662    if (json.has("priority"))
2663      res.setPriority(parseCoding(json.getAsJsonObject("priority")));
2664    if (json.has("fundsReserve"))
2665      res.setFundsReserve(parseCoding(json.getAsJsonObject("fundsReserve")));
2666    Type enterer = parseType("enterer", json);
2667    if (enterer != null)
2668      res.setEnterer(enterer);
2669    Type facility = parseType("facility", json);
2670    if (facility != null)
2671      res.setFacility(facility);
2672    if (json.has("related")) {
2673      JsonArray array = json.getAsJsonArray("related");
2674      for (int i = 0; i < array.size(); i++) {
2675        res.getRelated().add(parseClaimRelatedClaimsComponent(array.get(i).getAsJsonObject(), res));
2676      }
2677    };
2678    Type prescription = parseType("prescription", json);
2679    if (prescription != null)
2680      res.setPrescription(prescription);
2681    Type originalPrescription = parseType("originalPrescription", json);
2682    if (originalPrescription != null)
2683      res.setOriginalPrescription(originalPrescription);
2684    if (json.has("payee"))
2685      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
2686    Type referral = parseType("referral", json);
2687    if (referral != null)
2688      res.setReferral(referral);
2689    if (json.has("occurrenceCode")) {
2690      JsonArray array = json.getAsJsonArray("occurrenceCode");
2691      for (int i = 0; i < array.size(); i++) {
2692        res.getOccurrenceCode().add(parseCoding(array.get(i).getAsJsonObject()));
2693      }
2694    };
2695    if (json.has("occurenceSpanCode")) {
2696      JsonArray array = json.getAsJsonArray("occurenceSpanCode");
2697      for (int i = 0; i < array.size(); i++) {
2698        res.getOccurenceSpanCode().add(parseCoding(array.get(i).getAsJsonObject()));
2699      }
2700    };
2701    if (json.has("valueCode")) {
2702      JsonArray array = json.getAsJsonArray("valueCode");
2703      for (int i = 0; i < array.size(); i++) {
2704        res.getValueCode().add(parseCoding(array.get(i).getAsJsonObject()));
2705      }
2706    };
2707    if (json.has("diagnosis")) {
2708      JsonArray array = json.getAsJsonArray("diagnosis");
2709      for (int i = 0; i < array.size(); i++) {
2710        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
2711      }
2712    };
2713    if (json.has("procedure")) {
2714      JsonArray array = json.getAsJsonArray("procedure");
2715      for (int i = 0; i < array.size(); i++) {
2716        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
2717      }
2718    };
2719    if (json.has("specialCondition")) {
2720      JsonArray array = json.getAsJsonArray("specialCondition");
2721      for (int i = 0; i < array.size(); i++) {
2722        res.getSpecialCondition().add(parseCoding(array.get(i).getAsJsonObject()));
2723      }
2724    };
2725    Type patient = parseType("patient", json);
2726    if (patient != null)
2727      res.setPatient(patient);
2728    if (json.has("coverage")) {
2729      JsonArray array = json.getAsJsonArray("coverage");
2730      for (int i = 0; i < array.size(); i++) {
2731        res.getCoverage().add(parseClaimCoverageComponent(array.get(i).getAsJsonObject(), res));
2732      }
2733    };
2734    if (json.has("accidentDate"))
2735      res.setAccidentDateElement(parseDate(json.get("accidentDate").getAsString()));
2736    if (json.has("_accidentDate"))
2737      parseElementProperties(json.getAsJsonObject("_accidentDate"), res.getAccidentDateElement());
2738    if (json.has("accidentType"))
2739      res.setAccidentType(parseCoding(json.getAsJsonObject("accidentType")));
2740    Type accidentLocation = parseType("accidentLocation", json);
2741    if (accidentLocation != null)
2742      res.setAccidentLocation(accidentLocation);
2743    if (json.has("interventionException")) {
2744      JsonArray array = json.getAsJsonArray("interventionException");
2745      for (int i = 0; i < array.size(); i++) {
2746        res.getInterventionException().add(parseCoding(array.get(i).getAsJsonObject()));
2747      }
2748    };
2749    if (json.has("onset")) {
2750      JsonArray array = json.getAsJsonArray("onset");
2751      for (int i = 0; i < array.size(); i++) {
2752        res.getOnset().add(parseClaimOnsetComponent(array.get(i).getAsJsonObject(), res));
2753      }
2754    };
2755    if (json.has("employmentImpacted"))
2756      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
2757    if (json.has("hospitalization"))
2758      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
2759    if (json.has("item")) {
2760      JsonArray array = json.getAsJsonArray("item");
2761      for (int i = 0; i < array.size(); i++) {
2762        res.getItem().add(parseClaimItemsComponent(array.get(i).getAsJsonObject(), res));
2763      }
2764    };
2765    if (json.has("total"))
2766      res.setTotal(parseMoney(json.getAsJsonObject("total")));
2767    if (json.has("additionalMaterial")) {
2768      JsonArray array = json.getAsJsonArray("additionalMaterial");
2769      for (int i = 0; i < array.size(); i++) {
2770        res.getAdditionalMaterial().add(parseCoding(array.get(i).getAsJsonObject()));
2771      }
2772    };
2773    if (json.has("missingTeeth")) {
2774      JsonArray array = json.getAsJsonArray("missingTeeth");
2775      for (int i = 0; i < array.size(); i++) {
2776        res.getMissingTeeth().add(parseClaimMissingTeethComponent(array.get(i).getAsJsonObject(), res));
2777      }
2778    };
2779    return res;
2780  }
2781
2782  protected Claim.RelatedClaimsComponent parseClaimRelatedClaimsComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2783    Claim.RelatedClaimsComponent res = new Claim.RelatedClaimsComponent();
2784    parseBackboneProperties(json, res);
2785    Type claim = parseType("claim", json);
2786    if (claim != null)
2787      res.setClaim(claim);
2788    if (json.has("relationship"))
2789      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
2790    if (json.has("reference"))
2791      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
2792    return res;
2793  }
2794
2795  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2796    Claim.PayeeComponent res = new Claim.PayeeComponent();
2797    parseBackboneProperties(json, res);
2798    if (json.has("type"))
2799      res.setType(parseCoding(json.getAsJsonObject("type")));
2800    Type party = parseType("party", json);
2801    if (party != null)
2802      res.setParty(party);
2803    return res;
2804  }
2805
2806  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2807    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
2808    parseBackboneProperties(json, res);
2809    if (json.has("sequence"))
2810      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2811    if (json.has("_sequence"))
2812      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2813    if (json.has("diagnosis"))
2814      res.setDiagnosis(parseCoding(json.getAsJsonObject("diagnosis")));
2815    return res;
2816  }
2817
2818  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2819    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
2820    parseBackboneProperties(json, res);
2821    if (json.has("sequence"))
2822      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2823    if (json.has("_sequence"))
2824      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2825    if (json.has("date"))
2826      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2827    if (json.has("_date"))
2828      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2829    Type procedure = parseType("procedure", json);
2830    if (procedure != null)
2831      res.setProcedure(procedure);
2832    return res;
2833  }
2834
2835  protected Claim.CoverageComponent parseClaimCoverageComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2836    Claim.CoverageComponent res = new Claim.CoverageComponent();
2837    parseBackboneProperties(json, res);
2838    if (json.has("sequence"))
2839      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2840    if (json.has("_sequence"))
2841      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2842    if (json.has("focal"))
2843      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
2844    if (json.has("_focal"))
2845      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
2846    Type coverage = parseType("coverage", json);
2847    if (coverage != null)
2848      res.setCoverage(coverage);
2849    if (json.has("businessArrangement"))
2850      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
2851    if (json.has("_businessArrangement"))
2852      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
2853    if (json.has("preAuthRef")) {
2854      JsonArray array = json.getAsJsonArray("preAuthRef");
2855      for (int i = 0; i < array.size(); i++) {
2856        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
2857      }
2858    };
2859    if (json.has("_preAuthRef")) {
2860      JsonArray array = json.getAsJsonArray("_preAuthRef");
2861      for (int i = 0; i < array.size(); i++) {
2862        if (i == res.getPreAuthRef().size())
2863          res.getPreAuthRef().add(parseString(null));
2864        if (array.get(i) instanceof JsonObject) 
2865          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
2866      }
2867    };
2868    if (json.has("claimResponse"))
2869      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
2870    if (json.has("originalRuleset"))
2871      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2872    return res;
2873  }
2874
2875  protected Claim.OnsetComponent parseClaimOnsetComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2876    Claim.OnsetComponent res = new Claim.OnsetComponent();
2877    parseBackboneProperties(json, res);
2878    Type time = parseType("time", json);
2879    if (time != null)
2880      res.setTime(time);
2881    if (json.has("type"))
2882      res.setType(parseCoding(json.getAsJsonObject("type")));
2883    return res;
2884  }
2885
2886  protected Claim.ItemsComponent parseClaimItemsComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2887    Claim.ItemsComponent res = new Claim.ItemsComponent();
2888    parseBackboneProperties(json, res);
2889    if (json.has("sequence"))
2890      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2891    if (json.has("_sequence"))
2892      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2893    if (json.has("type"))
2894      res.setType(parseCoding(json.getAsJsonObject("type")));
2895    Type provider = parseType("provider", json);
2896    if (provider != null)
2897      res.setProvider(provider);
2898    Type supervisor = parseType("supervisor", json);
2899    if (supervisor != null)
2900      res.setSupervisor(supervisor);
2901    if (json.has("providerQualification"))
2902      res.setProviderQualification(parseCoding(json.getAsJsonObject("providerQualification")));
2903    if (json.has("diagnosisLinkId")) {
2904      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
2905      for (int i = 0; i < array.size(); i++) {
2906        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2907      }
2908    };
2909    if (json.has("_diagnosisLinkId")) {
2910      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
2911      for (int i = 0; i < array.size(); i++) {
2912        if (i == res.getDiagnosisLinkId().size())
2913          res.getDiagnosisLinkId().add(parsePositiveInt(null));
2914        if (array.get(i) instanceof JsonObject) 
2915          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
2916      }
2917    };
2918    if (json.has("service"))
2919      res.setService(parseCoding(json.getAsJsonObject("service")));
2920    if (json.has("serviceModifier")) {
2921      JsonArray array = json.getAsJsonArray("serviceModifier");
2922      for (int i = 0; i < array.size(); i++) {
2923        res.getServiceModifier().add(parseCoding(array.get(i).getAsJsonObject()));
2924      }
2925    };
2926    if (json.has("modifier")) {
2927      JsonArray array = json.getAsJsonArray("modifier");
2928      for (int i = 0; i < array.size(); i++) {
2929        res.getModifier().add(parseCoding(array.get(i).getAsJsonObject()));
2930      }
2931    };
2932    if (json.has("programCode")) {
2933      JsonArray array = json.getAsJsonArray("programCode");
2934      for (int i = 0; i < array.size(); i++) {
2935        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
2936      }
2937    };
2938    Type serviced = parseType("serviced", json);
2939    if (serviced != null)
2940      res.setServiced(serviced);
2941    if (json.has("place"))
2942      res.setPlace(parseCoding(json.getAsJsonObject("place")));
2943    if (json.has("quantity"))
2944      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2945    if (json.has("unitPrice"))
2946      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2947    if (json.has("factor"))
2948      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2949    if (json.has("_factor"))
2950      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2951    if (json.has("points"))
2952      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2953    if (json.has("_points"))
2954      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2955    if (json.has("net"))
2956      res.setNet(parseMoney(json.getAsJsonObject("net")));
2957    if (json.has("udi")) {
2958      JsonArray array = json.getAsJsonArray("udi");
2959      for (int i = 0; i < array.size(); i++) {
2960        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
2961      }
2962    };
2963    if (json.has("bodySite"))
2964      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
2965    if (json.has("subSite")) {
2966      JsonArray array = json.getAsJsonArray("subSite");
2967      for (int i = 0; i < array.size(); i++) {
2968        res.getSubSite().add(parseCoding(array.get(i).getAsJsonObject()));
2969      }
2970    };
2971    if (json.has("detail")) {
2972      JsonArray array = json.getAsJsonArray("detail");
2973      for (int i = 0; i < array.size(); i++) {
2974        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
2975      }
2976    };
2977    if (json.has("prosthesis"))
2978      res.setProsthesis(parseClaimProsthesisComponent(json.getAsJsonObject("prosthesis"), owner));
2979    return res;
2980  }
2981
2982  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2983    Claim.DetailComponent res = new Claim.DetailComponent();
2984    parseBackboneProperties(json, res);
2985    if (json.has("sequence"))
2986      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2987    if (json.has("_sequence"))
2988      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2989    if (json.has("type"))
2990      res.setType(parseCoding(json.getAsJsonObject("type")));
2991    if (json.has("service"))
2992      res.setService(parseCoding(json.getAsJsonObject("service")));
2993    if (json.has("programCode")) {
2994      JsonArray array = json.getAsJsonArray("programCode");
2995      for (int i = 0; i < array.size(); i++) {
2996        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
2997      }
2998    };
2999    if (json.has("quantity"))
3000      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
3001    if (json.has("unitPrice"))
3002      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
3003    if (json.has("factor"))
3004      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
3005    if (json.has("_factor"))
3006      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
3007    if (json.has("points"))
3008      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
3009    if (json.has("_points"))
3010      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
3011    if (json.has("net"))
3012      res.setNet(parseMoney(json.getAsJsonObject("net")));
3013    if (json.has("udi")) {
3014      JsonArray array = json.getAsJsonArray("udi");
3015      for (int i = 0; i < array.size(); i++) {
3016        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
3017      }
3018    };
3019    if (json.has("subDetail")) {
3020      JsonArray array = json.getAsJsonArray("subDetail");
3021      for (int i = 0; i < array.size(); i++) {
3022        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
3023      }
3024    };
3025    return res;
3026  }
3027
3028  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
3029    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
3030    parseBackboneProperties(json, res);
3031    if (json.has("sequence"))
3032      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
3033    if (json.has("_sequence"))
3034      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
3035    if (json.has("type"))
3036      res.setType(parseCoding(json.getAsJsonObject("type")));
3037    if (json.has("service"))
3038      res.setService(parseCoding(json.getAsJsonObject("service")));
3039    if (json.has("programCode")) {
3040      JsonArray array = json.getAsJsonArray("programCode");
3041      for (int i = 0; i < array.size(); i++) {
3042        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
3043      }
3044    };
3045    if (json.has("quantity"))
3046      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
3047    if (json.has("unitPrice"))
3048      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
3049    if (json.has("factor"))
3050      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
3051    if (json.has("_factor"))
3052      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
3053    if (json.has("points"))
3054      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
3055    if (json.has("_points"))
3056      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
3057    if (json.has("net"))
3058      res.setNet(parseMoney(json.getAsJsonObject("net")));
3059    if (json.has("udi")) {
3060      JsonArray array = json.getAsJsonArray("udi");
3061      for (int i = 0; i < array.size(); i++) {
3062        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
3063      }
3064    };
3065    return res;
3066  }
3067
3068  protected Claim.ProsthesisComponent parseClaimProsthesisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
3069    Claim.ProsthesisComponent res = new Claim.ProsthesisComponent();
3070    parseBackboneProperties(json, res);
3071    if (json.has("initial"))
3072      res.setInitialElement(parseBoolean(json.get("initial").getAsBoolean()));
3073    if (json.has("_initial"))
3074      parseElementProperties(json.getAsJsonObject("_initial"), res.getInitialElement());
3075    if (json.has("priorDate"))
3076      res.setPriorDateElement(parseDate(json.get("priorDate").getAsString()));
3077    if (json.has("_priorDate"))
3078      parseElementProperties(json.getAsJsonObject("_priorDate"), res.getPriorDateElement());
3079    if (json.has("priorMaterial"))
3080      res.setPriorMaterial(parseCoding(json.getAsJsonObject("priorMaterial")));
3081    return res;
3082  }
3083
3084  protected Claim.MissingTeethComponent parseClaimMissingTeethComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
3085    Claim.MissingTeethComponent res = new Claim.MissingTeethComponent();
3086    parseBackboneProperties(json, res);
3087    if (json.has("tooth"))
3088      res.setTooth(parseCoding(json.getAsJsonObject("tooth")));
3089    if (json.has("reason"))
3090      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3091    if (json.has("extractionDate"))
3092      res.setExtractionDateElement(parseDate(json.get("extractionDate").getAsString()));
3093    if (json.has("_extractionDate"))
3094      parseElementProperties(json.getAsJsonObject("_extractionDate"), res.getExtractionDateElement());
3095    return res;
3096  }
3097
3098  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
3099    ClaimResponse res = new ClaimResponse();
3100    parseDomainResourceProperties(json, res);
3101    if (json.has("identifier")) {
3102      JsonArray array = json.getAsJsonArray("identifier");
3103      for (int i = 0; i < array.size(); i++) {
3104        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3105      }
3106    };
3107    Type request = parseType("request", json);
3108    if (request != null)
3109      res.setRequest(request);
3110    if (json.has("ruleset"))
3111      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
3112    if (json.has("originalRuleset"))
3113      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
3114    if (json.has("created"))
3115      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3116    if (json.has("_created"))
3117      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3118    Type organization = parseType("organization", json);
3119    if (organization != null)
3120      res.setOrganization(organization);
3121    Type requestProvider = parseType("requestProvider", json);
3122    if (requestProvider != null)
3123      res.setRequestProvider(requestProvider);
3124    Type requestOrganization = parseType("requestOrganization", json);
3125    if (requestOrganization != null)
3126      res.setRequestOrganization(requestOrganization);
3127    if (json.has("outcome"))
3128      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
3129    if (json.has("_outcome"))
3130      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
3131    if (json.has("disposition"))
3132      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
3133    if (json.has("_disposition"))
3134      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
3135    if (json.has("payeeType"))
3136      res.setPayeeType(parseCoding(json.getAsJsonObject("payeeType")));
3137    if (json.has("item")) {
3138      JsonArray array = json.getAsJsonArray("item");
3139      for (int i = 0; i < array.size(); i++) {
3140        res.getItem().add(parseClaimResponseItemsComponent(array.get(i).getAsJsonObject(), res));
3141      }
3142    };
3143    if (json.has("addItem")) {
3144      JsonArray array = json.getAsJsonArray("addItem");
3145      for (int i = 0; i < array.size(); i++) {
3146        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
3147      }
3148    };
3149    if (json.has("error")) {
3150      JsonArray array = json.getAsJsonArray("error");
3151      for (int i = 0; i < array.size(); i++) {
3152        res.getError().add(parseClaimResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
3153      }
3154    };
3155    if (json.has("totalCost"))
3156      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
3157    if (json.has("unallocDeductable"))
3158      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
3159    if (json.has("totalBenefit"))
3160      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
3161    if (json.has("paymentAdjustment"))
3162      res.setPaymentAdjustment(parseMoney(json.getAsJsonObject("paymentAdjustment")));
3163    if (json.has("paymentAdjustmentReason"))
3164      res.setPaymentAdjustmentReason(parseCoding(json.getAsJsonObject("paymentAdjustmentReason")));
3165    if (json.has("paymentDate"))
3166      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
3167    if (json.has("_paymentDate"))
3168      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
3169    if (json.has("paymentAmount"))
3170      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
3171    if (json.has("paymentRef"))
3172      res.setPaymentRef(parseIdentifier(json.getAsJsonObject("paymentRef")));
3173    if (json.has("reserved"))
3174      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
3175    if (json.has("form"))
3176      res.setForm(parseCoding(json.getAsJsonObject("form")));
3177    if (json.has("note")) {
3178      JsonArray array = json.getAsJsonArray("note");
3179      for (int i = 0; i < array.size(); i++) {
3180        res.getNote().add(parseClaimResponseNotesComponent(array.get(i).getAsJsonObject(), res));
3181      }
3182    };
3183    if (json.has("coverage")) {
3184      JsonArray array = json.getAsJsonArray("coverage");
3185      for (int i = 0; i < array.size(); i++) {
3186        res.getCoverage().add(parseClaimResponseCoverageComponent(array.get(i).getAsJsonObject(), res));
3187      }
3188    };
3189    return res;
3190  }
3191
3192  protected ClaimResponse.ItemsComponent parseClaimResponseItemsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3193    ClaimResponse.ItemsComponent res = new ClaimResponse.ItemsComponent();
3194    parseBackboneProperties(json, res);
3195    if (json.has("sequenceLinkId"))
3196      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
3197    if (json.has("_sequenceLinkId"))
3198      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
3199    if (json.has("noteNumber")) {
3200      JsonArray array = json.getAsJsonArray("noteNumber");
3201      for (int i = 0; i < array.size(); i++) {
3202        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
3203      }
3204    };
3205    if (json.has("_noteNumber")) {
3206      JsonArray array = json.getAsJsonArray("_noteNumber");
3207      for (int i = 0; i < array.size(); i++) {
3208        if (i == res.getNoteNumber().size())
3209          res.getNoteNumber().add(parsePositiveInt(null));
3210        if (array.get(i) instanceof JsonObject) 
3211          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
3212      }
3213    };
3214    if (json.has("adjudication")) {
3215      JsonArray array = json.getAsJsonArray("adjudication");
3216      for (int i = 0; i < array.size(); i++) {
3217        res.getAdjudication().add(parseClaimResponseItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
3218      }
3219    };
3220    if (json.has("detail")) {
3221      JsonArray array = json.getAsJsonArray("detail");
3222      for (int i = 0; i < array.size(); i++) {
3223        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
3224      }
3225    };
3226    return res;
3227  }
3228
3229  protected ClaimResponse.ItemAdjudicationComponent parseClaimResponseItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3230    ClaimResponse.ItemAdjudicationComponent res = new ClaimResponse.ItemAdjudicationComponent();
3231    parseBackboneProperties(json, res);
3232    if (json.has("category"))
3233      res.setCategory(parseCoding(json.getAsJsonObject("category")));
3234    if (json.has("reason"))
3235      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3236    if (json.has("amount"))
3237      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
3238    if (json.has("value"))
3239      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
3240    if (json.has("_value"))
3241      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3242    return res;
3243  }
3244
3245  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3246    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
3247    parseBackboneProperties(json, res);
3248    if (json.has("sequenceLinkId"))
3249      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
3250    if (json.has("_sequenceLinkId"))
3251      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
3252    if (json.has("adjudication")) {
3253      JsonArray array = json.getAsJsonArray("adjudication");
3254      for (int i = 0; i < array.size(); i++) {
3255        res.getAdjudication().add(parseClaimResponseDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
3256      }
3257    };
3258    if (json.has("subDetail")) {
3259      JsonArray array = json.getAsJsonArray("subDetail");
3260      for (int i = 0; i < array.size(); i++) {
3261        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
3262      }
3263    };
3264    return res;
3265  }
3266
3267  protected ClaimResponse.DetailAdjudicationComponent parseClaimResponseDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3268    ClaimResponse.DetailAdjudicationComponent res = new ClaimResponse.DetailAdjudicationComponent();
3269    parseBackboneProperties(json, res);
3270    if (json.has("category"))
3271      res.setCategory(parseCoding(json.getAsJsonObject("category")));
3272    if (json.has("reason"))
3273      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3274    if (json.has("amount"))
3275      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
3276    if (json.has("value"))
3277      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
3278    if (json.has("_value"))
3279      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3280    return res;
3281  }
3282
3283  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3284    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
3285    parseBackboneProperties(json, res);
3286    if (json.has("sequenceLinkId"))
3287      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
3288    if (json.has("_sequenceLinkId"))
3289      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
3290    if (json.has("adjudication")) {
3291      JsonArray array = json.getAsJsonArray("adjudication");
3292      for (int i = 0; i < array.size(); i++) {
3293        res.getAdjudication().add(parseClaimResponseSubdetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
3294      }
3295    };
3296    return res;
3297  }
3298
3299  protected ClaimResponse.SubdetailAdjudicationComponent parseClaimResponseSubdetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3300    ClaimResponse.SubdetailAdjudicationComponent res = new ClaimResponse.SubdetailAdjudicationComponent();
3301    parseBackboneProperties(json, res);
3302    if (json.has("category"))
3303      res.setCategory(parseCoding(json.getAsJsonObject("category")));
3304    if (json.has("reason"))
3305      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3306    if (json.has("amount"))
3307      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
3308    if (json.has("value"))
3309      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
3310    if (json.has("_value"))
3311      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3312    return res;
3313  }
3314
3315  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3316    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
3317    parseBackboneProperties(json, res);
3318    if (json.has("sequenceLinkId")) {
3319      JsonArray array = json.getAsJsonArray("sequenceLinkId");
3320      for (int i = 0; i < array.size(); i++) {
3321        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
3322      }
3323    };
3324    if (json.has("_sequenceLinkId")) {
3325      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
3326      for (int i = 0; i < array.size(); i++) {
3327        if (i == res.getSequenceLinkId().size())
3328          res.getSequenceLinkId().add(parsePositiveInt(null));
3329        if (array.get(i) instanceof JsonObject) 
3330          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
3331      }
3332    };
3333    if (json.has("service"))
3334      res.setService(parseCoding(json.getAsJsonObject("service")));
3335    if (json.has("fee"))
3336      res.setFee(parseMoney(json.getAsJsonObject("fee")));
3337    if (json.has("noteNumberLinkId")) {
3338      JsonArray array = json.getAsJsonArray("noteNumberLinkId");
3339      for (int i = 0; i < array.size(); i++) {
3340        res.getNoteNumberLinkId().add(parsePositiveInt(array.get(i).getAsString()));
3341      }
3342    };
3343    if (json.has("_noteNumberLinkId")) {
3344      JsonArray array = json.getAsJsonArray("_noteNumberLinkId");
3345      for (int i = 0; i < array.size(); i++) {
3346        if (i == res.getNoteNumberLinkId().size())
3347          res.getNoteNumberLinkId().add(parsePositiveInt(null));
3348        if (array.get(i) instanceof JsonObject) 
3349          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumberLinkId().get(i));
3350      }
3351    };
3352    if (json.has("adjudication")) {
3353      JsonArray array = json.getAsJsonArray("adjudication");
3354      for (int i = 0; i < array.size(); i++) {
3355        res.getAdjudication().add(parseClaimResponseAddedItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
3356      }
3357    };
3358    if (json.has("detail")) {
3359      JsonArray array = json.getAsJsonArray("detail");
3360      for (int i = 0; i < array.size(); i++) {
3361        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
3362      }
3363    };
3364    return res;
3365  }
3366
3367  protected ClaimResponse.AddedItemAdjudicationComponent parseClaimResponseAddedItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3368    ClaimResponse.AddedItemAdjudicationComponent res = new ClaimResponse.AddedItemAdjudicationComponent();
3369    parseBackboneProperties(json, res);
3370    if (json.has("category"))
3371      res.setCategory(parseCoding(json.getAsJsonObject("category")));
3372    if (json.has("reason"))
3373      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3374    if (json.has("amount"))
3375      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
3376    if (json.has("value"))
3377      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
3378    if (json.has("_value"))
3379      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3380    return res;
3381  }
3382
3383  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3384    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
3385    parseBackboneProperties(json, res);
3386    if (json.has("service"))
3387      res.setService(parseCoding(json.getAsJsonObject("service")));
3388    if (json.has("fee"))
3389      res.setFee(parseMoney(json.getAsJsonObject("fee")));
3390    if (json.has("adjudication")) {
3391      JsonArray array = json.getAsJsonArray("adjudication");
3392      for (int i = 0; i < array.size(); i++) {
3393        res.getAdjudication().add(parseClaimResponseAddedItemDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
3394      }
3395    };
3396    return res;
3397  }
3398
3399  protected ClaimResponse.AddedItemDetailAdjudicationComponent parseClaimResponseAddedItemDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3400    ClaimResponse.AddedItemDetailAdjudicationComponent res = new ClaimResponse.AddedItemDetailAdjudicationComponent();
3401    parseBackboneProperties(json, res);
3402    if (json.has("category"))
3403      res.setCategory(parseCoding(json.getAsJsonObject("category")));
3404    if (json.has("reason"))
3405      res.setReason(parseCoding(json.getAsJsonObject("reason")));
3406    if (json.has("amount"))
3407      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
3408    if (json.has("value"))
3409      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
3410    if (json.has("_value"))
3411      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3412    return res;
3413  }
3414
3415  protected ClaimResponse.ErrorsComponent parseClaimResponseErrorsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3416    ClaimResponse.ErrorsComponent res = new ClaimResponse.ErrorsComponent();
3417    parseBackboneProperties(json, res);
3418    if (json.has("sequenceLinkId"))
3419      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
3420    if (json.has("_sequenceLinkId"))
3421      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
3422    if (json.has("detailSequenceLinkId"))
3423      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
3424    if (json.has("_detailSequenceLinkId"))
3425      parseElementProperties(json.getAsJsonObject("_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
3426    if (json.has("subdetailSequenceLinkId"))
3427      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
3428    if (json.has("_subdetailSequenceLinkId"))
3429      parseElementProperties(json.getAsJsonObject("_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
3430    if (json.has("code"))
3431      res.setCode(parseCoding(json.getAsJsonObject("code")));
3432    return res;
3433  }
3434
3435  protected ClaimResponse.NotesComponent parseClaimResponseNotesComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3436    ClaimResponse.NotesComponent res = new ClaimResponse.NotesComponent();
3437    parseBackboneProperties(json, res);
3438    if (json.has("number"))
3439      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
3440    if (json.has("_number"))
3441      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
3442    if (json.has("type"))
3443      res.setType(parseCoding(json.getAsJsonObject("type")));
3444    if (json.has("text"))
3445      res.setTextElement(parseString(json.get("text").getAsString()));
3446    if (json.has("_text"))
3447      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
3448    return res;
3449  }
3450
3451  protected ClaimResponse.CoverageComponent parseClaimResponseCoverageComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
3452    ClaimResponse.CoverageComponent res = new ClaimResponse.CoverageComponent();
3453    parseBackboneProperties(json, res);
3454    if (json.has("sequence"))
3455      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
3456    if (json.has("_sequence"))
3457      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
3458    if (json.has("focal"))
3459      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
3460    if (json.has("_focal"))
3461      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
3462    Type coverage = parseType("coverage", json);
3463    if (coverage != null)
3464      res.setCoverage(coverage);
3465    if (json.has("businessArrangement"))
3466      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
3467    if (json.has("_businessArrangement"))
3468      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
3469    if (json.has("preAuthRef")) {
3470      JsonArray array = json.getAsJsonArray("preAuthRef");
3471      for (int i = 0; i < array.size(); i++) {
3472        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
3473      }
3474    };
3475    if (json.has("_preAuthRef")) {
3476      JsonArray array = json.getAsJsonArray("_preAuthRef");
3477      for (int i = 0; i < array.size(); i++) {
3478        if (i == res.getPreAuthRef().size())
3479          res.getPreAuthRef().add(parseString(null));
3480        if (array.get(i) instanceof JsonObject) 
3481          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
3482      }
3483    };
3484    if (json.has("claimResponse"))
3485      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
3486    return res;
3487  }
3488
3489  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
3490    ClinicalImpression res = new ClinicalImpression();
3491    parseDomainResourceProperties(json, res);
3492    if (json.has("patient"))
3493      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3494    if (json.has("assessor"))
3495      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
3496    if (json.has("status"))
3497      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
3498    if (json.has("_status"))
3499      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3500    if (json.has("date"))
3501      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3502    if (json.has("_date"))
3503      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3504    if (json.has("description"))
3505      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3506    if (json.has("_description"))
3507      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3508    if (json.has("previous"))
3509      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
3510    if (json.has("problem")) {
3511      JsonArray array = json.getAsJsonArray("problem");
3512      for (int i = 0; i < array.size(); i++) {
3513        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
3514      }
3515    };
3516    Type trigger = parseType("trigger", json);
3517    if (trigger != null)
3518      res.setTrigger(trigger);
3519    if (json.has("investigations")) {
3520      JsonArray array = json.getAsJsonArray("investigations");
3521      for (int i = 0; i < array.size(); i++) {
3522        res.getInvestigations().add(parseClinicalImpressionClinicalImpressionInvestigationsComponent(array.get(i).getAsJsonObject(), res));
3523      }
3524    };
3525    if (json.has("protocol"))
3526      res.setProtocolElement(parseUri(json.get("protocol").getAsString()));
3527    if (json.has("_protocol"))
3528      parseElementProperties(json.getAsJsonObject("_protocol"), res.getProtocolElement());
3529    if (json.has("summary"))
3530      res.setSummaryElement(parseString(json.get("summary").getAsString()));
3531    if (json.has("_summary"))
3532      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
3533    if (json.has("finding")) {
3534      JsonArray array = json.getAsJsonArray("finding");
3535      for (int i = 0; i < array.size(); i++) {
3536        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
3537      }
3538    };
3539    if (json.has("resolved")) {
3540      JsonArray array = json.getAsJsonArray("resolved");
3541      for (int i = 0; i < array.size(); i++) {
3542        res.getResolved().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3543      }
3544    };
3545    if (json.has("ruledOut")) {
3546      JsonArray array = json.getAsJsonArray("ruledOut");
3547      for (int i = 0; i < array.size(); i++) {
3548        res.getRuledOut().add(parseClinicalImpressionClinicalImpressionRuledOutComponent(array.get(i).getAsJsonObject(), res));
3549      }
3550    };
3551    if (json.has("prognosis"))
3552      res.setPrognosisElement(parseString(json.get("prognosis").getAsString()));
3553    if (json.has("_prognosis"))
3554      parseElementProperties(json.getAsJsonObject("_prognosis"), res.getPrognosisElement());
3555    if (json.has("plan")) {
3556      JsonArray array = json.getAsJsonArray("plan");
3557      for (int i = 0; i < array.size(); i++) {
3558        res.getPlan().add(parseReference(array.get(i).getAsJsonObject()));
3559      }
3560    };
3561    if (json.has("action")) {
3562      JsonArray array = json.getAsJsonArray("action");
3563      for (int i = 0; i < array.size(); i++) {
3564        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
3565      }
3566    };
3567    return res;
3568  }
3569
3570  protected ClinicalImpression.ClinicalImpressionInvestigationsComponent parseClinicalImpressionClinicalImpressionInvestigationsComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
3571    ClinicalImpression.ClinicalImpressionInvestigationsComponent res = new ClinicalImpression.ClinicalImpressionInvestigationsComponent();
3572    parseBackboneProperties(json, res);
3573    if (json.has("code"))
3574      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3575    if (json.has("item")) {
3576      JsonArray array = json.getAsJsonArray("item");
3577      for (int i = 0; i < array.size(); i++) {
3578        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
3579      }
3580    };
3581    return res;
3582  }
3583
3584  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
3585    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
3586    parseBackboneProperties(json, res);
3587    if (json.has("item"))
3588      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
3589    if (json.has("cause"))
3590      res.setCauseElement(parseString(json.get("cause").getAsString()));
3591    if (json.has("_cause"))
3592      parseElementProperties(json.getAsJsonObject("_cause"), res.getCauseElement());
3593    return res;
3594  }
3595
3596  protected ClinicalImpression.ClinicalImpressionRuledOutComponent parseClinicalImpressionClinicalImpressionRuledOutComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
3597    ClinicalImpression.ClinicalImpressionRuledOutComponent res = new ClinicalImpression.ClinicalImpressionRuledOutComponent();
3598    parseBackboneProperties(json, res);
3599    if (json.has("item"))
3600      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
3601    if (json.has("reason"))
3602      res.setReasonElement(parseString(json.get("reason").getAsString()));
3603    if (json.has("_reason"))
3604      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
3605    return res;
3606  }
3607
3608  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
3609    CodeSystem res = new CodeSystem();
3610    parseDomainResourceProperties(json, res);
3611    if (json.has("url"))
3612      res.setUrlElement(parseUri(json.get("url").getAsString()));
3613    if (json.has("_url"))
3614      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3615    if (json.has("identifier"))
3616      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3617    if (json.has("version"))
3618      res.setVersionElement(parseString(json.get("version").getAsString()));
3619    if (json.has("_version"))
3620      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3621    if (json.has("name"))
3622      res.setNameElement(parseString(json.get("name").getAsString()));
3623    if (json.has("_name"))
3624      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3625    if (json.has("status"))
3626      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3627    if (json.has("_status"))
3628      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3629    if (json.has("experimental"))
3630      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3631    if (json.has("_experimental"))
3632      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3633    if (json.has("publisher"))
3634      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3635    if (json.has("_publisher"))
3636      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3637    if (json.has("contact")) {
3638      JsonArray array = json.getAsJsonArray("contact");
3639      for (int i = 0; i < array.size(); i++) {
3640        res.getContact().add(parseCodeSystemCodeSystemContactComponent(array.get(i).getAsJsonObject(), res));
3641      }
3642    };
3643    if (json.has("date"))
3644      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3645    if (json.has("_date"))
3646      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3647    if (json.has("description"))
3648      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3649    if (json.has("_description"))
3650      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3651    if (json.has("useContext")) {
3652      JsonArray array = json.getAsJsonArray("useContext");
3653      for (int i = 0; i < array.size(); i++) {
3654        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3655      }
3656    };
3657    if (json.has("requirements"))
3658      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
3659    if (json.has("_requirements"))
3660      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
3661    if (json.has("copyright"))
3662      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
3663    if (json.has("_copyright"))
3664      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3665    if (json.has("caseSensitive"))
3666      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
3667    if (json.has("_caseSensitive"))
3668      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
3669    if (json.has("valueSet"))
3670      res.setValueSetElement(parseUri(json.get("valueSet").getAsString()));
3671    if (json.has("_valueSet"))
3672      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
3673    if (json.has("compositional"))
3674      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
3675    if (json.has("_compositional"))
3676      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
3677    if (json.has("versionNeeded"))
3678      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
3679    if (json.has("_versionNeeded"))
3680      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
3681    if (json.has("content"))
3682      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
3683    if (json.has("_content"))
3684      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
3685    if (json.has("count"))
3686      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
3687    if (json.has("_count"))
3688      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
3689    if (json.has("filter")) {
3690      JsonArray array = json.getAsJsonArray("filter");
3691      for (int i = 0; i < array.size(); i++) {
3692        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
3693      }
3694    };
3695    if (json.has("property")) {
3696      JsonArray array = json.getAsJsonArray("property");
3697      for (int i = 0; i < array.size(); i++) {
3698        res.getProperty().add(parseCodeSystemCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
3699      }
3700    };
3701    if (json.has("concept")) {
3702      JsonArray array = json.getAsJsonArray("concept");
3703      for (int i = 0; i < array.size(); i++) {
3704        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
3705      }
3706    };
3707    return res;
3708  }
3709
3710  protected CodeSystem.CodeSystemContactComponent parseCodeSystemCodeSystemContactComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3711    CodeSystem.CodeSystemContactComponent res = new CodeSystem.CodeSystemContactComponent();
3712    parseBackboneProperties(json, res);
3713    if (json.has("name"))
3714      res.setNameElement(parseString(json.get("name").getAsString()));
3715    if (json.has("_name"))
3716      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3717    if (json.has("telecom")) {
3718      JsonArray array = json.getAsJsonArray("telecom");
3719      for (int i = 0; i < array.size(); i++) {
3720        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
3721      }
3722    };
3723    return res;
3724  }
3725
3726  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3727    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
3728    parseBackboneProperties(json, res);
3729    if (json.has("code"))
3730      res.setCodeElement(parseCode(json.get("code").getAsString()));
3731    if (json.has("_code"))
3732      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3733    if (json.has("description"))
3734      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3735    if (json.has("_description"))
3736      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3737    if (json.has("operator")) {
3738      JsonArray array = json.getAsJsonArray("operator");
3739      for (int i = 0; i < array.size(); i++) {
3740        res.getOperator().add(parseCode(array.get(i).getAsString()));
3741      }
3742    };
3743    if (json.has("_operator")) {
3744      JsonArray array = json.getAsJsonArray("_operator");
3745      for (int i = 0; i < array.size(); i++) {
3746        if (i == res.getOperator().size())
3747          res.getOperator().add(parseCode(null));
3748        if (array.get(i) instanceof JsonObject) 
3749          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
3750      }
3751    };
3752    if (json.has("value"))
3753      res.setValueElement(parseString(json.get("value").getAsString()));
3754    if (json.has("_value"))
3755      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3756    return res;
3757  }
3758
3759  protected CodeSystem.CodeSystemPropertyComponent parseCodeSystemCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3760    CodeSystem.CodeSystemPropertyComponent res = new CodeSystem.CodeSystemPropertyComponent();
3761    parseBackboneProperties(json, res);
3762    if (json.has("code"))
3763      res.setCodeElement(parseCode(json.get("code").getAsString()));
3764    if (json.has("_code"))
3765      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3766    if (json.has("description"))
3767      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3768    if (json.has("_description"))
3769      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3770    if (json.has("type"))
3771      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
3772    if (json.has("_type"))
3773      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3774    return res;
3775  }
3776
3777  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3778    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
3779    parseBackboneProperties(json, res);
3780    if (json.has("code"))
3781      res.setCodeElement(parseCode(json.get("code").getAsString()));
3782    if (json.has("_code"))
3783      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3784    if (json.has("display"))
3785      res.setDisplayElement(parseString(json.get("display").getAsString()));
3786    if (json.has("_display"))
3787      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
3788    if (json.has("definition"))
3789      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
3790    if (json.has("_definition"))
3791      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3792    if (json.has("designation")) {
3793      JsonArray array = json.getAsJsonArray("designation");
3794      for (int i = 0; i < array.size(); i++) {
3795        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
3796      }
3797    };
3798    if (json.has("property")) {
3799      JsonArray array = json.getAsJsonArray("property");
3800      for (int i = 0; i < array.size(); i++) {
3801        res.getProperty().add(parseCodeSystemConceptDefinitionPropertyComponent(array.get(i).getAsJsonObject(), owner));
3802      }
3803    };
3804    if (json.has("concept")) {
3805      JsonArray array = json.getAsJsonArray("concept");
3806      for (int i = 0; i < array.size(); i++) {
3807        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
3808      }
3809    };
3810    return res;
3811  }
3812
3813  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3814    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
3815    parseBackboneProperties(json, res);
3816    if (json.has("language"))
3817      res.setLanguageElement(parseCode(json.get("language").getAsString()));
3818    if (json.has("_language"))
3819      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
3820    if (json.has("use"))
3821      res.setUse(parseCoding(json.getAsJsonObject("use")));
3822    if (json.has("value"))
3823      res.setValueElement(parseString(json.get("value").getAsString()));
3824    if (json.has("_value"))
3825      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
3826    return res;
3827  }
3828
3829  protected CodeSystem.ConceptDefinitionPropertyComponent parseCodeSystemConceptDefinitionPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
3830    CodeSystem.ConceptDefinitionPropertyComponent res = new CodeSystem.ConceptDefinitionPropertyComponent();
3831    parseBackboneProperties(json, res);
3832    if (json.has("code"))
3833      res.setCodeElement(parseCode(json.get("code").getAsString()));
3834    if (json.has("_code"))
3835      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3836    Type value = parseType("value", json);
3837    if (value != null)
3838      res.setValue(value);
3839    return res;
3840  }
3841
3842  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
3843    Communication res = new Communication();
3844    parseDomainResourceProperties(json, res);
3845    if (json.has("identifier")) {
3846      JsonArray array = json.getAsJsonArray("identifier");
3847      for (int i = 0; i < array.size(); i++) {
3848        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3849      }
3850    };
3851    if (json.has("category"))
3852      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3853    if (json.has("sender"))
3854      res.setSender(parseReference(json.getAsJsonObject("sender")));
3855    if (json.has("recipient")) {
3856      JsonArray array = json.getAsJsonArray("recipient");
3857      for (int i = 0; i < array.size(); i++) {
3858        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
3859      }
3860    };
3861    if (json.has("payload")) {
3862      JsonArray array = json.getAsJsonArray("payload");
3863      for (int i = 0; i < array.size(); i++) {
3864        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
3865      }
3866    };
3867    if (json.has("medium")) {
3868      JsonArray array = json.getAsJsonArray("medium");
3869      for (int i = 0; i < array.size(); i++) {
3870        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3871      }
3872    };
3873    if (json.has("status"))
3874      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
3875    if (json.has("_status"))
3876      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3877    if (json.has("encounter"))
3878      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3879    if (json.has("sent"))
3880      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
3881    if (json.has("_sent"))
3882      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
3883    if (json.has("received"))
3884      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
3885    if (json.has("_received"))
3886      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
3887    if (json.has("reason")) {
3888      JsonArray array = json.getAsJsonArray("reason");
3889      for (int i = 0; i < array.size(); i++) {
3890        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3891      }
3892    };
3893    if (json.has("subject"))
3894      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3895    if (json.has("requestDetail"))
3896      res.setRequestDetail(parseReference(json.getAsJsonObject("requestDetail")));
3897    return res;
3898  }
3899
3900  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
3901    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
3902    parseBackboneProperties(json, res);
3903    Type content = parseType("content", json);
3904    if (content != null)
3905      res.setContent(content);
3906    return res;
3907  }
3908
3909  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
3910    CommunicationRequest res = new CommunicationRequest();
3911    parseDomainResourceProperties(json, res);
3912    if (json.has("identifier")) {
3913      JsonArray array = json.getAsJsonArray("identifier");
3914      for (int i = 0; i < array.size(); i++) {
3915        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3916      }
3917    };
3918    if (json.has("category"))
3919      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3920    if (json.has("sender"))
3921      res.setSender(parseReference(json.getAsJsonObject("sender")));
3922    if (json.has("recipient")) {
3923      JsonArray array = json.getAsJsonArray("recipient");
3924      for (int i = 0; i < array.size(); i++) {
3925        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
3926      }
3927    };
3928    if (json.has("payload")) {
3929      JsonArray array = json.getAsJsonArray("payload");
3930      for (int i = 0; i < array.size(); i++) {
3931        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
3932      }
3933    };
3934    if (json.has("medium")) {
3935      JsonArray array = json.getAsJsonArray("medium");
3936      for (int i = 0; i < array.size(); i++) {
3937        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3938      }
3939    };
3940    if (json.has("requester"))
3941      res.setRequester(parseReference(json.getAsJsonObject("requester")));
3942    if (json.has("status"))
3943      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
3944    if (json.has("_status"))
3945      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3946    if (json.has("encounter"))
3947      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3948    Type scheduled = parseType("scheduled", json);
3949    if (scheduled != null)
3950      res.setScheduled(scheduled);
3951    if (json.has("reason")) {
3952      JsonArray array = json.getAsJsonArray("reason");
3953      for (int i = 0; i < array.size(); i++) {
3954        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3955      }
3956    };
3957    if (json.has("requestedOn"))
3958      res.setRequestedOnElement(parseDateTime(json.get("requestedOn").getAsString()));
3959    if (json.has("_requestedOn"))
3960      parseElementProperties(json.getAsJsonObject("_requestedOn"), res.getRequestedOnElement());
3961    if (json.has("subject"))
3962      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3963    if (json.has("priority"))
3964      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
3965    return res;
3966  }
3967
3968  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
3969    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
3970    parseBackboneProperties(json, res);
3971    Type content = parseType("content", json);
3972    if (content != null)
3973      res.setContent(content);
3974    return res;
3975  }
3976
3977  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
3978    CompartmentDefinition res = new CompartmentDefinition();
3979    parseDomainResourceProperties(json, res);
3980    if (json.has("url"))
3981      res.setUrlElement(parseUri(json.get("url").getAsString()));
3982    if (json.has("_url"))
3983      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3984    if (json.has("name"))
3985      res.setNameElement(parseString(json.get("name").getAsString()));
3986    if (json.has("_name"))
3987      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3988    if (json.has("status"))
3989      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3990    if (json.has("_status"))
3991      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3992    if (json.has("experimental"))
3993      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3994    if (json.has("_experimental"))
3995      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3996    if (json.has("publisher"))
3997      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3998    if (json.has("_publisher"))
3999      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4000    if (json.has("contact")) {
4001      JsonArray array = json.getAsJsonArray("contact");
4002      for (int i = 0; i < array.size(); i++) {
4003        res.getContact().add(parseCompartmentDefinitionCompartmentDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
4004      }
4005    };
4006    if (json.has("date"))
4007      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4008    if (json.has("_date"))
4009      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4010    if (json.has("description"))
4011      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4012    if (json.has("_description"))
4013      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4014    if (json.has("requirements"))
4015      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
4016    if (json.has("_requirements"))
4017      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
4018    if (json.has("code"))
4019      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
4020    if (json.has("_code"))
4021      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4022    if (json.has("search"))
4023      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
4024    if (json.has("_search"))
4025      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
4026    if (json.has("resource")) {
4027      JsonArray array = json.getAsJsonArray("resource");
4028      for (int i = 0; i < array.size(); i++) {
4029        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
4030      }
4031    };
4032    return res;
4033  }
4034
4035  protected CompartmentDefinition.CompartmentDefinitionContactComponent parseCompartmentDefinitionCompartmentDefinitionContactComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
4036    CompartmentDefinition.CompartmentDefinitionContactComponent res = new CompartmentDefinition.CompartmentDefinitionContactComponent();
4037    parseBackboneProperties(json, res);
4038    if (json.has("name"))
4039      res.setNameElement(parseString(json.get("name").getAsString()));
4040    if (json.has("_name"))
4041      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4042    if (json.has("telecom")) {
4043      JsonArray array = json.getAsJsonArray("telecom");
4044      for (int i = 0; i < array.size(); i++) {
4045        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4046      }
4047    };
4048    return res;
4049  }
4050
4051  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
4052    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
4053    parseBackboneProperties(json, res);
4054    if (json.has("code"))
4055      res.setCodeElement(parseCode(json.get("code").getAsString()));
4056    if (json.has("_code"))
4057      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4058    if (json.has("param")) {
4059      JsonArray array = json.getAsJsonArray("param");
4060      for (int i = 0; i < array.size(); i++) {
4061        res.getParam().add(parseString(array.get(i).getAsString()));
4062      }
4063    };
4064    if (json.has("_param")) {
4065      JsonArray array = json.getAsJsonArray("_param");
4066      for (int i = 0; i < array.size(); i++) {
4067        if (i == res.getParam().size())
4068          res.getParam().add(parseString(null));
4069        if (array.get(i) instanceof JsonObject) 
4070          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
4071      }
4072    };
4073    if (json.has("documentation"))
4074      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4075    if (json.has("_documentation"))
4076      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4077    return res;
4078  }
4079
4080  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
4081    Composition res = new Composition();
4082    parseDomainResourceProperties(json, res);
4083    if (json.has("identifier"))
4084      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4085    if (json.has("date"))
4086      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4087    if (json.has("_date"))
4088      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4089    if (json.has("type"))
4090      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4091    if (json.has("class"))
4092      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
4093    if (json.has("title"))
4094      res.setTitleElement(parseString(json.get("title").getAsString()));
4095    if (json.has("_title"))
4096      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4097    if (json.has("status"))
4098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
4099    if (json.has("_status"))
4100      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4101    if (json.has("confidentiality"))
4102      res.setConfidentialityElement(parseCode(json.get("confidentiality").getAsString()));
4103    if (json.has("_confidentiality"))
4104      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
4105    if (json.has("subject"))
4106      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4107    if (json.has("author")) {
4108      JsonArray array = json.getAsJsonArray("author");
4109      for (int i = 0; i < array.size(); i++) {
4110        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
4111      }
4112    };
4113    if (json.has("attester")) {
4114      JsonArray array = json.getAsJsonArray("attester");
4115      for (int i = 0; i < array.size(); i++) {
4116        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
4117      }
4118    };
4119    if (json.has("custodian"))
4120      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
4121    if (json.has("event")) {
4122      JsonArray array = json.getAsJsonArray("event");
4123      for (int i = 0; i < array.size(); i++) {
4124        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
4125      }
4126    };
4127    if (json.has("encounter"))
4128      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4129    if (json.has("section")) {
4130      JsonArray array = json.getAsJsonArray("section");
4131      for (int i = 0; i < array.size(); i++) {
4132        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
4133      }
4134    };
4135    return res;
4136  }
4137
4138  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
4139    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
4140    parseBackboneProperties(json, res);
4141    if (json.has("mode")) {
4142      JsonArray array = json.getAsJsonArray("mode");
4143      for (int i = 0; i < array.size(); i++) {
4144        res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
4145      }
4146    };
4147    if (json.has("_mode")) {
4148      JsonArray array = json.getAsJsonArray("_mode");
4149      for (int i = 0; i < array.size(); i++) {
4150        if (i == res.getMode().size())
4151          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
4152        if (array.get(i) instanceof JsonObject) 
4153          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
4154      }
4155    };
4156    if (json.has("time"))
4157      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
4158    if (json.has("_time"))
4159      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
4160    if (json.has("party"))
4161      res.setParty(parseReference(json.getAsJsonObject("party")));
4162    return res;
4163  }
4164
4165  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
4166    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
4167    parseBackboneProperties(json, res);
4168    if (json.has("code")) {
4169      JsonArray array = json.getAsJsonArray("code");
4170      for (int i = 0; i < array.size(); i++) {
4171        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4172      }
4173    };
4174    if (json.has("period"))
4175      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4176    if (json.has("detail")) {
4177      JsonArray array = json.getAsJsonArray("detail");
4178      for (int i = 0; i < array.size(); i++) {
4179        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
4180      }
4181    };
4182    return res;
4183  }
4184
4185  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
4186    Composition.SectionComponent res = new Composition.SectionComponent();
4187    parseBackboneProperties(json, res);
4188    if (json.has("title"))
4189      res.setTitleElement(parseString(json.get("title").getAsString()));
4190    if (json.has("_title"))
4191      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4192    if (json.has("code"))
4193      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4194    if (json.has("text"))
4195      res.setText(parseNarrative(json.getAsJsonObject("text")));
4196    if (json.has("mode"))
4197      res.setModeElement(parseCode(json.get("mode").getAsString()));
4198    if (json.has("_mode"))
4199      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4200    if (json.has("orderedBy"))
4201      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
4202    if (json.has("entry")) {
4203      JsonArray array = json.getAsJsonArray("entry");
4204      for (int i = 0; i < array.size(); i++) {
4205        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
4206      }
4207    };
4208    if (json.has("emptyReason"))
4209      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
4210    if (json.has("section")) {
4211      JsonArray array = json.getAsJsonArray("section");
4212      for (int i = 0; i < array.size(); i++) {
4213        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
4214      }
4215    };
4216    return res;
4217  }
4218
4219  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
4220    ConceptMap res = new ConceptMap();
4221    parseDomainResourceProperties(json, res);
4222    if (json.has("url"))
4223      res.setUrlElement(parseUri(json.get("url").getAsString()));
4224    if (json.has("_url"))
4225      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4226    if (json.has("identifier"))
4227      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4228    if (json.has("version"))
4229      res.setVersionElement(parseString(json.get("version").getAsString()));
4230    if (json.has("_version"))
4231      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4232    if (json.has("name"))
4233      res.setNameElement(parseString(json.get("name").getAsString()));
4234    if (json.has("_name"))
4235      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4236    if (json.has("status"))
4237      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
4238    if (json.has("_status"))
4239      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4240    if (json.has("experimental"))
4241      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4242    if (json.has("_experimental"))
4243      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4244    if (json.has("publisher"))
4245      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4246    if (json.has("_publisher"))
4247      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4248    if (json.has("contact")) {
4249      JsonArray array = json.getAsJsonArray("contact");
4250      for (int i = 0; i < array.size(); i++) {
4251        res.getContact().add(parseConceptMapConceptMapContactComponent(array.get(i).getAsJsonObject(), res));
4252      }
4253    };
4254    if (json.has("date"))
4255      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4256    if (json.has("_date"))
4257      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4258    if (json.has("description"))
4259      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4260    if (json.has("_description"))
4261      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4262    if (json.has("useContext")) {
4263      JsonArray array = json.getAsJsonArray("useContext");
4264      for (int i = 0; i < array.size(); i++) {
4265        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4266      }
4267    };
4268    if (json.has("requirements"))
4269      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
4270    if (json.has("_requirements"))
4271      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
4272    if (json.has("copyright"))
4273      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
4274    if (json.has("_copyright"))
4275      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4276    Type source = parseType("source", json);
4277    if (source != null)
4278      res.setSource(source);
4279    Type target = parseType("target", json);
4280    if (target != null)
4281      res.setTarget(target);
4282    if (json.has("element")) {
4283      JsonArray array = json.getAsJsonArray("element");
4284      for (int i = 0; i < array.size(); i++) {
4285        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), res));
4286      }
4287    };
4288    return res;
4289  }
4290
4291  protected ConceptMap.ConceptMapContactComponent parseConceptMapConceptMapContactComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
4292    ConceptMap.ConceptMapContactComponent res = new ConceptMap.ConceptMapContactComponent();
4293    parseBackboneProperties(json, res);
4294    if (json.has("name"))
4295      res.setNameElement(parseString(json.get("name").getAsString()));
4296    if (json.has("_name"))
4297      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4298    if (json.has("telecom")) {
4299      JsonArray array = json.getAsJsonArray("telecom");
4300      for (int i = 0; i < array.size(); i++) {
4301        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4302      }
4303    };
4304    return res;
4305  }
4306
4307  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
4308    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
4309    parseBackboneProperties(json, res);
4310    if (json.has("system"))
4311      res.setSystemElement(parseUri(json.get("system").getAsString()));
4312    if (json.has("_system"))
4313      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
4314    if (json.has("version"))
4315      res.setVersionElement(parseString(json.get("version").getAsString()));
4316    if (json.has("_version"))
4317      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4318    if (json.has("code"))
4319      res.setCodeElement(parseCode(json.get("code").getAsString()));
4320    if (json.has("_code"))
4321      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4322    if (json.has("target")) {
4323      JsonArray array = json.getAsJsonArray("target");
4324      for (int i = 0; i < array.size(); i++) {
4325        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
4326      }
4327    };
4328    return res;
4329  }
4330
4331  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
4332    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
4333    parseBackboneProperties(json, res);
4334    if (json.has("system"))
4335      res.setSystemElement(parseUri(json.get("system").getAsString()));
4336    if (json.has("_system"))
4337      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
4338    if (json.has("version"))
4339      res.setVersionElement(parseString(json.get("version").getAsString()));
4340    if (json.has("_version"))
4341      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4342    if (json.has("code"))
4343      res.setCodeElement(parseCode(json.get("code").getAsString()));
4344    if (json.has("_code"))
4345      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4346    if (json.has("equivalence"))
4347      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
4348    if (json.has("_equivalence"))
4349      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
4350    if (json.has("comments"))
4351      res.setCommentsElement(parseString(json.get("comments").getAsString()));
4352    if (json.has("_comments"))
4353      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
4354    if (json.has("dependsOn")) {
4355      JsonArray array = json.getAsJsonArray("dependsOn");
4356      for (int i = 0; i < array.size(); i++) {
4357        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
4358      }
4359    };
4360    if (json.has("product")) {
4361      JsonArray array = json.getAsJsonArray("product");
4362      for (int i = 0; i < array.size(); i++) {
4363        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
4364      }
4365    };
4366    return res;
4367  }
4368
4369  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
4370    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
4371    parseBackboneProperties(json, res);
4372    if (json.has("element"))
4373      res.setElementElement(parseUri(json.get("element").getAsString()));
4374    if (json.has("_element"))
4375      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
4376    if (json.has("system"))
4377      res.setSystemElement(parseUri(json.get("system").getAsString()));
4378    if (json.has("_system"))
4379      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
4380    if (json.has("code"))
4381      res.setCodeElement(parseString(json.get("code").getAsString()));
4382    if (json.has("_code"))
4383      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4384    return res;
4385  }
4386
4387  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
4388    Condition res = new Condition();
4389    parseDomainResourceProperties(json, res);
4390    if (json.has("identifier")) {
4391      JsonArray array = json.getAsJsonArray("identifier");
4392      for (int i = 0; i < array.size(); i++) {
4393        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4394      }
4395    };
4396    if (json.has("patient"))
4397      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4398    if (json.has("encounter"))
4399      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4400    if (json.has("asserter"))
4401      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
4402    if (json.has("dateRecorded"))
4403      res.setDateRecordedElement(parseDate(json.get("dateRecorded").getAsString()));
4404    if (json.has("_dateRecorded"))
4405      parseElementProperties(json.getAsJsonObject("_dateRecorded"), res.getDateRecordedElement());
4406    if (json.has("code"))
4407      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4408    if (json.has("category"))
4409      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4410    if (json.has("clinicalStatus"))
4411      res.setClinicalStatusElement(parseCode(json.get("clinicalStatus").getAsString()));
4412    if (json.has("_clinicalStatus"))
4413      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
4414    if (json.has("verificationStatus"))
4415      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
4416    if (json.has("_verificationStatus"))
4417      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
4418    if (json.has("severity"))
4419      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
4420    Type onset = parseType("onset", json);
4421    if (onset != null)
4422      res.setOnset(onset);
4423    Type abatement = parseType("abatement", json);
4424    if (abatement != null)
4425      res.setAbatement(abatement);
4426    if (json.has("stage"))
4427      res.setStage(parseConditionConditionStageComponent(json.getAsJsonObject("stage"), res));
4428    if (json.has("evidence")) {
4429      JsonArray array = json.getAsJsonArray("evidence");
4430      for (int i = 0; i < array.size(); i++) {
4431        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
4432      }
4433    };
4434    if (json.has("bodySite")) {
4435      JsonArray array = json.getAsJsonArray("bodySite");
4436      for (int i = 0; i < array.size(); i++) {
4437        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4438      }
4439    };
4440    if (json.has("notes"))
4441      res.setNotesElement(parseString(json.get("notes").getAsString()));
4442    if (json.has("_notes"))
4443      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
4444    return res;
4445  }
4446
4447  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
4448    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
4449    parseBackboneProperties(json, res);
4450    if (json.has("summary"))
4451      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
4452    if (json.has("assessment")) {
4453      JsonArray array = json.getAsJsonArray("assessment");
4454      for (int i = 0; i < array.size(); i++) {
4455        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
4456      }
4457    };
4458    return res;
4459  }
4460
4461  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
4462    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
4463    parseBackboneProperties(json, res);
4464    if (json.has("code"))
4465      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4466    if (json.has("detail")) {
4467      JsonArray array = json.getAsJsonArray("detail");
4468      for (int i = 0; i < array.size(); i++) {
4469        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
4470      }
4471    };
4472    return res;
4473  }
4474
4475  protected Conformance parseConformance(JsonObject json) throws IOException, FHIRFormatError {
4476    Conformance res = new Conformance();
4477    parseDomainResourceProperties(json, res);
4478    if (json.has("url"))
4479      res.setUrlElement(parseUri(json.get("url").getAsString()));
4480    if (json.has("_url"))
4481      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4482    if (json.has("version"))
4483      res.setVersionElement(parseString(json.get("version").getAsString()));
4484    if (json.has("_version"))
4485      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4486    if (json.has("name"))
4487      res.setNameElement(parseString(json.get("name").getAsString()));
4488    if (json.has("_name"))
4489      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4490    if (json.has("status"))
4491      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
4492    if (json.has("_status"))
4493      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4494    if (json.has("experimental"))
4495      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4496    if (json.has("_experimental"))
4497      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4498    if (json.has("date"))
4499      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4500    if (json.has("_date"))
4501      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4502    if (json.has("publisher"))
4503      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4504    if (json.has("_publisher"))
4505      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4506    if (json.has("contact")) {
4507      JsonArray array = json.getAsJsonArray("contact");
4508      for (int i = 0; i < array.size(); i++) {
4509        res.getContact().add(parseConformanceConformanceContactComponent(array.get(i).getAsJsonObject(), res));
4510      }
4511    };
4512    if (json.has("description"))
4513      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4514    if (json.has("_description"))
4515      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4516    if (json.has("useContext")) {
4517      JsonArray array = json.getAsJsonArray("useContext");
4518      for (int i = 0; i < array.size(); i++) {
4519        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4520      }
4521    };
4522    if (json.has("requirements"))
4523      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
4524    if (json.has("_requirements"))
4525      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
4526    if (json.has("copyright"))
4527      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
4528    if (json.has("_copyright"))
4529      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4530    if (json.has("kind"))
4531      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Conformance.ConformanceStatementKind.NULL, new Conformance.ConformanceStatementKindEnumFactory()));
4532    if (json.has("_kind"))
4533      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4534    if (json.has("software"))
4535      res.setSoftware(parseConformanceConformanceSoftwareComponent(json.getAsJsonObject("software"), res));
4536    if (json.has("implementation"))
4537      res.setImplementation(parseConformanceConformanceImplementationComponent(json.getAsJsonObject("implementation"), res));
4538    if (json.has("fhirVersion"))
4539      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
4540    if (json.has("_fhirVersion"))
4541      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
4542    if (json.has("acceptUnknown"))
4543      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), Conformance.UnknownContentCode.NULL, new Conformance.UnknownContentCodeEnumFactory()));
4544    if (json.has("_acceptUnknown"))
4545      parseElementProperties(json.getAsJsonObject("_acceptUnknown"), res.getAcceptUnknownElement());
4546    if (json.has("format")) {
4547      JsonArray array = json.getAsJsonArray("format");
4548      for (int i = 0; i < array.size(); i++) {
4549        res.getFormat().add(parseCode(array.get(i).getAsString()));
4550      }
4551    };
4552    if (json.has("_format")) {
4553      JsonArray array = json.getAsJsonArray("_format");
4554      for (int i = 0; i < array.size(); i++) {
4555        if (i == res.getFormat().size())
4556          res.getFormat().add(parseCode(null));
4557        if (array.get(i) instanceof JsonObject) 
4558          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4559      }
4560    };
4561    if (json.has("profile")) {
4562      JsonArray array = json.getAsJsonArray("profile");
4563      for (int i = 0; i < array.size(); i++) {
4564        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
4565      }
4566    };
4567    if (json.has("rest")) {
4568      JsonArray array = json.getAsJsonArray("rest");
4569      for (int i = 0; i < array.size(); i++) {
4570        res.getRest().add(parseConformanceConformanceRestComponent(array.get(i).getAsJsonObject(), res));
4571      }
4572    };
4573    if (json.has("messaging")) {
4574      JsonArray array = json.getAsJsonArray("messaging");
4575      for (int i = 0; i < array.size(); i++) {
4576        res.getMessaging().add(parseConformanceConformanceMessagingComponent(array.get(i).getAsJsonObject(), res));
4577      }
4578    };
4579    if (json.has("document")) {
4580      JsonArray array = json.getAsJsonArray("document");
4581      for (int i = 0; i < array.size(); i++) {
4582        res.getDocument().add(parseConformanceConformanceDocumentComponent(array.get(i).getAsJsonObject(), res));
4583      }
4584    };
4585    return res;
4586  }
4587
4588  protected Conformance.ConformanceContactComponent parseConformanceConformanceContactComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4589    Conformance.ConformanceContactComponent res = new Conformance.ConformanceContactComponent();
4590    parseBackboneProperties(json, res);
4591    if (json.has("name"))
4592      res.setNameElement(parseString(json.get("name").getAsString()));
4593    if (json.has("_name"))
4594      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4595    if (json.has("telecom")) {
4596      JsonArray array = json.getAsJsonArray("telecom");
4597      for (int i = 0; i < array.size(); i++) {
4598        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4599      }
4600    };
4601    return res;
4602  }
4603
4604  protected Conformance.ConformanceSoftwareComponent parseConformanceConformanceSoftwareComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4605    Conformance.ConformanceSoftwareComponent res = new Conformance.ConformanceSoftwareComponent();
4606    parseBackboneProperties(json, res);
4607    if (json.has("name"))
4608      res.setNameElement(parseString(json.get("name").getAsString()));
4609    if (json.has("_name"))
4610      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4611    if (json.has("version"))
4612      res.setVersionElement(parseString(json.get("version").getAsString()));
4613    if (json.has("_version"))
4614      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4615    if (json.has("releaseDate"))
4616      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4617    if (json.has("_releaseDate"))
4618      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
4619    return res;
4620  }
4621
4622  protected Conformance.ConformanceImplementationComponent parseConformanceConformanceImplementationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4623    Conformance.ConformanceImplementationComponent res = new Conformance.ConformanceImplementationComponent();
4624    parseBackboneProperties(json, res);
4625    if (json.has("description"))
4626      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4627    if (json.has("_description"))
4628      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4629    if (json.has("url"))
4630      res.setUrlElement(parseUri(json.get("url").getAsString()));
4631    if (json.has("_url"))
4632      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4633    return res;
4634  }
4635
4636  protected Conformance.ConformanceRestComponent parseConformanceConformanceRestComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4637    Conformance.ConformanceRestComponent res = new Conformance.ConformanceRestComponent();
4638    parseBackboneProperties(json, res);
4639    if (json.has("mode"))
4640      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.RestfulConformanceMode.NULL, new Conformance.RestfulConformanceModeEnumFactory()));
4641    if (json.has("_mode"))
4642      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4643    if (json.has("documentation"))
4644      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4645    if (json.has("_documentation"))
4646      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4647    if (json.has("security"))
4648      res.setSecurity(parseConformanceConformanceRestSecurityComponent(json.getAsJsonObject("security"), owner));
4649    if (json.has("resource")) {
4650      JsonArray array = json.getAsJsonArray("resource");
4651      for (int i = 0; i < array.size(); i++) {
4652        res.getResource().add(parseConformanceConformanceRestResourceComponent(array.get(i).getAsJsonObject(), owner));
4653      }
4654    };
4655    if (json.has("interaction")) {
4656      JsonArray array = json.getAsJsonArray("interaction");
4657      for (int i = 0; i < array.size(); i++) {
4658        res.getInteraction().add(parseConformanceSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
4659      }
4660    };
4661    if (json.has("transactionMode"))
4662      res.setTransactionModeElement(parseEnumeration(json.get("transactionMode").getAsString(), Conformance.TransactionMode.NULL, new Conformance.TransactionModeEnumFactory()));
4663    if (json.has("_transactionMode"))
4664      parseElementProperties(json.getAsJsonObject("_transactionMode"), res.getTransactionModeElement());
4665    if (json.has("searchParam")) {
4666      JsonArray array = json.getAsJsonArray("searchParam");
4667      for (int i = 0; i < array.size(); i++) {
4668        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
4669      }
4670    };
4671    if (json.has("operation")) {
4672      JsonArray array = json.getAsJsonArray("operation");
4673      for (int i = 0; i < array.size(); i++) {
4674        res.getOperation().add(parseConformanceConformanceRestOperationComponent(array.get(i).getAsJsonObject(), owner));
4675      }
4676    };
4677    if (json.has("compartment")) {
4678      JsonArray array = json.getAsJsonArray("compartment");
4679      for (int i = 0; i < array.size(); i++) {
4680        res.getCompartment().add(parseUri(array.get(i).getAsString()));
4681      }
4682    };
4683    if (json.has("_compartment")) {
4684      JsonArray array = json.getAsJsonArray("_compartment");
4685      for (int i = 0; i < array.size(); i++) {
4686        if (i == res.getCompartment().size())
4687          res.getCompartment().add(parseUri(null));
4688        if (array.get(i) instanceof JsonObject) 
4689          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4690      }
4691    };
4692    return res;
4693  }
4694
4695  protected Conformance.ConformanceRestSecurityComponent parseConformanceConformanceRestSecurityComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4696    Conformance.ConformanceRestSecurityComponent res = new Conformance.ConformanceRestSecurityComponent();
4697    parseBackboneProperties(json, res);
4698    if (json.has("cors"))
4699      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4700    if (json.has("_cors"))
4701      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
4702    if (json.has("service")) {
4703      JsonArray array = json.getAsJsonArray("service");
4704      for (int i = 0; i < array.size(); i++) {
4705        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4706      }
4707    };
4708    if (json.has("description"))
4709      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4710    if (json.has("_description"))
4711      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4712    if (json.has("certificate")) {
4713      JsonArray array = json.getAsJsonArray("certificate");
4714      for (int i = 0; i < array.size(); i++) {
4715        res.getCertificate().add(parseConformanceConformanceRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
4716      }
4717    };
4718    return res;
4719  }
4720
4721  protected Conformance.ConformanceRestSecurityCertificateComponent parseConformanceConformanceRestSecurityCertificateComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4722    Conformance.ConformanceRestSecurityCertificateComponent res = new Conformance.ConformanceRestSecurityCertificateComponent();
4723    parseBackboneProperties(json, res);
4724    if (json.has("type"))
4725      res.setTypeElement(parseCode(json.get("type").getAsString()));
4726    if (json.has("_type"))
4727      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4728    if (json.has("blob"))
4729      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
4730    if (json.has("_blob"))
4731      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
4732    return res;
4733  }
4734
4735  protected Conformance.ConformanceRestResourceComponent parseConformanceConformanceRestResourceComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4736    Conformance.ConformanceRestResourceComponent res = new Conformance.ConformanceRestResourceComponent();
4737    parseBackboneProperties(json, res);
4738    if (json.has("type"))
4739      res.setTypeElement(parseCode(json.get("type").getAsString()));
4740    if (json.has("_type"))
4741      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4742    if (json.has("profile"))
4743      res.setProfile(parseReference(json.getAsJsonObject("profile")));
4744    if (json.has("interaction")) {
4745      JsonArray array = json.getAsJsonArray("interaction");
4746      for (int i = 0; i < array.size(); i++) {
4747        res.getInteraction().add(parseConformanceResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
4748      }
4749    };
4750    if (json.has("versioning"))
4751      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), Conformance.ResourceVersionPolicy.NULL, new Conformance.ResourceVersionPolicyEnumFactory()));
4752    if (json.has("_versioning"))
4753      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
4754    if (json.has("readHistory"))
4755      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4756    if (json.has("_readHistory"))
4757      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
4758    if (json.has("updateCreate"))
4759      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4760    if (json.has("_updateCreate"))
4761      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
4762    if (json.has("conditionalCreate"))
4763      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4764    if (json.has("_conditionalCreate"))
4765      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
4766    if (json.has("conditionalUpdate"))
4767      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4768    if (json.has("_conditionalUpdate"))
4769      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
4770    if (json.has("conditionalDelete"))
4771      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), Conformance.ConditionalDeleteStatus.NULL, new Conformance.ConditionalDeleteStatusEnumFactory()));
4772    if (json.has("_conditionalDelete"))
4773      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
4774    if (json.has("searchInclude")) {
4775      JsonArray array = json.getAsJsonArray("searchInclude");
4776      for (int i = 0; i < array.size(); i++) {
4777        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4778      }
4779    };
4780    if (json.has("_searchInclude")) {
4781      JsonArray array = json.getAsJsonArray("_searchInclude");
4782      for (int i = 0; i < array.size(); i++) {
4783        if (i == res.getSearchInclude().size())
4784          res.getSearchInclude().add(parseString(null));
4785        if (array.get(i) instanceof JsonObject) 
4786          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4787      }
4788    };
4789    if (json.has("searchRevInclude")) {
4790      JsonArray array = json.getAsJsonArray("searchRevInclude");
4791      for (int i = 0; i < array.size(); i++) {
4792        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4793      }
4794    };
4795    if (json.has("_searchRevInclude")) {
4796      JsonArray array = json.getAsJsonArray("_searchRevInclude");
4797      for (int i = 0; i < array.size(); i++) {
4798        if (i == res.getSearchRevInclude().size())
4799          res.getSearchRevInclude().add(parseString(null));
4800        if (array.get(i) instanceof JsonObject) 
4801          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4802      }
4803    };
4804    if (json.has("searchParam")) {
4805      JsonArray array = json.getAsJsonArray("searchParam");
4806      for (int i = 0; i < array.size(); i++) {
4807        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
4808      }
4809    };
4810    return res;
4811  }
4812
4813  protected Conformance.ResourceInteractionComponent parseConformanceResourceInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4814    Conformance.ResourceInteractionComponent res = new Conformance.ResourceInteractionComponent();
4815    parseBackboneProperties(json, res);
4816    if (json.has("code"))
4817      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.TypeRestfulInteraction.NULL, new Conformance.TypeRestfulInteractionEnumFactory()));
4818    if (json.has("_code"))
4819      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4820    if (json.has("documentation"))
4821      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4822    if (json.has("_documentation"))
4823      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4824    return res;
4825  }
4826
4827  protected Conformance.ConformanceRestResourceSearchParamComponent parseConformanceConformanceRestResourceSearchParamComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4828    Conformance.ConformanceRestResourceSearchParamComponent res = new Conformance.ConformanceRestResourceSearchParamComponent();
4829    parseBackboneProperties(json, res);
4830    if (json.has("name"))
4831      res.setNameElement(parseString(json.get("name").getAsString()));
4832    if (json.has("_name"))
4833      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4834    if (json.has("definition"))
4835      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
4836    if (json.has("_definition"))
4837      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4838    if (json.has("type"))
4839      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4840    if (json.has("_type"))
4841      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4842    if (json.has("documentation"))
4843      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4844    if (json.has("_documentation"))
4845      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4846    if (json.has("target")) {
4847      JsonArray array = json.getAsJsonArray("target");
4848      for (int i = 0; i < array.size(); i++) {
4849        res.getTarget().add(parseCode(array.get(i).getAsString()));
4850      }
4851    };
4852    if (json.has("_target")) {
4853      JsonArray array = json.getAsJsonArray("_target");
4854      for (int i = 0; i < array.size(); i++) {
4855        if (i == res.getTarget().size())
4856          res.getTarget().add(parseCode(null));
4857        if (array.get(i) instanceof JsonObject) 
4858          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
4859      }
4860    };
4861    if (json.has("modifier")) {
4862      JsonArray array = json.getAsJsonArray("modifier");
4863      for (int i = 0; i < array.size(); i++) {
4864        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
4865      }
4866    };
4867    if (json.has("_modifier")) {
4868      JsonArray array = json.getAsJsonArray("_modifier");
4869      for (int i = 0; i < array.size(); i++) {
4870        if (i == res.getModifier().size())
4871          res.getModifier().add(parseEnumeration(null, Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
4872        if (array.get(i) instanceof JsonObject) 
4873          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
4874      }
4875    };
4876    if (json.has("chain")) {
4877      JsonArray array = json.getAsJsonArray("chain");
4878      for (int i = 0; i < array.size(); i++) {
4879        res.getChain().add(parseString(array.get(i).getAsString()));
4880      }
4881    };
4882    if (json.has("_chain")) {
4883      JsonArray array = json.getAsJsonArray("_chain");
4884      for (int i = 0; i < array.size(); i++) {
4885        if (i == res.getChain().size())
4886          res.getChain().add(parseString(null));
4887        if (array.get(i) instanceof JsonObject) 
4888          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
4889      }
4890    };
4891    return res;
4892  }
4893
4894  protected Conformance.SystemInteractionComponent parseConformanceSystemInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4895    Conformance.SystemInteractionComponent res = new Conformance.SystemInteractionComponent();
4896    parseBackboneProperties(json, res);
4897    if (json.has("code"))
4898      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.SystemRestfulInteraction.NULL, new Conformance.SystemRestfulInteractionEnumFactory()));
4899    if (json.has("_code"))
4900      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4901    if (json.has("documentation"))
4902      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4903    if (json.has("_documentation"))
4904      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4905    return res;
4906  }
4907
4908  protected Conformance.ConformanceRestOperationComponent parseConformanceConformanceRestOperationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4909    Conformance.ConformanceRestOperationComponent res = new Conformance.ConformanceRestOperationComponent();
4910    parseBackboneProperties(json, res);
4911    if (json.has("name"))
4912      res.setNameElement(parseString(json.get("name").getAsString()));
4913    if (json.has("_name"))
4914      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4915    if (json.has("definition"))
4916      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
4917    return res;
4918  }
4919
4920  protected Conformance.ConformanceMessagingComponent parseConformanceConformanceMessagingComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4921    Conformance.ConformanceMessagingComponent res = new Conformance.ConformanceMessagingComponent();
4922    parseBackboneProperties(json, res);
4923    if (json.has("endpoint")) {
4924      JsonArray array = json.getAsJsonArray("endpoint");
4925      for (int i = 0; i < array.size(); i++) {
4926        res.getEndpoint().add(parseConformanceConformanceMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
4927      }
4928    };
4929    if (json.has("reliableCache"))
4930      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4931    if (json.has("_reliableCache"))
4932      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
4933    if (json.has("documentation"))
4934      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4935    if (json.has("_documentation"))
4936      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4937    if (json.has("event")) {
4938      JsonArray array = json.getAsJsonArray("event");
4939      for (int i = 0; i < array.size(); i++) {
4940        res.getEvent().add(parseConformanceConformanceMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
4941      }
4942    };
4943    return res;
4944  }
4945
4946  protected Conformance.ConformanceMessagingEndpointComponent parseConformanceConformanceMessagingEndpointComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4947    Conformance.ConformanceMessagingEndpointComponent res = new Conformance.ConformanceMessagingEndpointComponent();
4948    parseBackboneProperties(json, res);
4949    if (json.has("protocol"))
4950      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
4951    if (json.has("address"))
4952      res.setAddressElement(parseUri(json.get("address").getAsString()));
4953    if (json.has("_address"))
4954      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
4955    return res;
4956  }
4957
4958  protected Conformance.ConformanceMessagingEventComponent parseConformanceConformanceMessagingEventComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4959    Conformance.ConformanceMessagingEventComponent res = new Conformance.ConformanceMessagingEventComponent();
4960    parseBackboneProperties(json, res);
4961    if (json.has("code"))
4962      res.setCode(parseCoding(json.getAsJsonObject("code")));
4963    if (json.has("category"))
4964      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), Conformance.MessageSignificanceCategory.NULL, new Conformance.MessageSignificanceCategoryEnumFactory()));
4965    if (json.has("_category"))
4966      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
4967    if (json.has("mode"))
4968      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.ConformanceEventMode.NULL, new Conformance.ConformanceEventModeEnumFactory()));
4969    if (json.has("_mode"))
4970      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4971    if (json.has("focus"))
4972      res.setFocusElement(parseCode(json.get("focus").getAsString()));
4973    if (json.has("_focus"))
4974      parseElementProperties(json.getAsJsonObject("_focus"), res.getFocusElement());
4975    if (json.has("request"))
4976      res.setRequest(parseReference(json.getAsJsonObject("request")));
4977    if (json.has("response"))
4978      res.setResponse(parseReference(json.getAsJsonObject("response")));
4979    if (json.has("documentation"))
4980      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4981    if (json.has("_documentation"))
4982      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4983    return res;
4984  }
4985
4986  protected Conformance.ConformanceDocumentComponent parseConformanceConformanceDocumentComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
4987    Conformance.ConformanceDocumentComponent res = new Conformance.ConformanceDocumentComponent();
4988    parseBackboneProperties(json, res);
4989    if (json.has("mode"))
4990      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.DocumentMode.NULL, new Conformance.DocumentModeEnumFactory()));
4991    if (json.has("_mode"))
4992      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4993    if (json.has("documentation"))
4994      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
4995    if (json.has("_documentation"))
4996      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4997    if (json.has("profile"))
4998      res.setProfile(parseReference(json.getAsJsonObject("profile")));
4999    return res;
5000  }
5001
5002  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
5003    Contract res = new Contract();
5004    parseDomainResourceProperties(json, res);
5005    if (json.has("identifier"))
5006      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5007    if (json.has("issued"))
5008      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
5009    if (json.has("_issued"))
5010      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
5011    if (json.has("applies"))
5012      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
5013    if (json.has("subject")) {
5014      JsonArray array = json.getAsJsonArray("subject");
5015      for (int i = 0; i < array.size(); i++) {
5016        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
5017      }
5018    };
5019    if (json.has("topic")) {
5020      JsonArray array = json.getAsJsonArray("topic");
5021      for (int i = 0; i < array.size(); i++) {
5022        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5023      }
5024    };
5025    if (json.has("authority")) {
5026      JsonArray array = json.getAsJsonArray("authority");
5027      for (int i = 0; i < array.size(); i++) {
5028        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
5029      }
5030    };
5031    if (json.has("domain")) {
5032      JsonArray array = json.getAsJsonArray("domain");
5033      for (int i = 0; i < array.size(); i++) {
5034        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
5035      }
5036    };
5037    if (json.has("type"))
5038      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5039    if (json.has("subType")) {
5040      JsonArray array = json.getAsJsonArray("subType");
5041      for (int i = 0; i < array.size(); i++) {
5042        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5043      }
5044    };
5045    if (json.has("action")) {
5046      JsonArray array = json.getAsJsonArray("action");
5047      for (int i = 0; i < array.size(); i++) {
5048        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5049      }
5050    };
5051    if (json.has("actionReason")) {
5052      JsonArray array = json.getAsJsonArray("actionReason");
5053      for (int i = 0; i < array.size(); i++) {
5054        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5055      }
5056    };
5057    if (json.has("agent")) {
5058      JsonArray array = json.getAsJsonArray("agent");
5059      for (int i = 0; i < array.size(); i++) {
5060        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), res));
5061      }
5062    };
5063    if (json.has("signer")) {
5064      JsonArray array = json.getAsJsonArray("signer");
5065      for (int i = 0; i < array.size(); i++) {
5066        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
5067      }
5068    };
5069    if (json.has("valuedItem")) {
5070      JsonArray array = json.getAsJsonArray("valuedItem");
5071      for (int i = 0; i < array.size(); i++) {
5072        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
5073      }
5074    };
5075    if (json.has("term")) {
5076      JsonArray array = json.getAsJsonArray("term");
5077      for (int i = 0; i < array.size(); i++) {
5078        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
5079      }
5080    };
5081    Type binding = parseType("binding", json);
5082    if (binding != null)
5083      res.setBinding(binding);
5084    if (json.has("friendly")) {
5085      JsonArray array = json.getAsJsonArray("friendly");
5086      for (int i = 0; i < array.size(); i++) {
5087        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
5088      }
5089    };
5090    if (json.has("legal")) {
5091      JsonArray array = json.getAsJsonArray("legal");
5092      for (int i = 0; i < array.size(); i++) {
5093        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
5094      }
5095    };
5096    if (json.has("rule")) {
5097      JsonArray array = json.getAsJsonArray("rule");
5098      for (int i = 0; i < array.size(); i++) {
5099        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
5100      }
5101    };
5102    return res;
5103  }
5104
5105  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5106    Contract.AgentComponent res = new Contract.AgentComponent();
5107    parseBackboneProperties(json, res);
5108    if (json.has("actor"))
5109      res.setActor(parseReference(json.getAsJsonObject("actor")));
5110    if (json.has("role")) {
5111      JsonArray array = json.getAsJsonArray("role");
5112      for (int i = 0; i < array.size(); i++) {
5113        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5114      }
5115    };
5116    return res;
5117  }
5118
5119  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5120    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
5121    parseBackboneProperties(json, res);
5122    if (json.has("type"))
5123      res.setType(parseCoding(json.getAsJsonObject("type")));
5124    if (json.has("party"))
5125      res.setParty(parseReference(json.getAsJsonObject("party")));
5126    if (json.has("signature")) {
5127      JsonArray array = json.getAsJsonArray("signature");
5128      for (int i = 0; i < array.size(); i++) {
5129        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
5130      }
5131    };
5132    return res;
5133  }
5134
5135  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5136    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
5137    parseBackboneProperties(json, res);
5138    Type entity = parseType("entity", json);
5139    if (entity != null)
5140      res.setEntity(entity);
5141    if (json.has("identifier"))
5142      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5143    if (json.has("effectiveTime"))
5144      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
5145    if (json.has("_effectiveTime"))
5146      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
5147    if (json.has("quantity"))
5148      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
5149    if (json.has("unitPrice"))
5150      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5151    if (json.has("factor"))
5152      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5153    if (json.has("_factor"))
5154      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5155    if (json.has("points"))
5156      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
5157    if (json.has("_points"))
5158      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
5159    if (json.has("net"))
5160      res.setNet(parseMoney(json.getAsJsonObject("net")));
5161    return res;
5162  }
5163
5164  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5165    Contract.TermComponent res = new Contract.TermComponent();
5166    parseBackboneProperties(json, res);
5167    if (json.has("identifier"))
5168      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5169    if (json.has("issued"))
5170      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
5171    if (json.has("_issued"))
5172      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
5173    if (json.has("applies"))
5174      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
5175    if (json.has("type"))
5176      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5177    if (json.has("subType"))
5178      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5179    if (json.has("topic")) {
5180      JsonArray array = json.getAsJsonArray("topic");
5181      for (int i = 0; i < array.size(); i++) {
5182        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5183      }
5184    };
5185    if (json.has("action")) {
5186      JsonArray array = json.getAsJsonArray("action");
5187      for (int i = 0; i < array.size(); i++) {
5188        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5189      }
5190    };
5191    if (json.has("actionReason")) {
5192      JsonArray array = json.getAsJsonArray("actionReason");
5193      for (int i = 0; i < array.size(); i++) {
5194        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5195      }
5196    };
5197    if (json.has("agent")) {
5198      JsonArray array = json.getAsJsonArray("agent");
5199      for (int i = 0; i < array.size(); i++) {
5200        res.getAgent().add(parseContractTermAgentComponent(array.get(i).getAsJsonObject(), owner));
5201      }
5202    };
5203    if (json.has("text"))
5204      res.setTextElement(parseString(json.get("text").getAsString()));
5205    if (json.has("_text"))
5206      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
5207    if (json.has("valuedItem")) {
5208      JsonArray array = json.getAsJsonArray("valuedItem");
5209      for (int i = 0; i < array.size(); i++) {
5210        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
5211      }
5212    };
5213    if (json.has("group")) {
5214      JsonArray array = json.getAsJsonArray("group");
5215      for (int i = 0; i < array.size(); i++) {
5216        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
5217      }
5218    };
5219    return res;
5220  }
5221
5222  protected Contract.TermAgentComponent parseContractTermAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5223    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
5224    parseBackboneProperties(json, res);
5225    if (json.has("actor"))
5226      res.setActor(parseReference(json.getAsJsonObject("actor")));
5227    if (json.has("role")) {
5228      JsonArray array = json.getAsJsonArray("role");
5229      for (int i = 0; i < array.size(); i++) {
5230        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5231      }
5232    };
5233    return res;
5234  }
5235
5236  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5237    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
5238    parseBackboneProperties(json, res);
5239    Type entity = parseType("entity", json);
5240    if (entity != null)
5241      res.setEntity(entity);
5242    if (json.has("identifier"))
5243      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5244    if (json.has("effectiveTime"))
5245      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
5246    if (json.has("_effectiveTime"))
5247      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
5248    if (json.has("quantity"))
5249      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
5250    if (json.has("unitPrice"))
5251      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5252    if (json.has("factor"))
5253      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5254    if (json.has("_factor"))
5255      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5256    if (json.has("points"))
5257      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
5258    if (json.has("_points"))
5259      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
5260    if (json.has("net"))
5261      res.setNet(parseMoney(json.getAsJsonObject("net")));
5262    return res;
5263  }
5264
5265  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5266    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
5267    parseBackboneProperties(json, res);
5268    Type content = parseType("content", json);
5269    if (content != null)
5270      res.setContent(content);
5271    return res;
5272  }
5273
5274  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5275    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
5276    parseBackboneProperties(json, res);
5277    Type content = parseType("content", json);
5278    if (content != null)
5279      res.setContent(content);
5280    return res;
5281  }
5282
5283  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
5284    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
5285    parseBackboneProperties(json, res);
5286    Type content = parseType("content", json);
5287    if (content != null)
5288      res.setContent(content);
5289    return res;
5290  }
5291
5292  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
5293    Coverage res = new Coverage();
5294    parseDomainResourceProperties(json, res);
5295    Type issuer = parseType("issuer", json);
5296    if (issuer != null)
5297      res.setIssuer(issuer);
5298    if (json.has("bin"))
5299      res.setBinElement(parseString(json.get("bin").getAsString()));
5300    if (json.has("_bin"))
5301      parseElementProperties(json.getAsJsonObject("_bin"), res.getBinElement());
5302    if (json.has("period"))
5303      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5304    if (json.has("type"))
5305      res.setType(parseCoding(json.getAsJsonObject("type")));
5306    Type planholder = parseType("planholder", json);
5307    if (planholder != null)
5308      res.setPlanholder(planholder);
5309    Type beneficiary = parseType("beneficiary", json);
5310    if (beneficiary != null)
5311      res.setBeneficiary(beneficiary);
5312    if (json.has("relationship"))
5313      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
5314    if (json.has("identifier")) {
5315      JsonArray array = json.getAsJsonArray("identifier");
5316      for (int i = 0; i < array.size(); i++) {
5317        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5318      }
5319    };
5320    if (json.has("group"))
5321      res.setGroupElement(parseString(json.get("group").getAsString()));
5322    if (json.has("_group"))
5323      parseElementProperties(json.getAsJsonObject("_group"), res.getGroupElement());
5324    if (json.has("plan"))
5325      res.setPlanElement(parseString(json.get("plan").getAsString()));
5326    if (json.has("_plan"))
5327      parseElementProperties(json.getAsJsonObject("_plan"), res.getPlanElement());
5328    if (json.has("subPlan"))
5329      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
5330    if (json.has("_subPlan"))
5331      parseElementProperties(json.getAsJsonObject("_subPlan"), res.getSubPlanElement());
5332    if (json.has("dependent"))
5333      res.setDependentElement(parsePositiveInt(json.get("dependent").getAsString()));
5334    if (json.has("_dependent"))
5335      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
5336    if (json.has("sequence"))
5337      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5338    if (json.has("_sequence"))
5339      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5340    if (json.has("exception")) {
5341      JsonArray array = json.getAsJsonArray("exception");
5342      for (int i = 0; i < array.size(); i++) {
5343        res.getException().add(parseCoding(array.get(i).getAsJsonObject()));
5344      }
5345    };
5346    if (json.has("school"))
5347      res.setSchoolElement(parseString(json.get("school").getAsString()));
5348    if (json.has("_school"))
5349      parseElementProperties(json.getAsJsonObject("_school"), res.getSchoolElement());
5350    if (json.has("network"))
5351      res.setNetworkElement(parseString(json.get("network").getAsString()));
5352    if (json.has("_network"))
5353      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
5354    if (json.has("contract")) {
5355      JsonArray array = json.getAsJsonArray("contract");
5356      for (int i = 0; i < array.size(); i++) {
5357        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
5358      }
5359    };
5360    return res;
5361  }
5362
5363  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
5364    DataElement res = new DataElement();
5365    parseDomainResourceProperties(json, res);
5366    if (json.has("url"))
5367      res.setUrlElement(parseUri(json.get("url").getAsString()));
5368    if (json.has("_url"))
5369      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5370    if (json.has("identifier")) {
5371      JsonArray array = json.getAsJsonArray("identifier");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5374      }
5375    };
5376    if (json.has("version"))
5377      res.setVersionElement(parseString(json.get("version").getAsString()));
5378    if (json.has("_version"))
5379      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5380    if (json.has("status"))
5381      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
5382    if (json.has("_status"))
5383      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5384    if (json.has("experimental"))
5385      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5386    if (json.has("_experimental"))
5387      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5388    if (json.has("publisher"))
5389      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5390    if (json.has("_publisher"))
5391      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5392    if (json.has("date"))
5393      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5394    if (json.has("_date"))
5395      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5396    if (json.has("name"))
5397      res.setNameElement(parseString(json.get("name").getAsString()));
5398    if (json.has("_name"))
5399      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5400    if (json.has("contact")) {
5401      JsonArray array = json.getAsJsonArray("contact");
5402      for (int i = 0; i < array.size(); i++) {
5403        res.getContact().add(parseDataElementDataElementContactComponent(array.get(i).getAsJsonObject(), res));
5404      }
5405    };
5406    if (json.has("useContext")) {
5407      JsonArray array = json.getAsJsonArray("useContext");
5408      for (int i = 0; i < array.size(); i++) {
5409        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5410      }
5411    };
5412    if (json.has("copyright"))
5413      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
5414    if (json.has("_copyright"))
5415      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5416    if (json.has("stringency"))
5417      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
5418    if (json.has("_stringency"))
5419      parseElementProperties(json.getAsJsonObject("_stringency"), res.getStringencyElement());
5420    if (json.has("mapping")) {
5421      JsonArray array = json.getAsJsonArray("mapping");
5422      for (int i = 0; i < array.size(); i++) {
5423        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
5424      }
5425    };
5426    if (json.has("element")) {
5427      JsonArray array = json.getAsJsonArray("element");
5428      for (int i = 0; i < array.size(); i++) {
5429        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
5430      }
5431    };
5432    return res;
5433  }
5434
5435  protected DataElement.DataElementContactComponent parseDataElementDataElementContactComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
5436    DataElement.DataElementContactComponent res = new DataElement.DataElementContactComponent();
5437    parseBackboneProperties(json, res);
5438    if (json.has("name"))
5439      res.setNameElement(parseString(json.get("name").getAsString()));
5440    if (json.has("_name"))
5441      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5442    if (json.has("telecom")) {
5443      JsonArray array = json.getAsJsonArray("telecom");
5444      for (int i = 0; i < array.size(); i++) {
5445        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5446      }
5447    };
5448    return res;
5449  }
5450
5451  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
5452    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
5453    parseBackboneProperties(json, res);
5454    if (json.has("identity"))
5455      res.setIdentityElement(parseId(json.get("identity").getAsString()));
5456    if (json.has("_identity"))
5457      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
5458    if (json.has("uri"))
5459      res.setUriElement(parseUri(json.get("uri").getAsString()));
5460    if (json.has("_uri"))
5461      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
5462    if (json.has("name"))
5463      res.setNameElement(parseString(json.get("name").getAsString()));
5464    if (json.has("_name"))
5465      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5466    if (json.has("comment"))
5467      res.setCommentElement(parseString(json.get("comment").getAsString()));
5468    if (json.has("_comment"))
5469      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
5470    return res;
5471  }
5472
5473  protected DecisionSupportRule parseDecisionSupportRule(JsonObject json) throws IOException, FHIRFormatError {
5474    DecisionSupportRule res = new DecisionSupportRule();
5475    parseDomainResourceProperties(json, res);
5476    if (json.has("moduleMetadata"))
5477      res.setModuleMetadata(parseModuleMetadata(json.getAsJsonObject("moduleMetadata")));
5478    if (json.has("library")) {
5479      JsonArray array = json.getAsJsonArray("library");
5480      for (int i = 0; i < array.size(); i++) {
5481        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
5482      }
5483    };
5484    if (json.has("trigger")) {
5485      JsonArray array = json.getAsJsonArray("trigger");
5486      for (int i = 0; i < array.size(); i++) {
5487        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
5488      }
5489    };
5490    if (json.has("condition"))
5491      res.setConditionElement(parseString(json.get("condition").getAsString()));
5492    if (json.has("_condition"))
5493      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
5494    if (json.has("action")) {
5495      JsonArray array = json.getAsJsonArray("action");
5496      for (int i = 0; i < array.size(); i++) {
5497        res.getAction().add(parseActionDefinition(array.get(i).getAsJsonObject()));
5498      }
5499    };
5500    return res;
5501  }
5502
5503  protected DecisionSupportServiceModule parseDecisionSupportServiceModule(JsonObject json) throws IOException, FHIRFormatError {
5504    DecisionSupportServiceModule res = new DecisionSupportServiceModule();
5505    parseDomainResourceProperties(json, res);
5506    if (json.has("moduleMetadata"))
5507      res.setModuleMetadata(parseModuleMetadata(json.getAsJsonObject("moduleMetadata")));
5508    if (json.has("trigger")) {
5509      JsonArray array = json.getAsJsonArray("trigger");
5510      for (int i = 0; i < array.size(); i++) {
5511        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
5512      }
5513    };
5514    if (json.has("parameter")) {
5515      JsonArray array = json.getAsJsonArray("parameter");
5516      for (int i = 0; i < array.size(); i++) {
5517        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
5518      }
5519    };
5520    if (json.has("dataRequirement")) {
5521      JsonArray array = json.getAsJsonArray("dataRequirement");
5522      for (int i = 0; i < array.size(); i++) {
5523        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
5524      }
5525    };
5526    return res;
5527  }
5528
5529  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
5530    DetectedIssue res = new DetectedIssue();
5531    parseDomainResourceProperties(json, res);
5532    if (json.has("patient"))
5533      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5534    if (json.has("category"))
5535      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5536    if (json.has("severity"))
5537      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
5538    if (json.has("_severity"))
5539      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
5540    if (json.has("implicated")) {
5541      JsonArray array = json.getAsJsonArray("implicated");
5542      for (int i = 0; i < array.size(); i++) {
5543        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
5544      }
5545    };
5546    if (json.has("detail"))
5547      res.setDetailElement(parseString(json.get("detail").getAsString()));
5548    if (json.has("_detail"))
5549      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
5550    if (json.has("date"))
5551      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5552    if (json.has("_date"))
5553      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5554    if (json.has("author"))
5555      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5556    if (json.has("identifier"))
5557      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5558    if (json.has("reference"))
5559      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
5560    if (json.has("_reference"))
5561      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
5562    if (json.has("mitigation")) {
5563      JsonArray array = json.getAsJsonArray("mitigation");
5564      for (int i = 0; i < array.size(); i++) {
5565        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
5566      }
5567    };
5568    return res;
5569  }
5570
5571  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
5572    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
5573    parseBackboneProperties(json, res);
5574    if (json.has("action"))
5575      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
5576    if (json.has("date"))
5577      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5578    if (json.has("_date"))
5579      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5580    if (json.has("author"))
5581      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5582    return res;
5583  }
5584
5585  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
5586    Device res = new Device();
5587    parseDomainResourceProperties(json, res);
5588    if (json.has("identifier")) {
5589      JsonArray array = json.getAsJsonArray("identifier");
5590      for (int i = 0; i < array.size(); i++) {
5591        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5592      }
5593    };
5594    if (json.has("udiCarrier"))
5595      res.setUdiCarrier(parseIdentifier(json.getAsJsonObject("udiCarrier")));
5596    if (json.has("status"))
5597      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.DeviceStatus.NULL, new Device.DeviceStatusEnumFactory()));
5598    if (json.has("_status"))
5599      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5600    if (json.has("type"))
5601      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5602    if (json.has("lotNumber"))
5603      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
5604    if (json.has("_lotNumber"))
5605      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
5606    if (json.has("manufacturer"))
5607      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
5608    if (json.has("_manufacturer"))
5609      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
5610    if (json.has("manufactureDate"))
5611      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
5612    if (json.has("_manufactureDate"))
5613      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
5614    if (json.has("expirationDate"))
5615      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
5616    if (json.has("_expirationDate"))
5617      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
5618    if (json.has("model"))
5619      res.setModelElement(parseString(json.get("model").getAsString()));
5620    if (json.has("_model"))
5621      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
5622    if (json.has("version"))
5623      res.setVersionElement(parseString(json.get("version").getAsString()));
5624    if (json.has("_version"))
5625      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5626    if (json.has("patient"))
5627      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5628    if (json.has("owner"))
5629      res.setOwner(parseReference(json.getAsJsonObject("owner")));
5630    if (json.has("contact")) {
5631      JsonArray array = json.getAsJsonArray("contact");
5632      for (int i = 0; i < array.size(); i++) {
5633        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
5634      }
5635    };
5636    if (json.has("location"))
5637      res.setLocation(parseReference(json.getAsJsonObject("location")));
5638    if (json.has("url"))
5639      res.setUrlElement(parseUri(json.get("url").getAsString()));
5640    if (json.has("_url"))
5641      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5642    if (json.has("note")) {
5643      JsonArray array = json.getAsJsonArray("note");
5644      for (int i = 0; i < array.size(); i++) {
5645        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5646      }
5647    };
5648    return res;
5649  }
5650
5651  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
5652    DeviceComponent res = new DeviceComponent();
5653    parseDomainResourceProperties(json, res);
5654    if (json.has("type"))
5655      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5656    if (json.has("identifier"))
5657      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5658    if (json.has("lastSystemChange"))
5659      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
5660    if (json.has("_lastSystemChange"))
5661      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
5662    if (json.has("source"))
5663      res.setSource(parseReference(json.getAsJsonObject("source")));
5664    if (json.has("parent"))
5665      res.setParent(parseReference(json.getAsJsonObject("parent")));
5666    if (json.has("operationalStatus")) {
5667      JsonArray array = json.getAsJsonArray("operationalStatus");
5668      for (int i = 0; i < array.size(); i++) {
5669        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5670      }
5671    };
5672    if (json.has("parameterGroup"))
5673      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
5674    if (json.has("measurementPrinciple"))
5675      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
5676    if (json.has("_measurementPrinciple"))
5677      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
5678    if (json.has("productionSpecification")) {
5679      JsonArray array = json.getAsJsonArray("productionSpecification");
5680      for (int i = 0; i < array.size(); i++) {
5681        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
5682      }
5683    };
5684    if (json.has("languageCode"))
5685      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
5686    return res;
5687  }
5688
5689  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
5690    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
5691    parseBackboneProperties(json, res);
5692    if (json.has("specType"))
5693      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
5694    if (json.has("componentId"))
5695      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
5696    if (json.has("productionSpec"))
5697      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
5698    if (json.has("_productionSpec"))
5699      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
5700    return res;
5701  }
5702
5703  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
5704    DeviceMetric res = new DeviceMetric();
5705    parseDomainResourceProperties(json, res);
5706    if (json.has("type"))
5707      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5708    if (json.has("identifier"))
5709      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5710    if (json.has("unit"))
5711      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
5712    if (json.has("source"))
5713      res.setSource(parseReference(json.getAsJsonObject("source")));
5714    if (json.has("parent"))
5715      res.setParent(parseReference(json.getAsJsonObject("parent")));
5716    if (json.has("operationalStatus"))
5717      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
5718    if (json.has("_operationalStatus"))
5719      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
5720    if (json.has("color"))
5721      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
5722    if (json.has("_color"))
5723      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
5724    if (json.has("category"))
5725      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
5726    if (json.has("_category"))
5727      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
5728    if (json.has("measurementPeriod"))
5729      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
5730    if (json.has("calibration")) {
5731      JsonArray array = json.getAsJsonArray("calibration");
5732      for (int i = 0; i < array.size(); i++) {
5733        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
5734      }
5735    };
5736    return res;
5737  }
5738
5739  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
5740    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
5741    parseBackboneProperties(json, res);
5742    if (json.has("type"))
5743      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
5744    if (json.has("_type"))
5745      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5746    if (json.has("state"))
5747      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
5748    if (json.has("_state"))
5749      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
5750    if (json.has("time"))
5751      res.setTimeElement(parseInstant(json.get("time").getAsString()));
5752    if (json.has("_time"))
5753      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
5754    return res;
5755  }
5756
5757  protected DeviceUseRequest parseDeviceUseRequest(JsonObject json) throws IOException, FHIRFormatError {
5758    DeviceUseRequest res = new DeviceUseRequest();
5759    parseDomainResourceProperties(json, res);
5760    Type bodySite = parseType("bodySite", json);
5761    if (bodySite != null)
5762      res.setBodySite(bodySite);
5763    if (json.has("status"))
5764      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseRequest.DeviceUseRequestStatus.NULL, new DeviceUseRequest.DeviceUseRequestStatusEnumFactory()));
5765    if (json.has("_status"))
5766      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5767    if (json.has("device"))
5768      res.setDevice(parseReference(json.getAsJsonObject("device")));
5769    if (json.has("encounter"))
5770      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5771    if (json.has("identifier")) {
5772      JsonArray array = json.getAsJsonArray("identifier");
5773      for (int i = 0; i < array.size(); i++) {
5774        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5775      }
5776    };
5777    if (json.has("indication")) {
5778      JsonArray array = json.getAsJsonArray("indication");
5779      for (int i = 0; i < array.size(); i++) {
5780        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5781      }
5782    };
5783    if (json.has("notes")) {
5784      JsonArray array = json.getAsJsonArray("notes");
5785      for (int i = 0; i < array.size(); i++) {
5786        res.getNotes().add(parseString(array.get(i).getAsString()));
5787      }
5788    };
5789    if (json.has("_notes")) {
5790      JsonArray array = json.getAsJsonArray("_notes");
5791      for (int i = 0; i < array.size(); i++) {
5792        if (i == res.getNotes().size())
5793          res.getNotes().add(parseString(null));
5794        if (array.get(i) instanceof JsonObject) 
5795          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
5796      }
5797    };
5798    if (json.has("prnReason")) {
5799      JsonArray array = json.getAsJsonArray("prnReason");
5800      for (int i = 0; i < array.size(); i++) {
5801        res.getPrnReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5802      }
5803    };
5804    if (json.has("orderedOn"))
5805      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
5806    if (json.has("_orderedOn"))
5807      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
5808    if (json.has("recordedOn"))
5809      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
5810    if (json.has("_recordedOn"))
5811      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
5812    if (json.has("subject"))
5813      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5814    Type timing = parseType("timing", json);
5815    if (timing != null)
5816      res.setTiming(timing);
5817    if (json.has("priority"))
5818      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceUseRequest.DeviceUseRequestPriority.NULL, new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory()));
5819    if (json.has("_priority"))
5820      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5821    return res;
5822  }
5823
5824  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
5825    DeviceUseStatement res = new DeviceUseStatement();
5826    parseDomainResourceProperties(json, res);
5827    Type bodySite = parseType("bodySite", json);
5828    if (bodySite != null)
5829      res.setBodySite(bodySite);
5830    if (json.has("whenUsed"))
5831      res.setWhenUsed(parsePeriod(json.getAsJsonObject("whenUsed")));
5832    if (json.has("device"))
5833      res.setDevice(parseReference(json.getAsJsonObject("device")));
5834    if (json.has("identifier")) {
5835      JsonArray array = json.getAsJsonArray("identifier");
5836      for (int i = 0; i < array.size(); i++) {
5837        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5838      }
5839    };
5840    if (json.has("indication")) {
5841      JsonArray array = json.getAsJsonArray("indication");
5842      for (int i = 0; i < array.size(); i++) {
5843        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5844      }
5845    };
5846    if (json.has("notes")) {
5847      JsonArray array = json.getAsJsonArray("notes");
5848      for (int i = 0; i < array.size(); i++) {
5849        res.getNotes().add(parseString(array.get(i).getAsString()));
5850      }
5851    };
5852    if (json.has("_notes")) {
5853      JsonArray array = json.getAsJsonArray("_notes");
5854      for (int i = 0; i < array.size(); i++) {
5855        if (i == res.getNotes().size())
5856          res.getNotes().add(parseString(null));
5857        if (array.get(i) instanceof JsonObject) 
5858          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
5859      }
5860    };
5861    if (json.has("recordedOn"))
5862      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
5863    if (json.has("_recordedOn"))
5864      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
5865    if (json.has("subject"))
5866      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5867    Type timing = parseType("timing", json);
5868    if (timing != null)
5869      res.setTiming(timing);
5870    return res;
5871  }
5872
5873  protected DiagnosticOrder parseDiagnosticOrder(JsonObject json) throws IOException, FHIRFormatError {
5874    DiagnosticOrder res = new DiagnosticOrder();
5875    parseDomainResourceProperties(json, res);
5876    if (json.has("identifier")) {
5877      JsonArray array = json.getAsJsonArray("identifier");
5878      for (int i = 0; i < array.size(); i++) {
5879        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5880      }
5881    };
5882    if (json.has("status"))
5883      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
5884    if (json.has("_status"))
5885      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5886    if (json.has("priority"))
5887      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DiagnosticOrder.DiagnosticOrderPriority.NULL, new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory()));
5888    if (json.has("_priority"))
5889      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5890    if (json.has("subject"))
5891      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5892    if (json.has("encounter"))
5893      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5894    if (json.has("orderer"))
5895      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
5896    if (json.has("reason")) {
5897      JsonArray array = json.getAsJsonArray("reason");
5898      for (int i = 0; i < array.size(); i++) {
5899        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5900      }
5901    };
5902    if (json.has("supportingInformation")) {
5903      JsonArray array = json.getAsJsonArray("supportingInformation");
5904      for (int i = 0; i < array.size(); i++) {
5905        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5906      }
5907    };
5908    if (json.has("specimen")) {
5909      JsonArray array = json.getAsJsonArray("specimen");
5910      for (int i = 0; i < array.size(); i++) {
5911        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
5912      }
5913    };
5914    if (json.has("event")) {
5915      JsonArray array = json.getAsJsonArray("event");
5916      for (int i = 0; i < array.size(); i++) {
5917        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), res));
5918      }
5919    };
5920    if (json.has("item")) {
5921      JsonArray array = json.getAsJsonArray("item");
5922      for (int i = 0; i < array.size(); i++) {
5923        res.getItem().add(parseDiagnosticOrderDiagnosticOrderItemComponent(array.get(i).getAsJsonObject(), res));
5924      }
5925    };
5926    if (json.has("note")) {
5927      JsonArray array = json.getAsJsonArray("note");
5928      for (int i = 0; i < array.size(); i++) {
5929        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5930      }
5931    };
5932    return res;
5933  }
5934
5935  protected DiagnosticOrder.DiagnosticOrderEventComponent parseDiagnosticOrderDiagnosticOrderEventComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
5936    DiagnosticOrder.DiagnosticOrderEventComponent res = new DiagnosticOrder.DiagnosticOrderEventComponent();
5937    parseBackboneProperties(json, res);
5938    if (json.has("status"))
5939      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
5940    if (json.has("_status"))
5941      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5942    if (json.has("description"))
5943      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
5944    if (json.has("dateTime"))
5945      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
5946    if (json.has("_dateTime"))
5947      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
5948    if (json.has("actor"))
5949      res.setActor(parseReference(json.getAsJsonObject("actor")));
5950    return res;
5951  }
5952
5953  protected DiagnosticOrder.DiagnosticOrderItemComponent parseDiagnosticOrderDiagnosticOrderItemComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
5954    DiagnosticOrder.DiagnosticOrderItemComponent res = new DiagnosticOrder.DiagnosticOrderItemComponent();
5955    parseBackboneProperties(json, res);
5956    if (json.has("code"))
5957      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5958    if (json.has("specimen")) {
5959      JsonArray array = json.getAsJsonArray("specimen");
5960      for (int i = 0; i < array.size(); i++) {
5961        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
5962      }
5963    };
5964    if (json.has("bodySite"))
5965      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5966    if (json.has("status"))
5967      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
5968    if (json.has("_status"))
5969      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5970    if (json.has("event")) {
5971      JsonArray array = json.getAsJsonArray("event");
5972      for (int i = 0; i < array.size(); i++) {
5973        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), owner));
5974      }
5975    };
5976    return res;
5977  }
5978
5979  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
5980    DiagnosticReport res = new DiagnosticReport();
5981    parseDomainResourceProperties(json, res);
5982    if (json.has("identifier")) {
5983      JsonArray array = json.getAsJsonArray("identifier");
5984      for (int i = 0; i < array.size(); i++) {
5985        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5986      }
5987    };
5988    if (json.has("status"))
5989      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
5990    if (json.has("_status"))
5991      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5992    if (json.has("category"))
5993      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5994    if (json.has("code"))
5995      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5996    if (json.has("subject"))
5997      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5998    if (json.has("encounter"))
5999      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6000    Type effective = parseType("effective", json);
6001    if (effective != null)
6002      res.setEffective(effective);
6003    if (json.has("issued"))
6004      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
6005    if (json.has("_issued"))
6006      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6007    if (json.has("performer"))
6008      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
6009    if (json.has("request")) {
6010      JsonArray array = json.getAsJsonArray("request");
6011      for (int i = 0; i < array.size(); i++) {
6012        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
6013      }
6014    };
6015    if (json.has("specimen")) {
6016      JsonArray array = json.getAsJsonArray("specimen");
6017      for (int i = 0; i < array.size(); i++) {
6018        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
6019      }
6020    };
6021    if (json.has("result")) {
6022      JsonArray array = json.getAsJsonArray("result");
6023      for (int i = 0; i < array.size(); i++) {
6024        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
6025      }
6026    };
6027    if (json.has("imagingStudy")) {
6028      JsonArray array = json.getAsJsonArray("imagingStudy");
6029      for (int i = 0; i < array.size(); i++) {
6030        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
6031      }
6032    };
6033    if (json.has("image")) {
6034      JsonArray array = json.getAsJsonArray("image");
6035      for (int i = 0; i < array.size(); i++) {
6036        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
6037      }
6038    };
6039    if (json.has("conclusion"))
6040      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
6041    if (json.has("_conclusion"))
6042      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
6043    if (json.has("codedDiagnosis")) {
6044      JsonArray array = json.getAsJsonArray("codedDiagnosis");
6045      for (int i = 0; i < array.size(); i++) {
6046        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6047      }
6048    };
6049    if (json.has("presentedForm")) {
6050      JsonArray array = json.getAsJsonArray("presentedForm");
6051      for (int i = 0; i < array.size(); i++) {
6052        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
6053      }
6054    };
6055    return res;
6056  }
6057
6058  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
6059    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
6060    parseBackboneProperties(json, res);
6061    if (json.has("comment"))
6062      res.setCommentElement(parseString(json.get("comment").getAsString()));
6063    if (json.has("_comment"))
6064      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
6065    if (json.has("link"))
6066      res.setLink(parseReference(json.getAsJsonObject("link")));
6067    return res;
6068  }
6069
6070  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
6071    DocumentManifest res = new DocumentManifest();
6072    parseDomainResourceProperties(json, res);
6073    if (json.has("masterIdentifier"))
6074      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
6075    if (json.has("identifier")) {
6076      JsonArray array = json.getAsJsonArray("identifier");
6077      for (int i = 0; i < array.size(); i++) {
6078        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6079      }
6080    };
6081    if (json.has("subject"))
6082      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6083    if (json.has("recipient")) {
6084      JsonArray array = json.getAsJsonArray("recipient");
6085      for (int i = 0; i < array.size(); i++) {
6086        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6087      }
6088    };
6089    if (json.has("type"))
6090      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6091    if (json.has("author")) {
6092      JsonArray array = json.getAsJsonArray("author");
6093      for (int i = 0; i < array.size(); i++) {
6094        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6095      }
6096    };
6097    if (json.has("created"))
6098      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6099    if (json.has("_created"))
6100      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6101    if (json.has("source"))
6102      res.setSourceElement(parseUri(json.get("source").getAsString()));
6103    if (json.has("_source"))
6104      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6105    if (json.has("status"))
6106      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
6107    if (json.has("_status"))
6108      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6109    if (json.has("description"))
6110      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6111    if (json.has("_description"))
6112      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6113    if (json.has("content")) {
6114      JsonArray array = json.getAsJsonArray("content");
6115      for (int i = 0; i < array.size(); i++) {
6116        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
6117      }
6118    };
6119    if (json.has("related")) {
6120      JsonArray array = json.getAsJsonArray("related");
6121      for (int i = 0; i < array.size(); i++) {
6122        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
6123      }
6124    };
6125    return res;
6126  }
6127
6128  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
6129    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
6130    parseBackboneProperties(json, res);
6131    Type p = parseType("p", json);
6132    if (p != null)
6133      res.setP(p);
6134    return res;
6135  }
6136
6137  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
6138    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
6139    parseBackboneProperties(json, res);
6140    if (json.has("identifier"))
6141      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6142    if (json.has("ref"))
6143      res.setRef(parseReference(json.getAsJsonObject("ref")));
6144    return res;
6145  }
6146
6147  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
6148    DocumentReference res = new DocumentReference();
6149    parseDomainResourceProperties(json, res);
6150    if (json.has("masterIdentifier"))
6151      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
6152    if (json.has("identifier")) {
6153      JsonArray array = json.getAsJsonArray("identifier");
6154      for (int i = 0; i < array.size(); i++) {
6155        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6156      }
6157    };
6158    if (json.has("subject"))
6159      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6160    if (json.has("type"))
6161      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6162    if (json.has("class"))
6163      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
6164    if (json.has("author")) {
6165      JsonArray array = json.getAsJsonArray("author");
6166      for (int i = 0; i < array.size(); i++) {
6167        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6168      }
6169    };
6170    if (json.has("custodian"))
6171      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
6172    if (json.has("authenticator"))
6173      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
6174    if (json.has("created"))
6175      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6176    if (json.has("_created"))
6177      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6178    if (json.has("indexed"))
6179      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
6180    if (json.has("_indexed"))
6181      parseElementProperties(json.getAsJsonObject("_indexed"), res.getIndexedElement());
6182    if (json.has("status"))
6183      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
6184    if (json.has("_status"))
6185      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6186    if (json.has("docStatus"))
6187      res.setDocStatus(parseCodeableConcept(json.getAsJsonObject("docStatus")));
6188    if (json.has("relatesTo")) {
6189      JsonArray array = json.getAsJsonArray("relatesTo");
6190      for (int i = 0; i < array.size(); i++) {
6191        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
6192      }
6193    };
6194    if (json.has("description"))
6195      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6196    if (json.has("_description"))
6197      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6198    if (json.has("securityLabel")) {
6199      JsonArray array = json.getAsJsonArray("securityLabel");
6200      for (int i = 0; i < array.size(); i++) {
6201        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6202      }
6203    };
6204    if (json.has("content")) {
6205      JsonArray array = json.getAsJsonArray("content");
6206      for (int i = 0; i < array.size(); i++) {
6207        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
6208      }
6209    };
6210    if (json.has("context"))
6211      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
6212    return res;
6213  }
6214
6215  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
6216    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
6217    parseBackboneProperties(json, res);
6218    if (json.has("code"))
6219      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
6220    if (json.has("_code"))
6221      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6222    if (json.has("target"))
6223      res.setTarget(parseReference(json.getAsJsonObject("target")));
6224    return res;
6225  }
6226
6227  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
6228    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
6229    parseBackboneProperties(json, res);
6230    if (json.has("attachment"))
6231      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
6232    if (json.has("format")) {
6233      JsonArray array = json.getAsJsonArray("format");
6234      for (int i = 0; i < array.size(); i++) {
6235        res.getFormat().add(parseCoding(array.get(i).getAsJsonObject()));
6236      }
6237    };
6238    return res;
6239  }
6240
6241  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
6242    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
6243    parseBackboneProperties(json, res);
6244    if (json.has("encounter"))
6245      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6246    if (json.has("event")) {
6247      JsonArray array = json.getAsJsonArray("event");
6248      for (int i = 0; i < array.size(); i++) {
6249        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6250      }
6251    };
6252    if (json.has("period"))
6253      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6254    if (json.has("facilityType"))
6255      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
6256    if (json.has("practiceSetting"))
6257      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
6258    if (json.has("sourcePatientInfo"))
6259      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
6260    if (json.has("related")) {
6261      JsonArray array = json.getAsJsonArray("related");
6262      for (int i = 0; i < array.size(); i++) {
6263        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
6264      }
6265    };
6266    return res;
6267  }
6268
6269  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
6270    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
6271    parseBackboneProperties(json, res);
6272    if (json.has("identifier"))
6273      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6274    if (json.has("ref"))
6275      res.setRef(parseReference(json.getAsJsonObject("ref")));
6276    return res;
6277  }
6278
6279  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
6280    EligibilityRequest res = new EligibilityRequest();
6281    parseDomainResourceProperties(json, res);
6282    if (json.has("identifier")) {
6283      JsonArray array = json.getAsJsonArray("identifier");
6284      for (int i = 0; i < array.size(); i++) {
6285        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6286      }
6287    };
6288    if (json.has("ruleset"))
6289      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
6290    if (json.has("originalRuleset"))
6291      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
6292    if (json.has("created"))
6293      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6294    if (json.has("_created"))
6295      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6296    Type target = parseType("target", json);
6297    if (target != null)
6298      res.setTarget(target);
6299    Type provider = parseType("provider", json);
6300    if (provider != null)
6301      res.setProvider(provider);
6302    Type organization = parseType("organization", json);
6303    if (organization != null)
6304      res.setOrganization(organization);
6305    if (json.has("priority"))
6306      res.setPriority(parseCoding(json.getAsJsonObject("priority")));
6307    Type enterer = parseType("enterer", json);
6308    if (enterer != null)
6309      res.setEnterer(enterer);
6310    Type facility = parseType("facility", json);
6311    if (facility != null)
6312      res.setFacility(facility);
6313    Type patient = parseType("patient", json);
6314    if (patient != null)
6315      res.setPatient(patient);
6316    Type coverage = parseType("coverage", json);
6317    if (coverage != null)
6318      res.setCoverage(coverage);
6319    if (json.has("businessArrangement"))
6320      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6321    if (json.has("_businessArrangement"))
6322      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
6323    Type serviced = parseType("serviced", json);
6324    if (serviced != null)
6325      res.setServiced(serviced);
6326    if (json.has("benefitCategory"))
6327      res.setBenefitCategory(parseCoding(json.getAsJsonObject("benefitCategory")));
6328    if (json.has("benefitSubCategory"))
6329      res.setBenefitSubCategory(parseCoding(json.getAsJsonObject("benefitSubCategory")));
6330    return res;
6331  }
6332
6333  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
6334    EligibilityResponse res = new EligibilityResponse();
6335    parseDomainResourceProperties(json, res);
6336    if (json.has("identifier")) {
6337      JsonArray array = json.getAsJsonArray("identifier");
6338      for (int i = 0; i < array.size(); i++) {
6339        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6340      }
6341    };
6342    Type request = parseType("request", json);
6343    if (request != null)
6344      res.setRequest(request);
6345    if (json.has("outcome"))
6346      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
6347    if (json.has("_outcome"))
6348      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
6349    if (json.has("disposition"))
6350      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6351    if (json.has("_disposition"))
6352      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
6353    if (json.has("ruleset"))
6354      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
6355    if (json.has("originalRuleset"))
6356      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
6357    if (json.has("created"))
6358      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6359    if (json.has("_created"))
6360      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6361    Type organization = parseType("organization", json);
6362    if (organization != null)
6363      res.setOrganization(organization);
6364    Type requestProvider = parseType("requestProvider", json);
6365    if (requestProvider != null)
6366      res.setRequestProvider(requestProvider);
6367    Type requestOrganization = parseType("requestOrganization", json);
6368    if (requestOrganization != null)
6369      res.setRequestOrganization(requestOrganization);
6370    if (json.has("inforce"))
6371      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
6372    if (json.has("_inforce"))
6373      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
6374    if (json.has("contract"))
6375      res.setContract(parseReference(json.getAsJsonObject("contract")));
6376    if (json.has("form"))
6377      res.setForm(parseCoding(json.getAsJsonObject("form")));
6378    if (json.has("benefitBalance")) {
6379      JsonArray array = json.getAsJsonArray("benefitBalance");
6380      for (int i = 0; i < array.size(); i++) {
6381        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), res));
6382      }
6383    };
6384    if (json.has("error")) {
6385      JsonArray array = json.getAsJsonArray("error");
6386      for (int i = 0; i < array.size(); i++) {
6387        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
6388      }
6389    };
6390    return res;
6391  }
6392
6393  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
6394    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
6395    parseBackboneProperties(json, res);
6396    if (json.has("category"))
6397      res.setCategory(parseCoding(json.getAsJsonObject("category")));
6398    if (json.has("subCategory"))
6399      res.setSubCategory(parseCoding(json.getAsJsonObject("subCategory")));
6400    if (json.has("network"))
6401      res.setNetwork(parseCoding(json.getAsJsonObject("network")));
6402    if (json.has("unit"))
6403      res.setUnit(parseCoding(json.getAsJsonObject("unit")));
6404    if (json.has("term"))
6405      res.setTerm(parseCoding(json.getAsJsonObject("term")));
6406    if (json.has("financial")) {
6407      JsonArray array = json.getAsJsonArray("financial");
6408      for (int i = 0; i < array.size(); i++) {
6409        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
6410      }
6411    };
6412    return res;
6413  }
6414
6415  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
6416    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
6417    parseBackboneProperties(json, res);
6418    if (json.has("type"))
6419      res.setType(parseCoding(json.getAsJsonObject("type")));
6420    Type benefit = parseType("benefit", json);
6421    if (benefit != null)
6422      res.setBenefit(benefit);
6423    Type benefitUsed = parseType("benefitUsed", json);
6424    if (benefitUsed != null)
6425      res.setBenefitUsed(benefitUsed);
6426    return res;
6427  }
6428
6429  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
6430    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
6431    parseBackboneProperties(json, res);
6432    if (json.has("code"))
6433      res.setCode(parseCoding(json.getAsJsonObject("code")));
6434    return res;
6435  }
6436
6437  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
6438    Encounter res = new Encounter();
6439    parseDomainResourceProperties(json, res);
6440    if (json.has("identifier")) {
6441      JsonArray array = json.getAsJsonArray("identifier");
6442      for (int i = 0; i < array.size(); i++) {
6443        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6444      }
6445    };
6446    if (json.has("status"))
6447      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
6448    if (json.has("_status"))
6449      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6450    if (json.has("statusHistory")) {
6451      JsonArray array = json.getAsJsonArray("statusHistory");
6452      for (int i = 0; i < array.size(); i++) {
6453        res.getStatusHistory().add(parseEncounterEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
6454      }
6455    };
6456    if (json.has("class"))
6457      res.setClass_Element(parseEnumeration(json.get("class").getAsString(), Encounter.EncounterClass.NULL, new Encounter.EncounterClassEnumFactory()));
6458    if (json.has("_class"))
6459      parseElementProperties(json.getAsJsonObject("_class"), res.getClass_Element());
6460    if (json.has("type")) {
6461      JsonArray array = json.getAsJsonArray("type");
6462      for (int i = 0; i < array.size(); i++) {
6463        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6464      }
6465    };
6466    if (json.has("priority"))
6467      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
6468    if (json.has("patient"))
6469      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6470    if (json.has("episodeOfCare")) {
6471      JsonArray array = json.getAsJsonArray("episodeOfCare");
6472      for (int i = 0; i < array.size(); i++) {
6473        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
6474      }
6475    };
6476    if (json.has("incomingReferral")) {
6477      JsonArray array = json.getAsJsonArray("incomingReferral");
6478      for (int i = 0; i < array.size(); i++) {
6479        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
6480      }
6481    };
6482    if (json.has("participant")) {
6483      JsonArray array = json.getAsJsonArray("participant");
6484      for (int i = 0; i < array.size(); i++) {
6485        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
6486      }
6487    };
6488    if (json.has("appointment"))
6489      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
6490    if (json.has("period"))
6491      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6492    if (json.has("length"))
6493      res.setLength(parseDuration(json.getAsJsonObject("length")));
6494    if (json.has("reason")) {
6495      JsonArray array = json.getAsJsonArray("reason");
6496      for (int i = 0; i < array.size(); i++) {
6497        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6498      }
6499    };
6500    if (json.has("indication")) {
6501      JsonArray array = json.getAsJsonArray("indication");
6502      for (int i = 0; i < array.size(); i++) {
6503        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
6504      }
6505    };
6506    if (json.has("hospitalization"))
6507      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
6508    if (json.has("location")) {
6509      JsonArray array = json.getAsJsonArray("location");
6510      for (int i = 0; i < array.size(); i++) {
6511        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
6512      }
6513    };
6514    if (json.has("serviceProvider"))
6515      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
6516    if (json.has("partOf"))
6517      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
6518    return res;
6519  }
6520
6521  protected Encounter.EncounterStatusHistoryComponent parseEncounterEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
6522    Encounter.EncounterStatusHistoryComponent res = new Encounter.EncounterStatusHistoryComponent();
6523    parseBackboneProperties(json, res);
6524    if (json.has("status"))
6525      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
6526    if (json.has("_status"))
6527      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6528    if (json.has("period"))
6529      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6530    return res;
6531  }
6532
6533  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
6534    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
6535    parseBackboneProperties(json, res);
6536    if (json.has("type")) {
6537      JsonArray array = json.getAsJsonArray("type");
6538      for (int i = 0; i < array.size(); i++) {
6539        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6540      }
6541    };
6542    if (json.has("period"))
6543      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6544    if (json.has("individual"))
6545      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
6546    return res;
6547  }
6548
6549  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
6550    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
6551    parseBackboneProperties(json, res);
6552    if (json.has("preAdmissionIdentifier"))
6553      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
6554    if (json.has("origin"))
6555      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
6556    if (json.has("admitSource"))
6557      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
6558    if (json.has("admittingDiagnosis")) {
6559      JsonArray array = json.getAsJsonArray("admittingDiagnosis");
6560      for (int i = 0; i < array.size(); i++) {
6561        res.getAdmittingDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
6562      }
6563    };
6564    if (json.has("reAdmission"))
6565      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
6566    if (json.has("dietPreference")) {
6567      JsonArray array = json.getAsJsonArray("dietPreference");
6568      for (int i = 0; i < array.size(); i++) {
6569        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6570      }
6571    };
6572    if (json.has("specialCourtesy")) {
6573      JsonArray array = json.getAsJsonArray("specialCourtesy");
6574      for (int i = 0; i < array.size(); i++) {
6575        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6576      }
6577    };
6578    if (json.has("specialArrangement")) {
6579      JsonArray array = json.getAsJsonArray("specialArrangement");
6580      for (int i = 0; i < array.size(); i++) {
6581        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6582      }
6583    };
6584    if (json.has("destination"))
6585      res.setDestination(parseReference(json.getAsJsonObject("destination")));
6586    if (json.has("dischargeDisposition"))
6587      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
6588    if (json.has("dischargeDiagnosis")) {
6589      JsonArray array = json.getAsJsonArray("dischargeDiagnosis");
6590      for (int i = 0; i < array.size(); i++) {
6591        res.getDischargeDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
6592      }
6593    };
6594    return res;
6595  }
6596
6597  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
6598    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
6599    parseBackboneProperties(json, res);
6600    if (json.has("location"))
6601      res.setLocation(parseReference(json.getAsJsonObject("location")));
6602    if (json.has("status"))
6603      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
6604    if (json.has("_status"))
6605      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6606    if (json.has("period"))
6607      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6608    return res;
6609  }
6610
6611  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
6612    EnrollmentRequest res = new EnrollmentRequest();
6613    parseDomainResourceProperties(json, res);
6614    if (json.has("identifier")) {
6615      JsonArray array = json.getAsJsonArray("identifier");
6616      for (int i = 0; i < array.size(); i++) {
6617        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6618      }
6619    };
6620    if (json.has("ruleset"))
6621      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
6622    if (json.has("originalRuleset"))
6623      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
6624    if (json.has("created"))
6625      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6626    if (json.has("_created"))
6627      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6628    if (json.has("target"))
6629      res.setTarget(parseReference(json.getAsJsonObject("target")));
6630    if (json.has("provider"))
6631      res.setProvider(parseReference(json.getAsJsonObject("provider")));
6632    if (json.has("organization"))
6633      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
6634    if (json.has("subject"))
6635      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6636    if (json.has("coverage"))
6637      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
6638    if (json.has("relationship"))
6639      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
6640    return res;
6641  }
6642
6643  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
6644    EnrollmentResponse res = new EnrollmentResponse();
6645    parseDomainResourceProperties(json, res);
6646    if (json.has("identifier")) {
6647      JsonArray array = json.getAsJsonArray("identifier");
6648      for (int i = 0; i < array.size(); i++) {
6649        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6650      }
6651    };
6652    if (json.has("request"))
6653      res.setRequest(parseReference(json.getAsJsonObject("request")));
6654    if (json.has("outcome"))
6655      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
6656    if (json.has("_outcome"))
6657      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
6658    if (json.has("disposition"))
6659      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6660    if (json.has("_disposition"))
6661      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
6662    if (json.has("ruleset"))
6663      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
6664    if (json.has("originalRuleset"))
6665      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
6666    if (json.has("created"))
6667      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6668    if (json.has("_created"))
6669      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6670    if (json.has("organization"))
6671      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
6672    if (json.has("requestProvider"))
6673      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
6674    if (json.has("requestOrganization"))
6675      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
6676    return res;
6677  }
6678
6679  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
6680    EpisodeOfCare res = new EpisodeOfCare();
6681    parseDomainResourceProperties(json, res);
6682    if (json.has("identifier")) {
6683      JsonArray array = json.getAsJsonArray("identifier");
6684      for (int i = 0; i < array.size(); i++) {
6685        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6686      }
6687    };
6688    if (json.has("status"))
6689      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
6690    if (json.has("_status"))
6691      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6692    if (json.has("statusHistory")) {
6693      JsonArray array = json.getAsJsonArray("statusHistory");
6694      for (int i = 0; i < array.size(); i++) {
6695        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
6696      }
6697    };
6698    if (json.has("type")) {
6699      JsonArray array = json.getAsJsonArray("type");
6700      for (int i = 0; i < array.size(); i++) {
6701        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6702      }
6703    };
6704    if (json.has("condition")) {
6705      JsonArray array = json.getAsJsonArray("condition");
6706      for (int i = 0; i < array.size(); i++) {
6707        res.getCondition().add(parseReference(array.get(i).getAsJsonObject()));
6708      }
6709    };
6710    if (json.has("patient"))
6711      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6712    if (json.has("managingOrganization"))
6713      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
6714    if (json.has("period"))
6715      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6716    if (json.has("referralRequest")) {
6717      JsonArray array = json.getAsJsonArray("referralRequest");
6718      for (int i = 0; i < array.size(); i++) {
6719        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
6720      }
6721    };
6722    if (json.has("careManager"))
6723      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
6724    if (json.has("team")) {
6725      JsonArray array = json.getAsJsonArray("team");
6726      for (int i = 0; i < array.size(); i++) {
6727        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
6728      }
6729    };
6730    return res;
6731  }
6732
6733  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
6734    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
6735    parseBackboneProperties(json, res);
6736    if (json.has("status"))
6737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
6738    if (json.has("_status"))
6739      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6740    if (json.has("period"))
6741      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6742    return res;
6743  }
6744
6745  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
6746    ExpansionProfile res = new ExpansionProfile();
6747    parseDomainResourceProperties(json, res);
6748    if (json.has("url"))
6749      res.setUrlElement(parseUri(json.get("url").getAsString()));
6750    if (json.has("_url"))
6751      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6752    if (json.has("identifier"))
6753      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6754    if (json.has("version"))
6755      res.setVersionElement(parseString(json.get("version").getAsString()));
6756    if (json.has("_version"))
6757      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6758    if (json.has("name"))
6759      res.setNameElement(parseString(json.get("name").getAsString()));
6760    if (json.has("_name"))
6761      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6762    if (json.has("status"))
6763      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
6764    if (json.has("_status"))
6765      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6766    if (json.has("experimental"))
6767      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6768    if (json.has("_experimental"))
6769      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6770    if (json.has("publisher"))
6771      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6772    if (json.has("_publisher"))
6773      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6774    if (json.has("contact")) {
6775      JsonArray array = json.getAsJsonArray("contact");
6776      for (int i = 0; i < array.size(); i++) {
6777        res.getContact().add(parseExpansionProfileExpansionProfileContactComponent(array.get(i).getAsJsonObject(), res));
6778      }
6779    };
6780    if (json.has("date"))
6781      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6782    if (json.has("_date"))
6783      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6784    if (json.has("description"))
6785      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6786    if (json.has("_description"))
6787      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6788    if (json.has("codeSystem"))
6789      res.setCodeSystem(parseExpansionProfileExpansionProfileCodeSystemComponent(json.getAsJsonObject("codeSystem"), res));
6790    if (json.has("includeDesignations"))
6791      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
6792    if (json.has("_includeDesignations"))
6793      parseElementProperties(json.getAsJsonObject("_includeDesignations"), res.getIncludeDesignationsElement());
6794    if (json.has("designation"))
6795      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(json.getAsJsonObject("designation"), res));
6796    if (json.has("includeDefinition"))
6797      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
6798    if (json.has("_includeDefinition"))
6799      parseElementProperties(json.getAsJsonObject("_includeDefinition"), res.getIncludeDefinitionElement());
6800    if (json.has("includeInactive"))
6801      res.setIncludeInactiveElement(parseBoolean(json.get("includeInactive").getAsBoolean()));
6802    if (json.has("_includeInactive"))
6803      parseElementProperties(json.getAsJsonObject("_includeInactive"), res.getIncludeInactiveElement());
6804    if (json.has("excludeNested"))
6805      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
6806    if (json.has("_excludeNested"))
6807      parseElementProperties(json.getAsJsonObject("_excludeNested"), res.getExcludeNestedElement());
6808    if (json.has("excludeNotForUI"))
6809      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
6810    if (json.has("_excludeNotForUI"))
6811      parseElementProperties(json.getAsJsonObject("_excludeNotForUI"), res.getExcludeNotForUIElement());
6812    if (json.has("excludePostCoordinated"))
6813      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
6814    if (json.has("_excludePostCoordinated"))
6815      parseElementProperties(json.getAsJsonObject("_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
6816    if (json.has("displayLanguage"))
6817      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
6818    if (json.has("_displayLanguage"))
6819      parseElementProperties(json.getAsJsonObject("_displayLanguage"), res.getDisplayLanguageElement());
6820    if (json.has("limitedExpansion"))
6821      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
6822    if (json.has("_limitedExpansion"))
6823      parseElementProperties(json.getAsJsonObject("_limitedExpansion"), res.getLimitedExpansionElement());
6824    return res;
6825  }
6826
6827  protected ExpansionProfile.ExpansionProfileContactComponent parseExpansionProfileExpansionProfileContactComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6828    ExpansionProfile.ExpansionProfileContactComponent res = new ExpansionProfile.ExpansionProfileContactComponent();
6829    parseBackboneProperties(json, res);
6830    if (json.has("name"))
6831      res.setNameElement(parseString(json.get("name").getAsString()));
6832    if (json.has("_name"))
6833      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6834    if (json.has("telecom")) {
6835      JsonArray array = json.getAsJsonArray("telecom");
6836      for (int i = 0; i < array.size(); i++) {
6837        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6838      }
6839    };
6840    return res;
6841  }
6842
6843  protected ExpansionProfile.ExpansionProfileCodeSystemComponent parseExpansionProfileExpansionProfileCodeSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6844    ExpansionProfile.ExpansionProfileCodeSystemComponent res = new ExpansionProfile.ExpansionProfileCodeSystemComponent();
6845    parseBackboneProperties(json, res);
6846    if (json.has("include"))
6847      res.setInclude(parseExpansionProfileCodeSystemIncludeComponent(json.getAsJsonObject("include"), owner));
6848    if (json.has("exclude"))
6849      res.setExclude(parseExpansionProfileCodeSystemExcludeComponent(json.getAsJsonObject("exclude"), owner));
6850    return res;
6851  }
6852
6853  protected ExpansionProfile.CodeSystemIncludeComponent parseExpansionProfileCodeSystemIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6854    ExpansionProfile.CodeSystemIncludeComponent res = new ExpansionProfile.CodeSystemIncludeComponent();
6855    parseBackboneProperties(json, res);
6856    if (json.has("codeSystem")) {
6857      JsonArray array = json.getAsJsonArray("codeSystem");
6858      for (int i = 0; i < array.size(); i++) {
6859        res.getCodeSystem().add(parseExpansionProfileCodeSystemIncludeCodeSystemComponent(array.get(i).getAsJsonObject(), owner));
6860      }
6861    };
6862    return res;
6863  }
6864
6865  protected ExpansionProfile.CodeSystemIncludeCodeSystemComponent parseExpansionProfileCodeSystemIncludeCodeSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6866    ExpansionProfile.CodeSystemIncludeCodeSystemComponent res = new ExpansionProfile.CodeSystemIncludeCodeSystemComponent();
6867    parseBackboneProperties(json, res);
6868    if (json.has("system"))
6869      res.setSystemElement(parseUri(json.get("system").getAsString()));
6870    if (json.has("_system"))
6871      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
6872    if (json.has("version"))
6873      res.setVersionElement(parseString(json.get("version").getAsString()));
6874    if (json.has("_version"))
6875      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6876    return res;
6877  }
6878
6879  protected ExpansionProfile.CodeSystemExcludeComponent parseExpansionProfileCodeSystemExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6880    ExpansionProfile.CodeSystemExcludeComponent res = new ExpansionProfile.CodeSystemExcludeComponent();
6881    parseBackboneProperties(json, res);
6882    if (json.has("codeSystem")) {
6883      JsonArray array = json.getAsJsonArray("codeSystem");
6884      for (int i = 0; i < array.size(); i++) {
6885        res.getCodeSystem().add(parseExpansionProfileCodeSystemExcludeCodeSystemComponent(array.get(i).getAsJsonObject(), owner));
6886      }
6887    };
6888    return res;
6889  }
6890
6891  protected ExpansionProfile.CodeSystemExcludeCodeSystemComponent parseExpansionProfileCodeSystemExcludeCodeSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6892    ExpansionProfile.CodeSystemExcludeCodeSystemComponent res = new ExpansionProfile.CodeSystemExcludeCodeSystemComponent();
6893    parseBackboneProperties(json, res);
6894    if (json.has("system"))
6895      res.setSystemElement(parseUri(json.get("system").getAsString()));
6896    if (json.has("_system"))
6897      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
6898    if (json.has("version"))
6899      res.setVersionElement(parseString(json.get("version").getAsString()));
6900    if (json.has("_version"))
6901      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6902    return res;
6903  }
6904
6905  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6906    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
6907    parseBackboneProperties(json, res);
6908    if (json.has("include"))
6909      res.setInclude(parseExpansionProfileDesignationIncludeComponent(json.getAsJsonObject("include"), owner));
6910    if (json.has("exclude"))
6911      res.setExclude(parseExpansionProfileDesignationExcludeComponent(json.getAsJsonObject("exclude"), owner));
6912    return res;
6913  }
6914
6915  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6916    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
6917    parseBackboneProperties(json, res);
6918    if (json.has("designation")) {
6919      JsonArray array = json.getAsJsonArray("designation");
6920      for (int i = 0; i < array.size(); i++) {
6921        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
6922      }
6923    };
6924    return res;
6925  }
6926
6927  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6928    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
6929    parseBackboneProperties(json, res);
6930    if (json.has("language"))
6931      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6932    if (json.has("_language"))
6933      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
6934    if (json.has("use"))
6935      res.setUse(parseCoding(json.getAsJsonObject("use")));
6936    return res;
6937  }
6938
6939  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6940    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
6941    parseBackboneProperties(json, res);
6942    if (json.has("designation")) {
6943      JsonArray array = json.getAsJsonArray("designation");
6944      for (int i = 0; i < array.size(); i++) {
6945        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
6946      }
6947    };
6948    return res;
6949  }
6950
6951  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
6952    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
6953    parseBackboneProperties(json, res);
6954    if (json.has("language"))
6955      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6956    if (json.has("_language"))
6957      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
6958    if (json.has("use"))
6959      res.setUse(parseCoding(json.getAsJsonObject("use")));
6960    return res;
6961  }
6962
6963  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
6964    ExplanationOfBenefit res = new ExplanationOfBenefit();
6965    parseDomainResourceProperties(json, res);
6966    if (json.has("identifier")) {
6967      JsonArray array = json.getAsJsonArray("identifier");
6968      for (int i = 0; i < array.size(); i++) {
6969        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6970      }
6971    };
6972    Type claim = parseType("claim", json);
6973    if (claim != null)
6974      res.setClaim(claim);
6975    Type claimResponse = parseType("claimResponse", json);
6976    if (claimResponse != null)
6977      res.setClaimResponse(claimResponse);
6978    if (json.has("subType")) {
6979      JsonArray array = json.getAsJsonArray("subType");
6980      for (int i = 0; i < array.size(); i++) {
6981        res.getSubType().add(parseCoding(array.get(i).getAsJsonObject()));
6982      }
6983    };
6984    if (json.has("ruleset"))
6985      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
6986    if (json.has("originalRuleset"))
6987      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
6988    if (json.has("created"))
6989      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6990    if (json.has("_created"))
6991      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6992    if (json.has("billablePeriod"))
6993      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
6994    if (json.has("disposition"))
6995      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6996    if (json.has("_disposition"))
6997      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
6998    Type provider = parseType("provider", json);
6999    if (provider != null)
7000      res.setProvider(provider);
7001    Type organization = parseType("organization", json);
7002    if (organization != null)
7003      res.setOrganization(organization);
7004    Type facility = parseType("facility", json);
7005    if (facility != null)
7006      res.setFacility(facility);
7007    if (json.has("related")) {
7008      JsonArray array = json.getAsJsonArray("related");
7009      for (int i = 0; i < array.size(); i++) {
7010        res.getRelated().add(parseExplanationOfBenefitRelatedClaimsComponent(array.get(i).getAsJsonObject(), res));
7011      }
7012    };
7013    Type prescription = parseType("prescription", json);
7014    if (prescription != null)
7015      res.setPrescription(prescription);
7016    Type originalPrescription = parseType("originalPrescription", json);
7017    if (originalPrescription != null)
7018      res.setOriginalPrescription(originalPrescription);
7019    if (json.has("payee"))
7020      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
7021    Type referral = parseType("referral", json);
7022    if (referral != null)
7023      res.setReferral(referral);
7024    if (json.has("occurrenceCode")) {
7025      JsonArray array = json.getAsJsonArray("occurrenceCode");
7026      for (int i = 0; i < array.size(); i++) {
7027        res.getOccurrenceCode().add(parseCoding(array.get(i).getAsJsonObject()));
7028      }
7029    };
7030    if (json.has("occurenceSpanCode")) {
7031      JsonArray array = json.getAsJsonArray("occurenceSpanCode");
7032      for (int i = 0; i < array.size(); i++) {
7033        res.getOccurenceSpanCode().add(parseCoding(array.get(i).getAsJsonObject()));
7034      }
7035    };
7036    if (json.has("valueCode")) {
7037      JsonArray array = json.getAsJsonArray("valueCode");
7038      for (int i = 0; i < array.size(); i++) {
7039        res.getValueCode().add(parseCoding(array.get(i).getAsJsonObject()));
7040      }
7041    };
7042    if (json.has("diagnosis")) {
7043      JsonArray array = json.getAsJsonArray("diagnosis");
7044      for (int i = 0; i < array.size(); i++) {
7045        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
7046      }
7047    };
7048    if (json.has("procedure")) {
7049      JsonArray array = json.getAsJsonArray("procedure");
7050      for (int i = 0; i < array.size(); i++) {
7051        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
7052      }
7053    };
7054    if (json.has("specialCondition")) {
7055      JsonArray array = json.getAsJsonArray("specialCondition");
7056      for (int i = 0; i < array.size(); i++) {
7057        res.getSpecialCondition().add(parseCoding(array.get(i).getAsJsonObject()));
7058      }
7059    };
7060    Type patient = parseType("patient", json);
7061    if (patient != null)
7062      res.setPatient(patient);
7063    if (json.has("precedence"))
7064      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
7065    if (json.has("_precedence"))
7066      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
7067    if (json.has("coverage"))
7068      res.setCoverage(parseExplanationOfBenefitCoverageComponent(json.getAsJsonObject("coverage"), res));
7069    if (json.has("accidentDate"))
7070      res.setAccidentDateElement(parseDate(json.get("accidentDate").getAsString()));
7071    if (json.has("_accidentDate"))
7072      parseElementProperties(json.getAsJsonObject("_accidentDate"), res.getAccidentDateElement());
7073    if (json.has("accidentType"))
7074      res.setAccidentType(parseCoding(json.getAsJsonObject("accidentType")));
7075    Type accidentLocation = parseType("accidentLocation", json);
7076    if (accidentLocation != null)
7077      res.setAccidentLocation(accidentLocation);
7078    if (json.has("interventionException")) {
7079      JsonArray array = json.getAsJsonArray("interventionException");
7080      for (int i = 0; i < array.size(); i++) {
7081        res.getInterventionException().add(parseCoding(array.get(i).getAsJsonObject()));
7082      }
7083    };
7084    if (json.has("onset")) {
7085      JsonArray array = json.getAsJsonArray("onset");
7086      for (int i = 0; i < array.size(); i++) {
7087        res.getOnset().add(parseExplanationOfBenefitOnsetComponent(array.get(i).getAsJsonObject(), res));
7088      }
7089    };
7090    if (json.has("employmentImpacted"))
7091      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
7092    if (json.has("hospitalization"))
7093      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
7094    if (json.has("item")) {
7095      JsonArray array = json.getAsJsonArray("item");
7096      for (int i = 0; i < array.size(); i++) {
7097        res.getItem().add(parseExplanationOfBenefitItemsComponent(array.get(i).getAsJsonObject(), res));
7098      }
7099    };
7100    if (json.has("addItem")) {
7101      JsonArray array = json.getAsJsonArray("addItem");
7102      for (int i = 0; i < array.size(); i++) {
7103        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
7104      }
7105    };
7106    if (json.has("missingTeeth")) {
7107      JsonArray array = json.getAsJsonArray("missingTeeth");
7108      for (int i = 0; i < array.size(); i++) {
7109        res.getMissingTeeth().add(parseExplanationOfBenefitMissingTeethComponent(array.get(i).getAsJsonObject(), res));
7110      }
7111    };
7112    if (json.has("totalCost"))
7113      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
7114    if (json.has("unallocDeductable"))
7115      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
7116    if (json.has("totalBenefit"))
7117      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
7118    if (json.has("paymentAdjustment"))
7119      res.setPaymentAdjustment(parseMoney(json.getAsJsonObject("paymentAdjustment")));
7120    if (json.has("paymentAdjustmentReason"))
7121      res.setPaymentAdjustmentReason(parseCoding(json.getAsJsonObject("paymentAdjustmentReason")));
7122    if (json.has("paymentDate"))
7123      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
7124    if (json.has("_paymentDate"))
7125      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
7126    if (json.has("paymentAmount"))
7127      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
7128    if (json.has("paymentRef"))
7129      res.setPaymentRef(parseIdentifier(json.getAsJsonObject("paymentRef")));
7130    if (json.has("reserved"))
7131      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
7132    if (json.has("form"))
7133      res.setForm(parseCoding(json.getAsJsonObject("form")));
7134    if (json.has("note")) {
7135      JsonArray array = json.getAsJsonArray("note");
7136      for (int i = 0; i < array.size(); i++) {
7137        res.getNote().add(parseExplanationOfBenefitNotesComponent(array.get(i).getAsJsonObject(), res));
7138      }
7139    };
7140    if (json.has("benefitBalance")) {
7141      JsonArray array = json.getAsJsonArray("benefitBalance");
7142      for (int i = 0; i < array.size(); i++) {
7143        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
7144      }
7145    };
7146    return res;
7147  }
7148
7149  protected ExplanationOfBenefit.RelatedClaimsComponent parseExplanationOfBenefitRelatedClaimsComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7150    ExplanationOfBenefit.RelatedClaimsComponent res = new ExplanationOfBenefit.RelatedClaimsComponent();
7151    parseBackboneProperties(json, res);
7152    Type claim = parseType("claim", json);
7153    if (claim != null)
7154      res.setClaim(claim);
7155    if (json.has("relationship"))
7156      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
7157    if (json.has("reference"))
7158      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
7159    return res;
7160  }
7161
7162  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7163    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
7164    parseBackboneProperties(json, res);
7165    if (json.has("type"))
7166      res.setType(parseCoding(json.getAsJsonObject("type")));
7167    Type party = parseType("party", json);
7168    if (party != null)
7169      res.setParty(party);
7170    return res;
7171  }
7172
7173  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7174    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
7175    parseBackboneProperties(json, res);
7176    if (json.has("sequence"))
7177      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7178    if (json.has("_sequence"))
7179      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
7180    if (json.has("diagnosis"))
7181      res.setDiagnosis(parseCoding(json.getAsJsonObject("diagnosis")));
7182    return res;
7183  }
7184
7185  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7186    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
7187    parseBackboneProperties(json, res);
7188    if (json.has("sequence"))
7189      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7190    if (json.has("_sequence"))
7191      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
7192    if (json.has("date"))
7193      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7194    if (json.has("_date"))
7195      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7196    Type procedure = parseType("procedure", json);
7197    if (procedure != null)
7198      res.setProcedure(procedure);
7199    return res;
7200  }
7201
7202  protected ExplanationOfBenefit.CoverageComponent parseExplanationOfBenefitCoverageComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7203    ExplanationOfBenefit.CoverageComponent res = new ExplanationOfBenefit.CoverageComponent();
7204    parseBackboneProperties(json, res);
7205    Type coverage = parseType("coverage", json);
7206    if (coverage != null)
7207      res.setCoverage(coverage);
7208    if (json.has("preAuthRef")) {
7209      JsonArray array = json.getAsJsonArray("preAuthRef");
7210      for (int i = 0; i < array.size(); i++) {
7211        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
7212      }
7213    };
7214    if (json.has("_preAuthRef")) {
7215      JsonArray array = json.getAsJsonArray("_preAuthRef");
7216      for (int i = 0; i < array.size(); i++) {
7217        if (i == res.getPreAuthRef().size())
7218          res.getPreAuthRef().add(parseString(null));
7219        if (array.get(i) instanceof JsonObject) 
7220          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
7221      }
7222    };
7223    return res;
7224  }
7225
7226  protected ExplanationOfBenefit.OnsetComponent parseExplanationOfBenefitOnsetComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7227    ExplanationOfBenefit.OnsetComponent res = new ExplanationOfBenefit.OnsetComponent();
7228    parseBackboneProperties(json, res);
7229    Type time = parseType("time", json);
7230    if (time != null)
7231      res.setTime(time);
7232    if (json.has("type"))
7233      res.setType(parseCoding(json.getAsJsonObject("type")));
7234    return res;
7235  }
7236
7237  protected ExplanationOfBenefit.ItemsComponent parseExplanationOfBenefitItemsComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7238    ExplanationOfBenefit.ItemsComponent res = new ExplanationOfBenefit.ItemsComponent();
7239    parseBackboneProperties(json, res);
7240    if (json.has("sequence"))
7241      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7242    if (json.has("_sequence"))
7243      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
7244    if (json.has("type"))
7245      res.setType(parseCoding(json.getAsJsonObject("type")));
7246    Type provider = parseType("provider", json);
7247    if (provider != null)
7248      res.setProvider(provider);
7249    Type supervisor = parseType("supervisor", json);
7250    if (supervisor != null)
7251      res.setSupervisor(supervisor);
7252    if (json.has("providerQualification"))
7253      res.setProviderQualification(parseCoding(json.getAsJsonObject("providerQualification")));
7254    if (json.has("diagnosisLinkId")) {
7255      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
7256      for (int i = 0; i < array.size(); i++) {
7257        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
7258      }
7259    };
7260    if (json.has("_diagnosisLinkId")) {
7261      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
7262      for (int i = 0; i < array.size(); i++) {
7263        if (i == res.getDiagnosisLinkId().size())
7264          res.getDiagnosisLinkId().add(parsePositiveInt(null));
7265        if (array.get(i) instanceof JsonObject) 
7266          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
7267      }
7268    };
7269    if (json.has("service"))
7270      res.setService(parseCoding(json.getAsJsonObject("service")));
7271    if (json.has("serviceModifier")) {
7272      JsonArray array = json.getAsJsonArray("serviceModifier");
7273      for (int i = 0; i < array.size(); i++) {
7274        res.getServiceModifier().add(parseCoding(array.get(i).getAsJsonObject()));
7275      }
7276    };
7277    if (json.has("modifier")) {
7278      JsonArray array = json.getAsJsonArray("modifier");
7279      for (int i = 0; i < array.size(); i++) {
7280        res.getModifier().add(parseCoding(array.get(i).getAsJsonObject()));
7281      }
7282    };
7283    if (json.has("programCode")) {
7284      JsonArray array = json.getAsJsonArray("programCode");
7285      for (int i = 0; i < array.size(); i++) {
7286        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
7287      }
7288    };
7289    Type serviced = parseType("serviced", json);
7290    if (serviced != null)
7291      res.setServiced(serviced);
7292    if (json.has("place"))
7293      res.setPlace(parseCoding(json.getAsJsonObject("place")));
7294    if (json.has("quantity"))
7295      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7296    if (json.has("unitPrice"))
7297      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7298    if (json.has("factor"))
7299      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7300    if (json.has("_factor"))
7301      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7302    if (json.has("points"))
7303      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7304    if (json.has("_points"))
7305      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7306    if (json.has("net"))
7307      res.setNet(parseMoney(json.getAsJsonObject("net")));
7308    if (json.has("udi")) {
7309      JsonArray array = json.getAsJsonArray("udi");
7310      for (int i = 0; i < array.size(); i++) {
7311        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7312      }
7313    };
7314    if (json.has("bodySite"))
7315      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
7316    if (json.has("subSite")) {
7317      JsonArray array = json.getAsJsonArray("subSite");
7318      for (int i = 0; i < array.size(); i++) {
7319        res.getSubSite().add(parseCoding(array.get(i).getAsJsonObject()));
7320      }
7321    };
7322    if (json.has("noteNumber")) {
7323      JsonArray array = json.getAsJsonArray("noteNumber");
7324      for (int i = 0; i < array.size(); i++) {
7325        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7326      }
7327    };
7328    if (json.has("_noteNumber")) {
7329      JsonArray array = json.getAsJsonArray("_noteNumber");
7330      for (int i = 0; i < array.size(); i++) {
7331        if (i == res.getNoteNumber().size())
7332          res.getNoteNumber().add(parsePositiveInt(null));
7333        if (array.get(i) instanceof JsonObject) 
7334          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7335      }
7336    };
7337    if (json.has("adjudication")) {
7338      JsonArray array = json.getAsJsonArray("adjudication");
7339      for (int i = 0; i < array.size(); i++) {
7340        res.getAdjudication().add(parseExplanationOfBenefitItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
7341      }
7342    };
7343    if (json.has("detail")) {
7344      JsonArray array = json.getAsJsonArray("detail");
7345      for (int i = 0; i < array.size(); i++) {
7346        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
7347      }
7348    };
7349    if (json.has("prosthesis"))
7350      res.setProsthesis(parseExplanationOfBenefitProsthesisComponent(json.getAsJsonObject("prosthesis"), owner));
7351    return res;
7352  }
7353
7354  protected ExplanationOfBenefit.ItemAdjudicationComponent parseExplanationOfBenefitItemAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7355    ExplanationOfBenefit.ItemAdjudicationComponent res = new ExplanationOfBenefit.ItemAdjudicationComponent();
7356    parseBackboneProperties(json, res);
7357    if (json.has("category"))
7358      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7359    if (json.has("reason"))
7360      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7361    if (json.has("amount"))
7362      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
7363    if (json.has("value"))
7364      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7365    if (json.has("_value"))
7366      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7367    return res;
7368  }
7369
7370  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7371    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
7372    parseBackboneProperties(json, res);
7373    if (json.has("sequence"))
7374      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7375    if (json.has("_sequence"))
7376      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
7377    if (json.has("type"))
7378      res.setType(parseCoding(json.getAsJsonObject("type")));
7379    if (json.has("service"))
7380      res.setService(parseCoding(json.getAsJsonObject("service")));
7381    if (json.has("programCode")) {
7382      JsonArray array = json.getAsJsonArray("programCode");
7383      for (int i = 0; i < array.size(); i++) {
7384        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
7385      }
7386    };
7387    if (json.has("quantity"))
7388      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7389    if (json.has("unitPrice"))
7390      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7391    if (json.has("factor"))
7392      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7393    if (json.has("_factor"))
7394      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7395    if (json.has("points"))
7396      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7397    if (json.has("_points"))
7398      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7399    if (json.has("net"))
7400      res.setNet(parseMoney(json.getAsJsonObject("net")));
7401    if (json.has("udi")) {
7402      JsonArray array = json.getAsJsonArray("udi");
7403      for (int i = 0; i < array.size(); i++) {
7404        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7405      }
7406    };
7407    if (json.has("adjudication")) {
7408      JsonArray array = json.getAsJsonArray("adjudication");
7409      for (int i = 0; i < array.size(); i++) {
7410        res.getAdjudication().add(parseExplanationOfBenefitDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
7411      }
7412    };
7413    if (json.has("subDetail")) {
7414      JsonArray array = json.getAsJsonArray("subDetail");
7415      for (int i = 0; i < array.size(); i++) {
7416        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
7417      }
7418    };
7419    return res;
7420  }
7421
7422  protected ExplanationOfBenefit.DetailAdjudicationComponent parseExplanationOfBenefitDetailAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7423    ExplanationOfBenefit.DetailAdjudicationComponent res = new ExplanationOfBenefit.DetailAdjudicationComponent();
7424    parseBackboneProperties(json, res);
7425    if (json.has("category"))
7426      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7427    if (json.has("reason"))
7428      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7429    if (json.has("amount"))
7430      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
7431    if (json.has("value"))
7432      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7433    if (json.has("_value"))
7434      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7435    return res;
7436  }
7437
7438  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7439    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
7440    parseBackboneProperties(json, res);
7441    if (json.has("sequence"))
7442      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7443    if (json.has("_sequence"))
7444      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
7445    if (json.has("type"))
7446      res.setType(parseCoding(json.getAsJsonObject("type")));
7447    if (json.has("service"))
7448      res.setService(parseCoding(json.getAsJsonObject("service")));
7449    if (json.has("programCode")) {
7450      JsonArray array = json.getAsJsonArray("programCode");
7451      for (int i = 0; i < array.size(); i++) {
7452        res.getProgramCode().add(parseCoding(array.get(i).getAsJsonObject()));
7453      }
7454    };
7455    if (json.has("quantity"))
7456      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7457    if (json.has("unitPrice"))
7458      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7459    if (json.has("factor"))
7460      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7461    if (json.has("_factor"))
7462      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7463    if (json.has("points"))
7464      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7465    if (json.has("_points"))
7466      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7467    if (json.has("net"))
7468      res.setNet(parseMoney(json.getAsJsonObject("net")));
7469    if (json.has("udi")) {
7470      JsonArray array = json.getAsJsonArray("udi");
7471      for (int i = 0; i < array.size(); i++) {
7472        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7473      }
7474    };
7475    if (json.has("adjudication")) {
7476      JsonArray array = json.getAsJsonArray("adjudication");
7477      for (int i = 0; i < array.size(); i++) {
7478        res.getAdjudication().add(parseExplanationOfBenefitSubDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
7479      }
7480    };
7481    return res;
7482  }
7483
7484  protected ExplanationOfBenefit.SubDetailAdjudicationComponent parseExplanationOfBenefitSubDetailAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7485    ExplanationOfBenefit.SubDetailAdjudicationComponent res = new ExplanationOfBenefit.SubDetailAdjudicationComponent();
7486    parseBackboneProperties(json, res);
7487    if (json.has("category"))
7488      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7489    if (json.has("reason"))
7490      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7491    if (json.has("amount"))
7492      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
7493    if (json.has("value"))
7494      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7495    if (json.has("_value"))
7496      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7497    return res;
7498  }
7499
7500  protected ExplanationOfBenefit.ProsthesisComponent parseExplanationOfBenefitProsthesisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7501    ExplanationOfBenefit.ProsthesisComponent res = new ExplanationOfBenefit.ProsthesisComponent();
7502    parseBackboneProperties(json, res);
7503    if (json.has("initial"))
7504      res.setInitialElement(parseBoolean(json.get("initial").getAsBoolean()));
7505    if (json.has("_initial"))
7506      parseElementProperties(json.getAsJsonObject("_initial"), res.getInitialElement());
7507    if (json.has("priorDate"))
7508      res.setPriorDateElement(parseDate(json.get("priorDate").getAsString()));
7509    if (json.has("_priorDate"))
7510      parseElementProperties(json.getAsJsonObject("_priorDate"), res.getPriorDateElement());
7511    if (json.has("priorMaterial"))
7512      res.setPriorMaterial(parseCoding(json.getAsJsonObject("priorMaterial")));
7513    return res;
7514  }
7515
7516  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7517    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
7518    parseBackboneProperties(json, res);
7519    if (json.has("sequenceLinkId")) {
7520      JsonArray array = json.getAsJsonArray("sequenceLinkId");
7521      for (int i = 0; i < array.size(); i++) {
7522        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
7523      }
7524    };
7525    if (json.has("_sequenceLinkId")) {
7526      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
7527      for (int i = 0; i < array.size(); i++) {
7528        if (i == res.getSequenceLinkId().size())
7529          res.getSequenceLinkId().add(parsePositiveInt(null));
7530        if (array.get(i) instanceof JsonObject) 
7531          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
7532      }
7533    };
7534    if (json.has("service"))
7535      res.setService(parseCoding(json.getAsJsonObject("service")));
7536    if (json.has("fee"))
7537      res.setFee(parseMoney(json.getAsJsonObject("fee")));
7538    if (json.has("noteNumberLinkId")) {
7539      JsonArray array = json.getAsJsonArray("noteNumberLinkId");
7540      for (int i = 0; i < array.size(); i++) {
7541        res.getNoteNumberLinkId().add(parsePositiveInt(array.get(i).getAsString()));
7542      }
7543    };
7544    if (json.has("_noteNumberLinkId")) {
7545      JsonArray array = json.getAsJsonArray("_noteNumberLinkId");
7546      for (int i = 0; i < array.size(); i++) {
7547        if (i == res.getNoteNumberLinkId().size())
7548          res.getNoteNumberLinkId().add(parsePositiveInt(null));
7549        if (array.get(i) instanceof JsonObject) 
7550          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumberLinkId().get(i));
7551      }
7552    };
7553    if (json.has("adjudication")) {
7554      JsonArray array = json.getAsJsonArray("adjudication");
7555      for (int i = 0; i < array.size(); i++) {
7556        res.getAdjudication().add(parseExplanationOfBenefitAddedItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
7557      }
7558    };
7559    if (json.has("detail")) {
7560      JsonArray array = json.getAsJsonArray("detail");
7561      for (int i = 0; i < array.size(); i++) {
7562        res.getDetail().add(parseExplanationOfBenefitAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
7563      }
7564    };
7565    return res;
7566  }
7567
7568  protected ExplanationOfBenefit.AddedItemAdjudicationComponent parseExplanationOfBenefitAddedItemAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7569    ExplanationOfBenefit.AddedItemAdjudicationComponent res = new ExplanationOfBenefit.AddedItemAdjudicationComponent();
7570    parseBackboneProperties(json, res);
7571    if (json.has("category"))
7572      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7573    if (json.has("reason"))
7574      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7575    if (json.has("amount"))
7576      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
7577    if (json.has("value"))
7578      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7579    if (json.has("_value"))
7580      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7581    return res;
7582  }
7583
7584  protected ExplanationOfBenefit.AddedItemsDetailComponent parseExplanationOfBenefitAddedItemsDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7585    ExplanationOfBenefit.AddedItemsDetailComponent res = new ExplanationOfBenefit.AddedItemsDetailComponent();
7586    parseBackboneProperties(json, res);
7587    if (json.has("service"))
7588      res.setService(parseCoding(json.getAsJsonObject("service")));
7589    if (json.has("fee"))
7590      res.setFee(parseMoney(json.getAsJsonObject("fee")));
7591    if (json.has("adjudication")) {
7592      JsonArray array = json.getAsJsonArray("adjudication");
7593      for (int i = 0; i < array.size(); i++) {
7594        res.getAdjudication().add(parseExplanationOfBenefitAddedItemDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
7595      }
7596    };
7597    return res;
7598  }
7599
7600  protected ExplanationOfBenefit.AddedItemDetailAdjudicationComponent parseExplanationOfBenefitAddedItemDetailAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7601    ExplanationOfBenefit.AddedItemDetailAdjudicationComponent res = new ExplanationOfBenefit.AddedItemDetailAdjudicationComponent();
7602    parseBackboneProperties(json, res);
7603    if (json.has("category"))
7604      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7605    if (json.has("reason"))
7606      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7607    if (json.has("amount"))
7608      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
7609    if (json.has("value"))
7610      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7611    if (json.has("_value"))
7612      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7613    return res;
7614  }
7615
7616  protected ExplanationOfBenefit.MissingTeethComponent parseExplanationOfBenefitMissingTeethComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7617    ExplanationOfBenefit.MissingTeethComponent res = new ExplanationOfBenefit.MissingTeethComponent();
7618    parseBackboneProperties(json, res);
7619    if (json.has("tooth"))
7620      res.setTooth(parseCoding(json.getAsJsonObject("tooth")));
7621    if (json.has("reason"))
7622      res.setReason(parseCoding(json.getAsJsonObject("reason")));
7623    if (json.has("extractionDate"))
7624      res.setExtractionDateElement(parseDate(json.get("extractionDate").getAsString()));
7625    if (json.has("_extractionDate"))
7626      parseElementProperties(json.getAsJsonObject("_extractionDate"), res.getExtractionDateElement());
7627    return res;
7628  }
7629
7630  protected ExplanationOfBenefit.NotesComponent parseExplanationOfBenefitNotesComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7631    ExplanationOfBenefit.NotesComponent res = new ExplanationOfBenefit.NotesComponent();
7632    parseBackboneProperties(json, res);
7633    if (json.has("number"))
7634      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
7635    if (json.has("_number"))
7636      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
7637    if (json.has("type"))
7638      res.setType(parseCoding(json.getAsJsonObject("type")));
7639    if (json.has("text"))
7640      res.setTextElement(parseString(json.get("text").getAsString()));
7641    if (json.has("_text"))
7642      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7643    return res;
7644  }
7645
7646  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7647    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
7648    parseBackboneProperties(json, res);
7649    if (json.has("category"))
7650      res.setCategory(parseCoding(json.getAsJsonObject("category")));
7651    if (json.has("subCategory"))
7652      res.setSubCategory(parseCoding(json.getAsJsonObject("subCategory")));
7653    if (json.has("network"))
7654      res.setNetwork(parseCoding(json.getAsJsonObject("network")));
7655    if (json.has("unit"))
7656      res.setUnit(parseCoding(json.getAsJsonObject("unit")));
7657    if (json.has("term"))
7658      res.setTerm(parseCoding(json.getAsJsonObject("term")));
7659    if (json.has("financial")) {
7660      JsonArray array = json.getAsJsonArray("financial");
7661      for (int i = 0; i < array.size(); i++) {
7662        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
7663      }
7664    };
7665    return res;
7666  }
7667
7668  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
7669    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
7670    parseBackboneProperties(json, res);
7671    if (json.has("type"))
7672      res.setType(parseCoding(json.getAsJsonObject("type")));
7673    Type benefit = parseType("benefit", json);
7674    if (benefit != null)
7675      res.setBenefit(benefit);
7676    Type benefitUsed = parseType("benefitUsed", json);
7677    if (benefitUsed != null)
7678      res.setBenefitUsed(benefitUsed);
7679    return res;
7680  }
7681
7682  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
7683    FamilyMemberHistory res = new FamilyMemberHistory();
7684    parseDomainResourceProperties(json, res);
7685    if (json.has("identifier")) {
7686      JsonArray array = json.getAsJsonArray("identifier");
7687      for (int i = 0; i < array.size(); i++) {
7688        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7689      }
7690    };
7691    if (json.has("patient"))
7692      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7693    if (json.has("date"))
7694      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7695    if (json.has("_date"))
7696      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7697    if (json.has("status"))
7698      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
7699    if (json.has("_status"))
7700      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7701    if (json.has("name"))
7702      res.setNameElement(parseString(json.get("name").getAsString()));
7703    if (json.has("_name"))
7704      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7705    if (json.has("relationship"))
7706      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
7707    if (json.has("gender"))
7708      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
7709    if (json.has("_gender"))
7710      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
7711    Type born = parseType("born", json);
7712    if (born != null)
7713      res.setBorn(born);
7714    Type age = parseType("age", json);
7715    if (age != null)
7716      res.setAge(age);
7717    Type deceased = parseType("deceased", json);
7718    if (deceased != null)
7719      res.setDeceased(deceased);
7720    if (json.has("note"))
7721      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
7722    if (json.has("condition")) {
7723      JsonArray array = json.getAsJsonArray("condition");
7724      for (int i = 0; i < array.size(); i++) {
7725        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
7726      }
7727    };
7728    return res;
7729  }
7730
7731  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
7732    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
7733    parseBackboneProperties(json, res);
7734    if (json.has("code"))
7735      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7736    if (json.has("outcome"))
7737      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
7738    Type onset = parseType("onset", json);
7739    if (onset != null)
7740      res.setOnset(onset);
7741    if (json.has("note"))
7742      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
7743    return res;
7744  }
7745
7746  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
7747    Flag res = new Flag();
7748    parseDomainResourceProperties(json, res);
7749    if (json.has("identifier")) {
7750      JsonArray array = json.getAsJsonArray("identifier");
7751      for (int i = 0; i < array.size(); i++) {
7752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7753      }
7754    };
7755    if (json.has("category"))
7756      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7757    if (json.has("status"))
7758      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
7759    if (json.has("_status"))
7760      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7761    if (json.has("period"))
7762      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7763    if (json.has("subject"))
7764      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7765    if (json.has("encounter"))
7766      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7767    if (json.has("author"))
7768      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7769    if (json.has("code"))
7770      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7771    return res;
7772  }
7773
7774  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
7775    Goal res = new Goal();
7776    parseDomainResourceProperties(json, res);
7777    if (json.has("identifier")) {
7778      JsonArray array = json.getAsJsonArray("identifier");
7779      for (int i = 0; i < array.size(); i++) {
7780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7781      }
7782    };
7783    if (json.has("subject"))
7784      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7785    Type start = parseType("start", json);
7786    if (start != null)
7787      res.setStart(start);
7788    Type target = parseType("target", json);
7789    if (target != null)
7790      res.setTarget(target);
7791    if (json.has("category")) {
7792      JsonArray array = json.getAsJsonArray("category");
7793      for (int i = 0; i < array.size(); i++) {
7794        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7795      }
7796    };
7797    if (json.has("description"))
7798      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7799    if (json.has("_description"))
7800      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7801    if (json.has("status"))
7802      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
7803    if (json.has("_status"))
7804      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7805    if (json.has("statusDate"))
7806      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
7807    if (json.has("_statusDate"))
7808      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
7809    if (json.has("statusReason"))
7810      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
7811    if (json.has("author"))
7812      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7813    if (json.has("priority"))
7814      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
7815    if (json.has("addresses")) {
7816      JsonArray array = json.getAsJsonArray("addresses");
7817      for (int i = 0; i < array.size(); i++) {
7818        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
7819      }
7820    };
7821    if (json.has("note")) {
7822      JsonArray array = json.getAsJsonArray("note");
7823      for (int i = 0; i < array.size(); i++) {
7824        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7825      }
7826    };
7827    if (json.has("outcome")) {
7828      JsonArray array = json.getAsJsonArray("outcome");
7829      for (int i = 0; i < array.size(); i++) {
7830        res.getOutcome().add(parseGoalGoalOutcomeComponent(array.get(i).getAsJsonObject(), res));
7831      }
7832    };
7833    return res;
7834  }
7835
7836  protected Goal.GoalOutcomeComponent parseGoalGoalOutcomeComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
7837    Goal.GoalOutcomeComponent res = new Goal.GoalOutcomeComponent();
7838    parseBackboneProperties(json, res);
7839    Type result = parseType("result", json);
7840    if (result != null)
7841      res.setResult(result);
7842    return res;
7843  }
7844
7845  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
7846    Group res = new Group();
7847    parseDomainResourceProperties(json, res);
7848    if (json.has("identifier")) {
7849      JsonArray array = json.getAsJsonArray("identifier");
7850      for (int i = 0; i < array.size(); i++) {
7851        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7852      }
7853    };
7854    if (json.has("type"))
7855      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
7856    if (json.has("_type"))
7857      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7858    if (json.has("actual"))
7859      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
7860    if (json.has("_actual"))
7861      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
7862    if (json.has("active"))
7863      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
7864    if (json.has("_active"))
7865      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
7866    if (json.has("code"))
7867      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7868    if (json.has("name"))
7869      res.setNameElement(parseString(json.get("name").getAsString()));
7870    if (json.has("_name"))
7871      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7872    if (json.has("quantity"))
7873      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
7874    if (json.has("_quantity"))
7875      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
7876    if (json.has("characteristic")) {
7877      JsonArray array = json.getAsJsonArray("characteristic");
7878      for (int i = 0; i < array.size(); i++) {
7879        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
7880      }
7881    };
7882    if (json.has("member")) {
7883      JsonArray array = json.getAsJsonArray("member");
7884      for (int i = 0; i < array.size(); i++) {
7885        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
7886      }
7887    };
7888    return res;
7889  }
7890
7891  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
7892    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
7893    parseBackboneProperties(json, res);
7894    if (json.has("code"))
7895      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7896    Type value = parseType("value", json);
7897    if (value != null)
7898      res.setValue(value);
7899    if (json.has("exclude"))
7900      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
7901    if (json.has("_exclude"))
7902      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
7903    if (json.has("period"))
7904      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7905    return res;
7906  }
7907
7908  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
7909    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
7910    parseBackboneProperties(json, res);
7911    if (json.has("entity"))
7912      res.setEntity(parseReference(json.getAsJsonObject("entity")));
7913    if (json.has("period"))
7914      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7915    if (json.has("inactive"))
7916      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
7917    if (json.has("_inactive"))
7918      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
7919    return res;
7920  }
7921
7922  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
7923    GuidanceResponse res = new GuidanceResponse();
7924    parseDomainResourceProperties(json, res);
7925    if (json.has("requestId"))
7926      res.setRequestIdElement(parseString(json.get("requestId").getAsString()));
7927    if (json.has("_requestId"))
7928      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
7929    if (json.has("module"))
7930      res.setModule(parseReference(json.getAsJsonObject("module")));
7931    if (json.has("status"))
7932      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
7933    if (json.has("_status"))
7934      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7935    if (json.has("evaluationMessage")) {
7936      JsonArray array = json.getAsJsonArray("evaluationMessage");
7937      for (int i = 0; i < array.size(); i++) {
7938        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
7939      }
7940    };
7941    if (json.has("outputParameters"))
7942      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
7943    if (json.has("action")) {
7944      JsonArray array = json.getAsJsonArray("action");
7945      for (int i = 0; i < array.size(); i++) {
7946        res.getAction().add(parseGuidanceResponseGuidanceResponseActionComponent(array.get(i).getAsJsonObject(), res));
7947      }
7948    };
7949    if (json.has("dataRequirement")) {
7950      JsonArray array = json.getAsJsonArray("dataRequirement");
7951      for (int i = 0; i < array.size(); i++) {
7952        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
7953      }
7954    };
7955    return res;
7956  }
7957
7958  protected GuidanceResponse.GuidanceResponseActionComponent parseGuidanceResponseGuidanceResponseActionComponent(JsonObject json, GuidanceResponse owner) throws IOException, FHIRFormatError {
7959    GuidanceResponse.GuidanceResponseActionComponent res = new GuidanceResponse.GuidanceResponseActionComponent();
7960    parseBackboneProperties(json, res);
7961    if (json.has("actionIdentifier"))
7962      res.setActionIdentifier(parseIdentifier(json.getAsJsonObject("actionIdentifier")));
7963    if (json.has("label"))
7964      res.setLabelElement(parseString(json.get("label").getAsString()));
7965    if (json.has("_label"))
7966      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
7967    if (json.has("title"))
7968      res.setTitleElement(parseString(json.get("title").getAsString()));
7969    if (json.has("_title"))
7970      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7971    if (json.has("description"))
7972      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7973    if (json.has("_description"))
7974      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7975    if (json.has("textEquivalent"))
7976      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
7977    if (json.has("_textEquivalent"))
7978      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
7979    if (json.has("concept")) {
7980      JsonArray array = json.getAsJsonArray("concept");
7981      for (int i = 0; i < array.size(); i++) {
7982        res.getConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7983      }
7984    };
7985    if (json.has("supportingEvidence")) {
7986      JsonArray array = json.getAsJsonArray("supportingEvidence");
7987      for (int i = 0; i < array.size(); i++) {
7988        res.getSupportingEvidence().add(parseAttachment(array.get(i).getAsJsonObject()));
7989      }
7990    };
7991    if (json.has("relatedAction"))
7992      res.setRelatedAction(parseGuidanceResponseGuidanceResponseActionRelatedActionComponent(json.getAsJsonObject("relatedAction"), owner));
7993    if (json.has("documentation")) {
7994      JsonArray array = json.getAsJsonArray("documentation");
7995      for (int i = 0; i < array.size(); i++) {
7996        res.getDocumentation().add(parseAttachment(array.get(i).getAsJsonObject()));
7997      }
7998    };
7999    if (json.has("participant")) {
8000      JsonArray array = json.getAsJsonArray("participant");
8001      for (int i = 0; i < array.size(); i++) {
8002        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
8003      }
8004    };
8005    if (json.has("type"))
8006      res.setTypeElement(parseCode(json.get("type").getAsString()));
8007    if (json.has("_type"))
8008      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8009    if (json.has("behavior")) {
8010      JsonArray array = json.getAsJsonArray("behavior");
8011      for (int i = 0; i < array.size(); i++) {
8012        res.getBehavior().add(parseGuidanceResponseGuidanceResponseActionBehaviorComponent(array.get(i).getAsJsonObject(), owner));
8013      }
8014    };
8015    if (json.has("resource"))
8016      res.setResource(parseReference(json.getAsJsonObject("resource")));
8017    if (json.has("action")) {
8018      JsonArray array = json.getAsJsonArray("action");
8019      for (int i = 0; i < array.size(); i++) {
8020        res.getAction().add(parseGuidanceResponseGuidanceResponseActionComponent(array.get(i).getAsJsonObject(), owner));
8021      }
8022    };
8023    return res;
8024  }
8025
8026  protected GuidanceResponse.GuidanceResponseActionRelatedActionComponent parseGuidanceResponseGuidanceResponseActionRelatedActionComponent(JsonObject json, GuidanceResponse owner) throws IOException, FHIRFormatError {
8027    GuidanceResponse.GuidanceResponseActionRelatedActionComponent res = new GuidanceResponse.GuidanceResponseActionRelatedActionComponent();
8028    parseBackboneProperties(json, res);
8029    if (json.has("actionIdentifier"))
8030      res.setActionIdentifier(parseIdentifier(json.getAsJsonObject("actionIdentifier")));
8031    if (json.has("relationship"))
8032      res.setRelationshipElement(parseCode(json.get("relationship").getAsString()));
8033    if (json.has("_relationship"))
8034      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
8035    Type offset = parseType("offset", json);
8036    if (offset != null)
8037      res.setOffset(offset);
8038    if (json.has("anchor"))
8039      res.setAnchorElement(parseCode(json.get("anchor").getAsString()));
8040    if (json.has("_anchor"))
8041      parseElementProperties(json.getAsJsonObject("_anchor"), res.getAnchorElement());
8042    return res;
8043  }
8044
8045  protected GuidanceResponse.GuidanceResponseActionBehaviorComponent parseGuidanceResponseGuidanceResponseActionBehaviorComponent(JsonObject json, GuidanceResponse owner) throws IOException, FHIRFormatError {
8046    GuidanceResponse.GuidanceResponseActionBehaviorComponent res = new GuidanceResponse.GuidanceResponseActionBehaviorComponent();
8047    parseBackboneProperties(json, res);
8048    if (json.has("type"))
8049      res.setType(parseCoding(json.getAsJsonObject("type")));
8050    if (json.has("value"))
8051      res.setValue(parseCoding(json.getAsJsonObject("value")));
8052    return res;
8053  }
8054
8055  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
8056    HealthcareService res = new HealthcareService();
8057    parseDomainResourceProperties(json, res);
8058    if (json.has("identifier")) {
8059      JsonArray array = json.getAsJsonArray("identifier");
8060      for (int i = 0; i < array.size(); i++) {
8061        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8062      }
8063    };
8064    if (json.has("providedBy"))
8065      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
8066    if (json.has("serviceCategory"))
8067      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
8068    if (json.has("serviceType")) {
8069      JsonArray array = json.getAsJsonArray("serviceType");
8070      for (int i = 0; i < array.size(); i++) {
8071        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8072      }
8073    };
8074    if (json.has("specialty")) {
8075      JsonArray array = json.getAsJsonArray("specialty");
8076      for (int i = 0; i < array.size(); i++) {
8077        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8078      }
8079    };
8080    if (json.has("location")) {
8081      JsonArray array = json.getAsJsonArray("location");
8082      for (int i = 0; i < array.size(); i++) {
8083        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
8084      }
8085    };
8086    if (json.has("serviceName"))
8087      res.setServiceNameElement(parseString(json.get("serviceName").getAsString()));
8088    if (json.has("_serviceName"))
8089      parseElementProperties(json.getAsJsonObject("_serviceName"), res.getServiceNameElement());
8090    if (json.has("comment"))
8091      res.setCommentElement(parseString(json.get("comment").getAsString()));
8092    if (json.has("_comment"))
8093      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
8094    if (json.has("extraDetails"))
8095      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
8096    if (json.has("_extraDetails"))
8097      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
8098    if (json.has("photo"))
8099      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
8100    if (json.has("telecom")) {
8101      JsonArray array = json.getAsJsonArray("telecom");
8102      for (int i = 0; i < array.size(); i++) {
8103        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8104      }
8105    };
8106    if (json.has("coverageArea")) {
8107      JsonArray array = json.getAsJsonArray("coverageArea");
8108      for (int i = 0; i < array.size(); i++) {
8109        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
8110      }
8111    };
8112    if (json.has("serviceProvisionCode")) {
8113      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
8114      for (int i = 0; i < array.size(); i++) {
8115        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8116      }
8117    };
8118    if (json.has("eligibility"))
8119      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
8120    if (json.has("eligibilityNote"))
8121      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
8122    if (json.has("_eligibilityNote"))
8123      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
8124    if (json.has("programName")) {
8125      JsonArray array = json.getAsJsonArray("programName");
8126      for (int i = 0; i < array.size(); i++) {
8127        res.getProgramName().add(parseString(array.get(i).getAsString()));
8128      }
8129    };
8130    if (json.has("_programName")) {
8131      JsonArray array = json.getAsJsonArray("_programName");
8132      for (int i = 0; i < array.size(); i++) {
8133        if (i == res.getProgramName().size())
8134          res.getProgramName().add(parseString(null));
8135        if (array.get(i) instanceof JsonObject) 
8136          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
8137      }
8138    };
8139    if (json.has("characteristic")) {
8140      JsonArray array = json.getAsJsonArray("characteristic");
8141      for (int i = 0; i < array.size(); i++) {
8142        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8143      }
8144    };
8145    if (json.has("referralMethod")) {
8146      JsonArray array = json.getAsJsonArray("referralMethod");
8147      for (int i = 0; i < array.size(); i++) {
8148        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8149      }
8150    };
8151    if (json.has("publicKey"))
8152      res.setPublicKeyElement(parseString(json.get("publicKey").getAsString()));
8153    if (json.has("_publicKey"))
8154      parseElementProperties(json.getAsJsonObject("_publicKey"), res.getPublicKeyElement());
8155    if (json.has("appointmentRequired"))
8156      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
8157    if (json.has("_appointmentRequired"))
8158      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
8159    if (json.has("availableTime")) {
8160      JsonArray array = json.getAsJsonArray("availableTime");
8161      for (int i = 0; i < array.size(); i++) {
8162        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
8163      }
8164    };
8165    if (json.has("notAvailable")) {
8166      JsonArray array = json.getAsJsonArray("notAvailable");
8167      for (int i = 0; i < array.size(); i++) {
8168        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
8169      }
8170    };
8171    if (json.has("availabilityExceptions"))
8172      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
8173    if (json.has("_availabilityExceptions"))
8174      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
8175    return res;
8176  }
8177
8178  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
8179    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
8180    parseBackboneProperties(json, res);
8181    if (json.has("daysOfWeek")) {
8182      JsonArray array = json.getAsJsonArray("daysOfWeek");
8183      for (int i = 0; i < array.size(); i++) {
8184        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
8185      }
8186    };
8187    if (json.has("_daysOfWeek")) {
8188      JsonArray array = json.getAsJsonArray("_daysOfWeek");
8189      for (int i = 0; i < array.size(); i++) {
8190        if (i == res.getDaysOfWeek().size())
8191          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
8192        if (array.get(i) instanceof JsonObject) 
8193          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
8194      }
8195    };
8196    if (json.has("allDay"))
8197      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
8198    if (json.has("_allDay"))
8199      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
8200    if (json.has("availableStartTime"))
8201      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
8202    if (json.has("_availableStartTime"))
8203      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
8204    if (json.has("availableEndTime"))
8205      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
8206    if (json.has("_availableEndTime"))
8207      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
8208    return res;
8209  }
8210
8211  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
8212    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
8213    parseBackboneProperties(json, res);
8214    if (json.has("description"))
8215      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8216    if (json.has("_description"))
8217      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8218    if (json.has("during"))
8219      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
8220    return res;
8221  }
8222
8223  protected ImagingExcerpt parseImagingExcerpt(JsonObject json) throws IOException, FHIRFormatError {
8224    ImagingExcerpt res = new ImagingExcerpt();
8225    parseDomainResourceProperties(json, res);
8226    if (json.has("uid"))
8227      res.setUidElement(parseOid(json.get("uid").getAsString()));
8228    if (json.has("_uid"))
8229      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8230    if (json.has("patient"))
8231      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8232    if (json.has("authoringTime"))
8233      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
8234    if (json.has("_authoringTime"))
8235      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
8236    if (json.has("author"))
8237      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8238    if (json.has("title"))
8239      res.setTitle(parseCodeableConcept(json.getAsJsonObject("title")));
8240    if (json.has("description"))
8241      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8242    if (json.has("_description"))
8243      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8244    if (json.has("study")) {
8245      JsonArray array = json.getAsJsonArray("study");
8246      for (int i = 0; i < array.size(); i++) {
8247        res.getStudy().add(parseImagingExcerptStudyComponent(array.get(i).getAsJsonObject(), res));
8248      }
8249    };
8250    return res;
8251  }
8252
8253  protected ImagingExcerpt.StudyComponent parseImagingExcerptStudyComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8254    ImagingExcerpt.StudyComponent res = new ImagingExcerpt.StudyComponent();
8255    parseBackboneProperties(json, res);
8256    if (json.has("uid"))
8257      res.setUidElement(parseOid(json.get("uid").getAsString()));
8258    if (json.has("_uid"))
8259      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8260    if (json.has("imagingStudy"))
8261      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
8262    if (json.has("dicom")) {
8263      JsonArray array = json.getAsJsonArray("dicom");
8264      for (int i = 0; i < array.size(); i++) {
8265        res.getDicom().add(parseImagingExcerptStudyDicomComponent(array.get(i).getAsJsonObject(), owner));
8266      }
8267    };
8268    if (json.has("viewable")) {
8269      JsonArray array = json.getAsJsonArray("viewable");
8270      for (int i = 0; i < array.size(); i++) {
8271        res.getViewable().add(parseImagingExcerptStudyViewableComponent(array.get(i).getAsJsonObject(), owner));
8272      }
8273    };
8274    if (json.has("series")) {
8275      JsonArray array = json.getAsJsonArray("series");
8276      for (int i = 0; i < array.size(); i++) {
8277        res.getSeries().add(parseImagingExcerptSeriesComponent(array.get(i).getAsJsonObject(), owner));
8278      }
8279    };
8280    return res;
8281  }
8282
8283  protected ImagingExcerpt.StudyDicomComponent parseImagingExcerptStudyDicomComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8284    ImagingExcerpt.StudyDicomComponent res = new ImagingExcerpt.StudyDicomComponent();
8285    parseBackboneProperties(json, res);
8286    if (json.has("type"))
8287      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImagingExcerpt.DWebType.NULL, new ImagingExcerpt.DWebTypeEnumFactory()));
8288    if (json.has("_type"))
8289      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8290    if (json.has("url"))
8291      res.setUrlElement(parseUri(json.get("url").getAsString()));
8292    if (json.has("_url"))
8293      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8294    return res;
8295  }
8296
8297  protected ImagingExcerpt.StudyViewableComponent parseImagingExcerptStudyViewableComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8298    ImagingExcerpt.StudyViewableComponent res = new ImagingExcerpt.StudyViewableComponent();
8299    parseBackboneProperties(json, res);
8300    if (json.has("contentType"))
8301      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
8302    if (json.has("_contentType"))
8303      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
8304    if (json.has("height"))
8305      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
8306    if (json.has("_height"))
8307      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
8308    if (json.has("width"))
8309      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
8310    if (json.has("_width"))
8311      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
8312    if (json.has("frames"))
8313      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
8314    if (json.has("_frames"))
8315      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
8316    if (json.has("duration"))
8317      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
8318    if (json.has("_duration"))
8319      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
8320    if (json.has("size"))
8321      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
8322    if (json.has("_size"))
8323      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
8324    if (json.has("title"))
8325      res.setTitleElement(parseString(json.get("title").getAsString()));
8326    if (json.has("_title"))
8327      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8328    if (json.has("url"))
8329      res.setUrlElement(parseUri(json.get("url").getAsString()));
8330    if (json.has("_url"))
8331      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8332    return res;
8333  }
8334
8335  protected ImagingExcerpt.SeriesComponent parseImagingExcerptSeriesComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8336    ImagingExcerpt.SeriesComponent res = new ImagingExcerpt.SeriesComponent();
8337    parseBackboneProperties(json, res);
8338    if (json.has("uid"))
8339      res.setUidElement(parseOid(json.get("uid").getAsString()));
8340    if (json.has("_uid"))
8341      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8342    if (json.has("dicom")) {
8343      JsonArray array = json.getAsJsonArray("dicom");
8344      for (int i = 0; i < array.size(); i++) {
8345        res.getDicom().add(parseImagingExcerptSeriesDicomComponent(array.get(i).getAsJsonObject(), owner));
8346      }
8347    };
8348    if (json.has("instance")) {
8349      JsonArray array = json.getAsJsonArray("instance");
8350      for (int i = 0; i < array.size(); i++) {
8351        res.getInstance().add(parseImagingExcerptInstanceComponent(array.get(i).getAsJsonObject(), owner));
8352      }
8353    };
8354    return res;
8355  }
8356
8357  protected ImagingExcerpt.SeriesDicomComponent parseImagingExcerptSeriesDicomComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8358    ImagingExcerpt.SeriesDicomComponent res = new ImagingExcerpt.SeriesDicomComponent();
8359    parseBackboneProperties(json, res);
8360    if (json.has("type"))
8361      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImagingExcerpt.DWebType.NULL, new ImagingExcerpt.DWebTypeEnumFactory()));
8362    if (json.has("_type"))
8363      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8364    if (json.has("url"))
8365      res.setUrlElement(parseUri(json.get("url").getAsString()));
8366    if (json.has("_url"))
8367      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8368    return res;
8369  }
8370
8371  protected ImagingExcerpt.InstanceComponent parseImagingExcerptInstanceComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8372    ImagingExcerpt.InstanceComponent res = new ImagingExcerpt.InstanceComponent();
8373    parseBackboneProperties(json, res);
8374    if (json.has("sopClass"))
8375      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
8376    if (json.has("_sopClass"))
8377      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
8378    if (json.has("uid"))
8379      res.setUidElement(parseOid(json.get("uid").getAsString()));
8380    if (json.has("_uid"))
8381      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8382    if (json.has("dicom")) {
8383      JsonArray array = json.getAsJsonArray("dicom");
8384      for (int i = 0; i < array.size(); i++) {
8385        res.getDicom().add(parseImagingExcerptInstanceDicomComponent(array.get(i).getAsJsonObject(), owner));
8386      }
8387    };
8388    if (json.has("frameNumbers")) {
8389      JsonArray array = json.getAsJsonArray("frameNumbers");
8390      for (int i = 0; i < array.size(); i++) {
8391        res.getFrameNumbers().add(parseUnsignedInt(array.get(i).getAsString()));
8392      }
8393    };
8394    if (json.has("_frameNumbers")) {
8395      JsonArray array = json.getAsJsonArray("_frameNumbers");
8396      for (int i = 0; i < array.size(); i++) {
8397        if (i == res.getFrameNumbers().size())
8398          res.getFrameNumbers().add(parseUnsignedInt(null));
8399        if (array.get(i) instanceof JsonObject) 
8400          parseElementProperties(array.get(i).getAsJsonObject(), res.getFrameNumbers().get(i));
8401      }
8402    };
8403    return res;
8404  }
8405
8406  protected ImagingExcerpt.InstanceDicomComponent parseImagingExcerptInstanceDicomComponent(JsonObject json, ImagingExcerpt owner) throws IOException, FHIRFormatError {
8407    ImagingExcerpt.InstanceDicomComponent res = new ImagingExcerpt.InstanceDicomComponent();
8408    parseBackboneProperties(json, res);
8409    if (json.has("type"))
8410      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImagingExcerpt.DWebType.NULL, new ImagingExcerpt.DWebTypeEnumFactory()));
8411    if (json.has("_type"))
8412      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8413    if (json.has("url"))
8414      res.setUrlElement(parseUri(json.get("url").getAsString()));
8415    if (json.has("_url"))
8416      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8417    return res;
8418  }
8419
8420  protected ImagingObjectSelection parseImagingObjectSelection(JsonObject json) throws IOException, FHIRFormatError {
8421    ImagingObjectSelection res = new ImagingObjectSelection();
8422    parseDomainResourceProperties(json, res);
8423    if (json.has("uid"))
8424      res.setUidElement(parseOid(json.get("uid").getAsString()));
8425    if (json.has("_uid"))
8426      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8427    if (json.has("patient"))
8428      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8429    if (json.has("authoringTime"))
8430      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
8431    if (json.has("_authoringTime"))
8432      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
8433    if (json.has("author"))
8434      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8435    if (json.has("title"))
8436      res.setTitle(parseCodeableConcept(json.getAsJsonObject("title")));
8437    if (json.has("description"))
8438      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8439    if (json.has("_description"))
8440      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8441    if (json.has("study")) {
8442      JsonArray array = json.getAsJsonArray("study");
8443      for (int i = 0; i < array.size(); i++) {
8444        res.getStudy().add(parseImagingObjectSelectionStudyComponent(array.get(i).getAsJsonObject(), res));
8445      }
8446    };
8447    return res;
8448  }
8449
8450  protected ImagingObjectSelection.StudyComponent parseImagingObjectSelectionStudyComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
8451    ImagingObjectSelection.StudyComponent res = new ImagingObjectSelection.StudyComponent();
8452    parseBackboneProperties(json, res);
8453    if (json.has("uid"))
8454      res.setUidElement(parseOid(json.get("uid").getAsString()));
8455    if (json.has("_uid"))
8456      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8457    if (json.has("url"))
8458      res.setUrlElement(parseUri(json.get("url").getAsString()));
8459    if (json.has("_url"))
8460      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8461    if (json.has("imagingStudy"))
8462      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
8463    if (json.has("series")) {
8464      JsonArray array = json.getAsJsonArray("series");
8465      for (int i = 0; i < array.size(); i++) {
8466        res.getSeries().add(parseImagingObjectSelectionSeriesComponent(array.get(i).getAsJsonObject(), owner));
8467      }
8468    };
8469    return res;
8470  }
8471
8472  protected ImagingObjectSelection.SeriesComponent parseImagingObjectSelectionSeriesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
8473    ImagingObjectSelection.SeriesComponent res = new ImagingObjectSelection.SeriesComponent();
8474    parseBackboneProperties(json, res);
8475    if (json.has("uid"))
8476      res.setUidElement(parseOid(json.get("uid").getAsString()));
8477    if (json.has("_uid"))
8478      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8479    if (json.has("url"))
8480      res.setUrlElement(parseUri(json.get("url").getAsString()));
8481    if (json.has("_url"))
8482      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8483    if (json.has("instance")) {
8484      JsonArray array = json.getAsJsonArray("instance");
8485      for (int i = 0; i < array.size(); i++) {
8486        res.getInstance().add(parseImagingObjectSelectionInstanceComponent(array.get(i).getAsJsonObject(), owner));
8487      }
8488    };
8489    return res;
8490  }
8491
8492  protected ImagingObjectSelection.InstanceComponent parseImagingObjectSelectionInstanceComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
8493    ImagingObjectSelection.InstanceComponent res = new ImagingObjectSelection.InstanceComponent();
8494    parseBackboneProperties(json, res);
8495    if (json.has("sopClass"))
8496      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
8497    if (json.has("_sopClass"))
8498      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
8499    if (json.has("uid"))
8500      res.setUidElement(parseOid(json.get("uid").getAsString()));
8501    if (json.has("_uid"))
8502      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8503    if (json.has("url"))
8504      res.setUrlElement(parseUri(json.get("url").getAsString()));
8505    if (json.has("_url"))
8506      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8507    if (json.has("frame")) {
8508      JsonArray array = json.getAsJsonArray("frame");
8509      for (int i = 0; i < array.size(); i++) {
8510        res.getFrame().add(parseImagingObjectSelectionFramesComponent(array.get(i).getAsJsonObject(), owner));
8511      }
8512    };
8513    return res;
8514  }
8515
8516  protected ImagingObjectSelection.FramesComponent parseImagingObjectSelectionFramesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
8517    ImagingObjectSelection.FramesComponent res = new ImagingObjectSelection.FramesComponent();
8518    parseBackboneProperties(json, res);
8519    if (json.has("number")) {
8520      JsonArray array = json.getAsJsonArray("number");
8521      for (int i = 0; i < array.size(); i++) {
8522        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8523      }
8524    };
8525    if (json.has("_number")) {
8526      JsonArray array = json.getAsJsonArray("_number");
8527      for (int i = 0; i < array.size(); i++) {
8528        if (i == res.getNumber().size())
8529          res.getNumber().add(parseUnsignedInt(null));
8530        if (array.get(i) instanceof JsonObject) 
8531          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
8532      }
8533    };
8534    if (json.has("url"))
8535      res.setUrlElement(parseUri(json.get("url").getAsString()));
8536    if (json.has("_url"))
8537      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8538    return res;
8539  }
8540
8541  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
8542    ImagingStudy res = new ImagingStudy();
8543    parseDomainResourceProperties(json, res);
8544    if (json.has("uid"))
8545      res.setUidElement(parseOid(json.get("uid").getAsString()));
8546    if (json.has("_uid"))
8547      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8548    if (json.has("accession"))
8549      res.setAccession(parseIdentifier(json.getAsJsonObject("accession")));
8550    if (json.has("identifier")) {
8551      JsonArray array = json.getAsJsonArray("identifier");
8552      for (int i = 0; i < array.size(); i++) {
8553        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8554      }
8555    };
8556    if (json.has("availability"))
8557      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
8558    if (json.has("_availability"))
8559      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
8560    if (json.has("modalityList")) {
8561      JsonArray array = json.getAsJsonArray("modalityList");
8562      for (int i = 0; i < array.size(); i++) {
8563        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
8564      }
8565    };
8566    if (json.has("patient"))
8567      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8568    if (json.has("started"))
8569      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
8570    if (json.has("_started"))
8571      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
8572    if (json.has("order")) {
8573      JsonArray array = json.getAsJsonArray("order");
8574      for (int i = 0; i < array.size(); i++) {
8575        res.getOrder().add(parseReference(array.get(i).getAsJsonObject()));
8576      }
8577    };
8578    if (json.has("referrer"))
8579      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
8580    if (json.has("interpreter"))
8581      res.setInterpreter(parseReference(json.getAsJsonObject("interpreter")));
8582    if (json.has("url"))
8583      res.setUrlElement(parseUri(json.get("url").getAsString()));
8584    if (json.has("_url"))
8585      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8586    if (json.has("numberOfSeries"))
8587      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
8588    if (json.has("_numberOfSeries"))
8589      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
8590    if (json.has("numberOfInstances"))
8591      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
8592    if (json.has("_numberOfInstances"))
8593      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
8594    if (json.has("procedure")) {
8595      JsonArray array = json.getAsJsonArray("procedure");
8596      for (int i = 0; i < array.size(); i++) {
8597        res.getProcedure().add(parseReference(array.get(i).getAsJsonObject()));
8598      }
8599    };
8600    if (json.has("description"))
8601      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8602    if (json.has("_description"))
8603      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8604    if (json.has("series")) {
8605      JsonArray array = json.getAsJsonArray("series");
8606      for (int i = 0; i < array.size(); i++) {
8607        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
8608      }
8609    };
8610    return res;
8611  }
8612
8613  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
8614    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
8615    parseBackboneProperties(json, res);
8616    if (json.has("uid"))
8617      res.setUidElement(parseOid(json.get("uid").getAsString()));
8618    if (json.has("_uid"))
8619      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8620    if (json.has("number"))
8621      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
8622    if (json.has("_number"))
8623      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
8624    if (json.has("modality"))
8625      res.setModality(parseCoding(json.getAsJsonObject("modality")));
8626    if (json.has("description"))
8627      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8628    if (json.has("_description"))
8629      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8630    if (json.has("numberOfInstances"))
8631      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
8632    if (json.has("_numberOfInstances"))
8633      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
8634    if (json.has("availability"))
8635      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
8636    if (json.has("_availability"))
8637      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
8638    if (json.has("url"))
8639      res.setUrlElement(parseUri(json.get("url").getAsString()));
8640    if (json.has("_url"))
8641      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8642    if (json.has("bodySite"))
8643      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
8644    if (json.has("laterality"))
8645      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
8646    if (json.has("started"))
8647      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
8648    if (json.has("_started"))
8649      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
8650    if (json.has("instance")) {
8651      JsonArray array = json.getAsJsonArray("instance");
8652      for (int i = 0; i < array.size(); i++) {
8653        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
8654      }
8655    };
8656    return res;
8657  }
8658
8659  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
8660    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
8661    parseBackboneProperties(json, res);
8662    if (json.has("uid"))
8663      res.setUidElement(parseOid(json.get("uid").getAsString()));
8664    if (json.has("_uid"))
8665      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
8666    if (json.has("number"))
8667      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
8668    if (json.has("_number"))
8669      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
8670    if (json.has("sopClass"))
8671      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
8672    if (json.has("_sopClass"))
8673      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
8674    if (json.has("type"))
8675      res.setTypeElement(parseString(json.get("type").getAsString()));
8676    if (json.has("_type"))
8677      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8678    if (json.has("title"))
8679      res.setTitleElement(parseString(json.get("title").getAsString()));
8680    if (json.has("_title"))
8681      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8682    if (json.has("content")) {
8683      JsonArray array = json.getAsJsonArray("content");
8684      for (int i = 0; i < array.size(); i++) {
8685        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
8686      }
8687    };
8688    return res;
8689  }
8690
8691  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
8692    Immunization res = new Immunization();
8693    parseDomainResourceProperties(json, res);
8694    if (json.has("identifier")) {
8695      JsonArray array = json.getAsJsonArray("identifier");
8696      for (int i = 0; i < array.size(); i++) {
8697        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8698      }
8699    };
8700    if (json.has("status"))
8701      res.setStatusElement(parseCode(json.get("status").getAsString()));
8702    if (json.has("_status"))
8703      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8704    if (json.has("date"))
8705      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8706    if (json.has("_date"))
8707      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8708    if (json.has("vaccineCode"))
8709      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
8710    if (json.has("patient"))
8711      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8712    if (json.has("wasNotGiven"))
8713      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
8714    if (json.has("_wasNotGiven"))
8715      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
8716    if (json.has("reported"))
8717      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
8718    if (json.has("_reported"))
8719      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
8720    if (json.has("performer"))
8721      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8722    if (json.has("requester"))
8723      res.setRequester(parseReference(json.getAsJsonObject("requester")));
8724    if (json.has("encounter"))
8725      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8726    if (json.has("manufacturer"))
8727      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
8728    if (json.has("location"))
8729      res.setLocation(parseReference(json.getAsJsonObject("location")));
8730    if (json.has("lotNumber"))
8731      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
8732    if (json.has("_lotNumber"))
8733      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
8734    if (json.has("expirationDate"))
8735      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
8736    if (json.has("_expirationDate"))
8737      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
8738    if (json.has("site"))
8739      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
8740    if (json.has("route"))
8741      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
8742    if (json.has("doseQuantity"))
8743      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
8744    if (json.has("note")) {
8745      JsonArray array = json.getAsJsonArray("note");
8746      for (int i = 0; i < array.size(); i++) {
8747        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8748      }
8749    };
8750    if (json.has("explanation"))
8751      res.setExplanation(parseImmunizationImmunizationExplanationComponent(json.getAsJsonObject("explanation"), res));
8752    if (json.has("reaction")) {
8753      JsonArray array = json.getAsJsonArray("reaction");
8754      for (int i = 0; i < array.size(); i++) {
8755        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
8756      }
8757    };
8758    if (json.has("vaccinationProtocol")) {
8759      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
8760      for (int i = 0; i < array.size(); i++) {
8761        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
8762      }
8763    };
8764    return res;
8765  }
8766
8767  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
8768    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
8769    parseBackboneProperties(json, res);
8770    if (json.has("reason")) {
8771      JsonArray array = json.getAsJsonArray("reason");
8772      for (int i = 0; i < array.size(); i++) {
8773        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8774      }
8775    };
8776    if (json.has("reasonNotGiven")) {
8777      JsonArray array = json.getAsJsonArray("reasonNotGiven");
8778      for (int i = 0; i < array.size(); i++) {
8779        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8780      }
8781    };
8782    return res;
8783  }
8784
8785  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
8786    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
8787    parseBackboneProperties(json, res);
8788    if (json.has("date"))
8789      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8790    if (json.has("_date"))
8791      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8792    if (json.has("detail"))
8793      res.setDetail(parseReference(json.getAsJsonObject("detail")));
8794    if (json.has("reported"))
8795      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
8796    if (json.has("_reported"))
8797      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
8798    return res;
8799  }
8800
8801  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
8802    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
8803    parseBackboneProperties(json, res);
8804    if (json.has("doseSequence"))
8805      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
8806    if (json.has("_doseSequence"))
8807      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
8808    if (json.has("description"))
8809      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8810    if (json.has("_description"))
8811      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8812    if (json.has("authority"))
8813      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
8814    if (json.has("series"))
8815      res.setSeriesElement(parseString(json.get("series").getAsString()));
8816    if (json.has("_series"))
8817      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
8818    if (json.has("seriesDoses"))
8819      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
8820    if (json.has("_seriesDoses"))
8821      parseElementProperties(json.getAsJsonObject("_seriesDoses"), res.getSeriesDosesElement());
8822    if (json.has("targetDisease")) {
8823      JsonArray array = json.getAsJsonArray("targetDisease");
8824      for (int i = 0; i < array.size(); i++) {
8825        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8826      }
8827    };
8828    if (json.has("doseStatus"))
8829      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
8830    if (json.has("doseStatusReason"))
8831      res.setDoseStatusReason(parseCodeableConcept(json.getAsJsonObject("doseStatusReason")));
8832    return res;
8833  }
8834
8835  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
8836    ImmunizationRecommendation res = new ImmunizationRecommendation();
8837    parseDomainResourceProperties(json, res);
8838    if (json.has("identifier")) {
8839      JsonArray array = json.getAsJsonArray("identifier");
8840      for (int i = 0; i < array.size(); i++) {
8841        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8842      }
8843    };
8844    if (json.has("patient"))
8845      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8846    if (json.has("recommendation")) {
8847      JsonArray array = json.getAsJsonArray("recommendation");
8848      for (int i = 0; i < array.size(); i++) {
8849        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
8850      }
8851    };
8852    return res;
8853  }
8854
8855  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
8856    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
8857    parseBackboneProperties(json, res);
8858    if (json.has("date"))
8859      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8860    if (json.has("_date"))
8861      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8862    if (json.has("vaccineCode"))
8863      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
8864    if (json.has("doseNumber"))
8865      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
8866    if (json.has("_doseNumber"))
8867      parseElementProperties(json.getAsJsonObject("_doseNumber"), res.getDoseNumberElement());
8868    if (json.has("forecastStatus"))
8869      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
8870    if (json.has("dateCriterion")) {
8871      JsonArray array = json.getAsJsonArray("dateCriterion");
8872      for (int i = 0; i < array.size(); i++) {
8873        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
8874      }
8875    };
8876    if (json.has("protocol"))
8877      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(json.getAsJsonObject("protocol"), owner));
8878    if (json.has("supportingImmunization")) {
8879      JsonArray array = json.getAsJsonArray("supportingImmunization");
8880      for (int i = 0; i < array.size(); i++) {
8881        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
8882      }
8883    };
8884    if (json.has("supportingPatientInformation")) {
8885      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
8886      for (int i = 0; i < array.size(); i++) {
8887        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
8888      }
8889    };
8890    return res;
8891  }
8892
8893  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
8894    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
8895    parseBackboneProperties(json, res);
8896    if (json.has("code"))
8897      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8898    if (json.has("value"))
8899      res.setValueElement(parseDateTime(json.get("value").getAsString()));
8900    if (json.has("_value"))
8901      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8902    return res;
8903  }
8904
8905  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
8906    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
8907    parseBackboneProperties(json, res);
8908    if (json.has("doseSequence"))
8909      res.setDoseSequenceElement(parseInteger(json.get("doseSequence").getAsLong()));
8910    if (json.has("_doseSequence"))
8911      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
8912    if (json.has("description"))
8913      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8914    if (json.has("_description"))
8915      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8916    if (json.has("authority"))
8917      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
8918    if (json.has("series"))
8919      res.setSeriesElement(parseString(json.get("series").getAsString()));
8920    if (json.has("_series"))
8921      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
8922    return res;
8923  }
8924
8925  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
8926    ImplementationGuide res = new ImplementationGuide();
8927    parseDomainResourceProperties(json, res);
8928    if (json.has("url"))
8929      res.setUrlElement(parseUri(json.get("url").getAsString()));
8930    if (json.has("_url"))
8931      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8932    if (json.has("version"))
8933      res.setVersionElement(parseString(json.get("version").getAsString()));
8934    if (json.has("_version"))
8935      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8936    if (json.has("name"))
8937      res.setNameElement(parseString(json.get("name").getAsString()));
8938    if (json.has("_name"))
8939      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8940    if (json.has("status"))
8941      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
8942    if (json.has("_status"))
8943      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8944    if (json.has("experimental"))
8945      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8946    if (json.has("_experimental"))
8947      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8948    if (json.has("publisher"))
8949      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8950    if (json.has("_publisher"))
8951      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8952    if (json.has("contact")) {
8953      JsonArray array = json.getAsJsonArray("contact");
8954      for (int i = 0; i < array.size(); i++) {
8955        res.getContact().add(parseImplementationGuideImplementationGuideContactComponent(array.get(i).getAsJsonObject(), res));
8956      }
8957    };
8958    if (json.has("date"))
8959      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8960    if (json.has("_date"))
8961      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8962    if (json.has("description"))
8963      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8964    if (json.has("_description"))
8965      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8966    if (json.has("useContext")) {
8967      JsonArray array = json.getAsJsonArray("useContext");
8968      for (int i = 0; i < array.size(); i++) {
8969        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8970      }
8971    };
8972    if (json.has("copyright"))
8973      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
8974    if (json.has("_copyright"))
8975      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
8976    if (json.has("fhirVersion"))
8977      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
8978    if (json.has("_fhirVersion"))
8979      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
8980    if (json.has("dependency")) {
8981      JsonArray array = json.getAsJsonArray("dependency");
8982      for (int i = 0; i < array.size(); i++) {
8983        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
8984      }
8985    };
8986    if (json.has("package")) {
8987      JsonArray array = json.getAsJsonArray("package");
8988      for (int i = 0; i < array.size(); i++) {
8989        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
8990      }
8991    };
8992    if (json.has("global")) {
8993      JsonArray array = json.getAsJsonArray("global");
8994      for (int i = 0; i < array.size(); i++) {
8995        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
8996      }
8997    };
8998    if (json.has("binary")) {
8999      JsonArray array = json.getAsJsonArray("binary");
9000      for (int i = 0; i < array.size(); i++) {
9001        res.getBinary().add(parseUri(array.get(i).getAsString()));
9002      }
9003    };
9004    if (json.has("_binary")) {
9005      JsonArray array = json.getAsJsonArray("_binary");
9006      for (int i = 0; i < array.size(); i++) {
9007        if (i == res.getBinary().size())
9008          res.getBinary().add(parseUri(null));
9009        if (array.get(i) instanceof JsonObject) 
9010          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
9011      }
9012    };
9013    if (json.has("page"))
9014      res.setPage(parseImplementationGuideImplementationGuidePageComponent(json.getAsJsonObject("page"), res));
9015    return res;
9016  }
9017
9018  protected ImplementationGuide.ImplementationGuideContactComponent parseImplementationGuideImplementationGuideContactComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9019    ImplementationGuide.ImplementationGuideContactComponent res = new ImplementationGuide.ImplementationGuideContactComponent();
9020    parseBackboneProperties(json, res);
9021    if (json.has("name"))
9022      res.setNameElement(parseString(json.get("name").getAsString()));
9023    if (json.has("_name"))
9024      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9025    if (json.has("telecom")) {
9026      JsonArray array = json.getAsJsonArray("telecom");
9027      for (int i = 0; i < array.size(); i++) {
9028        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9029      }
9030    };
9031    return res;
9032  }
9033
9034  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9035    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
9036    parseBackboneProperties(json, res);
9037    if (json.has("type"))
9038      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
9039    if (json.has("_type"))
9040      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9041    if (json.has("uri"))
9042      res.setUriElement(parseUri(json.get("uri").getAsString()));
9043    if (json.has("_uri"))
9044      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
9045    return res;
9046  }
9047
9048  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9049    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
9050    parseBackboneProperties(json, res);
9051    if (json.has("name"))
9052      res.setNameElement(parseString(json.get("name").getAsString()));
9053    if (json.has("_name"))
9054      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9055    if (json.has("description"))
9056      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9057    if (json.has("_description"))
9058      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9059    if (json.has("resource")) {
9060      JsonArray array = json.getAsJsonArray("resource");
9061      for (int i = 0; i < array.size(); i++) {
9062        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
9063      }
9064    };
9065    return res;
9066  }
9067
9068  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9069    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
9070    parseBackboneProperties(json, res);
9071    if (json.has("example"))
9072      res.setExampleElement(parseBoolean(json.get("example").getAsBoolean()));
9073    if (json.has("_example"))
9074      parseElementProperties(json.getAsJsonObject("_example"), res.getExampleElement());
9075    if (json.has("name"))
9076      res.setNameElement(parseString(json.get("name").getAsString()));
9077    if (json.has("_name"))
9078      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9079    if (json.has("description"))
9080      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9081    if (json.has("_description"))
9082      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9083    if (json.has("acronym"))
9084      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
9085    if (json.has("_acronym"))
9086      parseElementProperties(json.getAsJsonObject("_acronym"), res.getAcronymElement());
9087    Type source = parseType("source", json);
9088    if (source != null)
9089      res.setSource(source);
9090    if (json.has("exampleFor"))
9091      res.setExampleFor(parseReference(json.getAsJsonObject("exampleFor")));
9092    return res;
9093  }
9094
9095  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9096    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
9097    parseBackboneProperties(json, res);
9098    if (json.has("type"))
9099      res.setTypeElement(parseCode(json.get("type").getAsString()));
9100    if (json.has("_type"))
9101      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9102    if (json.has("profile"))
9103      res.setProfile(parseReference(json.getAsJsonObject("profile")));
9104    return res;
9105  }
9106
9107  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
9108    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
9109    parseBackboneProperties(json, res);
9110    if (json.has("source"))
9111      res.setSourceElement(parseUri(json.get("source").getAsString()));
9112    if (json.has("_source"))
9113      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
9114    if (json.has("name"))
9115      res.setNameElement(parseString(json.get("name").getAsString()));
9116    if (json.has("_name"))
9117      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9118    if (json.has("kind"))
9119      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
9120    if (json.has("_kind"))
9121      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
9122    if (json.has("type")) {
9123      JsonArray array = json.getAsJsonArray("type");
9124      for (int i = 0; i < array.size(); i++) {
9125        res.getType().add(parseCode(array.get(i).getAsString()));
9126      }
9127    };
9128    if (json.has("_type")) {
9129      JsonArray array = json.getAsJsonArray("_type");
9130      for (int i = 0; i < array.size(); i++) {
9131        if (i == res.getType().size())
9132          res.getType().add(parseCode(null));
9133        if (array.get(i) instanceof JsonObject) 
9134          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
9135      }
9136    };
9137    if (json.has("package")) {
9138      JsonArray array = json.getAsJsonArray("package");
9139      for (int i = 0; i < array.size(); i++) {
9140        res.getPackage().add(parseString(array.get(i).getAsString()));
9141      }
9142    };
9143    if (json.has("_package")) {
9144      JsonArray array = json.getAsJsonArray("_package");
9145      for (int i = 0; i < array.size(); i++) {
9146        if (i == res.getPackage().size())
9147          res.getPackage().add(parseString(null));
9148        if (array.get(i) instanceof JsonObject) 
9149          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
9150      }
9151    };
9152    if (json.has("format"))
9153      res.setFormatElement(parseCode(json.get("format").getAsString()));
9154    if (json.has("_format"))
9155      parseElementProperties(json.getAsJsonObject("_format"), res.getFormatElement());
9156    if (json.has("page")) {
9157      JsonArray array = json.getAsJsonArray("page");
9158      for (int i = 0; i < array.size(); i++) {
9159        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
9160      }
9161    };
9162    return res;
9163  }
9164
9165  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
9166    Library res = new Library();
9167    parseDomainResourceProperties(json, res);
9168    if (json.has("moduleMetadata"))
9169      res.setModuleMetadata(parseModuleMetadata(json.getAsJsonObject("moduleMetadata")));
9170    if (json.has("model")) {
9171      JsonArray array = json.getAsJsonArray("model");
9172      for (int i = 0; i < array.size(); i++) {
9173        res.getModel().add(parseLibraryLibraryModelComponent(array.get(i).getAsJsonObject(), res));
9174      }
9175    };
9176    if (json.has("library")) {
9177      JsonArray array = json.getAsJsonArray("library");
9178      for (int i = 0; i < array.size(); i++) {
9179        res.getLibrary().add(parseLibraryLibraryLibraryComponent(array.get(i).getAsJsonObject(), res));
9180      }
9181    };
9182    if (json.has("codeSystem")) {
9183      JsonArray array = json.getAsJsonArray("codeSystem");
9184      for (int i = 0; i < array.size(); i++) {
9185        res.getCodeSystem().add(parseLibraryLibraryCodeSystemComponent(array.get(i).getAsJsonObject(), res));
9186      }
9187    };
9188    if (json.has("valueSet")) {
9189      JsonArray array = json.getAsJsonArray("valueSet");
9190      for (int i = 0; i < array.size(); i++) {
9191        res.getValueSet().add(parseLibraryLibraryValueSetComponent(array.get(i).getAsJsonObject(), res));
9192      }
9193    };
9194    if (json.has("parameter")) {
9195      JsonArray array = json.getAsJsonArray("parameter");
9196      for (int i = 0; i < array.size(); i++) {
9197        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
9198      }
9199    };
9200    if (json.has("dataRequirement")) {
9201      JsonArray array = json.getAsJsonArray("dataRequirement");
9202      for (int i = 0; i < array.size(); i++) {
9203        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
9204      }
9205    };
9206    if (json.has("document"))
9207      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
9208    return res;
9209  }
9210
9211  protected Library.LibraryModelComponent parseLibraryLibraryModelComponent(JsonObject json, Library owner) throws IOException, FHIRFormatError {
9212    Library.LibraryModelComponent res = new Library.LibraryModelComponent();
9213    parseBackboneProperties(json, res);
9214    if (json.has("name"))
9215      res.setNameElement(parseString(json.get("name").getAsString()));
9216    if (json.has("_name"))
9217      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9218    if (json.has("identifier"))
9219      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
9220    if (json.has("_identifier"))
9221      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
9222    if (json.has("version"))
9223      res.setVersionElement(parseString(json.get("version").getAsString()));
9224    if (json.has("_version"))
9225      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9226    return res;
9227  }
9228
9229  protected Library.LibraryLibraryComponent parseLibraryLibraryLibraryComponent(JsonObject json, Library owner) throws IOException, FHIRFormatError {
9230    Library.LibraryLibraryComponent res = new Library.LibraryLibraryComponent();
9231    parseBackboneProperties(json, res);
9232    if (json.has("name"))
9233      res.setNameElement(parseString(json.get("name").getAsString()));
9234    if (json.has("_name"))
9235      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9236    if (json.has("identifier"))
9237      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
9238    if (json.has("_identifier"))
9239      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
9240    if (json.has("version"))
9241      res.setVersionElement(parseString(json.get("version").getAsString()));
9242    if (json.has("_version"))
9243      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9244    Type document = parseType("document", json);
9245    if (document != null)
9246      res.setDocument(document);
9247    return res;
9248  }
9249
9250  protected Library.LibraryCodeSystemComponent parseLibraryLibraryCodeSystemComponent(JsonObject json, Library owner) throws IOException, FHIRFormatError {
9251    Library.LibraryCodeSystemComponent res = new Library.LibraryCodeSystemComponent();
9252    parseBackboneProperties(json, res);
9253    if (json.has("name"))
9254      res.setNameElement(parseString(json.get("name").getAsString()));
9255    if (json.has("_name"))
9256      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9257    if (json.has("identifier"))
9258      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
9259    if (json.has("_identifier"))
9260      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
9261    if (json.has("version"))
9262      res.setVersionElement(parseString(json.get("version").getAsString()));
9263    if (json.has("_version"))
9264      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9265    return res;
9266  }
9267
9268  protected Library.LibraryValueSetComponent parseLibraryLibraryValueSetComponent(JsonObject json, Library owner) throws IOException, FHIRFormatError {
9269    Library.LibraryValueSetComponent res = new Library.LibraryValueSetComponent();
9270    parseBackboneProperties(json, res);
9271    if (json.has("name"))
9272      res.setNameElement(parseString(json.get("name").getAsString()));
9273    if (json.has("_name"))
9274      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9275    if (json.has("identifier"))
9276      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
9277    if (json.has("_identifier"))
9278      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
9279    if (json.has("version"))
9280      res.setVersionElement(parseString(json.get("version").getAsString()));
9281    if (json.has("_version"))
9282      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9283    if (json.has("codeSystem")) {
9284      JsonArray array = json.getAsJsonArray("codeSystem");
9285      for (int i = 0; i < array.size(); i++) {
9286        res.getCodeSystem().add(parseString(array.get(i).getAsString()));
9287      }
9288    };
9289    if (json.has("_codeSystem")) {
9290      JsonArray array = json.getAsJsonArray("_codeSystem");
9291      for (int i = 0; i < array.size(); i++) {
9292        if (i == res.getCodeSystem().size())
9293          res.getCodeSystem().add(parseString(null));
9294        if (array.get(i) instanceof JsonObject) 
9295          parseElementProperties(array.get(i).getAsJsonObject(), res.getCodeSystem().get(i));
9296      }
9297    };
9298    return res;
9299  }
9300
9301  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
9302    Linkage res = new Linkage();
9303    parseDomainResourceProperties(json, res);
9304    if (json.has("author"))
9305      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9306    if (json.has("item")) {
9307      JsonArray array = json.getAsJsonArray("item");
9308      for (int i = 0; i < array.size(); i++) {
9309        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
9310      }
9311    };
9312    return res;
9313  }
9314
9315  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
9316    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
9317    parseBackboneProperties(json, res);
9318    if (json.has("type"))
9319      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
9320    if (json.has("_type"))
9321      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9322    if (json.has("resource"))
9323      res.setResource(parseReference(json.getAsJsonObject("resource")));
9324    return res;
9325  }
9326
9327  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
9328    ListResource res = new ListResource();
9329    parseDomainResourceProperties(json, res);
9330    if (json.has("identifier")) {
9331      JsonArray array = json.getAsJsonArray("identifier");
9332      for (int i = 0; i < array.size(); i++) {
9333        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9334      }
9335    };
9336    if (json.has("status"))
9337      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
9338    if (json.has("_status"))
9339      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9340    if (json.has("mode"))
9341      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
9342    if (json.has("_mode"))
9343      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
9344    if (json.has("title"))
9345      res.setTitleElement(parseString(json.get("title").getAsString()));
9346    if (json.has("_title"))
9347      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9348    if (json.has("code"))
9349      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9350    if (json.has("subject"))
9351      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9352    if (json.has("encounter"))
9353      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9354    if (json.has("date"))
9355      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9356    if (json.has("_date"))
9357      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9358    if (json.has("source"))
9359      res.setSource(parseReference(json.getAsJsonObject("source")));
9360    if (json.has("orderedBy"))
9361      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
9362    if (json.has("note")) {
9363      JsonArray array = json.getAsJsonArray("note");
9364      for (int i = 0; i < array.size(); i++) {
9365        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9366      }
9367    };
9368    if (json.has("entry")) {
9369      JsonArray array = json.getAsJsonArray("entry");
9370      for (int i = 0; i < array.size(); i++) {
9371        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
9372      }
9373    };
9374    if (json.has("emptyReason"))
9375      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
9376    return res;
9377  }
9378
9379  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
9380    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
9381    parseBackboneProperties(json, res);
9382    if (json.has("flag"))
9383      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
9384    if (json.has("deleted"))
9385      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
9386    if (json.has("_deleted"))
9387      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
9388    if (json.has("date"))
9389      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9390    if (json.has("_date"))
9391      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9392    if (json.has("item"))
9393      res.setItem(parseReference(json.getAsJsonObject("item")));
9394    return res;
9395  }
9396
9397  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
9398    Location res = new Location();
9399    parseDomainResourceProperties(json, res);
9400    if (json.has("identifier")) {
9401      JsonArray array = json.getAsJsonArray("identifier");
9402      for (int i = 0; i < array.size(); i++) {
9403        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9404      }
9405    };
9406    if (json.has("status"))
9407      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
9408    if (json.has("_status"))
9409      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9410    if (json.has("name"))
9411      res.setNameElement(parseString(json.get("name").getAsString()));
9412    if (json.has("_name"))
9413      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9414    if (json.has("description"))
9415      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9416    if (json.has("_description"))
9417      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9418    if (json.has("mode"))
9419      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
9420    if (json.has("_mode"))
9421      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
9422    if (json.has("type"))
9423      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9424    if (json.has("telecom")) {
9425      JsonArray array = json.getAsJsonArray("telecom");
9426      for (int i = 0; i < array.size(); i++) {
9427        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9428      }
9429    };
9430    if (json.has("address"))
9431      res.setAddress(parseAddress(json.getAsJsonObject("address")));
9432    if (json.has("physicalType"))
9433      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
9434    if (json.has("position"))
9435      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
9436    if (json.has("managingOrganization"))
9437      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
9438    if (json.has("partOf"))
9439      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
9440    return res;
9441  }
9442
9443  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
9444    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
9445    parseBackboneProperties(json, res);
9446    if (json.has("longitude"))
9447      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
9448    if (json.has("_longitude"))
9449      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
9450    if (json.has("latitude"))
9451      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
9452    if (json.has("_latitude"))
9453      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
9454    if (json.has("altitude"))
9455      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
9456    if (json.has("_altitude"))
9457      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
9458    return res;
9459  }
9460
9461  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
9462    Measure res = new Measure();
9463    parseDomainResourceProperties(json, res);
9464    if (json.has("moduleMetadata"))
9465      res.setModuleMetadata(parseModuleMetadata(json.getAsJsonObject("moduleMetadata")));
9466    if (json.has("library")) {
9467      JsonArray array = json.getAsJsonArray("library");
9468      for (int i = 0; i < array.size(); i++) {
9469        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
9470      }
9471    };
9472    if (json.has("disclaimer"))
9473      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
9474    if (json.has("_disclaimer"))
9475      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
9476    if (json.has("scoring"))
9477      res.setScoringElement(parseEnumeration(json.get("scoring").getAsString(), Measure.MeasureScoring.NULL, new Measure.MeasureScoringEnumFactory()));
9478    if (json.has("_scoring"))
9479      parseElementProperties(json.getAsJsonObject("_scoring"), res.getScoringElement());
9480    if (json.has("type")) {
9481      JsonArray array = json.getAsJsonArray("type");
9482      for (int i = 0; i < array.size(); i++) {
9483        res.getType().add(parseEnumeration(array.get(i).getAsString(), Measure.MeasureType.NULL, new Measure.MeasureTypeEnumFactory()));
9484      }
9485    };
9486    if (json.has("_type")) {
9487      JsonArray array = json.getAsJsonArray("_type");
9488      for (int i = 0; i < array.size(); i++) {
9489        if (i == res.getType().size())
9490          res.getType().add(parseEnumeration(null, Measure.MeasureType.NULL, new Measure.MeasureTypeEnumFactory()));
9491        if (array.get(i) instanceof JsonObject) 
9492          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
9493      }
9494    };
9495    if (json.has("riskAdjustment"))
9496      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
9497    if (json.has("_riskAdjustment"))
9498      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
9499    if (json.has("rateAggregation"))
9500      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
9501    if (json.has("_rateAggregation"))
9502      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
9503    if (json.has("rationale"))
9504      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
9505    if (json.has("_rationale"))
9506      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
9507    if (json.has("clinicalRecommendationStatement"))
9508      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
9509    if (json.has("_clinicalRecommendationStatement"))
9510      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
9511    if (json.has("improvementNotation"))
9512      res.setImprovementNotationElement(parseString(json.get("improvementNotation").getAsString()));
9513    if (json.has("_improvementNotation"))
9514      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
9515    if (json.has("definition"))
9516      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
9517    if (json.has("_definition"))
9518      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
9519    if (json.has("guidance"))
9520      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
9521    if (json.has("_guidance"))
9522      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
9523    if (json.has("set"))
9524      res.setSetElement(parseString(json.get("set").getAsString()));
9525    if (json.has("_set"))
9526      parseElementProperties(json.getAsJsonObject("_set"), res.getSetElement());
9527    if (json.has("group")) {
9528      JsonArray array = json.getAsJsonArray("group");
9529      for (int i = 0; i < array.size(); i++) {
9530        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
9531      }
9532    };
9533    if (json.has("supplementalData")) {
9534      JsonArray array = json.getAsJsonArray("supplementalData");
9535      for (int i = 0; i < array.size(); i++) {
9536        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
9537      }
9538    };
9539    return res;
9540  }
9541
9542  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
9543    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
9544    parseBackboneProperties(json, res);
9545    if (json.has("identifier"))
9546      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9547    if (json.has("name"))
9548      res.setNameElement(parseString(json.get("name").getAsString()));
9549    if (json.has("_name"))
9550      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9551    if (json.has("description"))
9552      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9553    if (json.has("_description"))
9554      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9555    if (json.has("population")) {
9556      JsonArray array = json.getAsJsonArray("population");
9557      for (int i = 0; i < array.size(); i++) {
9558        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
9559      }
9560    };
9561    if (json.has("stratifier")) {
9562      JsonArray array = json.getAsJsonArray("stratifier");
9563      for (int i = 0; i < array.size(); i++) {
9564        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
9565      }
9566    };
9567    return res;
9568  }
9569
9570  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
9571    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
9572    parseBackboneProperties(json, res);
9573    if (json.has("type"))
9574      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Measure.MeasurePopulationType.NULL, new Measure.MeasurePopulationTypeEnumFactory()));
9575    if (json.has("_type"))
9576      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9577    if (json.has("identifier"))
9578      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9579    if (json.has("name"))
9580      res.setNameElement(parseString(json.get("name").getAsString()));
9581    if (json.has("_name"))
9582      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9583    if (json.has("description"))
9584      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9585    if (json.has("_description"))
9586      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9587    if (json.has("criteria"))
9588      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
9589    if (json.has("_criteria"))
9590      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
9591    return res;
9592  }
9593
9594  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
9595    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
9596    parseBackboneProperties(json, res);
9597    if (json.has("identifier"))
9598      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9599    if (json.has("criteria"))
9600      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
9601    if (json.has("_criteria"))
9602      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
9603    if (json.has("path"))
9604      res.setPathElement(parseString(json.get("path").getAsString()));
9605    if (json.has("_path"))
9606      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
9607    return res;
9608  }
9609
9610  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
9611    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
9612    parseBackboneProperties(json, res);
9613    if (json.has("identifier"))
9614      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9615    if (json.has("usage")) {
9616      JsonArray array = json.getAsJsonArray("usage");
9617      for (int i = 0; i < array.size(); i++) {
9618        res.getUsage().add(parseEnumeration(array.get(i).getAsString(), Measure.MeasureDataUsage.NULL, new Measure.MeasureDataUsageEnumFactory()));
9619      }
9620    };
9621    if (json.has("_usage")) {
9622      JsonArray array = json.getAsJsonArray("_usage");
9623      for (int i = 0; i < array.size(); i++) {
9624        if (i == res.getUsage().size())
9625          res.getUsage().add(parseEnumeration(null, Measure.MeasureDataUsage.NULL, new Measure.MeasureDataUsageEnumFactory()));
9626        if (array.get(i) instanceof JsonObject) 
9627          parseElementProperties(array.get(i).getAsJsonObject(), res.getUsage().get(i));
9628      }
9629    };
9630    if (json.has("criteria"))
9631      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
9632    if (json.has("_criteria"))
9633      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
9634    if (json.has("path"))
9635      res.setPathElement(parseString(json.get("path").getAsString()));
9636    if (json.has("_path"))
9637      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
9638    return res;
9639  }
9640
9641  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
9642    MeasureReport res = new MeasureReport();
9643    parseDomainResourceProperties(json, res);
9644    if (json.has("measure"))
9645      res.setMeasure(parseReference(json.getAsJsonObject("measure")));
9646    if (json.has("type"))
9647      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
9648    if (json.has("_type"))
9649      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9650    if (json.has("patient"))
9651      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9652    if (json.has("period"))
9653      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9654    if (json.has("status"))
9655      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
9656    if (json.has("_status"))
9657      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9658    if (json.has("date"))
9659      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9660    if (json.has("_date"))
9661      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9662    if (json.has("reportingOrganization"))
9663      res.setReportingOrganization(parseReference(json.getAsJsonObject("reportingOrganization")));
9664    if (json.has("group")) {
9665      JsonArray array = json.getAsJsonArray("group");
9666      for (int i = 0; i < array.size(); i++) {
9667        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
9668      }
9669    };
9670    if (json.has("evaluatedResources"))
9671      res.setEvaluatedResources(parseReference(json.getAsJsonObject("evaluatedResources")));
9672    return res;
9673  }
9674
9675  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9676    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
9677    parseBackboneProperties(json, res);
9678    if (json.has("identifier"))
9679      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9680    if (json.has("population")) {
9681      JsonArray array = json.getAsJsonArray("population");
9682      for (int i = 0; i < array.size(); i++) {
9683        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
9684      }
9685    };
9686    if (json.has("measureScore"))
9687      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
9688    if (json.has("_measureScore"))
9689      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
9690    if (json.has("stratifier")) {
9691      JsonArray array = json.getAsJsonArray("stratifier");
9692      for (int i = 0; i < array.size(); i++) {
9693        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
9694      }
9695    };
9696    if (json.has("supplementalData")) {
9697      JsonArray array = json.getAsJsonArray("supplementalData");
9698      for (int i = 0; i < array.size(); i++) {
9699        res.getSupplementalData().add(parseMeasureReportMeasureReportGroupSupplementalDataComponent(array.get(i).getAsJsonObject(), owner));
9700      }
9701    };
9702    return res;
9703  }
9704
9705  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9706    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
9707    parseBackboneProperties(json, res);
9708    if (json.has("type"))
9709      res.setTypeElement(parseCode(json.get("type").getAsString()));
9710    if (json.has("_type"))
9711      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9712    if (json.has("count"))
9713      res.setCountElement(parseInteger(json.get("count").getAsLong()));
9714    if (json.has("_count"))
9715      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
9716    if (json.has("patients"))
9717      res.setPatients(parseReference(json.getAsJsonObject("patients")));
9718    return res;
9719  }
9720
9721  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9722    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
9723    parseBackboneProperties(json, res);
9724    if (json.has("identifier"))
9725      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9726    if (json.has("group")) {
9727      JsonArray array = json.getAsJsonArray("group");
9728      for (int i = 0; i < array.size(); i++) {
9729        res.getGroup().add(parseMeasureReportMeasureReportGroupStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
9730      }
9731    };
9732    return res;
9733  }
9734
9735  protected MeasureReport.MeasureReportGroupStratifierGroupComponent parseMeasureReportMeasureReportGroupStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9736    MeasureReport.MeasureReportGroupStratifierGroupComponent res = new MeasureReport.MeasureReportGroupStratifierGroupComponent();
9737    parseBackboneProperties(json, res);
9738    if (json.has("value"))
9739      res.setValueElement(parseString(json.get("value").getAsString()));
9740    if (json.has("_value"))
9741      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9742    if (json.has("population")) {
9743      JsonArray array = json.getAsJsonArray("population");
9744      for (int i = 0; i < array.size(); i++) {
9745        res.getPopulation().add(parseMeasureReportMeasureReportGroupStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
9746      }
9747    };
9748    if (json.has("measureScore"))
9749      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
9750    if (json.has("_measureScore"))
9751      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
9752    return res;
9753  }
9754
9755  protected MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent parseMeasureReportMeasureReportGroupStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9756    MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent res = new MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent();
9757    parseBackboneProperties(json, res);
9758    if (json.has("type"))
9759      res.setTypeElement(parseCode(json.get("type").getAsString()));
9760    if (json.has("_type"))
9761      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9762    if (json.has("count"))
9763      res.setCountElement(parseInteger(json.get("count").getAsLong()));
9764    if (json.has("_count"))
9765      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
9766    if (json.has("patients"))
9767      res.setPatients(parseReference(json.getAsJsonObject("patients")));
9768    return res;
9769  }
9770
9771  protected MeasureReport.MeasureReportGroupSupplementalDataComponent parseMeasureReportMeasureReportGroupSupplementalDataComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9772    MeasureReport.MeasureReportGroupSupplementalDataComponent res = new MeasureReport.MeasureReportGroupSupplementalDataComponent();
9773    parseBackboneProperties(json, res);
9774    if (json.has("identifier"))
9775      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9776    if (json.has("group")) {
9777      JsonArray array = json.getAsJsonArray("group");
9778      for (int i = 0; i < array.size(); i++) {
9779        res.getGroup().add(parseMeasureReportMeasureReportGroupSupplementalDataGroupComponent(array.get(i).getAsJsonObject(), owner));
9780      }
9781    };
9782    return res;
9783  }
9784
9785  protected MeasureReport.MeasureReportGroupSupplementalDataGroupComponent parseMeasureReportMeasureReportGroupSupplementalDataGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
9786    MeasureReport.MeasureReportGroupSupplementalDataGroupComponent res = new MeasureReport.MeasureReportGroupSupplementalDataGroupComponent();
9787    parseBackboneProperties(json, res);
9788    if (json.has("value"))
9789      res.setValueElement(parseString(json.get("value").getAsString()));
9790    if (json.has("_value"))
9791      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9792    if (json.has("count"))
9793      res.setCountElement(parseInteger(json.get("count").getAsLong()));
9794    if (json.has("_count"))
9795      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
9796    if (json.has("patients"))
9797      res.setPatients(parseReference(json.getAsJsonObject("patients")));
9798    return res;
9799  }
9800
9801  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
9802    Media res = new Media();
9803    parseDomainResourceProperties(json, res);
9804    if (json.has("identifier")) {
9805      JsonArray array = json.getAsJsonArray("identifier");
9806      for (int i = 0; i < array.size(); i++) {
9807        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9808      }
9809    };
9810    if (json.has("type"))
9811      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
9812    if (json.has("_type"))
9813      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9814    if (json.has("subtype"))
9815      res.setSubtype(parseCodeableConcept(json.getAsJsonObject("subtype")));
9816    if (json.has("view"))
9817      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
9818    if (json.has("subject"))
9819      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9820    if (json.has("operator"))
9821      res.setOperator(parseReference(json.getAsJsonObject("operator")));
9822    if (json.has("deviceName"))
9823      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
9824    if (json.has("_deviceName"))
9825      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
9826    if (json.has("height"))
9827      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
9828    if (json.has("_height"))
9829      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
9830    if (json.has("width"))
9831      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
9832    if (json.has("_width"))
9833      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
9834    if (json.has("frames"))
9835      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
9836    if (json.has("_frames"))
9837      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
9838    if (json.has("duration"))
9839      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
9840    if (json.has("_duration"))
9841      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
9842    if (json.has("content"))
9843      res.setContent(parseAttachment(json.getAsJsonObject("content")));
9844    return res;
9845  }
9846
9847  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
9848    Medication res = new Medication();
9849    parseDomainResourceProperties(json, res);
9850    if (json.has("code"))
9851      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9852    if (json.has("isBrand"))
9853      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
9854    if (json.has("_isBrand"))
9855      parseElementProperties(json.getAsJsonObject("_isBrand"), res.getIsBrandElement());
9856    if (json.has("manufacturer"))
9857      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
9858    if (json.has("product"))
9859      res.setProduct(parseMedicationMedicationProductComponent(json.getAsJsonObject("product"), res));
9860    if (json.has("package"))
9861      res.setPackage(parseMedicationMedicationPackageComponent(json.getAsJsonObject("package"), res));
9862    return res;
9863  }
9864
9865  protected Medication.MedicationProductComponent parseMedicationMedicationProductComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
9866    Medication.MedicationProductComponent res = new Medication.MedicationProductComponent();
9867    parseBackboneProperties(json, res);
9868    if (json.has("form"))
9869      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
9870    if (json.has("ingredient")) {
9871      JsonArray array = json.getAsJsonArray("ingredient");
9872      for (int i = 0; i < array.size(); i++) {
9873        res.getIngredient().add(parseMedicationMedicationProductIngredientComponent(array.get(i).getAsJsonObject(), owner));
9874      }
9875    };
9876    if (json.has("batch")) {
9877      JsonArray array = json.getAsJsonArray("batch");
9878      for (int i = 0; i < array.size(); i++) {
9879        res.getBatch().add(parseMedicationMedicationProductBatchComponent(array.get(i).getAsJsonObject(), owner));
9880      }
9881    };
9882    return res;
9883  }
9884
9885  protected Medication.MedicationProductIngredientComponent parseMedicationMedicationProductIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
9886    Medication.MedicationProductIngredientComponent res = new Medication.MedicationProductIngredientComponent();
9887    parseBackboneProperties(json, res);
9888    Type item = parseType("item", json);
9889    if (item != null)
9890      res.setItem(item);
9891    if (json.has("amount"))
9892      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
9893    return res;
9894  }
9895
9896  protected Medication.MedicationProductBatchComponent parseMedicationMedicationProductBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
9897    Medication.MedicationProductBatchComponent res = new Medication.MedicationProductBatchComponent();
9898    parseBackboneProperties(json, res);
9899    if (json.has("lotNumber"))
9900      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
9901    if (json.has("_lotNumber"))
9902      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
9903    if (json.has("expirationDate"))
9904      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
9905    if (json.has("_expirationDate"))
9906      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
9907    return res;
9908  }
9909
9910  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
9911    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
9912    parseBackboneProperties(json, res);
9913    if (json.has("container"))
9914      res.setContainer(parseCodeableConcept(json.getAsJsonObject("container")));
9915    if (json.has("content")) {
9916      JsonArray array = json.getAsJsonArray("content");
9917      for (int i = 0; i < array.size(); i++) {
9918        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
9919      }
9920    };
9921    return res;
9922  }
9923
9924  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
9925    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
9926    parseBackboneProperties(json, res);
9927    Type item = parseType("item", json);
9928    if (item != null)
9929      res.setItem(item);
9930    if (json.has("amount"))
9931      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
9932    return res;
9933  }
9934
9935  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
9936    MedicationAdministration res = new MedicationAdministration();
9937    parseDomainResourceProperties(json, res);
9938    if (json.has("identifier")) {
9939      JsonArray array = json.getAsJsonArray("identifier");
9940      for (int i = 0; i < array.size(); i++) {
9941        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9942      }
9943    };
9944    if (json.has("status"))
9945      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
9946    if (json.has("_status"))
9947      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9948    Type medication = parseType("medication", json);
9949    if (medication != null)
9950      res.setMedication(medication);
9951    if (json.has("patient"))
9952      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9953    if (json.has("encounter"))
9954      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9955    Type effectiveTime = parseType("effectiveTime", json);
9956    if (effectiveTime != null)
9957      res.setEffectiveTime(effectiveTime);
9958    if (json.has("practitioner"))
9959      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
9960    if (json.has("prescription"))
9961      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
9962    if (json.has("wasNotGiven"))
9963      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
9964    if (json.has("_wasNotGiven"))
9965      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
9966    if (json.has("reasonNotGiven")) {
9967      JsonArray array = json.getAsJsonArray("reasonNotGiven");
9968      for (int i = 0; i < array.size(); i++) {
9969        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9970      }
9971    };
9972    if (json.has("reasonGiven")) {
9973      JsonArray array = json.getAsJsonArray("reasonGiven");
9974      for (int i = 0; i < array.size(); i++) {
9975        res.getReasonGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9976      }
9977    };
9978    if (json.has("device")) {
9979      JsonArray array = json.getAsJsonArray("device");
9980      for (int i = 0; i < array.size(); i++) {
9981        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
9982      }
9983    };
9984    if (json.has("note")) {
9985      JsonArray array = json.getAsJsonArray("note");
9986      for (int i = 0; i < array.size(); i++) {
9987        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9988      }
9989    };
9990    if (json.has("dosage"))
9991      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
9992    return res;
9993  }
9994
9995  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
9996    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
9997    parseBackboneProperties(json, res);
9998    if (json.has("text"))
9999      res.setTextElement(parseString(json.get("text").getAsString()));
10000    if (json.has("_text"))
10001      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
10002    Type site = parseType("site", json);
10003    if (site != null)
10004      res.setSite(site);
10005    if (json.has("route"))
10006      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10007    if (json.has("method"))
10008      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
10009    if (json.has("quantity"))
10010      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10011    Type rate = parseType("rate", json);
10012    if (rate != null)
10013      res.setRate(rate);
10014    return res;
10015  }
10016
10017  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
10018    MedicationDispense res = new MedicationDispense();
10019    parseDomainResourceProperties(json, res);
10020    if (json.has("identifier"))
10021      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10022    if (json.has("status"))
10023      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
10024    if (json.has("_status"))
10025      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10026    Type medication = parseType("medication", json);
10027    if (medication != null)
10028      res.setMedication(medication);
10029    if (json.has("patient"))
10030      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10031    if (json.has("dispenser"))
10032      res.setDispenser(parseReference(json.getAsJsonObject("dispenser")));
10033    if (json.has("authorizingPrescription")) {
10034      JsonArray array = json.getAsJsonArray("authorizingPrescription");
10035      for (int i = 0; i < array.size(); i++) {
10036        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
10037      }
10038    };
10039    if (json.has("type"))
10040      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10041    if (json.has("quantity"))
10042      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10043    if (json.has("daysSupply"))
10044      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
10045    if (json.has("whenPrepared"))
10046      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
10047    if (json.has("_whenPrepared"))
10048      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
10049    if (json.has("whenHandedOver"))
10050      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
10051    if (json.has("_whenHandedOver"))
10052      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
10053    if (json.has("destination"))
10054      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10055    if (json.has("receiver")) {
10056      JsonArray array = json.getAsJsonArray("receiver");
10057      for (int i = 0; i < array.size(); i++) {
10058        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
10059      }
10060    };
10061    if (json.has("note")) {
10062      JsonArray array = json.getAsJsonArray("note");
10063      for (int i = 0; i < array.size(); i++) {
10064        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10065      }
10066    };
10067    if (json.has("dosageInstruction")) {
10068      JsonArray array = json.getAsJsonArray("dosageInstruction");
10069      for (int i = 0; i < array.size(); i++) {
10070        res.getDosageInstruction().add(parseMedicationDispenseMedicationDispenseDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
10071      }
10072    };
10073    if (json.has("substitution"))
10074      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
10075    return res;
10076  }
10077
10078  protected MedicationDispense.MedicationDispenseDosageInstructionComponent parseMedicationDispenseMedicationDispenseDosageInstructionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
10079    MedicationDispense.MedicationDispenseDosageInstructionComponent res = new MedicationDispense.MedicationDispenseDosageInstructionComponent();
10080    parseBackboneProperties(json, res);
10081    if (json.has("text"))
10082      res.setTextElement(parseString(json.get("text").getAsString()));
10083    if (json.has("_text"))
10084      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
10085    if (json.has("additionalInstructions"))
10086      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
10087    if (json.has("timing"))
10088      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
10089    Type asNeeded = parseType("asNeeded", json);
10090    if (asNeeded != null)
10091      res.setAsNeeded(asNeeded);
10092    Type site = parseType("site", json);
10093    if (site != null)
10094      res.setSite(site);
10095    if (json.has("route"))
10096      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10097    if (json.has("method"))
10098      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
10099    Type dose = parseType("dose", json);
10100    if (dose != null)
10101      res.setDose(dose);
10102    Type rate = parseType("rate", json);
10103    if (rate != null)
10104      res.setRate(rate);
10105    if (json.has("maxDosePerPeriod"))
10106      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
10107    return res;
10108  }
10109
10110  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
10111    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
10112    parseBackboneProperties(json, res);
10113    if (json.has("type"))
10114      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10115    if (json.has("reason")) {
10116      JsonArray array = json.getAsJsonArray("reason");
10117      for (int i = 0; i < array.size(); i++) {
10118        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10119      }
10120    };
10121    if (json.has("responsibleParty")) {
10122      JsonArray array = json.getAsJsonArray("responsibleParty");
10123      for (int i = 0; i < array.size(); i++) {
10124        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
10125      }
10126    };
10127    return res;
10128  }
10129
10130  protected MedicationOrder parseMedicationOrder(JsonObject json) throws IOException, FHIRFormatError {
10131    MedicationOrder res = new MedicationOrder();
10132    parseDomainResourceProperties(json, res);
10133    if (json.has("identifier")) {
10134      JsonArray array = json.getAsJsonArray("identifier");
10135      for (int i = 0; i < array.size(); i++) {
10136        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10137      }
10138    };
10139    if (json.has("status"))
10140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationOrder.MedicationOrderStatus.NULL, new MedicationOrder.MedicationOrderStatusEnumFactory()));
10141    if (json.has("_status"))
10142      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10143    Type medication = parseType("medication", json);
10144    if (medication != null)
10145      res.setMedication(medication);
10146    if (json.has("patient"))
10147      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10148    if (json.has("encounter"))
10149      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10150    if (json.has("dateWritten"))
10151      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
10152    if (json.has("_dateWritten"))
10153      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
10154    if (json.has("prescriber"))
10155      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
10156    if (json.has("reasonCode")) {
10157      JsonArray array = json.getAsJsonArray("reasonCode");
10158      for (int i = 0; i < array.size(); i++) {
10159        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10160      }
10161    };
10162    if (json.has("reasonReference")) {
10163      JsonArray array = json.getAsJsonArray("reasonReference");
10164      for (int i = 0; i < array.size(); i++) {
10165        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10166      }
10167    };
10168    if (json.has("dateEnded"))
10169      res.setDateEndedElement(parseDateTime(json.get("dateEnded").getAsString()));
10170    if (json.has("_dateEnded"))
10171      parseElementProperties(json.getAsJsonObject("_dateEnded"), res.getDateEndedElement());
10172    if (json.has("reasonEnded"))
10173      res.setReasonEnded(parseCodeableConcept(json.getAsJsonObject("reasonEnded")));
10174    if (json.has("note")) {
10175      JsonArray array = json.getAsJsonArray("note");
10176      for (int i = 0; i < array.size(); i++) {
10177        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10178      }
10179    };
10180    if (json.has("dosageInstruction")) {
10181      JsonArray array = json.getAsJsonArray("dosageInstruction");
10182      for (int i = 0; i < array.size(); i++) {
10183        res.getDosageInstruction().add(parseMedicationOrderMedicationOrderDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
10184      }
10185    };
10186    if (json.has("dispenseRequest"))
10187      res.setDispenseRequest(parseMedicationOrderMedicationOrderDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
10188    if (json.has("substitution"))
10189      res.setSubstitution(parseMedicationOrderMedicationOrderSubstitutionComponent(json.getAsJsonObject("substitution"), res));
10190    if (json.has("priorPrescription"))
10191      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
10192    return res;
10193  }
10194
10195  protected MedicationOrder.MedicationOrderDosageInstructionComponent parseMedicationOrderMedicationOrderDosageInstructionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
10196    MedicationOrder.MedicationOrderDosageInstructionComponent res = new MedicationOrder.MedicationOrderDosageInstructionComponent();
10197    parseBackboneProperties(json, res);
10198    if (json.has("text"))
10199      res.setTextElement(parseString(json.get("text").getAsString()));
10200    if (json.has("_text"))
10201      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
10202    if (json.has("additionalInstructions"))
10203      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
10204    if (json.has("timing"))
10205      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
10206    Type asNeeded = parseType("asNeeded", json);
10207    if (asNeeded != null)
10208      res.setAsNeeded(asNeeded);
10209    Type site = parseType("site", json);
10210    if (site != null)
10211      res.setSite(site);
10212    if (json.has("route"))
10213      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10214    if (json.has("method"))
10215      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
10216    Type dose = parseType("dose", json);
10217    if (dose != null)
10218      res.setDose(dose);
10219    Type rate = parseType("rate", json);
10220    if (rate != null)
10221      res.setRate(rate);
10222    if (json.has("maxDosePerPeriod"))
10223      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
10224    return res;
10225  }
10226
10227  protected MedicationOrder.MedicationOrderDispenseRequestComponent parseMedicationOrderMedicationOrderDispenseRequestComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
10228    MedicationOrder.MedicationOrderDispenseRequestComponent res = new MedicationOrder.MedicationOrderDispenseRequestComponent();
10229    parseBackboneProperties(json, res);
10230    Type medication = parseType("medication", json);
10231    if (medication != null)
10232      res.setMedication(medication);
10233    if (json.has("validityPeriod"))
10234      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
10235    if (json.has("numberOfRepeatsAllowed"))
10236      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
10237    if (json.has("_numberOfRepeatsAllowed"))
10238      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
10239    if (json.has("quantity"))
10240      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10241    if (json.has("expectedSupplyDuration"))
10242      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
10243    return res;
10244  }
10245
10246  protected MedicationOrder.MedicationOrderSubstitutionComponent parseMedicationOrderMedicationOrderSubstitutionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
10247    MedicationOrder.MedicationOrderSubstitutionComponent res = new MedicationOrder.MedicationOrderSubstitutionComponent();
10248    parseBackboneProperties(json, res);
10249    if (json.has("type"))
10250      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10251    if (json.has("reason"))
10252      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
10253    return res;
10254  }
10255
10256  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
10257    MedicationStatement res = new MedicationStatement();
10258    parseDomainResourceProperties(json, res);
10259    if (json.has("identifier")) {
10260      JsonArray array = json.getAsJsonArray("identifier");
10261      for (int i = 0; i < array.size(); i++) {
10262        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10263      }
10264    };
10265    if (json.has("status"))
10266      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
10267    if (json.has("_status"))
10268      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10269    Type medication = parseType("medication", json);
10270    if (medication != null)
10271      res.setMedication(medication);
10272    if (json.has("patient"))
10273      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10274    Type effective = parseType("effective", json);
10275    if (effective != null)
10276      res.setEffective(effective);
10277    if (json.has("informationSource"))
10278      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
10279    if (json.has("supportingInformation")) {
10280      JsonArray array = json.getAsJsonArray("supportingInformation");
10281      for (int i = 0; i < array.size(); i++) {
10282        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
10283      }
10284    };
10285    if (json.has("dateAsserted"))
10286      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
10287    if (json.has("_dateAsserted"))
10288      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
10289    if (json.has("wasNotTaken"))
10290      res.setWasNotTakenElement(parseBoolean(json.get("wasNotTaken").getAsBoolean()));
10291    if (json.has("_wasNotTaken"))
10292      parseElementProperties(json.getAsJsonObject("_wasNotTaken"), res.getWasNotTakenElement());
10293    if (json.has("reasonNotTaken")) {
10294      JsonArray array = json.getAsJsonArray("reasonNotTaken");
10295      for (int i = 0; i < array.size(); i++) {
10296        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10297      }
10298    };
10299    Type reasonForUse = parseType("reasonForUse", json);
10300    if (reasonForUse != null)
10301      res.setReasonForUse(reasonForUse);
10302    if (json.has("note")) {
10303      JsonArray array = json.getAsJsonArray("note");
10304      for (int i = 0; i < array.size(); i++) {
10305        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10306      }
10307    };
10308    if (json.has("dosage")) {
10309      JsonArray array = json.getAsJsonArray("dosage");
10310      for (int i = 0; i < array.size(); i++) {
10311        res.getDosage().add(parseMedicationStatementMedicationStatementDosageComponent(array.get(i).getAsJsonObject(), res));
10312      }
10313    };
10314    return res;
10315  }
10316
10317  protected MedicationStatement.MedicationStatementDosageComponent parseMedicationStatementMedicationStatementDosageComponent(JsonObject json, MedicationStatement owner) throws IOException, FHIRFormatError {
10318    MedicationStatement.MedicationStatementDosageComponent res = new MedicationStatement.MedicationStatementDosageComponent();
10319    parseBackboneProperties(json, res);
10320    if (json.has("text"))
10321      res.setTextElement(parseString(json.get("text").getAsString()));
10322    if (json.has("_text"))
10323      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
10324    if (json.has("timing"))
10325      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
10326    Type asNeeded = parseType("asNeeded", json);
10327    if (asNeeded != null)
10328      res.setAsNeeded(asNeeded);
10329    Type site = parseType("site", json);
10330    if (site != null)
10331      res.setSite(site);
10332    if (json.has("route"))
10333      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10334    if (json.has("method"))
10335      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
10336    Type quantity = parseType("quantity", json);
10337    if (quantity != null)
10338      res.setQuantity(quantity);
10339    Type rate = parseType("rate", json);
10340    if (rate != null)
10341      res.setRate(rate);
10342    if (json.has("maxDosePerPeriod"))
10343      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
10344    return res;
10345  }
10346
10347  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
10348    MessageHeader res = new MessageHeader();
10349    parseDomainResourceProperties(json, res);
10350    if (json.has("timestamp"))
10351      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
10352    if (json.has("_timestamp"))
10353      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
10354    if (json.has("event"))
10355      res.setEvent(parseCoding(json.getAsJsonObject("event")));
10356    if (json.has("response"))
10357      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
10358    if (json.has("source"))
10359      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
10360    if (json.has("destination")) {
10361      JsonArray array = json.getAsJsonArray("destination");
10362      for (int i = 0; i < array.size(); i++) {
10363        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
10364      }
10365    };
10366    if (json.has("enterer"))
10367      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
10368    if (json.has("author"))
10369      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10370    if (json.has("receiver"))
10371      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
10372    if (json.has("responsible"))
10373      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
10374    if (json.has("reason"))
10375      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
10376    if (json.has("data")) {
10377      JsonArray array = json.getAsJsonArray("data");
10378      for (int i = 0; i < array.size(); i++) {
10379        res.getData().add(parseReference(array.get(i).getAsJsonObject()));
10380      }
10381    };
10382    return res;
10383  }
10384
10385  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
10386    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
10387    parseBackboneProperties(json, res);
10388    if (json.has("identifier"))
10389      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
10390    if (json.has("_identifier"))
10391      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10392    if (json.has("code"))
10393      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
10394    if (json.has("_code"))
10395      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10396    if (json.has("details"))
10397      res.setDetails(parseReference(json.getAsJsonObject("details")));
10398    return res;
10399  }
10400
10401  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
10402    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
10403    parseBackboneProperties(json, res);
10404    if (json.has("name"))
10405      res.setNameElement(parseString(json.get("name").getAsString()));
10406    if (json.has("_name"))
10407      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10408    if (json.has("software"))
10409      res.setSoftwareElement(parseString(json.get("software").getAsString()));
10410    if (json.has("_software"))
10411      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
10412    if (json.has("version"))
10413      res.setVersionElement(parseString(json.get("version").getAsString()));
10414    if (json.has("_version"))
10415      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10416    if (json.has("contact"))
10417      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
10418    if (json.has("endpoint"))
10419      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
10420    if (json.has("_endpoint"))
10421      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
10422    return res;
10423  }
10424
10425  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
10426    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
10427    parseBackboneProperties(json, res);
10428    if (json.has("name"))
10429      res.setNameElement(parseString(json.get("name").getAsString()));
10430    if (json.has("_name"))
10431      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10432    if (json.has("target"))
10433      res.setTarget(parseReference(json.getAsJsonObject("target")));
10434    if (json.has("endpoint"))
10435      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
10436    if (json.has("_endpoint"))
10437      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
10438    return res;
10439  }
10440
10441  protected ModuleDefinition parseModuleDefinition(JsonObject json) throws IOException, FHIRFormatError {
10442    ModuleDefinition res = new ModuleDefinition();
10443    parseDomainResourceProperties(json, res);
10444    if (json.has("identifier")) {
10445      JsonArray array = json.getAsJsonArray("identifier");
10446      for (int i = 0; i < array.size(); i++) {
10447        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10448      }
10449    };
10450    if (json.has("version"))
10451      res.setVersionElement(parseString(json.get("version").getAsString()));
10452    if (json.has("_version"))
10453      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10454    if (json.has("model")) {
10455      JsonArray array = json.getAsJsonArray("model");
10456      for (int i = 0; i < array.size(); i++) {
10457        res.getModel().add(parseModuleDefinitionModuleDefinitionModelComponent(array.get(i).getAsJsonObject(), res));
10458      }
10459    };
10460    if (json.has("library")) {
10461      JsonArray array = json.getAsJsonArray("library");
10462      for (int i = 0; i < array.size(); i++) {
10463        res.getLibrary().add(parseModuleDefinitionModuleDefinitionLibraryComponent(array.get(i).getAsJsonObject(), res));
10464      }
10465    };
10466    if (json.has("codeSystem")) {
10467      JsonArray array = json.getAsJsonArray("codeSystem");
10468      for (int i = 0; i < array.size(); i++) {
10469        res.getCodeSystem().add(parseModuleDefinitionModuleDefinitionCodeSystemComponent(array.get(i).getAsJsonObject(), res));
10470      }
10471    };
10472    if (json.has("valueSet")) {
10473      JsonArray array = json.getAsJsonArray("valueSet");
10474      for (int i = 0; i < array.size(); i++) {
10475        res.getValueSet().add(parseModuleDefinitionModuleDefinitionValueSetComponent(array.get(i).getAsJsonObject(), res));
10476      }
10477    };
10478    if (json.has("parameter")) {
10479      JsonArray array = json.getAsJsonArray("parameter");
10480      for (int i = 0; i < array.size(); i++) {
10481        res.getParameter().add(parseModuleDefinitionModuleDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
10482      }
10483    };
10484    if (json.has("data")) {
10485      JsonArray array = json.getAsJsonArray("data");
10486      for (int i = 0; i < array.size(); i++) {
10487        res.getData().add(parseModuleDefinitionModuleDefinitionDataComponent(array.get(i).getAsJsonObject(), res));
10488      }
10489    };
10490    return res;
10491  }
10492
10493  protected ModuleDefinition.ModuleDefinitionModelComponent parseModuleDefinitionModuleDefinitionModelComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10494    ModuleDefinition.ModuleDefinitionModelComponent res = new ModuleDefinition.ModuleDefinitionModelComponent();
10495    parseBackboneProperties(json, res);
10496    if (json.has("name"))
10497      res.setNameElement(parseString(json.get("name").getAsString()));
10498    if (json.has("_name"))
10499      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10500    if (json.has("identifier"))
10501      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
10502    if (json.has("_identifier"))
10503      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10504    if (json.has("version"))
10505      res.setVersionElement(parseString(json.get("version").getAsString()));
10506    if (json.has("_version"))
10507      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10508    return res;
10509  }
10510
10511  protected ModuleDefinition.ModuleDefinitionLibraryComponent parseModuleDefinitionModuleDefinitionLibraryComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10512    ModuleDefinition.ModuleDefinitionLibraryComponent res = new ModuleDefinition.ModuleDefinitionLibraryComponent();
10513    parseBackboneProperties(json, res);
10514    if (json.has("name"))
10515      res.setNameElement(parseString(json.get("name").getAsString()));
10516    if (json.has("_name"))
10517      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10518    if (json.has("identifier"))
10519      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
10520    if (json.has("_identifier"))
10521      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10522    if (json.has("version"))
10523      res.setVersionElement(parseString(json.get("version").getAsString()));
10524    if (json.has("_version"))
10525      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10526    Type document = parseType("document", json);
10527    if (document != null)
10528      res.setDocument(document);
10529    return res;
10530  }
10531
10532  protected ModuleDefinition.ModuleDefinitionCodeSystemComponent parseModuleDefinitionModuleDefinitionCodeSystemComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10533    ModuleDefinition.ModuleDefinitionCodeSystemComponent res = new ModuleDefinition.ModuleDefinitionCodeSystemComponent();
10534    parseBackboneProperties(json, res);
10535    if (json.has("name"))
10536      res.setNameElement(parseString(json.get("name").getAsString()));
10537    if (json.has("_name"))
10538      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10539    if (json.has("identifier"))
10540      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
10541    if (json.has("_identifier"))
10542      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10543    if (json.has("version"))
10544      res.setVersionElement(parseString(json.get("version").getAsString()));
10545    if (json.has("_version"))
10546      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10547    return res;
10548  }
10549
10550  protected ModuleDefinition.ModuleDefinitionValueSetComponent parseModuleDefinitionModuleDefinitionValueSetComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10551    ModuleDefinition.ModuleDefinitionValueSetComponent res = new ModuleDefinition.ModuleDefinitionValueSetComponent();
10552    parseBackboneProperties(json, res);
10553    if (json.has("name"))
10554      res.setNameElement(parseString(json.get("name").getAsString()));
10555    if (json.has("_name"))
10556      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10557    if (json.has("identifier"))
10558      res.setIdentifierElement(parseString(json.get("identifier").getAsString()));
10559    if (json.has("_identifier"))
10560      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10561    if (json.has("version"))
10562      res.setVersionElement(parseString(json.get("version").getAsString()));
10563    if (json.has("_version"))
10564      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10565    if (json.has("codeSystem")) {
10566      JsonArray array = json.getAsJsonArray("codeSystem");
10567      for (int i = 0; i < array.size(); i++) {
10568        res.getCodeSystem().add(parseString(array.get(i).getAsString()));
10569      }
10570    };
10571    if (json.has("_codeSystem")) {
10572      JsonArray array = json.getAsJsonArray("_codeSystem");
10573      for (int i = 0; i < array.size(); i++) {
10574        if (i == res.getCodeSystem().size())
10575          res.getCodeSystem().add(parseString(null));
10576        if (array.get(i) instanceof JsonObject) 
10577          parseElementProperties(array.get(i).getAsJsonObject(), res.getCodeSystem().get(i));
10578      }
10579    };
10580    return res;
10581  }
10582
10583  protected ModuleDefinition.ModuleDefinitionParameterComponent parseModuleDefinitionModuleDefinitionParameterComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10584    ModuleDefinition.ModuleDefinitionParameterComponent res = new ModuleDefinition.ModuleDefinitionParameterComponent();
10585    parseBackboneProperties(json, res);
10586    if (json.has("name"))
10587      res.setNameElement(parseCode(json.get("name").getAsString()));
10588    if (json.has("_name"))
10589      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10590    if (json.has("use"))
10591      res.setUseElement(parseCode(json.get("use").getAsString()));
10592    if (json.has("_use"))
10593      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
10594    if (json.has("documentation"))
10595      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
10596    if (json.has("_documentation"))
10597      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
10598    if (json.has("type"))
10599      res.setTypeElement(parseCode(json.get("type").getAsString()));
10600    if (json.has("_type"))
10601      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10602    if (json.has("profile"))
10603      res.setProfile(parseReference(json.getAsJsonObject("profile")));
10604    return res;
10605  }
10606
10607  protected ModuleDefinition.ModuleDefinitionDataComponent parseModuleDefinitionModuleDefinitionDataComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10608    ModuleDefinition.ModuleDefinitionDataComponent res = new ModuleDefinition.ModuleDefinitionDataComponent();
10609    parseBackboneProperties(json, res);
10610    if (json.has("type"))
10611      res.setTypeElement(parseCode(json.get("type").getAsString()));
10612    if (json.has("_type"))
10613      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10614    if (json.has("profile"))
10615      res.setProfile(parseReference(json.getAsJsonObject("profile")));
10616    if (json.has("mustSupport")) {
10617      JsonArray array = json.getAsJsonArray("mustSupport");
10618      for (int i = 0; i < array.size(); i++) {
10619        res.getMustSupport().add(parseString(array.get(i).getAsString()));
10620      }
10621    };
10622    if (json.has("_mustSupport")) {
10623      JsonArray array = json.getAsJsonArray("_mustSupport");
10624      for (int i = 0; i < array.size(); i++) {
10625        if (i == res.getMustSupport().size())
10626          res.getMustSupport().add(parseString(null));
10627        if (array.get(i) instanceof JsonObject) 
10628          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
10629      }
10630    };
10631    if (json.has("codeFilter")) {
10632      JsonArray array = json.getAsJsonArray("codeFilter");
10633      for (int i = 0; i < array.size(); i++) {
10634        res.getCodeFilter().add(parseModuleDefinitionModuleDefinitionDataCodeFilterComponent(array.get(i).getAsJsonObject(), owner));
10635      }
10636    };
10637    if (json.has("dateFilter")) {
10638      JsonArray array = json.getAsJsonArray("dateFilter");
10639      for (int i = 0; i < array.size(); i++) {
10640        res.getDateFilter().add(parseModuleDefinitionModuleDefinitionDataDateFilterComponent(array.get(i).getAsJsonObject(), owner));
10641      }
10642    };
10643    return res;
10644  }
10645
10646  protected ModuleDefinition.ModuleDefinitionDataCodeFilterComponent parseModuleDefinitionModuleDefinitionDataCodeFilterComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10647    ModuleDefinition.ModuleDefinitionDataCodeFilterComponent res = new ModuleDefinition.ModuleDefinitionDataCodeFilterComponent();
10648    parseBackboneProperties(json, res);
10649    if (json.has("path"))
10650      res.setPathElement(parseString(json.get("path").getAsString()));
10651    if (json.has("_path"))
10652      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10653    Type valueSet = parseType("valueSet", json);
10654    if (valueSet != null)
10655      res.setValueSet(valueSet);
10656    if (json.has("codeableConcept")) {
10657      JsonArray array = json.getAsJsonArray("codeableConcept");
10658      for (int i = 0; i < array.size(); i++) {
10659        res.getCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10660      }
10661    };
10662    return res;
10663  }
10664
10665  protected ModuleDefinition.ModuleDefinitionDataDateFilterComponent parseModuleDefinitionModuleDefinitionDataDateFilterComponent(JsonObject json, ModuleDefinition owner) throws IOException, FHIRFormatError {
10666    ModuleDefinition.ModuleDefinitionDataDateFilterComponent res = new ModuleDefinition.ModuleDefinitionDataDateFilterComponent();
10667    parseBackboneProperties(json, res);
10668    if (json.has("path"))
10669      res.setPathElement(parseString(json.get("path").getAsString()));
10670    if (json.has("_path"))
10671      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10672    Type value = parseType("value", json);
10673    if (value != null)
10674      res.setValue(value);
10675    return res;
10676  }
10677
10678  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
10679    NamingSystem res = new NamingSystem();
10680    parseDomainResourceProperties(json, res);
10681    if (json.has("name"))
10682      res.setNameElement(parseString(json.get("name").getAsString()));
10683    if (json.has("_name"))
10684      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10685    if (json.has("status"))
10686      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
10687    if (json.has("_status"))
10688      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10689    if (json.has("kind"))
10690      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
10691    if (json.has("_kind"))
10692      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
10693    if (json.has("date"))
10694      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10695    if (json.has("_date"))
10696      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10697    if (json.has("publisher"))
10698      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10699    if (json.has("_publisher"))
10700      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10701    if (json.has("contact")) {
10702      JsonArray array = json.getAsJsonArray("contact");
10703      for (int i = 0; i < array.size(); i++) {
10704        res.getContact().add(parseNamingSystemNamingSystemContactComponent(array.get(i).getAsJsonObject(), res));
10705      }
10706    };
10707    if (json.has("responsible"))
10708      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
10709    if (json.has("_responsible"))
10710      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
10711    if (json.has("type"))
10712      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10713    if (json.has("description"))
10714      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10715    if (json.has("_description"))
10716      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10717    if (json.has("useContext")) {
10718      JsonArray array = json.getAsJsonArray("useContext");
10719      for (int i = 0; i < array.size(); i++) {
10720        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10721      }
10722    };
10723    if (json.has("usage"))
10724      res.setUsageElement(parseString(json.get("usage").getAsString()));
10725    if (json.has("_usage"))
10726      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
10727    if (json.has("uniqueId")) {
10728      JsonArray array = json.getAsJsonArray("uniqueId");
10729      for (int i = 0; i < array.size(); i++) {
10730        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
10731      }
10732    };
10733    if (json.has("replacedBy"))
10734      res.setReplacedBy(parseReference(json.getAsJsonObject("replacedBy")));
10735    return res;
10736  }
10737
10738  protected NamingSystem.NamingSystemContactComponent parseNamingSystemNamingSystemContactComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
10739    NamingSystem.NamingSystemContactComponent res = new NamingSystem.NamingSystemContactComponent();
10740    parseBackboneProperties(json, res);
10741    if (json.has("name"))
10742      res.setNameElement(parseString(json.get("name").getAsString()));
10743    if (json.has("_name"))
10744      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10745    if (json.has("telecom")) {
10746      JsonArray array = json.getAsJsonArray("telecom");
10747      for (int i = 0; i < array.size(); i++) {
10748        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10749      }
10750    };
10751    return res;
10752  }
10753
10754  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
10755    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
10756    parseBackboneProperties(json, res);
10757    if (json.has("type"))
10758      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
10759    if (json.has("_type"))
10760      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10761    if (json.has("value"))
10762      res.setValueElement(parseString(json.get("value").getAsString()));
10763    if (json.has("_value"))
10764      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10765    if (json.has("preferred"))
10766      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
10767    if (json.has("_preferred"))
10768      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
10769    if (json.has("period"))
10770      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10771    return res;
10772  }
10773
10774  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
10775    NutritionOrder res = new NutritionOrder();
10776    parseDomainResourceProperties(json, res);
10777    if (json.has("identifier")) {
10778      JsonArray array = json.getAsJsonArray("identifier");
10779      for (int i = 0; i < array.size(); i++) {
10780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10781      }
10782    };
10783    if (json.has("status"))
10784      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
10785    if (json.has("_status"))
10786      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10787    if (json.has("patient"))
10788      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10789    if (json.has("encounter"))
10790      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10791    if (json.has("dateTime"))
10792      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
10793    if (json.has("_dateTime"))
10794      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
10795    if (json.has("orderer"))
10796      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
10797    if (json.has("allergyIntolerance")) {
10798      JsonArray array = json.getAsJsonArray("allergyIntolerance");
10799      for (int i = 0; i < array.size(); i++) {
10800        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
10801      }
10802    };
10803    if (json.has("foodPreferenceModifier")) {
10804      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
10805      for (int i = 0; i < array.size(); i++) {
10806        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10807      }
10808    };
10809    if (json.has("excludeFoodModifier")) {
10810      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
10811      for (int i = 0; i < array.size(); i++) {
10812        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10813      }
10814    };
10815    if (json.has("oralDiet"))
10816      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
10817    if (json.has("supplement")) {
10818      JsonArray array = json.getAsJsonArray("supplement");
10819      for (int i = 0; i < array.size(); i++) {
10820        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
10821      }
10822    };
10823    if (json.has("enteralFormula"))
10824      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
10825    return res;
10826  }
10827
10828  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10829    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
10830    parseBackboneProperties(json, res);
10831    if (json.has("type")) {
10832      JsonArray array = json.getAsJsonArray("type");
10833      for (int i = 0; i < array.size(); i++) {
10834        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10835      }
10836    };
10837    if (json.has("schedule")) {
10838      JsonArray array = json.getAsJsonArray("schedule");
10839      for (int i = 0; i < array.size(); i++) {
10840        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
10841      }
10842    };
10843    if (json.has("nutrient")) {
10844      JsonArray array = json.getAsJsonArray("nutrient");
10845      for (int i = 0; i < array.size(); i++) {
10846        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
10847      }
10848    };
10849    if (json.has("texture")) {
10850      JsonArray array = json.getAsJsonArray("texture");
10851      for (int i = 0; i < array.size(); i++) {
10852        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
10853      }
10854    };
10855    if (json.has("fluidConsistencyType")) {
10856      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
10857      for (int i = 0; i < array.size(); i++) {
10858        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10859      }
10860    };
10861    if (json.has("instruction"))
10862      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
10863    if (json.has("_instruction"))
10864      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
10865    return res;
10866  }
10867
10868  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10869    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
10870    parseBackboneProperties(json, res);
10871    if (json.has("modifier"))
10872      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
10873    if (json.has("amount"))
10874      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
10875    return res;
10876  }
10877
10878  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10879    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
10880    parseBackboneProperties(json, res);
10881    if (json.has("modifier"))
10882      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
10883    if (json.has("foodType"))
10884      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
10885    return res;
10886  }
10887
10888  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10889    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
10890    parseBackboneProperties(json, res);
10891    if (json.has("type"))
10892      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10893    if (json.has("productName"))
10894      res.setProductNameElement(parseString(json.get("productName").getAsString()));
10895    if (json.has("_productName"))
10896      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
10897    if (json.has("schedule")) {
10898      JsonArray array = json.getAsJsonArray("schedule");
10899      for (int i = 0; i < array.size(); i++) {
10900        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
10901      }
10902    };
10903    if (json.has("quantity"))
10904      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10905    if (json.has("instruction"))
10906      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
10907    if (json.has("_instruction"))
10908      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
10909    return res;
10910  }
10911
10912  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10913    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
10914    parseBackboneProperties(json, res);
10915    if (json.has("baseFormulaType"))
10916      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
10917    if (json.has("baseFormulaProductName"))
10918      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
10919    if (json.has("_baseFormulaProductName"))
10920      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
10921    if (json.has("additiveType"))
10922      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
10923    if (json.has("additiveProductName"))
10924      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
10925    if (json.has("_additiveProductName"))
10926      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
10927    if (json.has("caloricDensity"))
10928      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
10929    if (json.has("routeofAdministration"))
10930      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
10931    if (json.has("administration")) {
10932      JsonArray array = json.getAsJsonArray("administration");
10933      for (int i = 0; i < array.size(); i++) {
10934        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
10935      }
10936    };
10937    if (json.has("maxVolumeToDeliver"))
10938      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
10939    if (json.has("administrationInstruction"))
10940      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
10941    if (json.has("_administrationInstruction"))
10942      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
10943    return res;
10944  }
10945
10946  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
10947    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
10948    parseBackboneProperties(json, res);
10949    if (json.has("schedule"))
10950      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
10951    if (json.has("quantity"))
10952      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10953    Type rate = parseType("rate", json);
10954    if (rate != null)
10955      res.setRate(rate);
10956    return res;
10957  }
10958
10959  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
10960    Observation res = new Observation();
10961    parseDomainResourceProperties(json, res);
10962    if (json.has("identifier")) {
10963      JsonArray array = json.getAsJsonArray("identifier");
10964      for (int i = 0; i < array.size(); i++) {
10965        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10966      }
10967    };
10968    if (json.has("status"))
10969      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
10970    if (json.has("_status"))
10971      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10972    if (json.has("category"))
10973      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10974    if (json.has("code"))
10975      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10976    if (json.has("subject"))
10977      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10978    if (json.has("encounter"))
10979      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10980    Type effective = parseType("effective", json);
10981    if (effective != null)
10982      res.setEffective(effective);
10983    if (json.has("issued"))
10984      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
10985    if (json.has("_issued"))
10986      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
10987    if (json.has("performer")) {
10988      JsonArray array = json.getAsJsonArray("performer");
10989      for (int i = 0; i < array.size(); i++) {
10990        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
10991      }
10992    };
10993    Type value = parseType("value", json);
10994    if (value != null)
10995      res.setValue(value);
10996    if (json.has("dataAbsentReason"))
10997      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
10998    if (json.has("interpretation"))
10999      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
11000    if (json.has("comment"))
11001      res.setCommentElement(parseString(json.get("comment").getAsString()));
11002    if (json.has("_comment"))
11003      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
11004    if (json.has("bodySite"))
11005      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11006    if (json.has("method"))
11007      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
11008    if (json.has("specimen"))
11009      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
11010    if (json.has("device"))
11011      res.setDevice(parseReference(json.getAsJsonObject("device")));
11012    if (json.has("referenceRange")) {
11013      JsonArray array = json.getAsJsonArray("referenceRange");
11014      for (int i = 0; i < array.size(); i++) {
11015        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
11016      }
11017    };
11018    if (json.has("related")) {
11019      JsonArray array = json.getAsJsonArray("related");
11020      for (int i = 0; i < array.size(); i++) {
11021        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
11022      }
11023    };
11024    if (json.has("component")) {
11025      JsonArray array = json.getAsJsonArray("component");
11026      for (int i = 0; i < array.size(); i++) {
11027        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
11028      }
11029    };
11030    return res;
11031  }
11032
11033  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
11034    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
11035    parseBackboneProperties(json, res);
11036    if (json.has("low"))
11037      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
11038    if (json.has("high"))
11039      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
11040    if (json.has("meaning"))
11041      res.setMeaning(parseCodeableConcept(json.getAsJsonObject("meaning")));
11042    if (json.has("age"))
11043      res.setAge(parseRange(json.getAsJsonObject("age")));
11044    if (json.has("text"))
11045      res.setTextElement(parseString(json.get("text").getAsString()));
11046    if (json.has("_text"))
11047      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
11048    return res;
11049  }
11050
11051  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
11052    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
11053    parseBackboneProperties(json, res);
11054    if (json.has("type"))
11055      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
11056    if (json.has("_type"))
11057      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11058    if (json.has("target"))
11059      res.setTarget(parseReference(json.getAsJsonObject("target")));
11060    return res;
11061  }
11062
11063  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
11064    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
11065    parseBackboneProperties(json, res);
11066    if (json.has("code"))
11067      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11068    Type value = parseType("value", json);
11069    if (value != null)
11070      res.setValue(value);
11071    if (json.has("dataAbsentReason"))
11072      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
11073    if (json.has("referenceRange")) {
11074      JsonArray array = json.getAsJsonArray("referenceRange");
11075      for (int i = 0; i < array.size(); i++) {
11076        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
11077      }
11078    };
11079    return res;
11080  }
11081
11082  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
11083    OperationDefinition res = new OperationDefinition();
11084    parseDomainResourceProperties(json, res);
11085    if (json.has("url"))
11086      res.setUrlElement(parseUri(json.get("url").getAsString()));
11087    if (json.has("_url"))
11088      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11089    if (json.has("version"))
11090      res.setVersionElement(parseString(json.get("version").getAsString()));
11091    if (json.has("_version"))
11092      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11093    if (json.has("name"))
11094      res.setNameElement(parseString(json.get("name").getAsString()));
11095    if (json.has("_name"))
11096      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11097    if (json.has("status"))
11098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
11099    if (json.has("_status"))
11100      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11101    if (json.has("kind"))
11102      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
11103    if (json.has("_kind"))
11104      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
11105    if (json.has("experimental"))
11106      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11107    if (json.has("_experimental"))
11108      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11109    if (json.has("date"))
11110      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11111    if (json.has("_date"))
11112      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11113    if (json.has("publisher"))
11114      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11115    if (json.has("_publisher"))
11116      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11117    if (json.has("contact")) {
11118      JsonArray array = json.getAsJsonArray("contact");
11119      for (int i = 0; i < array.size(); i++) {
11120        res.getContact().add(parseOperationDefinitionOperationDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
11121      }
11122    };
11123    if (json.has("description"))
11124      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11125    if (json.has("_description"))
11126      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11127    if (json.has("useContext")) {
11128      JsonArray array = json.getAsJsonArray("useContext");
11129      for (int i = 0; i < array.size(); i++) {
11130        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11131      }
11132    };
11133    if (json.has("requirements"))
11134      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
11135    if (json.has("_requirements"))
11136      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
11137    if (json.has("idempotent"))
11138      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
11139    if (json.has("_idempotent"))
11140      parseElementProperties(json.getAsJsonObject("_idempotent"), res.getIdempotentElement());
11141    if (json.has("code"))
11142      res.setCodeElement(parseCode(json.get("code").getAsString()));
11143    if (json.has("_code"))
11144      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
11145    if (json.has("comment"))
11146      res.setCommentElement(parseString(json.get("comment").getAsString()));
11147    if (json.has("_comment"))
11148      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
11149    if (json.has("base"))
11150      res.setBase(parseReference(json.getAsJsonObject("base")));
11151    if (json.has("system"))
11152      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
11153    if (json.has("_system"))
11154      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
11155    if (json.has("type")) {
11156      JsonArray array = json.getAsJsonArray("type");
11157      for (int i = 0; i < array.size(); i++) {
11158        res.getType().add(parseCode(array.get(i).getAsString()));
11159      }
11160    };
11161    if (json.has("_type")) {
11162      JsonArray array = json.getAsJsonArray("_type");
11163      for (int i = 0; i < array.size(); i++) {
11164        if (i == res.getType().size())
11165          res.getType().add(parseCode(null));
11166        if (array.get(i) instanceof JsonObject) 
11167          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
11168      }
11169    };
11170    if (json.has("instance"))
11171      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
11172    if (json.has("_instance"))
11173      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
11174    if (json.has("parameter")) {
11175      JsonArray array = json.getAsJsonArray("parameter");
11176      for (int i = 0; i < array.size(); i++) {
11177        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
11178      }
11179    };
11180    return res;
11181  }
11182
11183  protected OperationDefinition.OperationDefinitionContactComponent parseOperationDefinitionOperationDefinitionContactComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
11184    OperationDefinition.OperationDefinitionContactComponent res = new OperationDefinition.OperationDefinitionContactComponent();
11185    parseBackboneProperties(json, res);
11186    if (json.has("name"))
11187      res.setNameElement(parseString(json.get("name").getAsString()));
11188    if (json.has("_name"))
11189      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11190    if (json.has("telecom")) {
11191      JsonArray array = json.getAsJsonArray("telecom");
11192      for (int i = 0; i < array.size(); i++) {
11193        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11194      }
11195    };
11196    return res;
11197  }
11198
11199  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
11200    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
11201    parseBackboneProperties(json, res);
11202    if (json.has("name"))
11203      res.setNameElement(parseCode(json.get("name").getAsString()));
11204    if (json.has("_name"))
11205      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11206    if (json.has("use"))
11207      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
11208    if (json.has("_use"))
11209      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
11210    if (json.has("min"))
11211      res.setMinElement(parseInteger(json.get("min").getAsLong()));
11212    if (json.has("_min"))
11213      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
11214    if (json.has("max"))
11215      res.setMaxElement(parseString(json.get("max").getAsString()));
11216    if (json.has("_max"))
11217      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
11218    if (json.has("documentation"))
11219      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
11220    if (json.has("_documentation"))
11221      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
11222    if (json.has("type"))
11223      res.setTypeElement(parseCode(json.get("type").getAsString()));
11224    if (json.has("_type"))
11225      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11226    if (json.has("searchType"))
11227      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
11228    if (json.has("_searchType"))
11229      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
11230    if (json.has("profile"))
11231      res.setProfile(parseReference(json.getAsJsonObject("profile")));
11232    if (json.has("binding"))
11233      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
11234    if (json.has("part")) {
11235      JsonArray array = json.getAsJsonArray("part");
11236      for (int i = 0; i < array.size(); i++) {
11237        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
11238      }
11239    };
11240    return res;
11241  }
11242
11243  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
11244    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
11245    parseBackboneProperties(json, res);
11246    if (json.has("strength"))
11247      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
11248    if (json.has("_strength"))
11249      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
11250    Type valueSet = parseType("valueSet", json);
11251    if (valueSet != null)
11252      res.setValueSet(valueSet);
11253    return res;
11254  }
11255
11256  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
11257    OperationOutcome res = new OperationOutcome();
11258    parseDomainResourceProperties(json, res);
11259    if (json.has("issue")) {
11260      JsonArray array = json.getAsJsonArray("issue");
11261      for (int i = 0; i < array.size(); i++) {
11262        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
11263      }
11264    };
11265    return res;
11266  }
11267
11268  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
11269    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
11270    parseBackboneProperties(json, res);
11271    if (json.has("severity"))
11272      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
11273    if (json.has("_severity"))
11274      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
11275    if (json.has("code"))
11276      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
11277    if (json.has("_code"))
11278      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
11279    if (json.has("details"))
11280      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
11281    if (json.has("diagnostics"))
11282      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
11283    if (json.has("_diagnostics"))
11284      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
11285    if (json.has("location")) {
11286      JsonArray array = json.getAsJsonArray("location");
11287      for (int i = 0; i < array.size(); i++) {
11288        res.getLocation().add(parseString(array.get(i).getAsString()));
11289      }
11290    };
11291    if (json.has("_location")) {
11292      JsonArray array = json.getAsJsonArray("_location");
11293      for (int i = 0; i < array.size(); i++) {
11294        if (i == res.getLocation().size())
11295          res.getLocation().add(parseString(null));
11296        if (array.get(i) instanceof JsonObject) 
11297          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
11298      }
11299    };
11300    if (json.has("expression")) {
11301      JsonArray array = json.getAsJsonArray("expression");
11302      for (int i = 0; i < array.size(); i++) {
11303        res.getExpression().add(parseString(array.get(i).getAsString()));
11304      }
11305    };
11306    if (json.has("_expression")) {
11307      JsonArray array = json.getAsJsonArray("_expression");
11308      for (int i = 0; i < array.size(); i++) {
11309        if (i == res.getExpression().size())
11310          res.getExpression().add(parseString(null));
11311        if (array.get(i) instanceof JsonObject) 
11312          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
11313      }
11314    };
11315    return res;
11316  }
11317
11318  protected Order parseOrder(JsonObject json) throws IOException, FHIRFormatError {
11319    Order res = new Order();
11320    parseDomainResourceProperties(json, res);
11321    if (json.has("identifier")) {
11322      JsonArray array = json.getAsJsonArray("identifier");
11323      for (int i = 0; i < array.size(); i++) {
11324        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11325      }
11326    };
11327    if (json.has("date"))
11328      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11329    if (json.has("_date"))
11330      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11331    if (json.has("subject"))
11332      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11333    if (json.has("source"))
11334      res.setSource(parseReference(json.getAsJsonObject("source")));
11335    if (json.has("target"))
11336      res.setTarget(parseReference(json.getAsJsonObject("target")));
11337    Type reason = parseType("reason", json);
11338    if (reason != null)
11339      res.setReason(reason);
11340    if (json.has("when"))
11341      res.setWhen(parseOrderOrderWhenComponent(json.getAsJsonObject("when"), res));
11342    if (json.has("detail")) {
11343      JsonArray array = json.getAsJsonArray("detail");
11344      for (int i = 0; i < array.size(); i++) {
11345        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
11346      }
11347    };
11348    return res;
11349  }
11350
11351  protected Order.OrderWhenComponent parseOrderOrderWhenComponent(JsonObject json, Order owner) throws IOException, FHIRFormatError {
11352    Order.OrderWhenComponent res = new Order.OrderWhenComponent();
11353    parseBackboneProperties(json, res);
11354    if (json.has("code"))
11355      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11356    if (json.has("schedule"))
11357      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
11358    return res;
11359  }
11360
11361  protected OrderResponse parseOrderResponse(JsonObject json) throws IOException, FHIRFormatError {
11362    OrderResponse res = new OrderResponse();
11363    parseDomainResourceProperties(json, res);
11364    if (json.has("identifier")) {
11365      JsonArray array = json.getAsJsonArray("identifier");
11366      for (int i = 0; i < array.size(); i++) {
11367        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11368      }
11369    };
11370    if (json.has("request"))
11371      res.setRequest(parseReference(json.getAsJsonObject("request")));
11372    if (json.has("date"))
11373      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11374    if (json.has("_date"))
11375      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11376    if (json.has("who"))
11377      res.setWho(parseReference(json.getAsJsonObject("who")));
11378    if (json.has("orderStatus"))
11379      res.setOrderStatusElement(parseEnumeration(json.get("orderStatus").getAsString(), OrderResponse.OrderStatus.NULL, new OrderResponse.OrderStatusEnumFactory()));
11380    if (json.has("_orderStatus"))
11381      parseElementProperties(json.getAsJsonObject("_orderStatus"), res.getOrderStatusElement());
11382    if (json.has("description"))
11383      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11384    if (json.has("_description"))
11385      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11386    if (json.has("fulfillment")) {
11387      JsonArray array = json.getAsJsonArray("fulfillment");
11388      for (int i = 0; i < array.size(); i++) {
11389        res.getFulfillment().add(parseReference(array.get(i).getAsJsonObject()));
11390      }
11391    };
11392    return res;
11393  }
11394
11395  protected OrderSet parseOrderSet(JsonObject json) throws IOException, FHIRFormatError {
11396    OrderSet res = new OrderSet();
11397    parseDomainResourceProperties(json, res);
11398    if (json.has("moduleMetadata"))
11399      res.setModuleMetadata(parseModuleMetadata(json.getAsJsonObject("moduleMetadata")));
11400    if (json.has("library")) {
11401      JsonArray array = json.getAsJsonArray("library");
11402      for (int i = 0; i < array.size(); i++) {
11403        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
11404      }
11405    };
11406    if (json.has("action")) {
11407      JsonArray array = json.getAsJsonArray("action");
11408      for (int i = 0; i < array.size(); i++) {
11409        res.getAction().add(parseActionDefinition(array.get(i).getAsJsonObject()));
11410      }
11411    };
11412    return res;
11413  }
11414
11415  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
11416    Organization res = new Organization();
11417    parseDomainResourceProperties(json, res);
11418    if (json.has("identifier")) {
11419      JsonArray array = json.getAsJsonArray("identifier");
11420      for (int i = 0; i < array.size(); i++) {
11421        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11422      }
11423    };
11424    if (json.has("active"))
11425      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11426    if (json.has("_active"))
11427      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11428    if (json.has("type"))
11429      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11430    if (json.has("name"))
11431      res.setNameElement(parseString(json.get("name").getAsString()));
11432    if (json.has("_name"))
11433      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11434    if (json.has("telecom")) {
11435      JsonArray array = json.getAsJsonArray("telecom");
11436      for (int i = 0; i < array.size(); i++) {
11437        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11438      }
11439    };
11440    if (json.has("address")) {
11441      JsonArray array = json.getAsJsonArray("address");
11442      for (int i = 0; i < array.size(); i++) {
11443        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
11444      }
11445    };
11446    if (json.has("partOf"))
11447      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
11448    if (json.has("contact")) {
11449      JsonArray array = json.getAsJsonArray("contact");
11450      for (int i = 0; i < array.size(); i++) {
11451        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
11452      }
11453    };
11454    return res;
11455  }
11456
11457  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
11458    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
11459    parseBackboneProperties(json, res);
11460    if (json.has("purpose"))
11461      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
11462    if (json.has("name"))
11463      res.setName(parseHumanName(json.getAsJsonObject("name")));
11464    if (json.has("telecom")) {
11465      JsonArray array = json.getAsJsonArray("telecom");
11466      for (int i = 0; i < array.size(); i++) {
11467        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11468      }
11469    };
11470    if (json.has("address"))
11471      res.setAddress(parseAddress(json.getAsJsonObject("address")));
11472    return res;
11473  }
11474
11475  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
11476    Patient res = new Patient();
11477    parseDomainResourceProperties(json, res);
11478    if (json.has("identifier")) {
11479      JsonArray array = json.getAsJsonArray("identifier");
11480      for (int i = 0; i < array.size(); i++) {
11481        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11482      }
11483    };
11484    if (json.has("active"))
11485      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11486    if (json.has("_active"))
11487      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11488    if (json.has("name")) {
11489      JsonArray array = json.getAsJsonArray("name");
11490      for (int i = 0; i < array.size(); i++) {
11491        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
11492      }
11493    };
11494    if (json.has("telecom")) {
11495      JsonArray array = json.getAsJsonArray("telecom");
11496      for (int i = 0; i < array.size(); i++) {
11497        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11498      }
11499    };
11500    if (json.has("gender"))
11501      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
11502    if (json.has("_gender"))
11503      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
11504    if (json.has("birthDate"))
11505      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
11506    if (json.has("_birthDate"))
11507      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
11508    Type deceased = parseType("deceased", json);
11509    if (deceased != null)
11510      res.setDeceased(deceased);
11511    if (json.has("address")) {
11512      JsonArray array = json.getAsJsonArray("address");
11513      for (int i = 0; i < array.size(); i++) {
11514        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
11515      }
11516    };
11517    if (json.has("maritalStatus"))
11518      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
11519    Type multipleBirth = parseType("multipleBirth", json);
11520    if (multipleBirth != null)
11521      res.setMultipleBirth(multipleBirth);
11522    if (json.has("photo")) {
11523      JsonArray array = json.getAsJsonArray("photo");
11524      for (int i = 0; i < array.size(); i++) {
11525        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
11526      }
11527    };
11528    if (json.has("contact")) {
11529      JsonArray array = json.getAsJsonArray("contact");
11530      for (int i = 0; i < array.size(); i++) {
11531        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
11532      }
11533    };
11534    if (json.has("animal"))
11535      res.setAnimal(parsePatientAnimalComponent(json.getAsJsonObject("animal"), res));
11536    if (json.has("communication")) {
11537      JsonArray array = json.getAsJsonArray("communication");
11538      for (int i = 0; i < array.size(); i++) {
11539        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
11540      }
11541    };
11542    if (json.has("careProvider")) {
11543      JsonArray array = json.getAsJsonArray("careProvider");
11544      for (int i = 0; i < array.size(); i++) {
11545        res.getCareProvider().add(parseReference(array.get(i).getAsJsonObject()));
11546      }
11547    };
11548    if (json.has("managingOrganization"))
11549      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11550    if (json.has("link")) {
11551      JsonArray array = json.getAsJsonArray("link");
11552      for (int i = 0; i < array.size(); i++) {
11553        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
11554      }
11555    };
11556    return res;
11557  }
11558
11559  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
11560    Patient.ContactComponent res = new Patient.ContactComponent();
11561    parseBackboneProperties(json, res);
11562    if (json.has("relationship")) {
11563      JsonArray array = json.getAsJsonArray("relationship");
11564      for (int i = 0; i < array.size(); i++) {
11565        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11566      }
11567    };
11568    if (json.has("name"))
11569      res.setName(parseHumanName(json.getAsJsonObject("name")));
11570    if (json.has("telecom")) {
11571      JsonArray array = json.getAsJsonArray("telecom");
11572      for (int i = 0; i < array.size(); i++) {
11573        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11574      }
11575    };
11576    if (json.has("address"))
11577      res.setAddress(parseAddress(json.getAsJsonObject("address")));
11578    if (json.has("gender"))
11579      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
11580    if (json.has("_gender"))
11581      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
11582    if (json.has("organization"))
11583      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
11584    if (json.has("period"))
11585      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11586    return res;
11587  }
11588
11589  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
11590    Patient.AnimalComponent res = new Patient.AnimalComponent();
11591    parseBackboneProperties(json, res);
11592    if (json.has("species"))
11593      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
11594    if (json.has("breed"))
11595      res.setBreed(parseCodeableConcept(json.getAsJsonObject("breed")));
11596    if (json.has("genderStatus"))
11597      res.setGenderStatus(parseCodeableConcept(json.getAsJsonObject("genderStatus")));
11598    return res;
11599  }
11600
11601  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
11602    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
11603    parseBackboneProperties(json, res);
11604    if (json.has("language"))
11605      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
11606    if (json.has("preferred"))
11607      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
11608    if (json.has("_preferred"))
11609      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
11610    return res;
11611  }
11612
11613  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
11614    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
11615    parseBackboneProperties(json, res);
11616    if (json.has("other"))
11617      res.setOther(parseReference(json.getAsJsonObject("other")));
11618    if (json.has("type"))
11619      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
11620    if (json.has("_type"))
11621      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11622    return res;
11623  }
11624
11625  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
11626    PaymentNotice res = new PaymentNotice();
11627    parseDomainResourceProperties(json, res);
11628    if (json.has("identifier")) {
11629      JsonArray array = json.getAsJsonArray("identifier");
11630      for (int i = 0; i < array.size(); i++) {
11631        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11632      }
11633    };
11634    if (json.has("ruleset"))
11635      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
11636    if (json.has("originalRuleset"))
11637      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
11638    if (json.has("created"))
11639      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11640    if (json.has("_created"))
11641      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11642    Type target = parseType("target", json);
11643    if (target != null)
11644      res.setTarget(target);
11645    Type provider = parseType("provider", json);
11646    if (provider != null)
11647      res.setProvider(provider);
11648    Type organization = parseType("organization", json);
11649    if (organization != null)
11650      res.setOrganization(organization);
11651    Type request = parseType("request", json);
11652    if (request != null)
11653      res.setRequest(request);
11654    Type response = parseType("response", json);
11655    if (response != null)
11656      res.setResponse(response);
11657    if (json.has("paymentStatus"))
11658      res.setPaymentStatus(parseCoding(json.getAsJsonObject("paymentStatus")));
11659    if (json.has("statusDate"))
11660      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
11661    if (json.has("_statusDate"))
11662      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
11663    return res;
11664  }
11665
11666  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
11667    PaymentReconciliation res = new PaymentReconciliation();
11668    parseDomainResourceProperties(json, res);
11669    if (json.has("identifier")) {
11670      JsonArray array = json.getAsJsonArray("identifier");
11671      for (int i = 0; i < array.size(); i++) {
11672        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11673      }
11674    };
11675    Type request = parseType("request", json);
11676    if (request != null)
11677      res.setRequest(request);
11678    if (json.has("outcome"))
11679      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
11680    if (json.has("_outcome"))
11681      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
11682    if (json.has("disposition"))
11683      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11684    if (json.has("_disposition"))
11685      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
11686    if (json.has("ruleset"))
11687      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
11688    if (json.has("originalRuleset"))
11689      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
11690    if (json.has("created"))
11691      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11692    if (json.has("_created"))
11693      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11694    if (json.has("period"))
11695      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11696    Type organization = parseType("organization", json);
11697    if (organization != null)
11698      res.setOrganization(organization);
11699    Type requestProvider = parseType("requestProvider", json);
11700    if (requestProvider != null)
11701      res.setRequestProvider(requestProvider);
11702    Type requestOrganization = parseType("requestOrganization", json);
11703    if (requestOrganization != null)
11704      res.setRequestOrganization(requestOrganization);
11705    if (json.has("detail")) {
11706      JsonArray array = json.getAsJsonArray("detail");
11707      for (int i = 0; i < array.size(); i++) {
11708        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
11709      }
11710    };
11711    if (json.has("form"))
11712      res.setForm(parseCoding(json.getAsJsonObject("form")));
11713    if (json.has("total"))
11714      res.setTotal(parseMoney(json.getAsJsonObject("total")));
11715    if (json.has("note")) {
11716      JsonArray array = json.getAsJsonArray("note");
11717      for (int i = 0; i < array.size(); i++) {
11718        res.getNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
11719      }
11720    };
11721    return res;
11722  }
11723
11724  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
11725    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
11726    parseBackboneProperties(json, res);
11727    if (json.has("type"))
11728      res.setType(parseCoding(json.getAsJsonObject("type")));
11729    Type request = parseType("request", json);
11730    if (request != null)
11731      res.setRequest(request);
11732    Type responce = parseType("responce", json);
11733    if (responce != null)
11734      res.setResponce(responce);
11735    Type submitter = parseType("submitter", json);
11736    if (submitter != null)
11737      res.setSubmitter(submitter);
11738    Type payee = parseType("payee", json);
11739    if (payee != null)
11740      res.setPayee(payee);
11741    if (json.has("date"))
11742      res.setDateElement(parseDate(json.get("date").getAsString()));
11743    if (json.has("_date"))
11744      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11745    if (json.has("amount"))
11746      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
11747    return res;
11748  }
11749
11750  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
11751    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
11752    parseBackboneProperties(json, res);
11753    if (json.has("type"))
11754      res.setType(parseCoding(json.getAsJsonObject("type")));
11755    if (json.has("text"))
11756      res.setTextElement(parseString(json.get("text").getAsString()));
11757    if (json.has("_text"))
11758      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
11759    return res;
11760  }
11761
11762  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
11763    Person res = new Person();
11764    parseDomainResourceProperties(json, res);
11765    if (json.has("identifier")) {
11766      JsonArray array = json.getAsJsonArray("identifier");
11767      for (int i = 0; i < array.size(); i++) {
11768        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11769      }
11770    };
11771    if (json.has("name")) {
11772      JsonArray array = json.getAsJsonArray("name");
11773      for (int i = 0; i < array.size(); i++) {
11774        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
11775      }
11776    };
11777    if (json.has("telecom")) {
11778      JsonArray array = json.getAsJsonArray("telecom");
11779      for (int i = 0; i < array.size(); i++) {
11780        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11781      }
11782    };
11783    if (json.has("gender"))
11784      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
11785    if (json.has("_gender"))
11786      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
11787    if (json.has("birthDate"))
11788      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
11789    if (json.has("_birthDate"))
11790      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
11791    if (json.has("address")) {
11792      JsonArray array = json.getAsJsonArray("address");
11793      for (int i = 0; i < array.size(); i++) {
11794        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
11795      }
11796    };
11797    if (json.has("photo"))
11798      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
11799    if (json.has("managingOrganization"))
11800      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11801    if (json.has("active"))
11802      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11803    if (json.has("_active"))
11804      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11805    if (json.has("link")) {
11806      JsonArray array = json.getAsJsonArray("link");
11807      for (int i = 0; i < array.size(); i++) {
11808        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
11809      }
11810    };
11811    return res;
11812  }
11813
11814  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
11815    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
11816    parseBackboneProperties(json, res);
11817    if (json.has("target"))
11818      res.setTarget(parseReference(json.getAsJsonObject("target")));
11819    if (json.has("assurance"))
11820      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
11821    if (json.has("_assurance"))
11822      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
11823    return res;
11824  }
11825
11826  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
11827    Practitioner res = new Practitioner();
11828    parseDomainResourceProperties(json, res);
11829    if (json.has("identifier")) {
11830      JsonArray array = json.getAsJsonArray("identifier");
11831      for (int i = 0; i < array.size(); i++) {
11832        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11833      }
11834    };
11835    if (json.has("active"))
11836      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11837    if (json.has("_active"))
11838      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11839    if (json.has("name")) {
11840      JsonArray array = json.getAsJsonArray("name");
11841      for (int i = 0; i < array.size(); i++) {
11842        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
11843      }
11844    };
11845    if (json.has("telecom")) {
11846      JsonArray array = json.getAsJsonArray("telecom");
11847      for (int i = 0; i < array.size(); i++) {
11848        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11849      }
11850    };
11851    if (json.has("address")) {
11852      JsonArray array = json.getAsJsonArray("address");
11853      for (int i = 0; i < array.size(); i++) {
11854        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
11855      }
11856    };
11857    if (json.has("gender"))
11858      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
11859    if (json.has("_gender"))
11860      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
11861    if (json.has("birthDate"))
11862      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
11863    if (json.has("_birthDate"))
11864      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
11865    if (json.has("photo")) {
11866      JsonArray array = json.getAsJsonArray("photo");
11867      for (int i = 0; i < array.size(); i++) {
11868        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
11869      }
11870    };
11871    if (json.has("practitionerRole")) {
11872      JsonArray array = json.getAsJsonArray("practitionerRole");
11873      for (int i = 0; i < array.size(); i++) {
11874        res.getPractitionerRole().add(parsePractitionerPractitionerPractitionerRoleComponent(array.get(i).getAsJsonObject(), res));
11875      }
11876    };
11877    if (json.has("qualification")) {
11878      JsonArray array = json.getAsJsonArray("qualification");
11879      for (int i = 0; i < array.size(); i++) {
11880        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
11881      }
11882    };
11883    if (json.has("communication")) {
11884      JsonArray array = json.getAsJsonArray("communication");
11885      for (int i = 0; i < array.size(); i++) {
11886        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11887      }
11888    };
11889    return res;
11890  }
11891
11892  protected Practitioner.PractitionerPractitionerRoleComponent parsePractitionerPractitionerPractitionerRoleComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
11893    Practitioner.PractitionerPractitionerRoleComponent res = new Practitioner.PractitionerPractitionerRoleComponent();
11894    parseBackboneProperties(json, res);
11895    if (json.has("organization"))
11896      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
11897    if (json.has("role"))
11898      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11899    if (json.has("specialty")) {
11900      JsonArray array = json.getAsJsonArray("specialty");
11901      for (int i = 0; i < array.size(); i++) {
11902        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11903      }
11904    };
11905    if (json.has("identifier")) {
11906      JsonArray array = json.getAsJsonArray("identifier");
11907      for (int i = 0; i < array.size(); i++) {
11908        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11909      }
11910    };
11911    if (json.has("telecom")) {
11912      JsonArray array = json.getAsJsonArray("telecom");
11913      for (int i = 0; i < array.size(); i++) {
11914        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11915      }
11916    };
11917    if (json.has("period"))
11918      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11919    if (json.has("location")) {
11920      JsonArray array = json.getAsJsonArray("location");
11921      for (int i = 0; i < array.size(); i++) {
11922        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
11923      }
11924    };
11925    if (json.has("healthcareService")) {
11926      JsonArray array = json.getAsJsonArray("healthcareService");
11927      for (int i = 0; i < array.size(); i++) {
11928        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
11929      }
11930    };
11931    return res;
11932  }
11933
11934  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
11935    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
11936    parseBackboneProperties(json, res);
11937    if (json.has("identifier")) {
11938      JsonArray array = json.getAsJsonArray("identifier");
11939      for (int i = 0; i < array.size(); i++) {
11940        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11941      }
11942    };
11943    if (json.has("code"))
11944      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11945    if (json.has("period"))
11946      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11947    if (json.has("issuer"))
11948      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
11949    return res;
11950  }
11951
11952  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
11953    PractitionerRole res = new PractitionerRole();
11954    parseDomainResourceProperties(json, res);
11955    if (json.has("identifier")) {
11956      JsonArray array = json.getAsJsonArray("identifier");
11957      for (int i = 0; i < array.size(); i++) {
11958        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11959      }
11960    };
11961    if (json.has("active"))
11962      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11963    if (json.has("_active"))
11964      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11965    if (json.has("practitioner"))
11966      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
11967    if (json.has("organization"))
11968      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
11969    if (json.has("role")) {
11970      JsonArray array = json.getAsJsonArray("role");
11971      for (int i = 0; i < array.size(); i++) {
11972        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11973      }
11974    };
11975    if (json.has("specialty")) {
11976      JsonArray array = json.getAsJsonArray("specialty");
11977      for (int i = 0; i < array.size(); i++) {
11978        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11979      }
11980    };
11981    if (json.has("location")) {
11982      JsonArray array = json.getAsJsonArray("location");
11983      for (int i = 0; i < array.size(); i++) {
11984        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
11985      }
11986    };
11987    if (json.has("healthcareService")) {
11988      JsonArray array = json.getAsJsonArray("healthcareService");
11989      for (int i = 0; i < array.size(); i++) {
11990        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
11991      }
11992    };
11993    if (json.has("telecom")) {
11994      JsonArray array = json.getAsJsonArray("telecom");
11995      for (int i = 0; i < array.size(); i++) {
11996        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11997      }
11998    };
11999    if (json.has("period"))
12000      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12001    if (json.has("availableTime")) {
12002      JsonArray array = json.getAsJsonArray("availableTime");
12003      for (int i = 0; i < array.size(); i++) {
12004        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
12005      }
12006    };
12007    if (json.has("notAvailable")) {
12008      JsonArray array = json.getAsJsonArray("notAvailable");
12009      for (int i = 0; i < array.size(); i++) {
12010        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
12011      }
12012    };
12013    if (json.has("availabilityExceptions"))
12014      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
12015    if (json.has("_availabilityExceptions"))
12016      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
12017    return res;
12018  }
12019
12020  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
12021    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
12022    parseBackboneProperties(json, res);
12023    if (json.has("daysOfWeek")) {
12024      JsonArray array = json.getAsJsonArray("daysOfWeek");
12025      for (int i = 0; i < array.size(); i++) {
12026        res.getDaysOfWeek().add(parseCode(array.get(i).getAsString()));
12027      }
12028    };
12029    if (json.has("_daysOfWeek")) {
12030      JsonArray array = json.getAsJsonArray("_daysOfWeek");
12031      for (int i = 0; i < array.size(); i++) {
12032        if (i == res.getDaysOfWeek().size())
12033          res.getDaysOfWeek().add(parseCode(null));
12034        if (array.get(i) instanceof JsonObject) 
12035          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
12036      }
12037    };
12038    if (json.has("allDay"))
12039      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
12040    if (json.has("_allDay"))
12041      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
12042    if (json.has("availableStartTime"))
12043      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
12044    if (json.has("_availableStartTime"))
12045      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
12046    if (json.has("availableEndTime"))
12047      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
12048    if (json.has("_availableEndTime"))
12049      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
12050    return res;
12051  }
12052
12053  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
12054    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
12055    parseBackboneProperties(json, res);
12056    if (json.has("description"))
12057      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12058    if (json.has("_description"))
12059      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12060    if (json.has("during"))
12061      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
12062    return res;
12063  }
12064
12065  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
12066    Procedure res = new Procedure();
12067    parseDomainResourceProperties(json, res);
12068    if (json.has("identifier")) {
12069      JsonArray array = json.getAsJsonArray("identifier");
12070      for (int i = 0; i < array.size(); i++) {
12071        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12072      }
12073    };
12074    if (json.has("subject"))
12075      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12076    if (json.has("status"))
12077      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
12078    if (json.has("_status"))
12079      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12080    if (json.has("category"))
12081      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12082    if (json.has("code"))
12083      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12084    if (json.has("notPerformed"))
12085      res.setNotPerformedElement(parseBoolean(json.get("notPerformed").getAsBoolean()));
12086    if (json.has("_notPerformed"))
12087      parseElementProperties(json.getAsJsonObject("_notPerformed"), res.getNotPerformedElement());
12088    if (json.has("reasonNotPerformed")) {
12089      JsonArray array = json.getAsJsonArray("reasonNotPerformed");
12090      for (int i = 0; i < array.size(); i++) {
12091        res.getReasonNotPerformed().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12092      }
12093    };
12094    if (json.has("bodySite")) {
12095      JsonArray array = json.getAsJsonArray("bodySite");
12096      for (int i = 0; i < array.size(); i++) {
12097        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12098      }
12099    };
12100    Type reason = parseType("reason", json);
12101    if (reason != null)
12102      res.setReason(reason);
12103    if (json.has("performer")) {
12104      JsonArray array = json.getAsJsonArray("performer");
12105      for (int i = 0; i < array.size(); i++) {
12106        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
12107      }
12108    };
12109    Type performed = parseType("performed", json);
12110    if (performed != null)
12111      res.setPerformed(performed);
12112    if (json.has("encounter"))
12113      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12114    if (json.has("location"))
12115      res.setLocation(parseReference(json.getAsJsonObject("location")));
12116    if (json.has("outcome"))
12117      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
12118    if (json.has("report")) {
12119      JsonArray array = json.getAsJsonArray("report");
12120      for (int i = 0; i < array.size(); i++) {
12121        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
12122      }
12123    };
12124    if (json.has("complication")) {
12125      JsonArray array = json.getAsJsonArray("complication");
12126      for (int i = 0; i < array.size(); i++) {
12127        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12128      }
12129    };
12130    if (json.has("followUp")) {
12131      JsonArray array = json.getAsJsonArray("followUp");
12132      for (int i = 0; i < array.size(); i++) {
12133        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12134      }
12135    };
12136    if (json.has("request"))
12137      res.setRequest(parseReference(json.getAsJsonObject("request")));
12138    if (json.has("notes")) {
12139      JsonArray array = json.getAsJsonArray("notes");
12140      for (int i = 0; i < array.size(); i++) {
12141        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
12142      }
12143    };
12144    if (json.has("focalDevice")) {
12145      JsonArray array = json.getAsJsonArray("focalDevice");
12146      for (int i = 0; i < array.size(); i++) {
12147        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
12148      }
12149    };
12150    if (json.has("used")) {
12151      JsonArray array = json.getAsJsonArray("used");
12152      for (int i = 0; i < array.size(); i++) {
12153        res.getUsed().add(parseReference(array.get(i).getAsJsonObject()));
12154      }
12155    };
12156    return res;
12157  }
12158
12159  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
12160    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
12161    parseBackboneProperties(json, res);
12162    if (json.has("actor"))
12163      res.setActor(parseReference(json.getAsJsonObject("actor")));
12164    if (json.has("role"))
12165      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
12166    return res;
12167  }
12168
12169  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
12170    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
12171    parseBackboneProperties(json, res);
12172    if (json.has("action"))
12173      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
12174    if (json.has("manipulated"))
12175      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
12176    return res;
12177  }
12178
12179  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
12180    ProcedureRequest res = new ProcedureRequest();
12181    parseDomainResourceProperties(json, res);
12182    if (json.has("identifier")) {
12183      JsonArray array = json.getAsJsonArray("identifier");
12184      for (int i = 0; i < array.size(); i++) {
12185        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12186      }
12187    };
12188    if (json.has("subject"))
12189      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12190    if (json.has("code"))
12191      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12192    if (json.has("bodySite")) {
12193      JsonArray array = json.getAsJsonArray("bodySite");
12194      for (int i = 0; i < array.size(); i++) {
12195        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12196      }
12197    };
12198    Type reason = parseType("reason", json);
12199    if (reason != null)
12200      res.setReason(reason);
12201    Type scheduled = parseType("scheduled", json);
12202    if (scheduled != null)
12203      res.setScheduled(scheduled);
12204    if (json.has("encounter"))
12205      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12206    if (json.has("performer"))
12207      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
12208    if (json.has("status"))
12209      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
12210    if (json.has("_status"))
12211      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12212    if (json.has("notes")) {
12213      JsonArray array = json.getAsJsonArray("notes");
12214      for (int i = 0; i < array.size(); i++) {
12215        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
12216      }
12217    };
12218    Type asNeeded = parseType("asNeeded", json);
12219    if (asNeeded != null)
12220      res.setAsNeeded(asNeeded);
12221    if (json.has("orderedOn"))
12222      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
12223    if (json.has("_orderedOn"))
12224      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
12225    if (json.has("orderer"))
12226      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
12227    if (json.has("priority"))
12228      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
12229    if (json.has("_priority"))
12230      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
12231    return res;
12232  }
12233
12234  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
12235    ProcessRequest res = new ProcessRequest();
12236    parseDomainResourceProperties(json, res);
12237    if (json.has("action"))
12238      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
12239    if (json.has("_action"))
12240      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
12241    if (json.has("identifier")) {
12242      JsonArray array = json.getAsJsonArray("identifier");
12243      for (int i = 0; i < array.size(); i++) {
12244        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12245      }
12246    };
12247    if (json.has("ruleset"))
12248      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
12249    if (json.has("originalRuleset"))
12250      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
12251    if (json.has("created"))
12252      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12253    if (json.has("_created"))
12254      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
12255    Type target = parseType("target", json);
12256    if (target != null)
12257      res.setTarget(target);
12258    Type provider = parseType("provider", json);
12259    if (provider != null)
12260      res.setProvider(provider);
12261    Type organization = parseType("organization", json);
12262    if (organization != null)
12263      res.setOrganization(organization);
12264    Type request = parseType("request", json);
12265    if (request != null)
12266      res.setRequest(request);
12267    Type response = parseType("response", json);
12268    if (response != null)
12269      res.setResponse(response);
12270    if (json.has("nullify"))
12271      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
12272    if (json.has("_nullify"))
12273      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
12274    if (json.has("reference"))
12275      res.setReferenceElement(parseString(json.get("reference").getAsString()));
12276    if (json.has("_reference"))
12277      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
12278    if (json.has("item")) {
12279      JsonArray array = json.getAsJsonArray("item");
12280      for (int i = 0; i < array.size(); i++) {
12281        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
12282      }
12283    };
12284    if (json.has("include")) {
12285      JsonArray array = json.getAsJsonArray("include");
12286      for (int i = 0; i < array.size(); i++) {
12287        res.getInclude().add(parseString(array.get(i).getAsString()));
12288      }
12289    };
12290    if (json.has("_include")) {
12291      JsonArray array = json.getAsJsonArray("_include");
12292      for (int i = 0; i < array.size(); i++) {
12293        if (i == res.getInclude().size())
12294          res.getInclude().add(parseString(null));
12295        if (array.get(i) instanceof JsonObject) 
12296          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
12297      }
12298    };
12299    if (json.has("exclude")) {
12300      JsonArray array = json.getAsJsonArray("exclude");
12301      for (int i = 0; i < array.size(); i++) {
12302        res.getExclude().add(parseString(array.get(i).getAsString()));
12303      }
12304    };
12305    if (json.has("_exclude")) {
12306      JsonArray array = json.getAsJsonArray("_exclude");
12307      for (int i = 0; i < array.size(); i++) {
12308        if (i == res.getExclude().size())
12309          res.getExclude().add(parseString(null));
12310        if (array.get(i) instanceof JsonObject) 
12311          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
12312      }
12313    };
12314    if (json.has("period"))
12315      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12316    return res;
12317  }
12318
12319  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
12320    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
12321    parseBackboneProperties(json, res);
12322    if (json.has("sequenceLinkId"))
12323      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
12324    if (json.has("_sequenceLinkId"))
12325      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
12326    return res;
12327  }
12328
12329  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
12330    ProcessResponse res = new ProcessResponse();
12331    parseDomainResourceProperties(json, res);
12332    if (json.has("identifier")) {
12333      JsonArray array = json.getAsJsonArray("identifier");
12334      for (int i = 0; i < array.size(); i++) {
12335        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12336      }
12337    };
12338    Type request = parseType("request", json);
12339    if (request != null)
12340      res.setRequest(request);
12341    if (json.has("outcome"))
12342      res.setOutcome(parseCoding(json.getAsJsonObject("outcome")));
12343    if (json.has("disposition"))
12344      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
12345    if (json.has("_disposition"))
12346      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
12347    if (json.has("ruleset"))
12348      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
12349    if (json.has("originalRuleset"))
12350      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
12351    if (json.has("created"))
12352      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12353    if (json.has("_created"))
12354      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
12355    Type organization = parseType("organization", json);
12356    if (organization != null)
12357      res.setOrganization(organization);
12358    Type requestProvider = parseType("requestProvider", json);
12359    if (requestProvider != null)
12360      res.setRequestProvider(requestProvider);
12361    Type requestOrganization = parseType("requestOrganization", json);
12362    if (requestOrganization != null)
12363      res.setRequestOrganization(requestOrganization);
12364    if (json.has("form"))
12365      res.setForm(parseCoding(json.getAsJsonObject("form")));
12366    if (json.has("notes")) {
12367      JsonArray array = json.getAsJsonArray("notes");
12368      for (int i = 0; i < array.size(); i++) {
12369        res.getNotes().add(parseProcessResponseProcessResponseNotesComponent(array.get(i).getAsJsonObject(), res));
12370      }
12371    };
12372    if (json.has("error")) {
12373      JsonArray array = json.getAsJsonArray("error");
12374      for (int i = 0; i < array.size(); i++) {
12375        res.getError().add(parseCoding(array.get(i).getAsJsonObject()));
12376      }
12377    };
12378    return res;
12379  }
12380
12381  protected ProcessResponse.ProcessResponseNotesComponent parseProcessResponseProcessResponseNotesComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
12382    ProcessResponse.ProcessResponseNotesComponent res = new ProcessResponse.ProcessResponseNotesComponent();
12383    parseBackboneProperties(json, res);
12384    if (json.has("type"))
12385      res.setType(parseCoding(json.getAsJsonObject("type")));
12386    if (json.has("text"))
12387      res.setTextElement(parseString(json.get("text").getAsString()));
12388    if (json.has("_text"))
12389      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12390    return res;
12391  }
12392
12393  protected Protocol parseProtocol(JsonObject json) throws IOException, FHIRFormatError {
12394    Protocol res = new Protocol();
12395    parseDomainResourceProperties(json, res);
12396    if (json.has("identifier")) {
12397      JsonArray array = json.getAsJsonArray("identifier");
12398      for (int i = 0; i < array.size(); i++) {
12399        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12400      }
12401    };
12402    if (json.has("title"))
12403      res.setTitleElement(parseString(json.get("title").getAsString()));
12404    if (json.has("_title"))
12405      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12406    if (json.has("status"))
12407      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Protocol.ProtocolStatus.NULL, new Protocol.ProtocolStatusEnumFactory()));
12408    if (json.has("_status"))
12409      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12410    if (json.has("type"))
12411      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Protocol.ProtocolType.NULL, new Protocol.ProtocolTypeEnumFactory()));
12412    if (json.has("_type"))
12413      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12414    if (json.has("subject"))
12415      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12416    if (json.has("group"))
12417      res.setGroup(parseReference(json.getAsJsonObject("group")));
12418    if (json.has("purpose"))
12419      res.setPurposeElement(parseString(json.get("purpose").getAsString()));
12420    if (json.has("_purpose"))
12421      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12422    if (json.has("author"))
12423      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12424    if (json.has("step")) {
12425      JsonArray array = json.getAsJsonArray("step");
12426      for (int i = 0; i < array.size(); i++) {
12427        res.getStep().add(parseProtocolProtocolStepComponent(array.get(i).getAsJsonObject(), res));
12428      }
12429    };
12430    return res;
12431  }
12432
12433  protected Protocol.ProtocolStepComponent parseProtocolProtocolStepComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12434    Protocol.ProtocolStepComponent res = new Protocol.ProtocolStepComponent();
12435    parseBackboneProperties(json, res);
12436    if (json.has("name"))
12437      res.setNameElement(parseString(json.get("name").getAsString()));
12438    if (json.has("_name"))
12439      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12440    if (json.has("description"))
12441      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12442    if (json.has("_description"))
12443      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12444    if (json.has("duration"))
12445      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
12446    if (json.has("precondition"))
12447      res.setPrecondition(parseProtocolProtocolStepPreconditionComponent(json.getAsJsonObject("precondition"), owner));
12448    if (json.has("exit"))
12449      res.setExit(parseProtocolProtocolStepPreconditionComponent(json.getAsJsonObject("exit"), owner));
12450    if (json.has("firstActivity"))
12451      res.setFirstActivityElement(parseUri(json.get("firstActivity").getAsString()));
12452    if (json.has("_firstActivity"))
12453      parseElementProperties(json.getAsJsonObject("_firstActivity"), res.getFirstActivityElement());
12454    if (json.has("activity")) {
12455      JsonArray array = json.getAsJsonArray("activity");
12456      for (int i = 0; i < array.size(); i++) {
12457        res.getActivity().add(parseProtocolProtocolStepActivityComponent(array.get(i).getAsJsonObject(), owner));
12458      }
12459    };
12460    if (json.has("next")) {
12461      JsonArray array = json.getAsJsonArray("next");
12462      for (int i = 0; i < array.size(); i++) {
12463        res.getNext().add(parseProtocolProtocolStepNextComponent(array.get(i).getAsJsonObject(), owner));
12464      }
12465    };
12466    return res;
12467  }
12468
12469  protected Protocol.ProtocolStepPreconditionComponent parseProtocolProtocolStepPreconditionComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12470    Protocol.ProtocolStepPreconditionComponent res = new Protocol.ProtocolStepPreconditionComponent();
12471    parseBackboneProperties(json, res);
12472    if (json.has("description"))
12473      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12474    if (json.has("_description"))
12475      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12476    if (json.has("condition"))
12477      res.setCondition(parseProtocolProtocolStepPreconditionConditionComponent(json.getAsJsonObject("condition"), owner));
12478    if (json.has("intersection")) {
12479      JsonArray array = json.getAsJsonArray("intersection");
12480      for (int i = 0; i < array.size(); i++) {
12481        res.getIntersection().add(parseProtocolProtocolStepPreconditionComponent(array.get(i).getAsJsonObject(), owner));
12482      }
12483    };
12484    if (json.has("union")) {
12485      JsonArray array = json.getAsJsonArray("union");
12486      for (int i = 0; i < array.size(); i++) {
12487        res.getUnion().add(parseProtocolProtocolStepPreconditionComponent(array.get(i).getAsJsonObject(), owner));
12488      }
12489    };
12490    if (json.has("exclude")) {
12491      JsonArray array = json.getAsJsonArray("exclude");
12492      for (int i = 0; i < array.size(); i++) {
12493        res.getExclude().add(parseProtocolProtocolStepPreconditionComponent(array.get(i).getAsJsonObject(), owner));
12494      }
12495    };
12496    return res;
12497  }
12498
12499  protected Protocol.ProtocolStepPreconditionConditionComponent parseProtocolProtocolStepPreconditionConditionComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12500    Protocol.ProtocolStepPreconditionConditionComponent res = new Protocol.ProtocolStepPreconditionConditionComponent();
12501    parseBackboneProperties(json, res);
12502    if (json.has("type"))
12503      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12504    Type value = parseType("value", json);
12505    if (value != null)
12506      res.setValue(value);
12507    return res;
12508  }
12509
12510  protected Protocol.ProtocolStepActivityComponent parseProtocolProtocolStepActivityComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12511    Protocol.ProtocolStepActivityComponent res = new Protocol.ProtocolStepActivityComponent();
12512    parseBackboneProperties(json, res);
12513    if (json.has("alternative")) {
12514      JsonArray array = json.getAsJsonArray("alternative");
12515      for (int i = 0; i < array.size(); i++) {
12516        res.getAlternative().add(parseUri(array.get(i).getAsString()));
12517      }
12518    };
12519    if (json.has("_alternative")) {
12520      JsonArray array = json.getAsJsonArray("_alternative");
12521      for (int i = 0; i < array.size(); i++) {
12522        if (i == res.getAlternative().size())
12523          res.getAlternative().add(parseUri(null));
12524        if (array.get(i) instanceof JsonObject) 
12525          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlternative().get(i));
12526      }
12527    };
12528    if (json.has("component")) {
12529      JsonArray array = json.getAsJsonArray("component");
12530      for (int i = 0; i < array.size(); i++) {
12531        res.getComponent().add(parseProtocolProtocolStepActivityComponentComponent(array.get(i).getAsJsonObject(), owner));
12532      }
12533    };
12534    if (json.has("following")) {
12535      JsonArray array = json.getAsJsonArray("following");
12536      for (int i = 0; i < array.size(); i++) {
12537        res.getFollowing().add(parseUri(array.get(i).getAsString()));
12538      }
12539    };
12540    if (json.has("_following")) {
12541      JsonArray array = json.getAsJsonArray("_following");
12542      for (int i = 0; i < array.size(); i++) {
12543        if (i == res.getFollowing().size())
12544          res.getFollowing().add(parseUri(null));
12545        if (array.get(i) instanceof JsonObject) 
12546          parseElementProperties(array.get(i).getAsJsonObject(), res.getFollowing().get(i));
12547      }
12548    };
12549    if (json.has("wait"))
12550      res.setWait(parseDuration(json.getAsJsonObject("wait")));
12551    if (json.has("detail"))
12552      res.setDetail(parseProtocolProtocolStepActivityDetailComponent(json.getAsJsonObject("detail"), owner));
12553    return res;
12554  }
12555
12556  protected Protocol.ProtocolStepActivityComponentComponent parseProtocolProtocolStepActivityComponentComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12557    Protocol.ProtocolStepActivityComponentComponent res = new Protocol.ProtocolStepActivityComponentComponent();
12558    parseBackboneProperties(json, res);
12559    if (json.has("sequence"))
12560      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
12561    if (json.has("_sequence"))
12562      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12563    if (json.has("activity"))
12564      res.setActivityElement(parseUri(json.get("activity").getAsString()));
12565    if (json.has("_activity"))
12566      parseElementProperties(json.getAsJsonObject("_activity"), res.getActivityElement());
12567    return res;
12568  }
12569
12570  protected Protocol.ProtocolStepActivityDetailComponent parseProtocolProtocolStepActivityDetailComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12571    Protocol.ProtocolStepActivityDetailComponent res = new Protocol.ProtocolStepActivityDetailComponent();
12572    parseBackboneProperties(json, res);
12573    if (json.has("category"))
12574      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), Protocol.ActivityDefinitionCategory.NULL, new Protocol.ActivityDefinitionCategoryEnumFactory()));
12575    if (json.has("_category"))
12576      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
12577    if (json.has("code"))
12578      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12579    Type timing = parseType("timing", json);
12580    if (timing != null)
12581      res.setTiming(timing);
12582    if (json.has("location"))
12583      res.setLocation(parseReference(json.getAsJsonObject("location")));
12584    if (json.has("performer")) {
12585      JsonArray array = json.getAsJsonArray("performer");
12586      for (int i = 0; i < array.size(); i++) {
12587        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
12588      }
12589    };
12590    if (json.has("product"))
12591      res.setProduct(parseReference(json.getAsJsonObject("product")));
12592    if (json.has("quantity"))
12593      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
12594    if (json.has("description"))
12595      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12596    if (json.has("_description"))
12597      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12598    return res;
12599  }
12600
12601  protected Protocol.ProtocolStepNextComponent parseProtocolProtocolStepNextComponent(JsonObject json, Protocol owner) throws IOException, FHIRFormatError {
12602    Protocol.ProtocolStepNextComponent res = new Protocol.ProtocolStepNextComponent();
12603    parseBackboneProperties(json, res);
12604    if (json.has("description"))
12605      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12606    if (json.has("_description"))
12607      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12608    if (json.has("reference"))
12609      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
12610    if (json.has("_reference"))
12611      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
12612    if (json.has("condition"))
12613      res.setCondition(parseProtocolProtocolStepPreconditionComponent(json.getAsJsonObject("condition"), owner));
12614    return res;
12615  }
12616
12617  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
12618    Provenance res = new Provenance();
12619    parseDomainResourceProperties(json, res);
12620    if (json.has("target")) {
12621      JsonArray array = json.getAsJsonArray("target");
12622      for (int i = 0; i < array.size(); i++) {
12623        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
12624      }
12625    };
12626    if (json.has("period"))
12627      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12628    if (json.has("recorded"))
12629      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
12630    if (json.has("_recorded"))
12631      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
12632    if (json.has("reason")) {
12633      JsonArray array = json.getAsJsonArray("reason");
12634      for (int i = 0; i < array.size(); i++) {
12635        res.getReason().add(parseCoding(array.get(i).getAsJsonObject()));
12636      }
12637    };
12638    if (json.has("activity"))
12639      res.setActivity(parseCoding(json.getAsJsonObject("activity")));
12640    if (json.has("location"))
12641      res.setLocation(parseReference(json.getAsJsonObject("location")));
12642    if (json.has("policy")) {
12643      JsonArray array = json.getAsJsonArray("policy");
12644      for (int i = 0; i < array.size(); i++) {
12645        res.getPolicy().add(parseUri(array.get(i).getAsString()));
12646      }
12647    };
12648    if (json.has("_policy")) {
12649      JsonArray array = json.getAsJsonArray("_policy");
12650      for (int i = 0; i < array.size(); i++) {
12651        if (i == res.getPolicy().size())
12652          res.getPolicy().add(parseUri(null));
12653        if (array.get(i) instanceof JsonObject) 
12654          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
12655      }
12656    };
12657    if (json.has("agent")) {
12658      JsonArray array = json.getAsJsonArray("agent");
12659      for (int i = 0; i < array.size(); i++) {
12660        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
12661      }
12662    };
12663    if (json.has("entity")) {
12664      JsonArray array = json.getAsJsonArray("entity");
12665      for (int i = 0; i < array.size(); i++) {
12666        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
12667      }
12668    };
12669    if (json.has("signature")) {
12670      JsonArray array = json.getAsJsonArray("signature");
12671      for (int i = 0; i < array.size(); i++) {
12672        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
12673      }
12674    };
12675    return res;
12676  }
12677
12678  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
12679    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
12680    parseBackboneProperties(json, res);
12681    if (json.has("role"))
12682      res.setRole(parseCoding(json.getAsJsonObject("role")));
12683    if (json.has("actor"))
12684      res.setActor(parseReference(json.getAsJsonObject("actor")));
12685    if (json.has("userId"))
12686      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
12687    if (json.has("relatedAgent")) {
12688      JsonArray array = json.getAsJsonArray("relatedAgent");
12689      for (int i = 0; i < array.size(); i++) {
12690        res.getRelatedAgent().add(parseProvenanceProvenanceAgentRelatedAgentComponent(array.get(i).getAsJsonObject(), owner));
12691      }
12692    };
12693    return res;
12694  }
12695
12696  protected Provenance.ProvenanceAgentRelatedAgentComponent parseProvenanceProvenanceAgentRelatedAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
12697    Provenance.ProvenanceAgentRelatedAgentComponent res = new Provenance.ProvenanceAgentRelatedAgentComponent();
12698    parseBackboneProperties(json, res);
12699    if (json.has("type"))
12700      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12701    if (json.has("target"))
12702      res.setTargetElement(parseUri(json.get("target").getAsString()));
12703    if (json.has("_target"))
12704      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
12705    return res;
12706  }
12707
12708  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
12709    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
12710    parseBackboneProperties(json, res);
12711    if (json.has("role"))
12712      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
12713    if (json.has("_role"))
12714      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
12715    if (json.has("type"))
12716      res.setType(parseCoding(json.getAsJsonObject("type")));
12717    if (json.has("reference"))
12718      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
12719    if (json.has("_reference"))
12720      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
12721    if (json.has("display"))
12722      res.setDisplayElement(parseString(json.get("display").getAsString()));
12723    if (json.has("_display"))
12724      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
12725    if (json.has("agent"))
12726      res.setAgent(parseProvenanceProvenanceAgentComponent(json.getAsJsonObject("agent"), owner));
12727    return res;
12728  }
12729
12730  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
12731    Questionnaire res = new Questionnaire();
12732    parseDomainResourceProperties(json, res);
12733    if (json.has("url"))
12734      res.setUrlElement(parseUri(json.get("url").getAsString()));
12735    if (json.has("_url"))
12736      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12737    if (json.has("identifier")) {
12738      JsonArray array = json.getAsJsonArray("identifier");
12739      for (int i = 0; i < array.size(); i++) {
12740        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12741      }
12742    };
12743    if (json.has("version"))
12744      res.setVersionElement(parseString(json.get("version").getAsString()));
12745    if (json.has("_version"))
12746      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12747    if (json.has("status"))
12748      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Questionnaire.QuestionnaireStatus.NULL, new Questionnaire.QuestionnaireStatusEnumFactory()));
12749    if (json.has("_status"))
12750      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12751    if (json.has("date"))
12752      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12753    if (json.has("_date"))
12754      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12755    if (json.has("publisher"))
12756      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12757    if (json.has("_publisher"))
12758      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12759    if (json.has("telecom")) {
12760      JsonArray array = json.getAsJsonArray("telecom");
12761      for (int i = 0; i < array.size(); i++) {
12762        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
12763      }
12764    };
12765    if (json.has("useContext")) {
12766      JsonArray array = json.getAsJsonArray("useContext");
12767      for (int i = 0; i < array.size(); i++) {
12768        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12769      }
12770    };
12771    if (json.has("title"))
12772      res.setTitleElement(parseString(json.get("title").getAsString()));
12773    if (json.has("_title"))
12774      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12775    if (json.has("concept")) {
12776      JsonArray array = json.getAsJsonArray("concept");
12777      for (int i = 0; i < array.size(); i++) {
12778        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
12779      }
12780    };
12781    if (json.has("subjectType")) {
12782      JsonArray array = json.getAsJsonArray("subjectType");
12783      for (int i = 0; i < array.size(); i++) {
12784        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
12785      }
12786    };
12787    if (json.has("_subjectType")) {
12788      JsonArray array = json.getAsJsonArray("_subjectType");
12789      for (int i = 0; i < array.size(); i++) {
12790        if (i == res.getSubjectType().size())
12791          res.getSubjectType().add(parseCode(null));
12792        if (array.get(i) instanceof JsonObject) 
12793          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
12794      }
12795    };
12796    if (json.has("item")) {
12797      JsonArray array = json.getAsJsonArray("item");
12798      for (int i = 0; i < array.size(); i++) {
12799        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
12800      }
12801    };
12802    return res;
12803  }
12804
12805  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
12806    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
12807    parseBackboneProperties(json, res);
12808    if (json.has("linkId"))
12809      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
12810    if (json.has("_linkId"))
12811      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
12812    if (json.has("concept")) {
12813      JsonArray array = json.getAsJsonArray("concept");
12814      for (int i = 0; i < array.size(); i++) {
12815        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
12816      }
12817    };
12818    if (json.has("prefix"))
12819      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
12820    if (json.has("_prefix"))
12821      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
12822    if (json.has("text"))
12823      res.setTextElement(parseString(json.get("text").getAsString()));
12824    if (json.has("_text"))
12825      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12826    if (json.has("type"))
12827      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
12828    if (json.has("_type"))
12829      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12830    if (json.has("enableWhen")) {
12831      JsonArray array = json.getAsJsonArray("enableWhen");
12832      for (int i = 0; i < array.size(); i++) {
12833        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
12834      }
12835    };
12836    if (json.has("required"))
12837      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
12838    if (json.has("_required"))
12839      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
12840    if (json.has("repeats"))
12841      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
12842    if (json.has("_repeats"))
12843      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
12844    if (json.has("readOnly"))
12845      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
12846    if (json.has("_readOnly"))
12847      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
12848    if (json.has("maxLength"))
12849      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
12850    if (json.has("_maxLength"))
12851      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
12852    if (json.has("options"))
12853      res.setOptions(parseReference(json.getAsJsonObject("options")));
12854    if (json.has("option")) {
12855      JsonArray array = json.getAsJsonArray("option");
12856      for (int i = 0; i < array.size(); i++) {
12857        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(array.get(i).getAsJsonObject(), owner));
12858      }
12859    };
12860    Type initial = parseType("initial", json);
12861    if (initial != null)
12862      res.setInitial(initial);
12863    if (json.has("item")) {
12864      JsonArray array = json.getAsJsonArray("item");
12865      for (int i = 0; i < array.size(); i++) {
12866        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
12867      }
12868    };
12869    return res;
12870  }
12871
12872  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
12873    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
12874    parseBackboneProperties(json, res);
12875    if (json.has("question"))
12876      res.setQuestionElement(parseString(json.get("question").getAsString()));
12877    if (json.has("_question"))
12878      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
12879    if (json.has("answered"))
12880      res.setAnsweredElement(parseBoolean(json.get("answered").getAsBoolean()));
12881    if (json.has("_answered"))
12882      parseElementProperties(json.getAsJsonObject("_answered"), res.getAnsweredElement());
12883    Type answer = parseType("answer", json);
12884    if (answer != null)
12885      res.setAnswer(answer);
12886    return res;
12887  }
12888
12889  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
12890    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
12891    parseBackboneProperties(json, res);
12892    Type value = parseType("value", json);
12893    if (value != null)
12894      res.setValue(value);
12895    return res;
12896  }
12897
12898  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
12899    QuestionnaireResponse res = new QuestionnaireResponse();
12900    parseDomainResourceProperties(json, res);
12901    if (json.has("identifier"))
12902      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12903    if (json.has("questionnaire"))
12904      res.setQuestionnaire(parseReference(json.getAsJsonObject("questionnaire")));
12905    if (json.has("status"))
12906      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
12907    if (json.has("_status"))
12908      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12909    if (json.has("subject"))
12910      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12911    if (json.has("author"))
12912      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12913    if (json.has("authored"))
12914      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
12915    if (json.has("_authored"))
12916      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
12917    if (json.has("source"))
12918      res.setSource(parseReference(json.getAsJsonObject("source")));
12919    if (json.has("encounter"))
12920      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12921    if (json.has("item")) {
12922      JsonArray array = json.getAsJsonArray("item");
12923      for (int i = 0; i < array.size(); i++) {
12924        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
12925      }
12926    };
12927    return res;
12928  }
12929
12930  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
12931    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
12932    parseBackboneProperties(json, res);
12933    if (json.has("linkId"))
12934      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
12935    if (json.has("_linkId"))
12936      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
12937    if (json.has("text"))
12938      res.setTextElement(parseString(json.get("text").getAsString()));
12939    if (json.has("_text"))
12940      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12941    if (json.has("subject"))
12942      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12943    if (json.has("answer")) {
12944      JsonArray array = json.getAsJsonArray("answer");
12945      for (int i = 0; i < array.size(); i++) {
12946        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
12947      }
12948    };
12949    if (json.has("item")) {
12950      JsonArray array = json.getAsJsonArray("item");
12951      for (int i = 0; i < array.size(); i++) {
12952        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
12953      }
12954    };
12955    return res;
12956  }
12957
12958  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
12959    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
12960    parseBackboneProperties(json, res);
12961    Type value = parseType("value", json);
12962    if (value != null)
12963      res.setValue(value);
12964    if (json.has("item")) {
12965      JsonArray array = json.getAsJsonArray("item");
12966      for (int i = 0; i < array.size(); i++) {
12967        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
12968      }
12969    };
12970    return res;
12971  }
12972
12973  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
12974    ReferralRequest res = new ReferralRequest();
12975    parseDomainResourceProperties(json, res);
12976    if (json.has("identifier")) {
12977      JsonArray array = json.getAsJsonArray("identifier");
12978      for (int i = 0; i < array.size(); i++) {
12979        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12980      }
12981    };
12982    if (json.has("basedOn")) {
12983      JsonArray array = json.getAsJsonArray("basedOn");
12984      for (int i = 0; i < array.size(); i++) {
12985        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12986      }
12987    };
12988    if (json.has("parent"))
12989      res.setParent(parseIdentifier(json.getAsJsonObject("parent")));
12990    if (json.has("status"))
12991      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralStatus.NULL, new ReferralRequest.ReferralStatusEnumFactory()));
12992    if (json.has("_status"))
12993      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12994    if (json.has("category"))
12995      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ReferralRequest.ReferralCategory.NULL, new ReferralRequest.ReferralCategoryEnumFactory()));
12996    if (json.has("_category"))
12997      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
12998    if (json.has("type"))
12999      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13000    if (json.has("priority"))
13001      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
13002    if (json.has("patient"))
13003      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13004    if (json.has("context"))
13005      res.setContext(parseReference(json.getAsJsonObject("context")));
13006    if (json.has("fulfillmentTime"))
13007      res.setFulfillmentTime(parsePeriod(json.getAsJsonObject("fulfillmentTime")));
13008    if (json.has("authored"))
13009      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
13010    if (json.has("_authored"))
13011      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
13012    if (json.has("requester"))
13013      res.setRequester(parseReference(json.getAsJsonObject("requester")));
13014    if (json.has("specialty"))
13015      res.setSpecialty(parseCodeableConcept(json.getAsJsonObject("specialty")));
13016    if (json.has("recipient")) {
13017      JsonArray array = json.getAsJsonArray("recipient");
13018      for (int i = 0; i < array.size(); i++) {
13019        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
13020      }
13021    };
13022    if (json.has("reason"))
13023      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
13024    if (json.has("description"))
13025      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13026    if (json.has("_description"))
13027      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13028    if (json.has("serviceRequested")) {
13029      JsonArray array = json.getAsJsonArray("serviceRequested");
13030      for (int i = 0; i < array.size(); i++) {
13031        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13032      }
13033    };
13034    if (json.has("supportingInformation")) {
13035      JsonArray array = json.getAsJsonArray("supportingInformation");
13036      for (int i = 0; i < array.size(); i++) {
13037        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
13038      }
13039    };
13040    return res;
13041  }
13042
13043  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
13044    RelatedPerson res = new RelatedPerson();
13045    parseDomainResourceProperties(json, res);
13046    if (json.has("identifier")) {
13047      JsonArray array = json.getAsJsonArray("identifier");
13048      for (int i = 0; i < array.size(); i++) {
13049        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13050      }
13051    };
13052    if (json.has("patient"))
13053      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13054    if (json.has("relationship"))
13055      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
13056    if (json.has("name"))
13057      res.setName(parseHumanName(json.getAsJsonObject("name")));
13058    if (json.has("telecom")) {
13059      JsonArray array = json.getAsJsonArray("telecom");
13060      for (int i = 0; i < array.size(); i++) {
13061        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13062      }
13063    };
13064    if (json.has("gender"))
13065      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13066    if (json.has("_gender"))
13067      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
13068    if (json.has("birthDate"))
13069      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
13070    if (json.has("_birthDate"))
13071      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
13072    if (json.has("address")) {
13073      JsonArray array = json.getAsJsonArray("address");
13074      for (int i = 0; i < array.size(); i++) {
13075        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13076      }
13077    };
13078    if (json.has("photo")) {
13079      JsonArray array = json.getAsJsonArray("photo");
13080      for (int i = 0; i < array.size(); i++) {
13081        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
13082      }
13083    };
13084    if (json.has("period"))
13085      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13086    return res;
13087  }
13088
13089  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
13090    RiskAssessment res = new RiskAssessment();
13091    parseDomainResourceProperties(json, res);
13092    if (json.has("subject"))
13093      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13094    if (json.has("date"))
13095      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13096    if (json.has("_date"))
13097      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13098    if (json.has("condition"))
13099      res.setCondition(parseReference(json.getAsJsonObject("condition")));
13100    if (json.has("encounter"))
13101      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13102    if (json.has("performer"))
13103      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
13104    if (json.has("identifier"))
13105      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
13106    if (json.has("method"))
13107      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
13108    if (json.has("basis")) {
13109      JsonArray array = json.getAsJsonArray("basis");
13110      for (int i = 0; i < array.size(); i++) {
13111        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
13112      }
13113    };
13114    if (json.has("prediction")) {
13115      JsonArray array = json.getAsJsonArray("prediction");
13116      for (int i = 0; i < array.size(); i++) {
13117        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
13118      }
13119    };
13120    if (json.has("mitigation"))
13121      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
13122    if (json.has("_mitigation"))
13123      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
13124    return res;
13125  }
13126
13127  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
13128    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
13129    parseBackboneProperties(json, res);
13130    if (json.has("outcome"))
13131      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
13132    Type probability = parseType("probability", json);
13133    if (probability != null)
13134      res.setProbability(probability);
13135    if (json.has("relativeRisk"))
13136      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
13137    if (json.has("_relativeRisk"))
13138      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
13139    Type when = parseType("when", json);
13140    if (when != null)
13141      res.setWhen(when);
13142    if (json.has("rationale"))
13143      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
13144    if (json.has("_rationale"))
13145      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
13146    return res;
13147  }
13148
13149  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
13150    Schedule res = new Schedule();
13151    parseDomainResourceProperties(json, res);
13152    if (json.has("identifier")) {
13153      JsonArray array = json.getAsJsonArray("identifier");
13154      for (int i = 0; i < array.size(); i++) {
13155        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13156      }
13157    };
13158    if (json.has("serviceCategory"))
13159      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
13160    if (json.has("serviceType")) {
13161      JsonArray array = json.getAsJsonArray("serviceType");
13162      for (int i = 0; i < array.size(); i++) {
13163        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13164      }
13165    };
13166    if (json.has("specialty")) {
13167      JsonArray array = json.getAsJsonArray("specialty");
13168      for (int i = 0; i < array.size(); i++) {
13169        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13170      }
13171    };
13172    if (json.has("actor"))
13173      res.setActor(parseReference(json.getAsJsonObject("actor")));
13174    if (json.has("planningHorizon"))
13175      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
13176    if (json.has("comment"))
13177      res.setCommentElement(parseString(json.get("comment").getAsString()));
13178    if (json.has("_comment"))
13179      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13180    return res;
13181  }
13182
13183  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
13184    SearchParameter res = new SearchParameter();
13185    parseDomainResourceProperties(json, res);
13186    if (json.has("url"))
13187      res.setUrlElement(parseUri(json.get("url").getAsString()));
13188    if (json.has("_url"))
13189      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13190    if (json.has("name"))
13191      res.setNameElement(parseString(json.get("name").getAsString()));
13192    if (json.has("_name"))
13193      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13194    if (json.has("status"))
13195      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
13196    if (json.has("_status"))
13197      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13198    if (json.has("experimental"))
13199      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13200    if (json.has("_experimental"))
13201      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13202    if (json.has("date"))
13203      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13204    if (json.has("_date"))
13205      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13206    if (json.has("publisher"))
13207      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13208    if (json.has("_publisher"))
13209      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13210    if (json.has("contact")) {
13211      JsonArray array = json.getAsJsonArray("contact");
13212      for (int i = 0; i < array.size(); i++) {
13213        res.getContact().add(parseSearchParameterSearchParameterContactComponent(array.get(i).getAsJsonObject(), res));
13214      }
13215    };
13216    if (json.has("useContext")) {
13217      JsonArray array = json.getAsJsonArray("useContext");
13218      for (int i = 0; i < array.size(); i++) {
13219        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13220      }
13221    };
13222    if (json.has("requirements"))
13223      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
13224    if (json.has("_requirements"))
13225      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
13226    if (json.has("code"))
13227      res.setCodeElement(parseCode(json.get("code").getAsString()));
13228    if (json.has("_code"))
13229      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13230    if (json.has("base"))
13231      res.setBaseElement(parseCode(json.get("base").getAsString()));
13232    if (json.has("_base"))
13233      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
13234    if (json.has("type"))
13235      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
13236    if (json.has("_type"))
13237      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13238    if (json.has("description"))
13239      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13240    if (json.has("_description"))
13241      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13242    if (json.has("expression"))
13243      res.setExpressionElement(parseString(json.get("expression").getAsString()));
13244    if (json.has("_expression"))
13245      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
13246    if (json.has("xpath"))
13247      res.setXpathElement(parseString(json.get("xpath").getAsString()));
13248    if (json.has("_xpath"))
13249      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
13250    if (json.has("xpathUsage"))
13251      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
13252    if (json.has("_xpathUsage"))
13253      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
13254    if (json.has("target")) {
13255      JsonArray array = json.getAsJsonArray("target");
13256      for (int i = 0; i < array.size(); i++) {
13257        res.getTarget().add(parseCode(array.get(i).getAsString()));
13258      }
13259    };
13260    if (json.has("_target")) {
13261      JsonArray array = json.getAsJsonArray("_target");
13262      for (int i = 0; i < array.size(); i++) {
13263        if (i == res.getTarget().size())
13264          res.getTarget().add(parseCode(null));
13265        if (array.get(i) instanceof JsonObject) 
13266          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
13267      }
13268    };
13269    return res;
13270  }
13271
13272  protected SearchParameter.SearchParameterContactComponent parseSearchParameterSearchParameterContactComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
13273    SearchParameter.SearchParameterContactComponent res = new SearchParameter.SearchParameterContactComponent();
13274    parseBackboneProperties(json, res);
13275    if (json.has("name"))
13276      res.setNameElement(parseString(json.get("name").getAsString()));
13277    if (json.has("_name"))
13278      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13279    if (json.has("telecom")) {
13280      JsonArray array = json.getAsJsonArray("telecom");
13281      for (int i = 0; i < array.size(); i++) {
13282        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13283      }
13284    };
13285    return res;
13286  }
13287
13288  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
13289    Sequence res = new Sequence();
13290    parseDomainResourceProperties(json, res);
13291    if (json.has("type"))
13292      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
13293    if (json.has("_type"))
13294      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13295    if (json.has("patient"))
13296      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13297    if (json.has("specimen"))
13298      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
13299    if (json.has("device"))
13300      res.setDevice(parseReference(json.getAsJsonObject("device")));
13301    if (json.has("quantity"))
13302      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13303    if (json.has("species"))
13304      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
13305    if (json.has("referenceSeq")) {
13306      JsonArray array = json.getAsJsonArray("referenceSeq");
13307      for (int i = 0; i < array.size(); i++) {
13308        res.getReferenceSeq().add(parseSequenceSequenceReferenceSeqComponent(array.get(i).getAsJsonObject(), res));
13309      }
13310    };
13311    if (json.has("variation"))
13312      res.setVariation(parseSequenceSequenceVariationComponent(json.getAsJsonObject("variation"), res));
13313    if (json.has("quality")) {
13314      JsonArray array = json.getAsJsonArray("quality");
13315      for (int i = 0; i < array.size(); i++) {
13316        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
13317      }
13318    };
13319    if (json.has("allelicState"))
13320      res.setAllelicState(parseCodeableConcept(json.getAsJsonObject("allelicState")));
13321    if (json.has("allelicFrequency"))
13322      res.setAllelicFrequencyElement(parseDecimal(json.get("allelicFrequency").getAsBigDecimal()));
13323    if (json.has("_allelicFrequency"))
13324      parseElementProperties(json.getAsJsonObject("_allelicFrequency"), res.getAllelicFrequencyElement());
13325    if (json.has("copyNumberEvent"))
13326      res.setCopyNumberEvent(parseCodeableConcept(json.getAsJsonObject("copyNumberEvent")));
13327    if (json.has("readCoverage"))
13328      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
13329    if (json.has("_readCoverage"))
13330      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
13331    if (json.has("repository")) {
13332      JsonArray array = json.getAsJsonArray("repository");
13333      for (int i = 0; i < array.size(); i++) {
13334        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
13335      }
13336    };
13337    if (json.has("pointer")) {
13338      JsonArray array = json.getAsJsonArray("pointer");
13339      for (int i = 0; i < array.size(); i++) {
13340        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
13341      }
13342    };
13343    if (json.has("observedSeq"))
13344      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
13345    if (json.has("_observedSeq"))
13346      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
13347    if (json.has("observation"))
13348      res.setObservation(parseReference(json.getAsJsonObject("observation")));
13349    if (json.has("structureVariation"))
13350      res.setStructureVariation(parseSequenceSequenceStructureVariationComponent(json.getAsJsonObject("structureVariation"), res));
13351    return res;
13352  }
13353
13354  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13355    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
13356    parseBackboneProperties(json, res);
13357    if (json.has("chromosome"))
13358      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
13359    if (json.has("genomeBuild"))
13360      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
13361    if (json.has("_genomeBuild"))
13362      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
13363    if (json.has("referenceSeqId"))
13364      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
13365    if (json.has("referenceSeqPointer"))
13366      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
13367    if (json.has("referenceSeqString"))
13368      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
13369    if (json.has("_referenceSeqString"))
13370      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
13371    if (json.has("windowStart"))
13372      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
13373    if (json.has("_windowStart"))
13374      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
13375    if (json.has("windowEnd"))
13376      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
13377    if (json.has("_windowEnd"))
13378      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
13379    return res;
13380  }
13381
13382  protected Sequence.SequenceVariationComponent parseSequenceSequenceVariationComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13383    Sequence.SequenceVariationComponent res = new Sequence.SequenceVariationComponent();
13384    parseBackboneProperties(json, res);
13385    if (json.has("start"))
13386      res.setStartElement(parseInteger(json.get("start").getAsLong()));
13387    if (json.has("_start"))
13388      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13389    if (json.has("end"))
13390      res.setEndElement(parseInteger(json.get("end").getAsLong()));
13391    if (json.has("_end"))
13392      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
13393    if (json.has("observedAllele"))
13394      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
13395    if (json.has("_observedAllele"))
13396      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
13397    if (json.has("referenceAllele"))
13398      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
13399    if (json.has("_referenceAllele"))
13400      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
13401    if (json.has("cigar"))
13402      res.setCigarElement(parseString(json.get("cigar").getAsString()));
13403    if (json.has("_cigar"))
13404      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
13405    return res;
13406  }
13407
13408  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13409    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
13410    parseBackboneProperties(json, res);
13411    if (json.has("start"))
13412      res.setStartElement(parseInteger(json.get("start").getAsLong()));
13413    if (json.has("_start"))
13414      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13415    if (json.has("end"))
13416      res.setEndElement(parseInteger(json.get("end").getAsLong()));
13417    if (json.has("_end"))
13418      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
13419    if (json.has("score"))
13420      res.setScore(parseQuantity(json.getAsJsonObject("score")));
13421    if (json.has("method"))
13422      res.setMethodElement(parseString(json.get("method").getAsString()));
13423    if (json.has("_method"))
13424      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
13425    return res;
13426  }
13427
13428  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13429    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
13430    parseBackboneProperties(json, res);
13431    if (json.has("url"))
13432      res.setUrlElement(parseUri(json.get("url").getAsString()));
13433    if (json.has("_url"))
13434      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13435    if (json.has("name"))
13436      res.setNameElement(parseString(json.get("name").getAsString()));
13437    if (json.has("_name"))
13438      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13439    if (json.has("variantId"))
13440      res.setVariantIdElement(parseString(json.get("variantId").getAsString()));
13441    if (json.has("_variantId"))
13442      parseElementProperties(json.getAsJsonObject("_variantId"), res.getVariantIdElement());
13443    if (json.has("readId"))
13444      res.setReadIdElement(parseString(json.get("readId").getAsString()));
13445    if (json.has("_readId"))
13446      parseElementProperties(json.getAsJsonObject("_readId"), res.getReadIdElement());
13447    return res;
13448  }
13449
13450  protected Sequence.SequenceStructureVariationComponent parseSequenceSequenceStructureVariationComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13451    Sequence.SequenceStructureVariationComponent res = new Sequence.SequenceStructureVariationComponent();
13452    parseBackboneProperties(json, res);
13453    if (json.has("precisionOfBoundaries"))
13454      res.setPrecisionOfBoundariesElement(parseString(json.get("precisionOfBoundaries").getAsString()));
13455    if (json.has("_precisionOfBoundaries"))
13456      parseElementProperties(json.getAsJsonObject("_precisionOfBoundaries"), res.getPrecisionOfBoundariesElement());
13457    if (json.has("reportedaCGHRatio"))
13458      res.setReportedaCGHRatioElement(parseDecimal(json.get("reportedaCGHRatio").getAsBigDecimal()));
13459    if (json.has("_reportedaCGHRatio"))
13460      parseElementProperties(json.getAsJsonObject("_reportedaCGHRatio"), res.getReportedaCGHRatioElement());
13461    if (json.has("length"))
13462      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
13463    if (json.has("_length"))
13464      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
13465    if (json.has("outer"))
13466      res.setOuter(parseSequenceSequenceStructureVariationOuterComponent(json.getAsJsonObject("outer"), owner));
13467    if (json.has("inner"))
13468      res.setInner(parseSequenceSequenceStructureVariationInnerComponent(json.getAsJsonObject("inner"), owner));
13469    return res;
13470  }
13471
13472  protected Sequence.SequenceStructureVariationOuterComponent parseSequenceSequenceStructureVariationOuterComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13473    Sequence.SequenceStructureVariationOuterComponent res = new Sequence.SequenceStructureVariationOuterComponent();
13474    parseBackboneProperties(json, res);
13475    if (json.has("start"))
13476      res.setStartElement(parseInteger(json.get("start").getAsLong()));
13477    if (json.has("_start"))
13478      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13479    if (json.has("end"))
13480      res.setEndElement(parseInteger(json.get("end").getAsLong()));
13481    if (json.has("_end"))
13482      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
13483    return res;
13484  }
13485
13486  protected Sequence.SequenceStructureVariationInnerComponent parseSequenceSequenceStructureVariationInnerComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
13487    Sequence.SequenceStructureVariationInnerComponent res = new Sequence.SequenceStructureVariationInnerComponent();
13488    parseBackboneProperties(json, res);
13489    if (json.has("start"))
13490      res.setStartElement(parseInteger(json.get("start").getAsLong()));
13491    if (json.has("_start"))
13492      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13493    if (json.has("end"))
13494      res.setEndElement(parseInteger(json.get("end").getAsLong()));
13495    if (json.has("_end"))
13496      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
13497    return res;
13498  }
13499
13500  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
13501    Slot res = new Slot();
13502    parseDomainResourceProperties(json, res);
13503    if (json.has("identifier")) {
13504      JsonArray array = json.getAsJsonArray("identifier");
13505      for (int i = 0; i < array.size(); i++) {
13506        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13507      }
13508    };
13509    if (json.has("serviceCategory"))
13510      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
13511    if (json.has("serviceType")) {
13512      JsonArray array = json.getAsJsonArray("serviceType");
13513      for (int i = 0; i < array.size(); i++) {
13514        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13515      }
13516    };
13517    if (json.has("specialty")) {
13518      JsonArray array = json.getAsJsonArray("specialty");
13519      for (int i = 0; i < array.size(); i++) {
13520        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13521      }
13522    };
13523    if (json.has("appointmentType"))
13524      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
13525    if (json.has("schedule"))
13526      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
13527    if (json.has("status"))
13528      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
13529    if (json.has("_status"))
13530      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13531    if (json.has("start"))
13532      res.setStartElement(parseInstant(json.get("start").getAsString()));
13533    if (json.has("_start"))
13534      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13535    if (json.has("end"))
13536      res.setEndElement(parseInstant(json.get("end").getAsString()));
13537    if (json.has("_end"))
13538      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
13539    if (json.has("overbooked"))
13540      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
13541    if (json.has("_overbooked"))
13542      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
13543    if (json.has("comment"))
13544      res.setCommentElement(parseString(json.get("comment").getAsString()));
13545    if (json.has("_comment"))
13546      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13547    return res;
13548  }
13549
13550  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
13551    Specimen res = new Specimen();
13552    parseDomainResourceProperties(json, res);
13553    if (json.has("identifier")) {
13554      JsonArray array = json.getAsJsonArray("identifier");
13555      for (int i = 0; i < array.size(); i++) {
13556        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13557      }
13558    };
13559    if (json.has("accessionIdentifier"))
13560      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
13561    if (json.has("status"))
13562      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
13563    if (json.has("_status"))
13564      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13565    if (json.has("type"))
13566      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13567    if (json.has("subject"))
13568      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13569    if (json.has("receivedTime"))
13570      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
13571    if (json.has("_receivedTime"))
13572      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
13573    if (json.has("parent")) {
13574      JsonArray array = json.getAsJsonArray("parent");
13575      for (int i = 0; i < array.size(); i++) {
13576        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
13577      }
13578    };
13579    if (json.has("collection"))
13580      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
13581    if (json.has("treatment")) {
13582      JsonArray array = json.getAsJsonArray("treatment");
13583      for (int i = 0; i < array.size(); i++) {
13584        res.getTreatment().add(parseSpecimenSpecimenTreatmentComponent(array.get(i).getAsJsonObject(), res));
13585      }
13586    };
13587    if (json.has("container")) {
13588      JsonArray array = json.getAsJsonArray("container");
13589      for (int i = 0; i < array.size(); i++) {
13590        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
13591      }
13592    };
13593    return res;
13594  }
13595
13596  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
13597    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
13598    parseBackboneProperties(json, res);
13599    if (json.has("collector"))
13600      res.setCollector(parseReference(json.getAsJsonObject("collector")));
13601    if (json.has("comment"))
13602      res.setCommentElement(parseString(json.get("comment").getAsString()));
13603    if (json.has("_comment"))
13604      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13605    Type collected = parseType("collected", json);
13606    if (collected != null)
13607      res.setCollected(collected);
13608    if (json.has("quantity"))
13609      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13610    if (json.has("method"))
13611      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
13612    if (json.has("bodySite"))
13613      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13614    return res;
13615  }
13616
13617  protected Specimen.SpecimenTreatmentComponent parseSpecimenSpecimenTreatmentComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
13618    Specimen.SpecimenTreatmentComponent res = new Specimen.SpecimenTreatmentComponent();
13619    parseBackboneProperties(json, res);
13620    if (json.has("description"))
13621      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13622    if (json.has("_description"))
13623      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13624    if (json.has("procedure"))
13625      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
13626    if (json.has("additive")) {
13627      JsonArray array = json.getAsJsonArray("additive");
13628      for (int i = 0; i < array.size(); i++) {
13629        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
13630      }
13631    };
13632    return res;
13633  }
13634
13635  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
13636    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
13637    parseBackboneProperties(json, res);
13638    if (json.has("identifier")) {
13639      JsonArray array = json.getAsJsonArray("identifier");
13640      for (int i = 0; i < array.size(); i++) {
13641        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13642      }
13643    };
13644    if (json.has("description"))
13645      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13646    if (json.has("_description"))
13647      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13648    if (json.has("type"))
13649      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13650    if (json.has("capacity"))
13651      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
13652    if (json.has("specimenQuantity"))
13653      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
13654    Type additive = parseType("additive", json);
13655    if (additive != null)
13656      res.setAdditive(additive);
13657    return res;
13658  }
13659
13660  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
13661    StructureDefinition res = new StructureDefinition();
13662    parseDomainResourceProperties(json, res);
13663    if (json.has("url"))
13664      res.setUrlElement(parseUri(json.get("url").getAsString()));
13665    if (json.has("_url"))
13666      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13667    if (json.has("identifier")) {
13668      JsonArray array = json.getAsJsonArray("identifier");
13669      for (int i = 0; i < array.size(); i++) {
13670        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13671      }
13672    };
13673    if (json.has("version"))
13674      res.setVersionElement(parseString(json.get("version").getAsString()));
13675    if (json.has("_version"))
13676      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13677    if (json.has("name"))
13678      res.setNameElement(parseString(json.get("name").getAsString()));
13679    if (json.has("_name"))
13680      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13681    if (json.has("display"))
13682      res.setDisplayElement(parseString(json.get("display").getAsString()));
13683    if (json.has("_display"))
13684      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
13685    if (json.has("status"))
13686      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
13687    if (json.has("_status"))
13688      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13689    if (json.has("experimental"))
13690      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13691    if (json.has("_experimental"))
13692      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13693    if (json.has("publisher"))
13694      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13695    if (json.has("_publisher"))
13696      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13697    if (json.has("contact")) {
13698      JsonArray array = json.getAsJsonArray("contact");
13699      for (int i = 0; i < array.size(); i++) {
13700        res.getContact().add(parseStructureDefinitionStructureDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
13701      }
13702    };
13703    if (json.has("date"))
13704      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13705    if (json.has("_date"))
13706      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13707    if (json.has("description"))
13708      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13709    if (json.has("_description"))
13710      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13711    if (json.has("useContext")) {
13712      JsonArray array = json.getAsJsonArray("useContext");
13713      for (int i = 0; i < array.size(); i++) {
13714        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13715      }
13716    };
13717    if (json.has("requirements"))
13718      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
13719    if (json.has("_requirements"))
13720      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
13721    if (json.has("copyright"))
13722      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
13723    if (json.has("_copyright"))
13724      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
13725    if (json.has("code")) {
13726      JsonArray array = json.getAsJsonArray("code");
13727      for (int i = 0; i < array.size(); i++) {
13728        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
13729      }
13730    };
13731    if (json.has("fhirVersion"))
13732      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
13733    if (json.has("_fhirVersion"))
13734      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
13735    if (json.has("mapping")) {
13736      JsonArray array = json.getAsJsonArray("mapping");
13737      for (int i = 0; i < array.size(); i++) {
13738        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
13739      }
13740    };
13741    if (json.has("kind"))
13742      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
13743    if (json.has("_kind"))
13744      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
13745    if (json.has("abstract"))
13746      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
13747    if (json.has("_abstract"))
13748      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
13749    if (json.has("contextType"))
13750      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
13751    if (json.has("_contextType"))
13752      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
13753    if (json.has("context")) {
13754      JsonArray array = json.getAsJsonArray("context");
13755      for (int i = 0; i < array.size(); i++) {
13756        res.getContext().add(parseString(array.get(i).getAsString()));
13757      }
13758    };
13759    if (json.has("_context")) {
13760      JsonArray array = json.getAsJsonArray("_context");
13761      for (int i = 0; i < array.size(); i++) {
13762        if (i == res.getContext().size())
13763          res.getContext().add(parseString(null));
13764        if (array.get(i) instanceof JsonObject) 
13765          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
13766      }
13767    };
13768    if (json.has("baseType"))
13769      res.setBaseTypeElement(parseCode(json.get("baseType").getAsString()));
13770    if (json.has("_baseType"))
13771      parseElementProperties(json.getAsJsonObject("_baseType"), res.getBaseTypeElement());
13772    if (json.has("baseDefinition"))
13773      res.setBaseDefinitionElement(parseUri(json.get("baseDefinition").getAsString()));
13774    if (json.has("_baseDefinition"))
13775      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
13776    if (json.has("derivation"))
13777      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
13778    if (json.has("_derivation"))
13779      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
13780    if (json.has("snapshot"))
13781      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
13782    if (json.has("differential"))
13783      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
13784    return res;
13785  }
13786
13787  protected StructureDefinition.StructureDefinitionContactComponent parseStructureDefinitionStructureDefinitionContactComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
13788    StructureDefinition.StructureDefinitionContactComponent res = new StructureDefinition.StructureDefinitionContactComponent();
13789    parseBackboneProperties(json, res);
13790    if (json.has("name"))
13791      res.setNameElement(parseString(json.get("name").getAsString()));
13792    if (json.has("_name"))
13793      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13794    if (json.has("telecom")) {
13795      JsonArray array = json.getAsJsonArray("telecom");
13796      for (int i = 0; i < array.size(); i++) {
13797        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13798      }
13799    };
13800    return res;
13801  }
13802
13803  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
13804    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
13805    parseBackboneProperties(json, res);
13806    if (json.has("identity"))
13807      res.setIdentityElement(parseId(json.get("identity").getAsString()));
13808    if (json.has("_identity"))
13809      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
13810    if (json.has("uri"))
13811      res.setUriElement(parseUri(json.get("uri").getAsString()));
13812    if (json.has("_uri"))
13813      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
13814    if (json.has("name"))
13815      res.setNameElement(parseString(json.get("name").getAsString()));
13816    if (json.has("_name"))
13817      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13818    if (json.has("comments"))
13819      res.setCommentsElement(parseString(json.get("comments").getAsString()));
13820    if (json.has("_comments"))
13821      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
13822    return res;
13823  }
13824
13825  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
13826    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
13827    parseBackboneProperties(json, res);
13828    if (json.has("element")) {
13829      JsonArray array = json.getAsJsonArray("element");
13830      for (int i = 0; i < array.size(); i++) {
13831        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
13832      }
13833    };
13834    return res;
13835  }
13836
13837  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
13838    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
13839    parseBackboneProperties(json, res);
13840    if (json.has("element")) {
13841      JsonArray array = json.getAsJsonArray("element");
13842      for (int i = 0; i < array.size(); i++) {
13843        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
13844      }
13845    };
13846    return res;
13847  }
13848
13849  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
13850    StructureMap res = new StructureMap();
13851    parseDomainResourceProperties(json, res);
13852    if (json.has("url"))
13853      res.setUrlElement(parseUri(json.get("url").getAsString()));
13854    if (json.has("_url"))
13855      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13856    if (json.has("identifier")) {
13857      JsonArray array = json.getAsJsonArray("identifier");
13858      for (int i = 0; i < array.size(); i++) {
13859        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13860      }
13861    };
13862    if (json.has("version"))
13863      res.setVersionElement(parseString(json.get("version").getAsString()));
13864    if (json.has("_version"))
13865      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13866    if (json.has("name"))
13867      res.setNameElement(parseString(json.get("name").getAsString()));
13868    if (json.has("_name"))
13869      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13870    if (json.has("status"))
13871      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
13872    if (json.has("_status"))
13873      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13874    if (json.has("experimental"))
13875      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13876    if (json.has("_experimental"))
13877      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13878    if (json.has("publisher"))
13879      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13880    if (json.has("_publisher"))
13881      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13882    if (json.has("contact")) {
13883      JsonArray array = json.getAsJsonArray("contact");
13884      for (int i = 0; i < array.size(); i++) {
13885        res.getContact().add(parseStructureMapStructureMapContactComponent(array.get(i).getAsJsonObject(), res));
13886      }
13887    };
13888    if (json.has("date"))
13889      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13890    if (json.has("_date"))
13891      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13892    if (json.has("description"))
13893      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13894    if (json.has("_description"))
13895      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13896    if (json.has("useContext")) {
13897      JsonArray array = json.getAsJsonArray("useContext");
13898      for (int i = 0; i < array.size(); i++) {
13899        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13900      }
13901    };
13902    if (json.has("requirements"))
13903      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
13904    if (json.has("_requirements"))
13905      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
13906    if (json.has("copyright"))
13907      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
13908    if (json.has("_copyright"))
13909      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
13910    if (json.has("structure")) {
13911      JsonArray array = json.getAsJsonArray("structure");
13912      for (int i = 0; i < array.size(); i++) {
13913        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
13914      }
13915    };
13916    if (json.has("import")) {
13917      JsonArray array = json.getAsJsonArray("import");
13918      for (int i = 0; i < array.size(); i++) {
13919        res.getImport().add(parseUri(array.get(i).getAsString()));
13920      }
13921    };
13922    if (json.has("_import")) {
13923      JsonArray array = json.getAsJsonArray("_import");
13924      for (int i = 0; i < array.size(); i++) {
13925        if (i == res.getImport().size())
13926          res.getImport().add(parseUri(null));
13927        if (array.get(i) instanceof JsonObject) 
13928          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
13929      }
13930    };
13931    if (json.has("group")) {
13932      JsonArray array = json.getAsJsonArray("group");
13933      for (int i = 0; i < array.size(); i++) {
13934        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
13935      }
13936    };
13937    return res;
13938  }
13939
13940  protected StructureMap.StructureMapContactComponent parseStructureMapStructureMapContactComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
13941    StructureMap.StructureMapContactComponent res = new StructureMap.StructureMapContactComponent();
13942    parseBackboneProperties(json, res);
13943    if (json.has("name"))
13944      res.setNameElement(parseString(json.get("name").getAsString()));
13945    if (json.has("_name"))
13946      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13947    if (json.has("telecom")) {
13948      JsonArray array = json.getAsJsonArray("telecom");
13949      for (int i = 0; i < array.size(); i++) {
13950        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13951      }
13952    };
13953    return res;
13954  }
13955
13956  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
13957    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
13958    parseBackboneProperties(json, res);
13959    if (json.has("url"))
13960      res.setUrlElement(parseUri(json.get("url").getAsString()));
13961    if (json.has("_url"))
13962      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13963    if (json.has("mode"))
13964      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
13965    if (json.has("_mode"))
13966      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
13967    if (json.has("documentation"))
13968      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
13969    if (json.has("_documentation"))
13970      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
13971    return res;
13972  }
13973
13974  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
13975    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
13976    parseBackboneProperties(json, res);
13977    if (json.has("name"))
13978      res.setNameElement(parseId(json.get("name").getAsString()));
13979    if (json.has("_name"))
13980      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13981    if (json.has("extends"))
13982      res.setExtendsElement(parseId(json.get("extends").getAsString()));
13983    if (json.has("_extends"))
13984      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
13985    if (json.has("documentation"))
13986      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
13987    if (json.has("_documentation"))
13988      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
13989    if (json.has("input")) {
13990      JsonArray array = json.getAsJsonArray("input");
13991      for (int i = 0; i < array.size(); i++) {
13992        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
13993      }
13994    };
13995    if (json.has("rule")) {
13996      JsonArray array = json.getAsJsonArray("rule");
13997      for (int i = 0; i < array.size(); i++) {
13998        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
13999      }
14000    };
14001    return res;
14002  }
14003
14004  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14005    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
14006    parseBackboneProperties(json, res);
14007    if (json.has("name"))
14008      res.setNameElement(parseId(json.get("name").getAsString()));
14009    if (json.has("_name"))
14010      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14011    if (json.has("type"))
14012      res.setTypeElement(parseString(json.get("type").getAsString()));
14013    if (json.has("_type"))
14014      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14015    if (json.has("mode"))
14016      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
14017    if (json.has("_mode"))
14018      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
14019    if (json.has("documentation"))
14020      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
14021    if (json.has("_documentation"))
14022      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
14023    return res;
14024  }
14025
14026  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14027    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
14028    parseBackboneProperties(json, res);
14029    if (json.has("name"))
14030      res.setNameElement(parseId(json.get("name").getAsString()));
14031    if (json.has("_name"))
14032      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14033    if (json.has("source")) {
14034      JsonArray array = json.getAsJsonArray("source");
14035      for (int i = 0; i < array.size(); i++) {
14036        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
14037      }
14038    };
14039    if (json.has("target")) {
14040      JsonArray array = json.getAsJsonArray("target");
14041      for (int i = 0; i < array.size(); i++) {
14042        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
14043      }
14044    };
14045    if (json.has("rule")) {
14046      JsonArray array = json.getAsJsonArray("rule");
14047      for (int i = 0; i < array.size(); i++) {
14048        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
14049      }
14050    };
14051    if (json.has("dependent")) {
14052      JsonArray array = json.getAsJsonArray("dependent");
14053      for (int i = 0; i < array.size(); i++) {
14054        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
14055      }
14056    };
14057    if (json.has("documentation"))
14058      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
14059    if (json.has("_documentation"))
14060      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
14061    return res;
14062  }
14063
14064  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14065    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
14066    parseBackboneProperties(json, res);
14067    if (json.has("required"))
14068      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
14069    if (json.has("_required"))
14070      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
14071    if (json.has("context"))
14072      res.setContextElement(parseId(json.get("context").getAsString()));
14073    if (json.has("_context"))
14074      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
14075    if (json.has("contextType"))
14076      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
14077    if (json.has("_contextType"))
14078      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
14079    if (json.has("element"))
14080      res.setElementElement(parseString(json.get("element").getAsString()));
14081    if (json.has("_element"))
14082      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
14083    if (json.has("listMode"))
14084      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapListMode.NULL, new StructureMap.StructureMapListModeEnumFactory()));
14085    if (json.has("_listMode"))
14086      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
14087    if (json.has("variable"))
14088      res.setVariableElement(parseId(json.get("variable").getAsString()));
14089    if (json.has("_variable"))
14090      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
14091    if (json.has("condition"))
14092      res.setConditionElement(parseString(json.get("condition").getAsString()));
14093    if (json.has("_condition"))
14094      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
14095    if (json.has("check"))
14096      res.setCheckElement(parseString(json.get("check").getAsString()));
14097    if (json.has("_check"))
14098      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
14099    return res;
14100  }
14101
14102  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14103    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
14104    parseBackboneProperties(json, res);
14105    if (json.has("context"))
14106      res.setContextElement(parseId(json.get("context").getAsString()));
14107    if (json.has("_context"))
14108      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
14109    if (json.has("contextType"))
14110      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
14111    if (json.has("_contextType"))
14112      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
14113    if (json.has("element"))
14114      res.setElementElement(parseString(json.get("element").getAsString()));
14115    if (json.has("_element"))
14116      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
14117    if (json.has("variable"))
14118      res.setVariableElement(parseId(json.get("variable").getAsString()));
14119    if (json.has("_variable"))
14120      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
14121    if (json.has("listMode")) {
14122      JsonArray array = json.getAsJsonArray("listMode");
14123      for (int i = 0; i < array.size(); i++) {
14124        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapListMode.NULL, new StructureMap.StructureMapListModeEnumFactory()));
14125      }
14126    };
14127    if (json.has("_listMode")) {
14128      JsonArray array = json.getAsJsonArray("_listMode");
14129      for (int i = 0; i < array.size(); i++) {
14130        if (i == res.getListMode().size())
14131          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapListMode.NULL, new StructureMap.StructureMapListModeEnumFactory()));
14132        if (array.get(i) instanceof JsonObject) 
14133          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
14134      }
14135    };
14136    if (json.has("listRuleId"))
14137      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
14138    if (json.has("_listRuleId"))
14139      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
14140    if (json.has("transform"))
14141      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
14142    if (json.has("_transform"))
14143      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
14144    if (json.has("parameter")) {
14145      JsonArray array = json.getAsJsonArray("parameter");
14146      for (int i = 0; i < array.size(); i++) {
14147        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
14148      }
14149    };
14150    return res;
14151  }
14152
14153  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14154    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
14155    parseBackboneProperties(json, res);
14156    Type value = parseType("value", json);
14157    if (value != null)
14158      res.setValue(value);
14159    return res;
14160  }
14161
14162  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
14163    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
14164    parseBackboneProperties(json, res);
14165    if (json.has("name"))
14166      res.setNameElement(parseId(json.get("name").getAsString()));
14167    if (json.has("_name"))
14168      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14169    if (json.has("variable")) {
14170      JsonArray array = json.getAsJsonArray("variable");
14171      for (int i = 0; i < array.size(); i++) {
14172        res.getVariable().add(parseString(array.get(i).getAsString()));
14173      }
14174    };
14175    if (json.has("_variable")) {
14176      JsonArray array = json.getAsJsonArray("_variable");
14177      for (int i = 0; i < array.size(); i++) {
14178        if (i == res.getVariable().size())
14179          res.getVariable().add(parseString(null));
14180        if (array.get(i) instanceof JsonObject) 
14181          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
14182      }
14183    };
14184    return res;
14185  }
14186
14187  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
14188    Subscription res = new Subscription();
14189    parseDomainResourceProperties(json, res);
14190    if (json.has("criteria"))
14191      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
14192    if (json.has("_criteria"))
14193      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
14194    if (json.has("contact")) {
14195      JsonArray array = json.getAsJsonArray("contact");
14196      for (int i = 0; i < array.size(); i++) {
14197        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
14198      }
14199    };
14200    if (json.has("reason"))
14201      res.setReasonElement(parseString(json.get("reason").getAsString()));
14202    if (json.has("_reason"))
14203      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
14204    if (json.has("status"))
14205      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
14206    if (json.has("_status"))
14207      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14208    if (json.has("error"))
14209      res.setErrorElement(parseString(json.get("error").getAsString()));
14210    if (json.has("_error"))
14211      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
14212    if (json.has("channel"))
14213      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
14214    if (json.has("end"))
14215      res.setEndElement(parseInstant(json.get("end").getAsString()));
14216    if (json.has("_end"))
14217      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
14218    if (json.has("tag")) {
14219      JsonArray array = json.getAsJsonArray("tag");
14220      for (int i = 0; i < array.size(); i++) {
14221        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
14222      }
14223    };
14224    return res;
14225  }
14226
14227  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
14228    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
14229    parseBackboneProperties(json, res);
14230    if (json.has("type"))
14231      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
14232    if (json.has("_type"))
14233      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14234    if (json.has("endpoint"))
14235      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
14236    if (json.has("_endpoint"))
14237      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
14238    if (json.has("payload"))
14239      res.setPayloadElement(parseString(json.get("payload").getAsString()));
14240    if (json.has("_payload"))
14241      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
14242    if (json.has("header"))
14243      res.setHeaderElement(parseString(json.get("header").getAsString()));
14244    if (json.has("_header"))
14245      parseElementProperties(json.getAsJsonObject("_header"), res.getHeaderElement());
14246    return res;
14247  }
14248
14249  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
14250    Substance res = new Substance();
14251    parseDomainResourceProperties(json, res);
14252    if (json.has("identifier")) {
14253      JsonArray array = json.getAsJsonArray("identifier");
14254      for (int i = 0; i < array.size(); i++) {
14255        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14256      }
14257    };
14258    if (json.has("category")) {
14259      JsonArray array = json.getAsJsonArray("category");
14260      for (int i = 0; i < array.size(); i++) {
14261        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14262      }
14263    };
14264    if (json.has("code"))
14265      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14266    if (json.has("description"))
14267      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14268    if (json.has("_description"))
14269      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14270    if (json.has("instance")) {
14271      JsonArray array = json.getAsJsonArray("instance");
14272      for (int i = 0; i < array.size(); i++) {
14273        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
14274      }
14275    };
14276    if (json.has("ingredient")) {
14277      JsonArray array = json.getAsJsonArray("ingredient");
14278      for (int i = 0; i < array.size(); i++) {
14279        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
14280      }
14281    };
14282    return res;
14283  }
14284
14285  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
14286    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
14287    parseBackboneProperties(json, res);
14288    if (json.has("identifier"))
14289      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14290    if (json.has("expiry"))
14291      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
14292    if (json.has("_expiry"))
14293      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
14294    if (json.has("quantity"))
14295      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
14296    return res;
14297  }
14298
14299  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
14300    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
14301    parseBackboneProperties(json, res);
14302    if (json.has("quantity"))
14303      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
14304    if (json.has("substance"))
14305      res.setSubstance(parseReference(json.getAsJsonObject("substance")));
14306    return res;
14307  }
14308
14309  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
14310    SupplyDelivery res = new SupplyDelivery();
14311    parseDomainResourceProperties(json, res);
14312    if (json.has("identifier"))
14313      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14314    if (json.has("status"))
14315      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
14316    if (json.has("_status"))
14317      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14318    if (json.has("patient"))
14319      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14320    if (json.has("type"))
14321      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14322    if (json.has("quantity"))
14323      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
14324    if (json.has("suppliedItem"))
14325      res.setSuppliedItem(parseReference(json.getAsJsonObject("suppliedItem")));
14326    if (json.has("supplier"))
14327      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
14328    if (json.has("whenPrepared"))
14329      res.setWhenPrepared(parsePeriod(json.getAsJsonObject("whenPrepared")));
14330    if (json.has("time"))
14331      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
14332    if (json.has("_time"))
14333      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
14334    if (json.has("destination"))
14335      res.setDestination(parseReference(json.getAsJsonObject("destination")));
14336    if (json.has("receiver")) {
14337      JsonArray array = json.getAsJsonArray("receiver");
14338      for (int i = 0; i < array.size(); i++) {
14339        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
14340      }
14341    };
14342    return res;
14343  }
14344
14345  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
14346    SupplyRequest res = new SupplyRequest();
14347    parseDomainResourceProperties(json, res);
14348    if (json.has("patient"))
14349      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14350    if (json.has("source"))
14351      res.setSource(parseReference(json.getAsJsonObject("source")));
14352    if (json.has("date"))
14353      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14354    if (json.has("_date"))
14355      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14356    if (json.has("identifier"))
14357      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14358    if (json.has("status"))
14359      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
14360    if (json.has("_status"))
14361      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14362    if (json.has("kind"))
14363      res.setKind(parseCodeableConcept(json.getAsJsonObject("kind")));
14364    if (json.has("orderedItem"))
14365      res.setOrderedItem(parseReference(json.getAsJsonObject("orderedItem")));
14366    if (json.has("supplier")) {
14367      JsonArray array = json.getAsJsonArray("supplier");
14368      for (int i = 0; i < array.size(); i++) {
14369        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
14370      }
14371    };
14372    Type reason = parseType("reason", json);
14373    if (reason != null)
14374      res.setReason(reason);
14375    if (json.has("when"))
14376      res.setWhen(parseSupplyRequestSupplyRequestWhenComponent(json.getAsJsonObject("when"), res));
14377    return res;
14378  }
14379
14380  protected SupplyRequest.SupplyRequestWhenComponent parseSupplyRequestSupplyRequestWhenComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
14381    SupplyRequest.SupplyRequestWhenComponent res = new SupplyRequest.SupplyRequestWhenComponent();
14382    parseBackboneProperties(json, res);
14383    if (json.has("code"))
14384      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14385    if (json.has("schedule"))
14386      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
14387    return res;
14388  }
14389
14390  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
14391    Task res = new Task();
14392    parseDomainResourceProperties(json, res);
14393    if (json.has("identifier"))
14394      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14395    if (json.has("type"))
14396      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14397    if (json.has("description"))
14398      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14399    if (json.has("_description"))
14400      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14401    if (json.has("performerType")) {
14402      JsonArray array = json.getAsJsonArray("performerType");
14403      for (int i = 0; i < array.size(); i++) {
14404        res.getPerformerType().add(parseCoding(array.get(i).getAsJsonObject()));
14405      }
14406    };
14407    if (json.has("priority"))
14408      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
14409    if (json.has("_priority"))
14410      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
14411    if (json.has("status"))
14412      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
14413    if (json.has("_status"))
14414      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14415    if (json.has("failureReason"))
14416      res.setFailureReason(parseCodeableConcept(json.getAsJsonObject("failureReason")));
14417    if (json.has("subject"))
14418      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14419    if (json.has("for"))
14420      res.setFor(parseReference(json.getAsJsonObject("for")));
14421    if (json.has("definition"))
14422      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
14423    if (json.has("_definition"))
14424      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
14425    if (json.has("created"))
14426      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
14427    if (json.has("_created"))
14428      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
14429    if (json.has("lastModified"))
14430      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
14431    if (json.has("_lastModified"))
14432      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
14433    if (json.has("creator"))
14434      res.setCreator(parseReference(json.getAsJsonObject("creator")));
14435    if (json.has("owner"))
14436      res.setOwner(parseReference(json.getAsJsonObject("owner")));
14437    if (json.has("parent"))
14438      res.setParent(parseReference(json.getAsJsonObject("parent")));
14439    if (json.has("input")) {
14440      JsonArray array = json.getAsJsonArray("input");
14441      for (int i = 0; i < array.size(); i++) {
14442        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
14443      }
14444    };
14445    if (json.has("output")) {
14446      JsonArray array = json.getAsJsonArray("output");
14447      for (int i = 0; i < array.size(); i++) {
14448        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
14449      }
14450    };
14451    return res;
14452  }
14453
14454  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
14455    Task.ParameterComponent res = new Task.ParameterComponent();
14456    parseBackboneProperties(json, res);
14457    if (json.has("name"))
14458      res.setNameElement(parseString(json.get("name").getAsString()));
14459    if (json.has("_name"))
14460      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14461    Type value = parseType("value", json);
14462    if (value != null)
14463      res.setValue(value);
14464    return res;
14465  }
14466
14467  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
14468    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
14469    parseBackboneProperties(json, res);
14470    if (json.has("name"))
14471      res.setNameElement(parseString(json.get("name").getAsString()));
14472    if (json.has("_name"))
14473      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14474    Type value = parseType("value", json);
14475    if (value != null)
14476      res.setValue(value);
14477    return res;
14478  }
14479
14480  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
14481    TestScript res = new TestScript();
14482    parseDomainResourceProperties(json, res);
14483    if (json.has("url"))
14484      res.setUrlElement(parseUri(json.get("url").getAsString()));
14485    if (json.has("_url"))
14486      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14487    if (json.has("version"))
14488      res.setVersionElement(parseString(json.get("version").getAsString()));
14489    if (json.has("_version"))
14490      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14491    if (json.has("name"))
14492      res.setNameElement(parseString(json.get("name").getAsString()));
14493    if (json.has("_name"))
14494      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14495    if (json.has("status"))
14496      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
14497    if (json.has("_status"))
14498      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14499    if (json.has("identifier"))
14500      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14501    if (json.has("experimental"))
14502      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14503    if (json.has("_experimental"))
14504      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14505    if (json.has("publisher"))
14506      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14507    if (json.has("_publisher"))
14508      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14509    if (json.has("contact")) {
14510      JsonArray array = json.getAsJsonArray("contact");
14511      for (int i = 0; i < array.size(); i++) {
14512        res.getContact().add(parseTestScriptTestScriptContactComponent(array.get(i).getAsJsonObject(), res));
14513      }
14514    };
14515    if (json.has("date"))
14516      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14517    if (json.has("_date"))
14518      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14519    if (json.has("description"))
14520      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14521    if (json.has("_description"))
14522      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14523    if (json.has("useContext")) {
14524      JsonArray array = json.getAsJsonArray("useContext");
14525      for (int i = 0; i < array.size(); i++) {
14526        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14527      }
14528    };
14529    if (json.has("requirements"))
14530      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
14531    if (json.has("_requirements"))
14532      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
14533    if (json.has("copyright"))
14534      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
14535    if (json.has("_copyright"))
14536      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14537    if (json.has("origin")) {
14538      JsonArray array = json.getAsJsonArray("origin");
14539      for (int i = 0; i < array.size(); i++) {
14540        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
14541      }
14542    };
14543    if (json.has("destination")) {
14544      JsonArray array = json.getAsJsonArray("destination");
14545      for (int i = 0; i < array.size(); i++) {
14546        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
14547      }
14548    };
14549    if (json.has("metadata"))
14550      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
14551    if (json.has("fixture")) {
14552      JsonArray array = json.getAsJsonArray("fixture");
14553      for (int i = 0; i < array.size(); i++) {
14554        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
14555      }
14556    };
14557    if (json.has("profile")) {
14558      JsonArray array = json.getAsJsonArray("profile");
14559      for (int i = 0; i < array.size(); i++) {
14560        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
14561      }
14562    };
14563    if (json.has("variable")) {
14564      JsonArray array = json.getAsJsonArray("variable");
14565      for (int i = 0; i < array.size(); i++) {
14566        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
14567      }
14568    };
14569    if (json.has("rule")) {
14570      JsonArray array = json.getAsJsonArray("rule");
14571      for (int i = 0; i < array.size(); i++) {
14572        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
14573      }
14574    };
14575    if (json.has("ruleset")) {
14576      JsonArray array = json.getAsJsonArray("ruleset");
14577      for (int i = 0; i < array.size(); i++) {
14578        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
14579      }
14580    };
14581    if (json.has("setup"))
14582      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
14583    if (json.has("test")) {
14584      JsonArray array = json.getAsJsonArray("test");
14585      for (int i = 0; i < array.size(); i++) {
14586        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
14587      }
14588    };
14589    if (json.has("teardown"))
14590      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
14591    return res;
14592  }
14593
14594  protected TestScript.TestScriptContactComponent parseTestScriptTestScriptContactComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14595    TestScript.TestScriptContactComponent res = new TestScript.TestScriptContactComponent();
14596    parseBackboneProperties(json, res);
14597    if (json.has("name"))
14598      res.setNameElement(parseString(json.get("name").getAsString()));
14599    if (json.has("_name"))
14600      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14601    if (json.has("telecom")) {
14602      JsonArray array = json.getAsJsonArray("telecom");
14603      for (int i = 0; i < array.size(); i++) {
14604        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14605      }
14606    };
14607    return res;
14608  }
14609
14610  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14611    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
14612    parseBackboneProperties(json, res);
14613    if (json.has("index"))
14614      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
14615    if (json.has("_index"))
14616      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
14617    if (json.has("profile"))
14618      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
14619    return res;
14620  }
14621
14622  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14623    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
14624    parseBackboneProperties(json, res);
14625    if (json.has("index"))
14626      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
14627    if (json.has("_index"))
14628      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
14629    if (json.has("profile"))
14630      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
14631    return res;
14632  }
14633
14634  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14635    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
14636    parseBackboneProperties(json, res);
14637    if (json.has("link")) {
14638      JsonArray array = json.getAsJsonArray("link");
14639      for (int i = 0; i < array.size(); i++) {
14640        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
14641      }
14642    };
14643    if (json.has("capability")) {
14644      JsonArray array = json.getAsJsonArray("capability");
14645      for (int i = 0; i < array.size(); i++) {
14646        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
14647      }
14648    };
14649    return res;
14650  }
14651
14652  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14653    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
14654    parseBackboneProperties(json, res);
14655    if (json.has("url"))
14656      res.setUrlElement(parseUri(json.get("url").getAsString()));
14657    if (json.has("_url"))
14658      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14659    if (json.has("description"))
14660      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14661    if (json.has("_description"))
14662      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14663    return res;
14664  }
14665
14666  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14667    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
14668    parseBackboneProperties(json, res);
14669    if (json.has("required"))
14670      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
14671    if (json.has("_required"))
14672      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
14673    if (json.has("validated"))
14674      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
14675    if (json.has("_validated"))
14676      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
14677    if (json.has("description"))
14678      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14679    if (json.has("_description"))
14680      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14681    if (json.has("origin")) {
14682      JsonArray array = json.getAsJsonArray("origin");
14683      for (int i = 0; i < array.size(); i++) {
14684        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
14685      }
14686    };
14687    if (json.has("_origin")) {
14688      JsonArray array = json.getAsJsonArray("_origin");
14689      for (int i = 0; i < array.size(); i++) {
14690        if (i == res.getOrigin().size())
14691          res.getOrigin().add(parseInteger(null));
14692        if (array.get(i) instanceof JsonObject) 
14693          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
14694      }
14695    };
14696    if (json.has("destination"))
14697      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
14698    if (json.has("_destination"))
14699      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
14700    if (json.has("link")) {
14701      JsonArray array = json.getAsJsonArray("link");
14702      for (int i = 0; i < array.size(); i++) {
14703        res.getLink().add(parseUri(array.get(i).getAsString()));
14704      }
14705    };
14706    if (json.has("_link")) {
14707      JsonArray array = json.getAsJsonArray("_link");
14708      for (int i = 0; i < array.size(); i++) {
14709        if (i == res.getLink().size())
14710          res.getLink().add(parseUri(null));
14711        if (array.get(i) instanceof JsonObject) 
14712          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
14713      }
14714    };
14715    if (json.has("conformance"))
14716      res.setConformance(parseReference(json.getAsJsonObject("conformance")));
14717    return res;
14718  }
14719
14720  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14721    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
14722    parseBackboneProperties(json, res);
14723    if (json.has("autocreate"))
14724      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
14725    if (json.has("_autocreate"))
14726      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
14727    if (json.has("autodelete"))
14728      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
14729    if (json.has("_autodelete"))
14730      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
14731    if (json.has("resource"))
14732      res.setResource(parseReference(json.getAsJsonObject("resource")));
14733    return res;
14734  }
14735
14736  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14737    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
14738    parseBackboneProperties(json, res);
14739    if (json.has("name"))
14740      res.setNameElement(parseString(json.get("name").getAsString()));
14741    if (json.has("_name"))
14742      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14743    if (json.has("defaultValue"))
14744      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
14745    if (json.has("_defaultValue"))
14746      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
14747    if (json.has("headerField"))
14748      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
14749    if (json.has("_headerField"))
14750      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
14751    if (json.has("path"))
14752      res.setPathElement(parseString(json.get("path").getAsString()));
14753    if (json.has("_path"))
14754      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
14755    if (json.has("sourceId"))
14756      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
14757    if (json.has("_sourceId"))
14758      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
14759    return res;
14760  }
14761
14762  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14763    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
14764    parseBackboneProperties(json, res);
14765    if (json.has("resource"))
14766      res.setResource(parseReference(json.getAsJsonObject("resource")));
14767    if (json.has("param")) {
14768      JsonArray array = json.getAsJsonArray("param");
14769      for (int i = 0; i < array.size(); i++) {
14770        res.getParam().add(parseTestScriptTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
14771      }
14772    };
14773    return res;
14774  }
14775
14776  protected TestScript.TestScriptRuleParamComponent parseTestScriptTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14777    TestScript.TestScriptRuleParamComponent res = new TestScript.TestScriptRuleParamComponent();
14778    parseBackboneProperties(json, res);
14779    if (json.has("name"))
14780      res.setNameElement(parseString(json.get("name").getAsString()));
14781    if (json.has("_name"))
14782      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14783    if (json.has("value"))
14784      res.setValueElement(parseString(json.get("value").getAsString()));
14785    if (json.has("_value"))
14786      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14787    return res;
14788  }
14789
14790  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14791    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
14792    parseBackboneProperties(json, res);
14793    if (json.has("resource"))
14794      res.setResource(parseReference(json.getAsJsonObject("resource")));
14795    if (json.has("rule")) {
14796      JsonArray array = json.getAsJsonArray("rule");
14797      for (int i = 0; i < array.size(); i++) {
14798        res.getRule().add(parseTestScriptTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
14799      }
14800    };
14801    return res;
14802  }
14803
14804  protected TestScript.TestScriptRulesetRuleComponent parseTestScriptTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14805    TestScript.TestScriptRulesetRuleComponent res = new TestScript.TestScriptRulesetRuleComponent();
14806    parseBackboneProperties(json, res);
14807    if (json.has("ruleId"))
14808      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
14809    if (json.has("_ruleId"))
14810      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
14811    if (json.has("param")) {
14812      JsonArray array = json.getAsJsonArray("param");
14813      for (int i = 0; i < array.size(); i++) {
14814        res.getParam().add(parseTestScriptTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
14815      }
14816    };
14817    return res;
14818  }
14819
14820  protected TestScript.TestScriptRulesetRuleParamComponent parseTestScriptTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14821    TestScript.TestScriptRulesetRuleParamComponent res = new TestScript.TestScriptRulesetRuleParamComponent();
14822    parseBackboneProperties(json, res);
14823    if (json.has("name"))
14824      res.setNameElement(parseString(json.get("name").getAsString()));
14825    if (json.has("_name"))
14826      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14827    if (json.has("value"))
14828      res.setValueElement(parseString(json.get("value").getAsString()));
14829    if (json.has("_value"))
14830      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14831    return res;
14832  }
14833
14834  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14835    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
14836    parseBackboneProperties(json, res);
14837    if (json.has("metadata"))
14838      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
14839    if (json.has("action")) {
14840      JsonArray array = json.getAsJsonArray("action");
14841      for (int i = 0; i < array.size(); i++) {
14842        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
14843      }
14844    };
14845    return res;
14846  }
14847
14848  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14849    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
14850    parseBackboneProperties(json, res);
14851    if (json.has("operation"))
14852      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
14853    if (json.has("assert"))
14854      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
14855    return res;
14856  }
14857
14858  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14859    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
14860    parseBackboneProperties(json, res);
14861    if (json.has("type"))
14862      res.setType(parseCoding(json.getAsJsonObject("type")));
14863    if (json.has("resource"))
14864      res.setResourceElement(parseCode(json.get("resource").getAsString()));
14865    if (json.has("_resource"))
14866      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
14867    if (json.has("label"))
14868      res.setLabelElement(parseString(json.get("label").getAsString()));
14869    if (json.has("_label"))
14870      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
14871    if (json.has("description"))
14872      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14873    if (json.has("_description"))
14874      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14875    if (json.has("accept"))
14876      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
14877    if (json.has("_accept"))
14878      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
14879    if (json.has("contentType"))
14880      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
14881    if (json.has("_contentType"))
14882      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
14883    if (json.has("destination"))
14884      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
14885    if (json.has("_destination"))
14886      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
14887    if (json.has("encodeRequestUrl"))
14888      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
14889    if (json.has("_encodeRequestUrl"))
14890      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
14891    if (json.has("origin"))
14892      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
14893    if (json.has("_origin"))
14894      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
14895    if (json.has("params"))
14896      res.setParamsElement(parseString(json.get("params").getAsString()));
14897    if (json.has("_params"))
14898      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
14899    if (json.has("requestHeader")) {
14900      JsonArray array = json.getAsJsonArray("requestHeader");
14901      for (int i = 0; i < array.size(); i++) {
14902        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
14903      }
14904    };
14905    if (json.has("responseId"))
14906      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
14907    if (json.has("_responseId"))
14908      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
14909    if (json.has("sourceId"))
14910      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
14911    if (json.has("_sourceId"))
14912      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
14913    if (json.has("targetId"))
14914      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
14915    if (json.has("_targetId"))
14916      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
14917    if (json.has("url"))
14918      res.setUrlElement(parseString(json.get("url").getAsString()));
14919    if (json.has("_url"))
14920      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14921    return res;
14922  }
14923
14924  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14925    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
14926    parseBackboneProperties(json, res);
14927    if (json.has("field"))
14928      res.setFieldElement(parseString(json.get("field").getAsString()));
14929    if (json.has("_field"))
14930      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
14931    if (json.has("value"))
14932      res.setValueElement(parseString(json.get("value").getAsString()));
14933    if (json.has("_value"))
14934      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14935    return res;
14936  }
14937
14938  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
14939    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
14940    parseBackboneProperties(json, res);
14941    if (json.has("label"))
14942      res.setLabelElement(parseString(json.get("label").getAsString()));
14943    if (json.has("_label"))
14944      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
14945    if (json.has("description"))
14946      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14947    if (json.has("_description"))
14948      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14949    if (json.has("direction"))
14950      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
14951    if (json.has("_direction"))
14952      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
14953    if (json.has("compareToSourceId"))
14954      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
14955    if (json.has("_compareToSourceId"))
14956      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
14957    if (json.has("compareToSourcePath"))
14958      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
14959    if (json.has("_compareToSourcePath"))
14960      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
14961    if (json.has("contentType"))
14962      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
14963    if (json.has("_contentType"))
14964      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
14965    if (json.has("headerField"))
14966      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
14967    if (json.has("_headerField"))
14968      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
14969    if (json.has("minimumId"))
14970      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
14971    if (json.has("_minimumId"))
14972      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
14973    if (json.has("navigationLinks"))
14974      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
14975    if (json.has("_navigationLinks"))
14976      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
14977    if (json.has("operator"))
14978      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
14979    if (json.has("_operator"))
14980      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
14981    if (json.has("path"))
14982      res.setPathElement(parseString(json.get("path").getAsString()));
14983    if (json.has("_path"))
14984      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
14985    if (json.has("resource"))
14986      res.setResourceElement(parseCode(json.get("resource").getAsString()));
14987    if (json.has("_resource"))
14988      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
14989    if (json.has("response"))
14990      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
14991    if (json.has("_response"))
14992      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
14993    if (json.has("responseCode"))
14994      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
14995    if (json.has("_responseCode"))
14996      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
14997    if (json.has("rule"))
14998      res.setRule(parseTestScriptSetupActionAssertRuleComponent(json.getAsJsonObject("rule"), owner));
14999    if (json.has("ruleset"))
15000      res.setRuleset(parseTestScriptSetupActionAssertRulesetComponent(json.getAsJsonObject("ruleset"), owner));
15001    if (json.has("sourceId"))
15002      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
15003    if (json.has("_sourceId"))
15004      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
15005    if (json.has("validateProfileId"))
15006      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
15007    if (json.has("_validateProfileId"))
15008      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
15009    if (json.has("value"))
15010      res.setValueElement(parseString(json.get("value").getAsString()));
15011    if (json.has("_value"))
15012      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15013    if (json.has("warningOnly"))
15014      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
15015    if (json.has("_warningOnly"))
15016      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
15017    return res;
15018  }
15019
15020  protected TestScript.SetupActionAssertRuleComponent parseTestScriptSetupActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15021    TestScript.SetupActionAssertRuleComponent res = new TestScript.SetupActionAssertRuleComponent();
15022    parseBackboneProperties(json, res);
15023    if (json.has("ruleId"))
15024      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
15025    if (json.has("_ruleId"))
15026      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
15027    if (json.has("param")) {
15028      JsonArray array = json.getAsJsonArray("param");
15029      for (int i = 0; i < array.size(); i++) {
15030        res.getParam().add(parseTestScriptSetupActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
15031      }
15032    };
15033    return res;
15034  }
15035
15036  protected TestScript.SetupActionAssertRuleParamComponent parseTestScriptSetupActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15037    TestScript.SetupActionAssertRuleParamComponent res = new TestScript.SetupActionAssertRuleParamComponent();
15038    parseBackboneProperties(json, res);
15039    if (json.has("name"))
15040      res.setNameElement(parseString(json.get("name").getAsString()));
15041    if (json.has("_name"))
15042      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15043    if (json.has("value"))
15044      res.setValueElement(parseString(json.get("value").getAsString()));
15045    if (json.has("_value"))
15046      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15047    return res;
15048  }
15049
15050  protected TestScript.SetupActionAssertRulesetComponent parseTestScriptSetupActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15051    TestScript.SetupActionAssertRulesetComponent res = new TestScript.SetupActionAssertRulesetComponent();
15052    parseBackboneProperties(json, res);
15053    if (json.has("rulesetId"))
15054      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
15055    if (json.has("_rulesetId"))
15056      parseElementProperties(json.getAsJsonObject("_rulesetId"), res.getRulesetIdElement());
15057    if (json.has("rule")) {
15058      JsonArray array = json.getAsJsonArray("rule");
15059      for (int i = 0; i < array.size(); i++) {
15060        res.getRule().add(parseTestScriptSetupActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
15061      }
15062    };
15063    return res;
15064  }
15065
15066  protected TestScript.SetupActionAssertRulesetRuleComponent parseTestScriptSetupActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15067    TestScript.SetupActionAssertRulesetRuleComponent res = new TestScript.SetupActionAssertRulesetRuleComponent();
15068    parseBackboneProperties(json, res);
15069    if (json.has("ruleId"))
15070      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
15071    if (json.has("_ruleId"))
15072      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
15073    if (json.has("param")) {
15074      JsonArray array = json.getAsJsonArray("param");
15075      for (int i = 0; i < array.size(); i++) {
15076        res.getParam().add(parseTestScriptSetupActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
15077      }
15078    };
15079    return res;
15080  }
15081
15082  protected TestScript.SetupActionAssertRulesetRuleParamComponent parseTestScriptSetupActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15083    TestScript.SetupActionAssertRulesetRuleParamComponent res = new TestScript.SetupActionAssertRulesetRuleParamComponent();
15084    parseBackboneProperties(json, res);
15085    if (json.has("name"))
15086      res.setNameElement(parseString(json.get("name").getAsString()));
15087    if (json.has("_name"))
15088      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15089    if (json.has("value"))
15090      res.setValueElement(parseString(json.get("value").getAsString()));
15091    if (json.has("_value"))
15092      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15093    return res;
15094  }
15095
15096  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15097    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
15098    parseBackboneProperties(json, res);
15099    if (json.has("name"))
15100      res.setNameElement(parseString(json.get("name").getAsString()));
15101    if (json.has("_name"))
15102      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15103    if (json.has("description"))
15104      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15105    if (json.has("_description"))
15106      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15107    if (json.has("metadata"))
15108      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
15109    if (json.has("action")) {
15110      JsonArray array = json.getAsJsonArray("action");
15111      for (int i = 0; i < array.size(); i++) {
15112        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
15113      }
15114    };
15115    return res;
15116  }
15117
15118  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15119    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
15120    parseBackboneProperties(json, res);
15121    if (json.has("operation"))
15122      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
15123    if (json.has("assert"))
15124      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
15125    return res;
15126  }
15127
15128  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15129    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
15130    parseBackboneProperties(json, res);
15131    if (json.has("action")) {
15132      JsonArray array = json.getAsJsonArray("action");
15133      for (int i = 0; i < array.size(); i++) {
15134        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
15135      }
15136    };
15137    return res;
15138  }
15139
15140  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
15141    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
15142    parseBackboneProperties(json, res);
15143    if (json.has("operation"))
15144      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
15145    return res;
15146  }
15147
15148  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
15149    ValueSet res = new ValueSet();
15150    parseDomainResourceProperties(json, res);
15151    if (json.has("url"))
15152      res.setUrlElement(parseUri(json.get("url").getAsString()));
15153    if (json.has("_url"))
15154      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15155    if (json.has("identifier"))
15156      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15157    if (json.has("version"))
15158      res.setVersionElement(parseString(json.get("version").getAsString()));
15159    if (json.has("_version"))
15160      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15161    if (json.has("name"))
15162      res.setNameElement(parseString(json.get("name").getAsString()));
15163    if (json.has("_name"))
15164      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15165    if (json.has("status"))
15166      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
15167    if (json.has("_status"))
15168      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15169    if (json.has("experimental"))
15170      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15171    if (json.has("_experimental"))
15172      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15173    if (json.has("publisher"))
15174      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15175    if (json.has("_publisher"))
15176      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15177    if (json.has("contact")) {
15178      JsonArray array = json.getAsJsonArray("contact");
15179      for (int i = 0; i < array.size(); i++) {
15180        res.getContact().add(parseValueSetValueSetContactComponent(array.get(i).getAsJsonObject(), res));
15181      }
15182    };
15183    if (json.has("date"))
15184      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15185    if (json.has("_date"))
15186      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15187    if (json.has("lockedDate"))
15188      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
15189    if (json.has("_lockedDate"))
15190      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
15191    if (json.has("description"))
15192      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15193    if (json.has("_description"))
15194      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15195    if (json.has("useContext")) {
15196      JsonArray array = json.getAsJsonArray("useContext");
15197      for (int i = 0; i < array.size(); i++) {
15198        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15199      }
15200    };
15201    if (json.has("immutable"))
15202      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
15203    if (json.has("_immutable"))
15204      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
15205    if (json.has("requirements"))
15206      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
15207    if (json.has("_requirements"))
15208      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
15209    if (json.has("copyright"))
15210      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
15211    if (json.has("_copyright"))
15212      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15213    if (json.has("extensible"))
15214      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
15215    if (json.has("_extensible"))
15216      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
15217    if (json.has("compose"))
15218      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
15219    if (json.has("expansion"))
15220      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
15221    return res;
15222  }
15223
15224  protected ValueSet.ValueSetContactComponent parseValueSetValueSetContactComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15225    ValueSet.ValueSetContactComponent res = new ValueSet.ValueSetContactComponent();
15226    parseBackboneProperties(json, res);
15227    if (json.has("name"))
15228      res.setNameElement(parseString(json.get("name").getAsString()));
15229    if (json.has("_name"))
15230      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15231    if (json.has("telecom")) {
15232      JsonArray array = json.getAsJsonArray("telecom");
15233      for (int i = 0; i < array.size(); i++) {
15234        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15235      }
15236    };
15237    return res;
15238  }
15239
15240  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15241    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
15242    parseBackboneProperties(json, res);
15243    if (json.has("import")) {
15244      JsonArray array = json.getAsJsonArray("import");
15245      for (int i = 0; i < array.size(); i++) {
15246        res.getImport().add(parseUri(array.get(i).getAsString()));
15247      }
15248    };
15249    if (json.has("_import")) {
15250      JsonArray array = json.getAsJsonArray("_import");
15251      for (int i = 0; i < array.size(); i++) {
15252        if (i == res.getImport().size())
15253          res.getImport().add(parseUri(null));
15254        if (array.get(i) instanceof JsonObject) 
15255          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
15256      }
15257    };
15258    if (json.has("include")) {
15259      JsonArray array = json.getAsJsonArray("include");
15260      for (int i = 0; i < array.size(); i++) {
15261        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
15262      }
15263    };
15264    if (json.has("exclude")) {
15265      JsonArray array = json.getAsJsonArray("exclude");
15266      for (int i = 0; i < array.size(); i++) {
15267        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
15268      }
15269    };
15270    return res;
15271  }
15272
15273  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15274    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
15275    parseBackboneProperties(json, res);
15276    if (json.has("system"))
15277      res.setSystemElement(parseUri(json.get("system").getAsString()));
15278    if (json.has("_system"))
15279      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
15280    if (json.has("version"))
15281      res.setVersionElement(parseString(json.get("version").getAsString()));
15282    if (json.has("_version"))
15283      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15284    if (json.has("concept")) {
15285      JsonArray array = json.getAsJsonArray("concept");
15286      for (int i = 0; i < array.size(); i++) {
15287        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
15288      }
15289    };
15290    if (json.has("filter")) {
15291      JsonArray array = json.getAsJsonArray("filter");
15292      for (int i = 0; i < array.size(); i++) {
15293        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
15294      }
15295    };
15296    return res;
15297  }
15298
15299  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15300    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
15301    parseBackboneProperties(json, res);
15302    if (json.has("code"))
15303      res.setCodeElement(parseCode(json.get("code").getAsString()));
15304    if (json.has("_code"))
15305      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15306    if (json.has("display"))
15307      res.setDisplayElement(parseString(json.get("display").getAsString()));
15308    if (json.has("_display"))
15309      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
15310    if (json.has("designation")) {
15311      JsonArray array = json.getAsJsonArray("designation");
15312      for (int i = 0; i < array.size(); i++) {
15313        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
15314      }
15315    };
15316    return res;
15317  }
15318
15319  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15320    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
15321    parseBackboneProperties(json, res);
15322    if (json.has("language"))
15323      res.setLanguageElement(parseCode(json.get("language").getAsString()));
15324    if (json.has("_language"))
15325      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
15326    if (json.has("use"))
15327      res.setUse(parseCoding(json.getAsJsonObject("use")));
15328    if (json.has("value"))
15329      res.setValueElement(parseString(json.get("value").getAsString()));
15330    if (json.has("_value"))
15331      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15332    return res;
15333  }
15334
15335  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15336    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
15337    parseBackboneProperties(json, res);
15338    if (json.has("property"))
15339      res.setPropertyElement(parseCode(json.get("property").getAsString()));
15340    if (json.has("_property"))
15341      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
15342    if (json.has("op"))
15343      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
15344    if (json.has("_op"))
15345      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
15346    if (json.has("value"))
15347      res.setValueElement(parseCode(json.get("value").getAsString()));
15348    if (json.has("_value"))
15349      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15350    return res;
15351  }
15352
15353  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15354    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
15355    parseBackboneProperties(json, res);
15356    if (json.has("identifier"))
15357      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
15358    if (json.has("_identifier"))
15359      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
15360    if (json.has("timestamp"))
15361      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
15362    if (json.has("_timestamp"))
15363      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
15364    if (json.has("total"))
15365      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
15366    if (json.has("_total"))
15367      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
15368    if (json.has("offset"))
15369      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
15370    if (json.has("_offset"))
15371      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
15372    if (json.has("parameter")) {
15373      JsonArray array = json.getAsJsonArray("parameter");
15374      for (int i = 0; i < array.size(); i++) {
15375        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
15376      }
15377    };
15378    if (json.has("contains")) {
15379      JsonArray array = json.getAsJsonArray("contains");
15380      for (int i = 0; i < array.size(); i++) {
15381        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
15382      }
15383    };
15384    return res;
15385  }
15386
15387  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15388    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
15389    parseBackboneProperties(json, res);
15390    if (json.has("name"))
15391      res.setNameElement(parseString(json.get("name").getAsString()));
15392    if (json.has("_name"))
15393      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15394    Type value = parseType("value", json);
15395    if (value != null)
15396      res.setValue(value);
15397    return res;
15398  }
15399
15400  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
15401    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
15402    parseBackboneProperties(json, res);
15403    if (json.has("system"))
15404      res.setSystemElement(parseUri(json.get("system").getAsString()));
15405    if (json.has("_system"))
15406      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
15407    if (json.has("abstract"))
15408      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
15409    if (json.has("_abstract"))
15410      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
15411    if (json.has("version"))
15412      res.setVersionElement(parseString(json.get("version").getAsString()));
15413    if (json.has("_version"))
15414      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15415    if (json.has("code"))
15416      res.setCodeElement(parseCode(json.get("code").getAsString()));
15417    if (json.has("_code"))
15418      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15419    if (json.has("display"))
15420      res.setDisplayElement(parseString(json.get("display").getAsString()));
15421    if (json.has("_display"))
15422      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
15423    if (json.has("contains")) {
15424      JsonArray array = json.getAsJsonArray("contains");
15425      for (int i = 0; i < array.size(); i++) {
15426        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
15427      }
15428    };
15429    return res;
15430  }
15431
15432  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
15433    VisionPrescription res = new VisionPrescription();
15434    parseDomainResourceProperties(json, res);
15435    if (json.has("identifier")) {
15436      JsonArray array = json.getAsJsonArray("identifier");
15437      for (int i = 0; i < array.size(); i++) {
15438        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15439      }
15440    };
15441    if (json.has("dateWritten"))
15442      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
15443    if (json.has("_dateWritten"))
15444      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
15445    if (json.has("patient"))
15446      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15447    if (json.has("prescriber"))
15448      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
15449    if (json.has("encounter"))
15450      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
15451    Type reason = parseType("reason", json);
15452    if (reason != null)
15453      res.setReason(reason);
15454    if (json.has("dispense")) {
15455      JsonArray array = json.getAsJsonArray("dispense");
15456      for (int i = 0; i < array.size(); i++) {
15457        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
15458      }
15459    };
15460    return res;
15461  }
15462
15463  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
15464    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
15465    parseBackboneProperties(json, res);
15466    if (json.has("product"))
15467      res.setProduct(parseCoding(json.getAsJsonObject("product")));
15468    if (json.has("eye"))
15469      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
15470    if (json.has("_eye"))
15471      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
15472    if (json.has("sphere"))
15473      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
15474    if (json.has("_sphere"))
15475      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
15476    if (json.has("cylinder"))
15477      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
15478    if (json.has("_cylinder"))
15479      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
15480    if (json.has("axis"))
15481      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
15482    if (json.has("_axis"))
15483      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
15484    if (json.has("prism"))
15485      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
15486    if (json.has("_prism"))
15487      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
15488    if (json.has("base"))
15489      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
15490    if (json.has("_base"))
15491      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
15492    if (json.has("add"))
15493      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
15494    if (json.has("_add"))
15495      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
15496    if (json.has("power"))
15497      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
15498    if (json.has("_power"))
15499      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
15500    if (json.has("backCurve"))
15501      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
15502    if (json.has("_backCurve"))
15503      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
15504    if (json.has("diameter"))
15505      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
15506    if (json.has("_diameter"))
15507      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
15508    if (json.has("duration"))
15509      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
15510    if (json.has("color"))
15511      res.setColorElement(parseString(json.get("color").getAsString()));
15512    if (json.has("_color"))
15513      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
15514    if (json.has("brand"))
15515      res.setBrandElement(parseString(json.get("brand").getAsString()));
15516    if (json.has("_brand"))
15517      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
15518    if (json.has("notes"))
15519      res.setNotesElement(parseString(json.get("notes").getAsString()));
15520    if (json.has("_notes"))
15521      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
15522    return res;
15523  }
15524
15525  @Override
15526  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
15527    if (!json.has("resourceType")) {
15528      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
15529    }
15530    String t = json.get("resourceType").getAsString();
15531    if (Utilities.noString(t))
15532      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
15533    if (t.equals("Parameters"))
15534      return parseParameters(json);
15535    else if (t.equals("Account"))
15536      return parseAccount(json);
15537    else if (t.equals("AllergyIntolerance"))
15538      return parseAllergyIntolerance(json);
15539    else if (t.equals("Appointment"))
15540      return parseAppointment(json);
15541    else if (t.equals("AppointmentResponse"))
15542      return parseAppointmentResponse(json);
15543    else if (t.equals("AuditEvent"))
15544      return parseAuditEvent(json);
15545    else if (t.equals("Basic"))
15546      return parseBasic(json);
15547    else if (t.equals("Binary"))
15548      return parseBinary(json);
15549    else if (t.equals("BodySite"))
15550      return parseBodySite(json);
15551    else if (t.equals("Bundle"))
15552      return parseBundle(json);
15553    else if (t.equals("CarePlan"))
15554      return parseCarePlan(json);
15555    else if (t.equals("CareTeam"))
15556      return parseCareTeam(json);
15557    else if (t.equals("Claim"))
15558      return parseClaim(json);
15559    else if (t.equals("ClaimResponse"))
15560      return parseClaimResponse(json);
15561    else if (t.equals("ClinicalImpression"))
15562      return parseClinicalImpression(json);
15563    else if (t.equals("CodeSystem"))
15564      return parseCodeSystem(json);
15565    else if (t.equals("Communication"))
15566      return parseCommunication(json);
15567    else if (t.equals("CommunicationRequest"))
15568      return parseCommunicationRequest(json);
15569    else if (t.equals("CompartmentDefinition"))
15570      return parseCompartmentDefinition(json);
15571    else if (t.equals("Composition"))
15572      return parseComposition(json);
15573    else if (t.equals("ConceptMap"))
15574      return parseConceptMap(json);
15575    else if (t.equals("Condition"))
15576      return parseCondition(json);
15577    else if (t.equals("Conformance"))
15578      return parseConformance(json);
15579    else if (t.equals("Contract"))
15580      return parseContract(json);
15581    else if (t.equals("Coverage"))
15582      return parseCoverage(json);
15583    else if (t.equals("DataElement"))
15584      return parseDataElement(json);
15585    else if (t.equals("DecisionSupportRule"))
15586      return parseDecisionSupportRule(json);
15587    else if (t.equals("DecisionSupportServiceModule"))
15588      return parseDecisionSupportServiceModule(json);
15589    else if (t.equals("DetectedIssue"))
15590      return parseDetectedIssue(json);
15591    else if (t.equals("Device"))
15592      return parseDevice(json);
15593    else if (t.equals("DeviceComponent"))
15594      return parseDeviceComponent(json);
15595    else if (t.equals("DeviceMetric"))
15596      return parseDeviceMetric(json);
15597    else if (t.equals("DeviceUseRequest"))
15598      return parseDeviceUseRequest(json);
15599    else if (t.equals("DeviceUseStatement"))
15600      return parseDeviceUseStatement(json);
15601    else if (t.equals("DiagnosticOrder"))
15602      return parseDiagnosticOrder(json);
15603    else if (t.equals("DiagnosticReport"))
15604      return parseDiagnosticReport(json);
15605    else if (t.equals("DocumentManifest"))
15606      return parseDocumentManifest(json);
15607    else if (t.equals("DocumentReference"))
15608      return parseDocumentReference(json);
15609    else if (t.equals("EligibilityRequest"))
15610      return parseEligibilityRequest(json);
15611    else if (t.equals("EligibilityResponse"))
15612      return parseEligibilityResponse(json);
15613    else if (t.equals("Encounter"))
15614      return parseEncounter(json);
15615    else if (t.equals("EnrollmentRequest"))
15616      return parseEnrollmentRequest(json);
15617    else if (t.equals("EnrollmentResponse"))
15618      return parseEnrollmentResponse(json);
15619    else if (t.equals("EpisodeOfCare"))
15620      return parseEpisodeOfCare(json);
15621    else if (t.equals("ExpansionProfile"))
15622      return parseExpansionProfile(json);
15623    else if (t.equals("ExplanationOfBenefit"))
15624      return parseExplanationOfBenefit(json);
15625    else if (t.equals("FamilyMemberHistory"))
15626      return parseFamilyMemberHistory(json);
15627    else if (t.equals("Flag"))
15628      return parseFlag(json);
15629    else if (t.equals("Goal"))
15630      return parseGoal(json);
15631    else if (t.equals("Group"))
15632      return parseGroup(json);
15633    else if (t.equals("GuidanceResponse"))
15634      return parseGuidanceResponse(json);
15635    else if (t.equals("HealthcareService"))
15636      return parseHealthcareService(json);
15637    else if (t.equals("ImagingExcerpt"))
15638      return parseImagingExcerpt(json);
15639    else if (t.equals("ImagingObjectSelection"))
15640      return parseImagingObjectSelection(json);
15641    else if (t.equals("ImagingStudy"))
15642      return parseImagingStudy(json);
15643    else if (t.equals("Immunization"))
15644      return parseImmunization(json);
15645    else if (t.equals("ImmunizationRecommendation"))
15646      return parseImmunizationRecommendation(json);
15647    else if (t.equals("ImplementationGuide"))
15648      return parseImplementationGuide(json);
15649    else if (t.equals("Library"))
15650      return parseLibrary(json);
15651    else if (t.equals("Linkage"))
15652      return parseLinkage(json);
15653    else if (t.equals("List"))
15654      return parseListResource(json);
15655    else if (t.equals("Location"))
15656      return parseLocation(json);
15657    else if (t.equals("Measure"))
15658      return parseMeasure(json);
15659    else if (t.equals("MeasureReport"))
15660      return parseMeasureReport(json);
15661    else if (t.equals("Media"))
15662      return parseMedia(json);
15663    else if (t.equals("Medication"))
15664      return parseMedication(json);
15665    else if (t.equals("MedicationAdministration"))
15666      return parseMedicationAdministration(json);
15667    else if (t.equals("MedicationDispense"))
15668      return parseMedicationDispense(json);
15669    else if (t.equals("MedicationOrder"))
15670      return parseMedicationOrder(json);
15671    else if (t.equals("MedicationStatement"))
15672      return parseMedicationStatement(json);
15673    else if (t.equals("MessageHeader"))
15674      return parseMessageHeader(json);
15675    else if (t.equals("ModuleDefinition"))
15676      return parseModuleDefinition(json);
15677    else if (t.equals("NamingSystem"))
15678      return parseNamingSystem(json);
15679    else if (t.equals("NutritionOrder"))
15680      return parseNutritionOrder(json);
15681    else if (t.equals("Observation"))
15682      return parseObservation(json);
15683    else if (t.equals("OperationDefinition"))
15684      return parseOperationDefinition(json);
15685    else if (t.equals("OperationOutcome"))
15686      return parseOperationOutcome(json);
15687    else if (t.equals("Order"))
15688      return parseOrder(json);
15689    else if (t.equals("OrderResponse"))
15690      return parseOrderResponse(json);
15691    else if (t.equals("OrderSet"))
15692      return parseOrderSet(json);
15693    else if (t.equals("Organization"))
15694      return parseOrganization(json);
15695    else if (t.equals("Patient"))
15696      return parsePatient(json);
15697    else if (t.equals("PaymentNotice"))
15698      return parsePaymentNotice(json);
15699    else if (t.equals("PaymentReconciliation"))
15700      return parsePaymentReconciliation(json);
15701    else if (t.equals("Person"))
15702      return parsePerson(json);
15703    else if (t.equals("Practitioner"))
15704      return parsePractitioner(json);
15705    else if (t.equals("PractitionerRole"))
15706      return parsePractitionerRole(json);
15707    else if (t.equals("Procedure"))
15708      return parseProcedure(json);
15709    else if (t.equals("ProcedureRequest"))
15710      return parseProcedureRequest(json);
15711    else if (t.equals("ProcessRequest"))
15712      return parseProcessRequest(json);
15713    else if (t.equals("ProcessResponse"))
15714      return parseProcessResponse(json);
15715    else if (t.equals("Protocol"))
15716      return parseProtocol(json);
15717    else if (t.equals("Provenance"))
15718      return parseProvenance(json);
15719    else if (t.equals("Questionnaire"))
15720      return parseQuestionnaire(json);
15721    else if (t.equals("QuestionnaireResponse"))
15722      return parseQuestionnaireResponse(json);
15723    else if (t.equals("ReferralRequest"))
15724      return parseReferralRequest(json);
15725    else if (t.equals("RelatedPerson"))
15726      return parseRelatedPerson(json);
15727    else if (t.equals("RiskAssessment"))
15728      return parseRiskAssessment(json);
15729    else if (t.equals("Schedule"))
15730      return parseSchedule(json);
15731    else if (t.equals("SearchParameter"))
15732      return parseSearchParameter(json);
15733    else if (t.equals("Sequence"))
15734      return parseSequence(json);
15735    else if (t.equals("Slot"))
15736      return parseSlot(json);
15737    else if (t.equals("Specimen"))
15738      return parseSpecimen(json);
15739    else if (t.equals("StructureDefinition"))
15740      return parseStructureDefinition(json);
15741    else if (t.equals("StructureMap"))
15742      return parseStructureMap(json);
15743    else if (t.equals("Subscription"))
15744      return parseSubscription(json);
15745    else if (t.equals("Substance"))
15746      return parseSubstance(json);
15747    else if (t.equals("SupplyDelivery"))
15748      return parseSupplyDelivery(json);
15749    else if (t.equals("SupplyRequest"))
15750      return parseSupplyRequest(json);
15751    else if (t.equals("Task"))
15752      return parseTask(json);
15753    else if (t.equals("TestScript"))
15754      return parseTestScript(json);
15755    else if (t.equals("ValueSet"))
15756      return parseValueSet(json);
15757    else if (t.equals("VisionPrescription"))
15758      return parseVisionPrescription(json);
15759    else if (t.equals("Binary"))
15760      return parseBinary(json);
15761    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
15762  }
15763
15764  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
15765    if (json.has(prefix+"Period"))
15766      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
15767    else if (json.has(prefix+"Coding"))
15768      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
15769    else if (json.has(prefix+"Range"))
15770      return parseRange(json.getAsJsonObject(prefix+"Range"));
15771    else if (json.has(prefix+"Quantity"))
15772      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
15773    else if (json.has(prefix+"Attachment"))
15774      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
15775    else if (json.has(prefix+"Ratio"))
15776      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
15777    else if (json.has(prefix+"Annotation"))
15778      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
15779    else if (json.has(prefix+"SampledData"))
15780      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
15781    else if (json.has(prefix+"Reference"))
15782      return parseReference(json.getAsJsonObject(prefix+"Reference"));
15783    else if (json.has(prefix+"CodeableConcept"))
15784      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
15785    else if (json.has(prefix+"Identifier"))
15786      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
15787    else if (json.has(prefix+"Signature"))
15788      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
15789    else if (json.has(prefix+"Age"))
15790      return parseAge(json.getAsJsonObject(prefix+"Age"));
15791    else if (json.has(prefix+"Count"))
15792      return parseCount(json.getAsJsonObject(prefix+"Count"));
15793    else if (json.has(prefix+"Money"))
15794      return parseMoney(json.getAsJsonObject(prefix+"Money"));
15795    else if (json.has(prefix+"Distance"))
15796      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
15797    else if (json.has(prefix+"Duration"))
15798      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
15799    else if (json.has(prefix+"SimpleQuantity"))
15800      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
15801    else if (json.has(prefix+"TriggerDefinition"))
15802      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
15803    else if (json.has(prefix+"ElementDefinition"))
15804      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
15805    else if (json.has(prefix+"Timing"))
15806      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
15807    else if (json.has(prefix+"ModuleMetadata"))
15808      return parseModuleMetadata(json.getAsJsonObject(prefix+"ModuleMetadata"));
15809    else if (json.has(prefix+"ActionDefinition"))
15810      return parseActionDefinition(json.getAsJsonObject(prefix+"ActionDefinition"));
15811    else if (json.has(prefix+"Address"))
15812      return parseAddress(json.getAsJsonObject(prefix+"Address"));
15813    else if (json.has(prefix+"HumanName"))
15814      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
15815    else if (json.has(prefix+"DataRequirement"))
15816      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
15817    else if (json.has(prefix+"Meta"))
15818      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
15819    else if (json.has(prefix+"ParameterDefinition"))
15820      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
15821    else if (json.has(prefix+"ContactPoint"))
15822      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
15823    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
15824      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
15825      if (json.has("_"+prefix+"Markdown"))
15826        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
15827      return t;
15828    }
15829    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
15830      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
15831      if (json.has("_"+prefix+"Integer"))
15832        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
15833      return t;
15834    }
15835    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
15836      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
15837      if (json.has("_"+prefix+"DateTime"))
15838        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
15839      return t;
15840    }
15841    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
15842      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
15843      if (json.has("_"+prefix+"UnsignedInt"))
15844        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
15845      return t;
15846    }
15847    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
15848      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
15849      if (json.has("_"+prefix+"Code"))
15850        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
15851      return t;
15852    }
15853    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
15854      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
15855      if (json.has("_"+prefix+"Date"))
15856        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
15857      return t;
15858    }
15859    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
15860      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
15861      if (json.has("_"+prefix+"Decimal"))
15862        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
15863      return t;
15864    }
15865    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
15866      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
15867      if (json.has("_"+prefix+"Uri"))
15868        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
15869      return t;
15870    }
15871    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
15872      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
15873      if (json.has("_"+prefix+"Id"))
15874        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
15875      return t;
15876    }
15877    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
15878      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
15879      if (json.has("_"+prefix+"Base64Binary"))
15880        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
15881      return t;
15882    }
15883    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
15884      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
15885      if (json.has("_"+prefix+"Time"))
15886        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
15887      return t;
15888    }
15889    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
15890      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
15891      if (json.has("_"+prefix+"Oid"))
15892        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
15893      return t;
15894    }
15895    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
15896      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
15897      if (json.has("_"+prefix+"PositiveInt"))
15898        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
15899      return t;
15900    }
15901    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
15902      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
15903      if (json.has("_"+prefix+"String"))
15904        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
15905      return t;
15906    }
15907    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
15908      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
15909      if (json.has("_"+prefix+"Boolean"))
15910        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
15911      return t;
15912    }
15913    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
15914      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
15915      if (json.has("_"+prefix+"Uuid"))
15916        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
15917      return t;
15918    }
15919    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
15920      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
15921      if (json.has("_"+prefix+"Instant"))
15922        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
15923      return t;
15924    }
15925    return null;
15926  }
15927
15928  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
15929    if (type.equals("Period"))
15930      return parsePeriod(json);
15931    else if (type.equals("Coding"))
15932      return parseCoding(json);
15933    else if (type.equals("Range"))
15934      return parseRange(json);
15935    else if (type.equals("Quantity"))
15936      return parseQuantity(json);
15937    else if (type.equals("Attachment"))
15938      return parseAttachment(json);
15939    else if (type.equals("Ratio"))
15940      return parseRatio(json);
15941    else if (type.equals("Annotation"))
15942      return parseAnnotation(json);
15943    else if (type.equals("SampledData"))
15944      return parseSampledData(json);
15945    else if (type.equals("Reference"))
15946      return parseReference(json);
15947    else if (type.equals("CodeableConcept"))
15948      return parseCodeableConcept(json);
15949    else if (type.equals("Identifier"))
15950      return parseIdentifier(json);
15951    else if (type.equals("Signature"))
15952      return parseSignature(json);
15953    else if (type.equals("Age"))
15954      return parseAge(json);
15955    else if (type.equals("Count"))
15956      return parseCount(json);
15957    else if (type.equals("Money"))
15958      return parseMoney(json);
15959    else if (type.equals("Distance"))
15960      return parseDistance(json);
15961    else if (type.equals("Duration"))
15962      return parseDuration(json);
15963    else if (type.equals("SimpleQuantity"))
15964      return parseSimpleQuantity(json);
15965    else if (type.equals("TriggerDefinition"))
15966      return parseTriggerDefinition(json);
15967    else if (type.equals("ElementDefinition"))
15968      return parseElementDefinition(json);
15969    else if (type.equals("Timing"))
15970      return parseTiming(json);
15971    else if (type.equals("ModuleMetadata"))
15972      return parseModuleMetadata(json);
15973    else if (type.equals("ActionDefinition"))
15974      return parseActionDefinition(json);
15975    else if (type.equals("Address"))
15976      return parseAddress(json);
15977    else if (type.equals("HumanName"))
15978      return parseHumanName(json);
15979    else if (type.equals("DataRequirement"))
15980      return parseDataRequirement(json);
15981    else if (type.equals("Meta"))
15982      return parseMeta(json);
15983    else if (type.equals("ParameterDefinition"))
15984      return parseParameterDefinition(json);
15985    else if (type.equals("ContactPoint"))
15986      return parseContactPoint(json);
15987    throw new FHIRFormatError("Unknown Type "+type);
15988  }
15989
15990  protected boolean hasTypeName(JsonObject json, String prefix) {
15991        if (json.has(prefix+"Period"))
15992      return true;
15993    if (json.has(prefix+"Coding"))
15994      return true;
15995    if (json.has(prefix+"Range"))
15996      return true;
15997    if (json.has(prefix+"Quantity"))
15998      return true;
15999    if (json.has(prefix+"Attachment"))
16000      return true;
16001    if (json.has(prefix+"Ratio"))
16002      return true;
16003    if (json.has(prefix+"Annotation"))
16004      return true;
16005    if (json.has(prefix+"SampledData"))
16006      return true;
16007    if (json.has(prefix+"Reference"))
16008      return true;
16009    if (json.has(prefix+"CodeableConcept"))
16010      return true;
16011    if (json.has(prefix+"Identifier"))
16012      return true;
16013    if (json.has(prefix+"Signature"))
16014      return true;
16015    if (json.has(prefix+"Age"))
16016      return true;
16017    if (json.has(prefix+"Count"))
16018      return true;
16019    if (json.has(prefix+"Money"))
16020      return true;
16021    if (json.has(prefix+"Distance"))
16022      return true;
16023    if (json.has(prefix+"Duration"))
16024      return true;
16025    if (json.has(prefix+"SimpleQuantity"))
16026      return true;
16027    if (json.has(prefix+"TriggerDefinition"))
16028      return true;
16029    if (json.has(prefix+"ElementDefinition"))
16030      return true;
16031    if (json.has(prefix+"Timing"))
16032      return true;
16033    if (json.has(prefix+"ModuleMetadata"))
16034      return true;
16035    if (json.has(prefix+"ActionDefinition"))
16036      return true;
16037    if (json.has(prefix+"Address"))
16038      return true;
16039    if (json.has(prefix+"HumanName"))
16040      return true;
16041    if (json.has(prefix+"DataRequirement"))
16042      return true;
16043    if (json.has(prefix+"Meta"))
16044      return true;
16045    if (json.has(prefix+"ParameterDefinition"))
16046      return true;
16047    if (json.has(prefix+"ContactPoint"))
16048      return true;
16049    if (json.has(prefix+"Parameters"))
16050      return true;
16051    if (json.has(prefix+"Account"))
16052      return true;
16053    if (json.has(prefix+"AllergyIntolerance"))
16054      return true;
16055    if (json.has(prefix+"Appointment"))
16056      return true;
16057    if (json.has(prefix+"AppointmentResponse"))
16058      return true;
16059    if (json.has(prefix+"AuditEvent"))
16060      return true;
16061    if (json.has(prefix+"Basic"))
16062      return true;
16063    if (json.has(prefix+"Binary"))
16064      return true;
16065    if (json.has(prefix+"BodySite"))
16066      return true;
16067    if (json.has(prefix+"Bundle"))
16068      return true;
16069    if (json.has(prefix+"CarePlan"))
16070      return true;
16071    if (json.has(prefix+"CareTeam"))
16072      return true;
16073    if (json.has(prefix+"Claim"))
16074      return true;
16075    if (json.has(prefix+"ClaimResponse"))
16076      return true;
16077    if (json.has(prefix+"ClinicalImpression"))
16078      return true;
16079    if (json.has(prefix+"CodeSystem"))
16080      return true;
16081    if (json.has(prefix+"Communication"))
16082      return true;
16083    if (json.has(prefix+"CommunicationRequest"))
16084      return true;
16085    if (json.has(prefix+"CompartmentDefinition"))
16086      return true;
16087    if (json.has(prefix+"Composition"))
16088      return true;
16089    if (json.has(prefix+"ConceptMap"))
16090      return true;
16091    if (json.has(prefix+"Condition"))
16092      return true;
16093    if (json.has(prefix+"Conformance"))
16094      return true;
16095    if (json.has(prefix+"Contract"))
16096      return true;
16097    if (json.has(prefix+"Coverage"))
16098      return true;
16099    if (json.has(prefix+"DataElement"))
16100      return true;
16101    if (json.has(prefix+"DecisionSupportRule"))
16102      return true;
16103    if (json.has(prefix+"DecisionSupportServiceModule"))
16104      return true;
16105    if (json.has(prefix+"DetectedIssue"))
16106      return true;
16107    if (json.has(prefix+"Device"))
16108      return true;
16109    if (json.has(prefix+"DeviceComponent"))
16110      return true;
16111    if (json.has(prefix+"DeviceMetric"))
16112      return true;
16113    if (json.has(prefix+"DeviceUseRequest"))
16114      return true;
16115    if (json.has(prefix+"DeviceUseStatement"))
16116      return true;
16117    if (json.has(prefix+"DiagnosticOrder"))
16118      return true;
16119    if (json.has(prefix+"DiagnosticReport"))
16120      return true;
16121    if (json.has(prefix+"DocumentManifest"))
16122      return true;
16123    if (json.has(prefix+"DocumentReference"))
16124      return true;
16125    if (json.has(prefix+"EligibilityRequest"))
16126      return true;
16127    if (json.has(prefix+"EligibilityResponse"))
16128      return true;
16129    if (json.has(prefix+"Encounter"))
16130      return true;
16131    if (json.has(prefix+"EnrollmentRequest"))
16132      return true;
16133    if (json.has(prefix+"EnrollmentResponse"))
16134      return true;
16135    if (json.has(prefix+"EpisodeOfCare"))
16136      return true;
16137    if (json.has(prefix+"ExpansionProfile"))
16138      return true;
16139    if (json.has(prefix+"ExplanationOfBenefit"))
16140      return true;
16141    if (json.has(prefix+"FamilyMemberHistory"))
16142      return true;
16143    if (json.has(prefix+"Flag"))
16144      return true;
16145    if (json.has(prefix+"Goal"))
16146      return true;
16147    if (json.has(prefix+"Group"))
16148      return true;
16149    if (json.has(prefix+"GuidanceResponse"))
16150      return true;
16151    if (json.has(prefix+"HealthcareService"))
16152      return true;
16153    if (json.has(prefix+"ImagingExcerpt"))
16154      return true;
16155    if (json.has(prefix+"ImagingObjectSelection"))
16156      return true;
16157    if (json.has(prefix+"ImagingStudy"))
16158      return true;
16159    if (json.has(prefix+"Immunization"))
16160      return true;
16161    if (json.has(prefix+"ImmunizationRecommendation"))
16162      return true;
16163    if (json.has(prefix+"ImplementationGuide"))
16164      return true;
16165    if (json.has(prefix+"Library"))
16166      return true;
16167    if (json.has(prefix+"Linkage"))
16168      return true;
16169    if (json.has(prefix+"List"))
16170      return true;
16171    if (json.has(prefix+"Location"))
16172      return true;
16173    if (json.has(prefix+"Measure"))
16174      return true;
16175    if (json.has(prefix+"MeasureReport"))
16176      return true;
16177    if (json.has(prefix+"Media"))
16178      return true;
16179    if (json.has(prefix+"Medication"))
16180      return true;
16181    if (json.has(prefix+"MedicationAdministration"))
16182      return true;
16183    if (json.has(prefix+"MedicationDispense"))
16184      return true;
16185    if (json.has(prefix+"MedicationOrder"))
16186      return true;
16187    if (json.has(prefix+"MedicationStatement"))
16188      return true;
16189    if (json.has(prefix+"MessageHeader"))
16190      return true;
16191    if (json.has(prefix+"ModuleDefinition"))
16192      return true;
16193    if (json.has(prefix+"NamingSystem"))
16194      return true;
16195    if (json.has(prefix+"NutritionOrder"))
16196      return true;
16197    if (json.has(prefix+"Observation"))
16198      return true;
16199    if (json.has(prefix+"OperationDefinition"))
16200      return true;
16201    if (json.has(prefix+"OperationOutcome"))
16202      return true;
16203    if (json.has(prefix+"Order"))
16204      return true;
16205    if (json.has(prefix+"OrderResponse"))
16206      return true;
16207    if (json.has(prefix+"OrderSet"))
16208      return true;
16209    if (json.has(prefix+"Organization"))
16210      return true;
16211    if (json.has(prefix+"Patient"))
16212      return true;
16213    if (json.has(prefix+"PaymentNotice"))
16214      return true;
16215    if (json.has(prefix+"PaymentReconciliation"))
16216      return true;
16217    if (json.has(prefix+"Person"))
16218      return true;
16219    if (json.has(prefix+"Practitioner"))
16220      return true;
16221    if (json.has(prefix+"PractitionerRole"))
16222      return true;
16223    if (json.has(prefix+"Procedure"))
16224      return true;
16225    if (json.has(prefix+"ProcedureRequest"))
16226      return true;
16227    if (json.has(prefix+"ProcessRequest"))
16228      return true;
16229    if (json.has(prefix+"ProcessResponse"))
16230      return true;
16231    if (json.has(prefix+"Protocol"))
16232      return true;
16233    if (json.has(prefix+"Provenance"))
16234      return true;
16235    if (json.has(prefix+"Questionnaire"))
16236      return true;
16237    if (json.has(prefix+"QuestionnaireResponse"))
16238      return true;
16239    if (json.has(prefix+"ReferralRequest"))
16240      return true;
16241    if (json.has(prefix+"RelatedPerson"))
16242      return true;
16243    if (json.has(prefix+"RiskAssessment"))
16244      return true;
16245    if (json.has(prefix+"Schedule"))
16246      return true;
16247    if (json.has(prefix+"SearchParameter"))
16248      return true;
16249    if (json.has(prefix+"Sequence"))
16250      return true;
16251    if (json.has(prefix+"Slot"))
16252      return true;
16253    if (json.has(prefix+"Specimen"))
16254      return true;
16255    if (json.has(prefix+"StructureDefinition"))
16256      return true;
16257    if (json.has(prefix+"StructureMap"))
16258      return true;
16259    if (json.has(prefix+"Subscription"))
16260      return true;
16261    if (json.has(prefix+"Substance"))
16262      return true;
16263    if (json.has(prefix+"SupplyDelivery"))
16264      return true;
16265    if (json.has(prefix+"SupplyRequest"))
16266      return true;
16267    if (json.has(prefix+"Task"))
16268      return true;
16269    if (json.has(prefix+"TestScript"))
16270      return true;
16271    if (json.has(prefix+"ValueSet"))
16272      return true;
16273    if (json.has(prefix+"VisionPrescription"))
16274      return true;
16275    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
16276      return true;
16277    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
16278      return true;
16279    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
16280      return true;
16281    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
16282      return true;
16283    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
16284      return true;
16285    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
16286      return true;
16287    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
16288      return true;
16289    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
16290      return true;
16291    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
16292      return true;
16293    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
16294      return true;
16295    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
16296      return true;
16297    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
16298      return true;
16299    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
16300      return true;
16301    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
16302      return true;
16303    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
16304      return true;
16305    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
16306      return true;
16307    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
16308      return true;
16309    return false;
16310  }
16311  protected void composeElement(Element element) throws IOException {
16312    if (element.hasId())
16313      prop("id", element.getId());
16314      if (makeComments(element)) {
16315        openArray("fhir_comments");
16316        for (String s : element.getFormatCommentsPre())
16317          prop(null,  s);
16318        for (String s : element.getFormatCommentsPost())
16319          prop(null,  s);
16320         closeArray();
16321      }
16322    if (element.hasExtension()) {
16323      openArray("extension");
16324      for (Extension e : element.getExtension())
16325        composeExtension(null, e);
16326      closeArray();
16327    }
16328  }
16329
16330  protected void composeBackbone(BackboneElement element) throws IOException {
16331    composeElement(element);
16332    if (element.hasModifierExtension()) {
16333      openArray("modifierExtension");
16334      for (Extension e : element.getModifierExtension())
16335        composeExtension(null, e);
16336      closeArray();
16337    }
16338  }
16339
16340  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
16341    if (value != null && value.getValue() != null) {
16342      prop(name, e.toCode(value.getValue()));
16343    } else if (inArray)   
16344      writeNull(name);
16345  }    
16346
16347  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
16348    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16349      open(inArray ? null : "_"+name);
16350      composeElement(value);
16351      close();
16352    } else if (inArray)   
16353      writeNull(name);
16354  }    
16355
16356  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
16357    if (value != null && value.hasValue()) {
16358        prop(name, toString(value.getValue()));
16359    }    
16360    else if (inArray) 
16361      writeNull(name); 
16362  }    
16363
16364  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
16365    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16366      open(inArray ? null : "_"+name);
16367      composeElement(value);
16368      close();
16369    }
16370    else if (inArray) 
16371      writeNull(name); 
16372  }
16373
16374  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
16375    if (value != null && value.hasValue()) {
16376        prop(name, Integer.valueOf(value.getValue()));
16377    }    
16378    else if (inArray) 
16379      writeNull(name); 
16380  }    
16381
16382  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
16383    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16384      open(inArray ? null : "_"+name);
16385      composeElement(value);
16386      close();
16387    }
16388    else if (inArray) 
16389      writeNull(name); 
16390  }
16391
16392  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
16393    if (value != null && value.hasValue()) {
16394        prop(name, value.asStringValue());
16395    }    
16396    else if (inArray) 
16397      writeNull(name); 
16398  }    
16399
16400  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
16401    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16402      open(inArray ? null : "_"+name);
16403      composeElement(value);
16404      close();
16405    }
16406    else if (inArray) 
16407      writeNull(name); 
16408  }
16409
16410  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
16411    if (value != null && value.hasValue()) {
16412        prop(name, Integer.valueOf(value.getValue()));
16413    }    
16414    else if (inArray) 
16415      writeNull(name); 
16416  }    
16417
16418  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
16419    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16420      open(inArray ? null : "_"+name);
16421      composeElement(value);
16422      close();
16423    }
16424    else if (inArray) 
16425      writeNull(name); 
16426  }
16427
16428  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
16429    if (value != null && value.hasValue()) {
16430        prop(name, toString(value.getValue()));
16431    }    
16432    else if (inArray) 
16433      writeNull(name); 
16434  }    
16435
16436  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
16437    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16438      open(inArray ? null : "_"+name);
16439      composeElement(value);
16440      close();
16441    }
16442    else if (inArray) 
16443      writeNull(name); 
16444  }
16445
16446  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
16447    if (value != null && value.hasValue()) {
16448        prop(name, value.asStringValue());
16449    }    
16450    else if (inArray) 
16451      writeNull(name); 
16452  }    
16453
16454  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
16455    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16456      open(inArray ? null : "_"+name);
16457      composeElement(value);
16458      close();
16459    }
16460    else if (inArray) 
16461      writeNull(name); 
16462  }
16463
16464  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
16465    if (value != null && value.hasValue()) {
16466        prop(name, value.getValue());
16467    }    
16468    else if (inArray) 
16469      writeNull(name); 
16470  }    
16471
16472  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
16473    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16474      open(inArray ? null : "_"+name);
16475      composeElement(value);
16476      close();
16477    }
16478    else if (inArray) 
16479      writeNull(name); 
16480  }
16481
16482  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
16483    if (value != null && value.hasValue()) {
16484        prop(name, toString(value.getValue()));
16485    }    
16486    else if (inArray) 
16487      writeNull(name); 
16488  }    
16489
16490  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
16491    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16492      open(inArray ? null : "_"+name);
16493      composeElement(value);
16494      close();
16495    }
16496    else if (inArray) 
16497      writeNull(name); 
16498  }
16499
16500  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
16501    if (value != null && value.hasValue()) {
16502        prop(name, toString(value.getValue()));
16503    }    
16504    else if (inArray) 
16505      writeNull(name); 
16506  }    
16507
16508  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
16509    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16510      open(inArray ? null : "_"+name);
16511      composeElement(value);
16512      close();
16513    }
16514    else if (inArray) 
16515      writeNull(name); 
16516  }
16517
16518  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
16519    if (value != null && value.hasValue()) {
16520        prop(name, toString(value.getValue()));
16521    }    
16522    else if (inArray) 
16523      writeNull(name); 
16524  }    
16525
16526  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
16527    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16528      open(inArray ? null : "_"+name);
16529      composeElement(value);
16530      close();
16531    }
16532    else if (inArray) 
16533      writeNull(name); 
16534  }
16535
16536  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
16537    if (value != null && value.hasValue()) {
16538        prop(name, value.asStringValue());
16539    }    
16540    else if (inArray) 
16541      writeNull(name); 
16542  }    
16543
16544  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
16545    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16546      open(inArray ? null : "_"+name);
16547      composeElement(value);
16548      close();
16549    }
16550    else if (inArray) 
16551      writeNull(name); 
16552  }
16553
16554  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
16555    if (value != null && value.hasValue()) {
16556        prop(name, toString(value.getValue()));
16557    }    
16558    else if (inArray) 
16559      writeNull(name); 
16560  }    
16561
16562  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
16563    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16564      open(inArray ? null : "_"+name);
16565      composeElement(value);
16566      close();
16567    }
16568    else if (inArray) 
16569      writeNull(name); 
16570  }
16571
16572  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
16573    if (value != null && value.hasValue()) {
16574        prop(name, Integer.valueOf(value.getValue()));
16575    }    
16576    else if (inArray) 
16577      writeNull(name); 
16578  }    
16579
16580  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
16581    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16582      open(inArray ? null : "_"+name);
16583      composeElement(value);
16584      close();
16585    }
16586    else if (inArray) 
16587      writeNull(name); 
16588  }
16589
16590  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
16591    if (value != null && value.hasValue()) {
16592        prop(name, toString(value.getValue()));
16593    }    
16594    else if (inArray) 
16595      writeNull(name); 
16596  }    
16597
16598  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
16599    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16600      open(inArray ? null : "_"+name);
16601      composeElement(value);
16602      close();
16603    }
16604    else if (inArray) 
16605      writeNull(name); 
16606  }
16607
16608  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
16609    if (value != null && value.hasValue()) {
16610        prop(name, value.getValue());
16611    }    
16612    else if (inArray) 
16613      writeNull(name); 
16614  }    
16615
16616  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
16617    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16618      open(inArray ? null : "_"+name);
16619      composeElement(value);
16620      close();
16621    }
16622    else if (inArray) 
16623      writeNull(name); 
16624  }
16625
16626  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
16627    if (value != null && value.hasValue()) {
16628        prop(name, toString(value.getValue()));
16629    }    
16630    else if (inArray) 
16631      writeNull(name); 
16632  }    
16633
16634  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
16635    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16636      open(inArray ? null : "_"+name);
16637      composeElement(value);
16638      close();
16639    }
16640    else if (inArray) 
16641      writeNull(name); 
16642  }
16643
16644  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
16645    if (value != null && value.hasValue()) {
16646        prop(name, value.asStringValue());
16647    }    
16648    else if (inArray) 
16649      writeNull(name); 
16650  }    
16651
16652  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
16653    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
16654      open(inArray ? null : "_"+name);
16655      composeElement(value);
16656      close();
16657    }
16658    else if (inArray) 
16659      writeNull(name); 
16660  }
16661
16662  protected void composeExtension(String name, Extension element) throws IOException {
16663    if (element != null) {
16664      open(name);
16665      composeExtensionInner(element);
16666      close();
16667    }
16668  }
16669
16670  protected void composeExtensionInner(Extension element) throws IOException {
16671      composeElement(element);
16672      if (element.hasUrlElement()) {
16673        composeUriCore("url", element.getUrlElement(), false);
16674        composeUriExtras("url", element.getUrlElement(), false);
16675      }
16676      if (element.hasValue()) {
16677        composeType("value", element.getValue());
16678      }
16679  }
16680
16681  protected void composeNarrative(String name, Narrative element) throws IOException {
16682    if (element != null) {
16683      open(name);
16684      composeNarrativeInner(element);
16685      close();
16686    }
16687  }
16688
16689  protected void composeNarrativeInner(Narrative element) throws IOException {
16690      composeElement(element);
16691      if (element.hasStatusElement()) {
16692        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
16693        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
16694      }
16695      if (element.hasDiv()) {
16696        XhtmlNode node = element.getDiv();
16697        if (node.getNsDecl() == null) {
16698          node.attribute("xmlns", XHTML_NS);
16699        }
16700        composeXhtml("div", node);
16701      }
16702  }
16703
16704  protected void composePeriod(String name, Period element) throws IOException {
16705    if (element != null) {
16706      open(name);
16707      composePeriodInner(element);
16708      close();
16709    }
16710  }
16711
16712  protected void composePeriodInner(Period element) throws IOException {
16713      composeElement(element);
16714      if (element.hasStartElement()) {
16715        composeDateTimeCore("start", element.getStartElement(), false);
16716        composeDateTimeExtras("start", element.getStartElement(), false);
16717      }
16718      if (element.hasEndElement()) {
16719        composeDateTimeCore("end", element.getEndElement(), false);
16720        composeDateTimeExtras("end", element.getEndElement(), false);
16721      }
16722  }
16723
16724  protected void composeCoding(String name, Coding element) throws IOException {
16725    if (element != null) {
16726      open(name);
16727      composeCodingInner(element);
16728      close();
16729    }
16730  }
16731
16732  protected void composeCodingInner(Coding element) throws IOException {
16733      composeElement(element);
16734      if (element.hasSystemElement()) {
16735        composeUriCore("system", element.getSystemElement(), false);
16736        composeUriExtras("system", element.getSystemElement(), false);
16737      }
16738      if (element.hasVersionElement()) {
16739        composeStringCore("version", element.getVersionElement(), false);
16740        composeStringExtras("version", element.getVersionElement(), false);
16741      }
16742      if (element.hasCodeElement()) {
16743        composeCodeCore("code", element.getCodeElement(), false);
16744        composeCodeExtras("code", element.getCodeElement(), false);
16745      }
16746      if (element.hasDisplayElement()) {
16747        composeStringCore("display", element.getDisplayElement(), false);
16748        composeStringExtras("display", element.getDisplayElement(), false);
16749      }
16750      if (element.hasUserSelectedElement()) {
16751        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
16752        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
16753      }
16754  }
16755
16756  protected void composeRange(String name, Range element) throws IOException {
16757    if (element != null) {
16758      open(name);
16759      composeRangeInner(element);
16760      close();
16761    }
16762  }
16763
16764  protected void composeRangeInner(Range element) throws IOException {
16765      composeElement(element);
16766      if (element.hasLow()) {
16767        composeSimpleQuantity("low", element.getLow());
16768      }
16769      if (element.hasHigh()) {
16770        composeSimpleQuantity("high", element.getHigh());
16771      }
16772  }
16773
16774  protected void composeQuantity(String name, Quantity element) throws IOException {
16775    if (element != null) {
16776      open(name);
16777      composeQuantityInner(element);
16778      close();
16779    }
16780  }
16781
16782  protected void composeQuantityInner(Quantity element) throws IOException {
16783      composeElement(element);
16784      if (element.hasValueElement()) {
16785        composeDecimalCore("value", element.getValueElement(), false);
16786        composeDecimalExtras("value", element.getValueElement(), false);
16787      }
16788      if (element.hasComparatorElement()) {
16789        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
16790        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
16791      }
16792      if (element.hasUnitElement()) {
16793        composeStringCore("unit", element.getUnitElement(), false);
16794        composeStringExtras("unit", element.getUnitElement(), false);
16795      }
16796      if (element.hasSystemElement()) {
16797        composeUriCore("system", element.getSystemElement(), false);
16798        composeUriExtras("system", element.getSystemElement(), false);
16799      }
16800      if (element.hasCodeElement()) {
16801        composeCodeCore("code", element.getCodeElement(), false);
16802        composeCodeExtras("code", element.getCodeElement(), false);
16803      }
16804  }
16805
16806  protected void composeAttachment(String name, Attachment element) throws IOException {
16807    if (element != null) {
16808      open(name);
16809      composeAttachmentInner(element);
16810      close();
16811    }
16812  }
16813
16814  protected void composeAttachmentInner(Attachment element) throws IOException {
16815      composeElement(element);
16816      if (element.hasContentTypeElement()) {
16817        composeCodeCore("contentType", element.getContentTypeElement(), false);
16818        composeCodeExtras("contentType", element.getContentTypeElement(), false);
16819      }
16820      if (element.hasLanguageElement()) {
16821        composeCodeCore("language", element.getLanguageElement(), false);
16822        composeCodeExtras("language", element.getLanguageElement(), false);
16823      }
16824      if (element.hasDataElement()) {
16825        composeBase64BinaryCore("data", element.getDataElement(), false);
16826        composeBase64BinaryExtras("data", element.getDataElement(), false);
16827      }
16828      if (element.hasUrlElement()) {
16829        composeUriCore("url", element.getUrlElement(), false);
16830        composeUriExtras("url", element.getUrlElement(), false);
16831      }
16832      if (element.hasSizeElement()) {
16833        composeUnsignedIntCore("size", element.getSizeElement(), false);
16834        composeUnsignedIntExtras("size", element.getSizeElement(), false);
16835      }
16836      if (element.hasHashElement()) {
16837        composeBase64BinaryCore("hash", element.getHashElement(), false);
16838        composeBase64BinaryExtras("hash", element.getHashElement(), false);
16839      }
16840      if (element.hasTitleElement()) {
16841        composeStringCore("title", element.getTitleElement(), false);
16842        composeStringExtras("title", element.getTitleElement(), false);
16843      }
16844      if (element.hasCreationElement()) {
16845        composeDateTimeCore("creation", element.getCreationElement(), false);
16846        composeDateTimeExtras("creation", element.getCreationElement(), false);
16847      }
16848  }
16849
16850  protected void composeRatio(String name, Ratio element) throws IOException {
16851    if (element != null) {
16852      open(name);
16853      composeRatioInner(element);
16854      close();
16855    }
16856  }
16857
16858  protected void composeRatioInner(Ratio element) throws IOException {
16859      composeElement(element);
16860      if (element.hasNumerator()) {
16861        composeQuantity("numerator", element.getNumerator());
16862      }
16863      if (element.hasDenominator()) {
16864        composeQuantity("denominator", element.getDenominator());
16865      }
16866  }
16867
16868  protected void composeAnnotation(String name, Annotation element) throws IOException {
16869    if (element != null) {
16870      open(name);
16871      composeAnnotationInner(element);
16872      close();
16873    }
16874  }
16875
16876  protected void composeAnnotationInner(Annotation element) throws IOException {
16877      composeElement(element);
16878      if (element.hasAuthor()) {
16879        composeType("author", element.getAuthor());
16880      }
16881      if (element.hasTimeElement()) {
16882        composeDateTimeCore("time", element.getTimeElement(), false);
16883        composeDateTimeExtras("time", element.getTimeElement(), false);
16884      }
16885      if (element.hasTextElement()) {
16886        composeStringCore("text", element.getTextElement(), false);
16887        composeStringExtras("text", element.getTextElement(), false);
16888      }
16889  }
16890
16891  protected void composeSampledData(String name, SampledData element) throws IOException {
16892    if (element != null) {
16893      open(name);
16894      composeSampledDataInner(element);
16895      close();
16896    }
16897  }
16898
16899  protected void composeSampledDataInner(SampledData element) throws IOException {
16900      composeElement(element);
16901      if (element.hasOrigin()) {
16902        composeSimpleQuantity("origin", element.getOrigin());
16903      }
16904      if (element.hasPeriodElement()) {
16905        composeDecimalCore("period", element.getPeriodElement(), false);
16906        composeDecimalExtras("period", element.getPeriodElement(), false);
16907      }
16908      if (element.hasFactorElement()) {
16909        composeDecimalCore("factor", element.getFactorElement(), false);
16910        composeDecimalExtras("factor", element.getFactorElement(), false);
16911      }
16912      if (element.hasLowerLimitElement()) {
16913        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
16914        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
16915      }
16916      if (element.hasUpperLimitElement()) {
16917        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
16918        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
16919      }
16920      if (element.hasDimensionsElement()) {
16921        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
16922        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
16923      }
16924      if (element.hasDataElement()) {
16925        composeStringCore("data", element.getDataElement(), false);
16926        composeStringExtras("data", element.getDataElement(), false);
16927      }
16928  }
16929
16930  protected void composeReference(String name, Reference element) throws IOException {
16931    if (element != null) {
16932      open(name);
16933      composeReferenceInner(element);
16934      close();
16935    }
16936  }
16937
16938  protected void composeReferenceInner(Reference element) throws IOException {
16939      composeElement(element);
16940      if (element.hasReferenceElement()) {
16941        composeStringCore("reference", element.getReferenceElement(), false);
16942        composeStringExtras("reference", element.getReferenceElement(), false);
16943      }
16944      if (element.hasDisplayElement()) {
16945        composeStringCore("display", element.getDisplayElement(), false);
16946        composeStringExtras("display", element.getDisplayElement(), false);
16947      }
16948  }
16949
16950  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
16951    if (element != null) {
16952      open(name);
16953      composeCodeableConceptInner(element);
16954      close();
16955    }
16956  }
16957
16958  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
16959      composeElement(element);
16960      if (element.hasCoding()) {
16961        openArray("coding");
16962        for (Coding e : element.getCoding()) 
16963          composeCoding(null, e);
16964        closeArray();
16965      };
16966      if (element.hasTextElement()) {
16967        composeStringCore("text", element.getTextElement(), false);
16968        composeStringExtras("text", element.getTextElement(), false);
16969      }
16970  }
16971
16972  protected void composeIdentifier(String name, Identifier element) throws IOException {
16973    if (element != null) {
16974      open(name);
16975      composeIdentifierInner(element);
16976      close();
16977    }
16978  }
16979
16980  protected void composeIdentifierInner(Identifier element) throws IOException {
16981      composeElement(element);
16982      if (element.hasUseElement()) {
16983        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
16984        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
16985      }
16986      if (element.hasType()) {
16987        composeCodeableConcept("type", element.getType());
16988      }
16989      if (element.hasSystemElement()) {
16990        composeUriCore("system", element.getSystemElement(), false);
16991        composeUriExtras("system", element.getSystemElement(), false);
16992      }
16993      if (element.hasValueElement()) {
16994        composeStringCore("value", element.getValueElement(), false);
16995        composeStringExtras("value", element.getValueElement(), false);
16996      }
16997      if (element.hasPeriod()) {
16998        composePeriod("period", element.getPeriod());
16999      }
17000      if (element.hasAssigner()) {
17001        composeReference("assigner", element.getAssigner());
17002      }
17003  }
17004
17005  protected void composeSignature(String name, Signature element) throws IOException {
17006    if (element != null) {
17007      open(name);
17008      composeSignatureInner(element);
17009      close();
17010    }
17011  }
17012
17013  protected void composeSignatureInner(Signature element) throws IOException {
17014      composeElement(element);
17015      if (element.hasType()) {
17016        openArray("type");
17017        for (Coding e : element.getType()) 
17018          composeCoding(null, e);
17019        closeArray();
17020      };
17021      if (element.hasWhenElement()) {
17022        composeInstantCore("when", element.getWhenElement(), false);
17023        composeInstantExtras("when", element.getWhenElement(), false);
17024      }
17025      if (element.hasWho()) {
17026        composeType("who", element.getWho());
17027      }
17028      if (element.hasContentTypeElement()) {
17029        composeCodeCore("contentType", element.getContentTypeElement(), false);
17030        composeCodeExtras("contentType", element.getContentTypeElement(), false);
17031      }
17032      if (element.hasBlobElement()) {
17033        composeBase64BinaryCore("blob", element.getBlobElement(), false);
17034        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
17035      }
17036  }
17037
17038  protected void composeAge(String name, Age element) throws IOException {
17039    if (element != null) {
17040      open(name);
17041      composeAgeInner(element);
17042      close();
17043    }
17044  }
17045
17046  protected void composeAgeInner(Age element) throws IOException {
17047      composeElement(element);
17048      if (element.hasValueElement()) {
17049        composeDecimalCore("value", element.getValueElement(), false);
17050        composeDecimalExtras("value", element.getValueElement(), false);
17051      }
17052      if (element.hasComparatorElement()) {
17053        composeEnumerationCore("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
17054        composeEnumerationExtras("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
17055      }
17056      if (element.hasUnitElement()) {
17057        composeStringCore("unit", element.getUnitElement(), false);
17058        composeStringExtras("unit", element.getUnitElement(), false);
17059      }
17060      if (element.hasSystemElement()) {
17061        composeUriCore("system", element.getSystemElement(), false);
17062        composeUriExtras("system", element.getSystemElement(), false);
17063      }
17064      if (element.hasCodeElement()) {
17065        composeCodeCore("code", element.getCodeElement(), false);
17066        composeCodeExtras("code", element.getCodeElement(), false);
17067      }
17068  }
17069
17070  protected void composeCount(String name, Count element) throws IOException {
17071    if (element != null) {
17072      open(name);
17073      composeCountInner(element);
17074      close();
17075    }
17076  }
17077
17078  protected void composeCountInner(Count element) throws IOException {
17079      composeElement(element);
17080      if (element.hasValueElement()) {
17081        composeDecimalCore("value", element.getValueElement(), false);
17082        composeDecimalExtras("value", element.getValueElement(), false);
17083      }
17084      if (element.hasComparatorElement()) {
17085        composeEnumerationCore("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
17086        composeEnumerationExtras("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
17087      }
17088      if (element.hasUnitElement()) {
17089        composeStringCore("unit", element.getUnitElement(), false);
17090        composeStringExtras("unit", element.getUnitElement(), false);
17091      }
17092      if (element.hasSystemElement()) {
17093        composeUriCore("system", element.getSystemElement(), false);
17094        composeUriExtras("system", element.getSystemElement(), false);
17095      }
17096      if (element.hasCodeElement()) {
17097        composeCodeCore("code", element.getCodeElement(), false);
17098        composeCodeExtras("code", element.getCodeElement(), false);
17099      }
17100  }
17101
17102  protected void composeMoney(String name, Money element) throws IOException {
17103    if (element != null) {
17104      open(name);
17105      composeMoneyInner(element);
17106      close();
17107    }
17108  }
17109
17110  protected void composeMoneyInner(Money element) throws IOException {
17111      composeElement(element);
17112      if (element.hasValueElement()) {
17113        composeDecimalCore("value", element.getValueElement(), false);
17114        composeDecimalExtras("value", element.getValueElement(), false);
17115      }
17116      if (element.hasComparatorElement()) {
17117        composeEnumerationCore("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
17118        composeEnumerationExtras("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
17119      }
17120      if (element.hasUnitElement()) {
17121        composeStringCore("unit", element.getUnitElement(), false);
17122        composeStringExtras("unit", element.getUnitElement(), false);
17123      }
17124      if (element.hasSystemElement()) {
17125        composeUriCore("system", element.getSystemElement(), false);
17126        composeUriExtras("system", element.getSystemElement(), false);
17127      }
17128      if (element.hasCodeElement()) {
17129        composeCodeCore("code", element.getCodeElement(), false);
17130        composeCodeExtras("code", element.getCodeElement(), false);
17131      }
17132  }
17133
17134  protected void composeDistance(String name, Distance element) throws IOException {
17135    if (element != null) {
17136      open(name);
17137      composeDistanceInner(element);
17138      close();
17139    }
17140  }
17141
17142  protected void composeDistanceInner(Distance element) throws IOException {
17143      composeElement(element);
17144      if (element.hasValueElement()) {
17145        composeDecimalCore("value", element.getValueElement(), false);
17146        composeDecimalExtras("value", element.getValueElement(), false);
17147      }
17148      if (element.hasComparatorElement()) {
17149        composeEnumerationCore("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
17150        composeEnumerationExtras("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
17151      }
17152      if (element.hasUnitElement()) {
17153        composeStringCore("unit", element.getUnitElement(), false);
17154        composeStringExtras("unit", element.getUnitElement(), false);
17155      }
17156      if (element.hasSystemElement()) {
17157        composeUriCore("system", element.getSystemElement(), false);
17158        composeUriExtras("system", element.getSystemElement(), false);
17159      }
17160      if (element.hasCodeElement()) {
17161        composeCodeCore("code", element.getCodeElement(), false);
17162        composeCodeExtras("code", element.getCodeElement(), false);
17163      }
17164  }
17165
17166  protected void composeDuration(String name, Duration element) throws IOException {
17167    if (element != null) {
17168      open(name);
17169      composeDurationInner(element);
17170      close();
17171    }
17172  }
17173
17174  protected void composeDurationInner(Duration element) throws IOException {
17175      composeElement(element);
17176      if (element.hasValueElement()) {
17177        composeDecimalCore("value", element.getValueElement(), false);
17178        composeDecimalExtras("value", element.getValueElement(), false);
17179      }
17180      if (element.hasComparatorElement()) {
17181        composeEnumerationCore("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
17182        composeEnumerationExtras("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
17183      }
17184      if (element.hasUnitElement()) {
17185        composeStringCore("unit", element.getUnitElement(), false);
17186        composeStringExtras("unit", element.getUnitElement(), false);
17187      }
17188      if (element.hasSystemElement()) {
17189        composeUriCore("system", element.getSystemElement(), false);
17190        composeUriExtras("system", element.getSystemElement(), false);
17191      }
17192      if (element.hasCodeElement()) {
17193        composeCodeCore("code", element.getCodeElement(), false);
17194        composeCodeExtras("code", element.getCodeElement(), false);
17195      }
17196  }
17197
17198  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
17199    if (element != null) {
17200      open(name);
17201      composeSimpleQuantityInner(element);
17202      close();
17203    }
17204  }
17205
17206  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
17207      composeElement(element);
17208      if (element.hasValueElement()) {
17209        composeDecimalCore("value", element.getValueElement(), false);
17210        composeDecimalExtras("value", element.getValueElement(), false);
17211      }
17212      if (element.hasComparatorElement()) {
17213        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
17214        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
17215      }
17216      if (element.hasUnitElement()) {
17217        composeStringCore("unit", element.getUnitElement(), false);
17218        composeStringExtras("unit", element.getUnitElement(), false);
17219      }
17220      if (element.hasSystemElement()) {
17221        composeUriCore("system", element.getSystemElement(), false);
17222        composeUriExtras("system", element.getSystemElement(), false);
17223      }
17224      if (element.hasCodeElement()) {
17225        composeCodeCore("code", element.getCodeElement(), false);
17226        composeCodeExtras("code", element.getCodeElement(), false);
17227      }
17228  }
17229
17230  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
17231    if (element != null) {
17232      open(name);
17233      composeTriggerDefinitionInner(element);
17234      close();
17235    }
17236  }
17237
17238  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
17239      composeElement(element);
17240      if (element.hasTypeElement()) {
17241        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
17242        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
17243      }
17244      if (element.hasEventNameElement()) {
17245        composeStringCore("eventName", element.getEventNameElement(), false);
17246        composeStringExtras("eventName", element.getEventNameElement(), false);
17247      }
17248      if (element.hasEventTiming()) {
17249        composeType("eventTiming", element.getEventTiming());
17250      }
17251      if (element.hasEventData()) {
17252        composeDataRequirement("eventData", element.getEventData());
17253      }
17254  }
17255
17256  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
17257    if (element != null) {
17258      open(name);
17259      composeElementDefinitionInner(element);
17260      close();
17261    }
17262  }
17263
17264  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
17265      composeElement(element);
17266      if (element.hasPathElement()) {
17267        composeStringCore("path", element.getPathElement(), false);
17268        composeStringExtras("path", element.getPathElement(), false);
17269      }
17270      if (element.hasRepresentation()) {
17271        openArray("representation");
17272        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
17273          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
17274        closeArray();
17275        if (anyHasExtras(element.getRepresentation())) {
17276          openArray("_representation");
17277          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
17278            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
17279          closeArray();
17280        }
17281      };
17282      if (element.hasNameElement()) {
17283        composeStringCore("name", element.getNameElement(), false);
17284        composeStringExtras("name", element.getNameElement(), false);
17285      }
17286      if (element.hasLabelElement()) {
17287        composeStringCore("label", element.getLabelElement(), false);
17288        composeStringExtras("label", element.getLabelElement(), false);
17289      }
17290      if (element.hasCode()) {
17291        openArray("code");
17292        for (Coding e : element.getCode()) 
17293          composeCoding(null, e);
17294        closeArray();
17295      };
17296      if (element.hasSlicing()) {
17297        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
17298      }
17299      if (element.hasShortElement()) {
17300        composeStringCore("short", element.getShortElement(), false);
17301        composeStringExtras("short", element.getShortElement(), false);
17302      }
17303      if (element.hasDefinitionElement()) {
17304        composeMarkdownCore("definition", element.getDefinitionElement(), false);
17305        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
17306      }
17307      if (element.hasCommentsElement()) {
17308        composeMarkdownCore("comments", element.getCommentsElement(), false);
17309        composeMarkdownExtras("comments", element.getCommentsElement(), false);
17310      }
17311      if (element.hasRequirementsElement()) {
17312        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
17313        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
17314      }
17315      if (element.hasAlias()) {
17316        openArray("alias");
17317        for (StringType e : element.getAlias()) 
17318          composeStringCore(null, e, true);
17319        closeArray();
17320        if (anyHasExtras(element.getAlias())) {
17321          openArray("_alias");
17322          for (StringType e : element.getAlias()) 
17323            composeStringExtras(null, e, true);
17324          closeArray();
17325        }
17326      };
17327      if (element.hasMinElement()) {
17328        composeIntegerCore("min", element.getMinElement(), false);
17329        composeIntegerExtras("min", element.getMinElement(), false);
17330      }
17331      if (element.hasMaxElement()) {
17332        composeStringCore("max", element.getMaxElement(), false);
17333        composeStringExtras("max", element.getMaxElement(), false);
17334      }
17335      if (element.hasBase()) {
17336        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
17337      }
17338      if (element.hasContentReferenceElement()) {
17339        composeUriCore("contentReference", element.getContentReferenceElement(), false);
17340        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
17341      }
17342      if (element.hasType()) {
17343        openArray("type");
17344        for (ElementDefinition.TypeRefComponent e : element.getType()) 
17345          composeElementDefinitionTypeRefComponent(null, e);
17346        closeArray();
17347      };
17348      if (element.hasDefaultValue()) {
17349        composeType("defaultValue", element.getDefaultValue());
17350      }
17351      if (element.hasMeaningWhenMissingElement()) {
17352        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
17353        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
17354      }
17355      if (element.hasFixed()) {
17356        composeType("fixed", element.getFixed());
17357      }
17358      if (element.hasPattern()) {
17359        composeType("pattern", element.getPattern());
17360      }
17361      if (element.hasExample()) {
17362        composeType("example", element.getExample());
17363      }
17364      if (element.hasMinValue()) {
17365        composeType("minValue", element.getMinValue());
17366      }
17367      if (element.hasMaxValue()) {
17368        composeType("maxValue", element.getMaxValue());
17369      }
17370      if (element.hasMaxLengthElement()) {
17371        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
17372        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
17373      }
17374      if (element.hasCondition()) {
17375        openArray("condition");
17376        for (IdType e : element.getCondition()) 
17377          composeIdCore(null, e, true);
17378        closeArray();
17379        if (anyHasExtras(element.getCondition())) {
17380          openArray("_condition");
17381          for (IdType e : element.getCondition()) 
17382            composeIdExtras(null, e, true);
17383          closeArray();
17384        }
17385      };
17386      if (element.hasConstraint()) {
17387        openArray("constraint");
17388        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
17389          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
17390        closeArray();
17391      };
17392      if (element.hasMustSupportElement()) {
17393        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
17394        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
17395      }
17396      if (element.hasIsModifierElement()) {
17397        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
17398        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
17399      }
17400      if (element.hasIsSummaryElement()) {
17401        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
17402        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
17403      }
17404      if (element.hasBinding()) {
17405        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
17406      }
17407      if (element.hasMapping()) {
17408        openArray("mapping");
17409        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
17410          composeElementDefinitionElementDefinitionMappingComponent(null, e);
17411        closeArray();
17412      };
17413  }
17414
17415  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
17416    if (element != null) {
17417      open(name);
17418      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
17419      close();
17420    }
17421  }
17422
17423  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
17424      composeElement(element);
17425      if (element.hasDiscriminator()) {
17426        openArray("discriminator");
17427        for (StringType e : element.getDiscriminator()) 
17428          composeStringCore(null, e, true);
17429        closeArray();
17430        if (anyHasExtras(element.getDiscriminator())) {
17431          openArray("_discriminator");
17432          for (StringType e : element.getDiscriminator()) 
17433            composeStringExtras(null, e, true);
17434          closeArray();
17435        }
17436      };
17437      if (element.hasDescriptionElement()) {
17438        composeStringCore("description", element.getDescriptionElement(), false);
17439        composeStringExtras("description", element.getDescriptionElement(), false);
17440      }
17441      if (element.hasOrderedElement()) {
17442        composeBooleanCore("ordered", element.getOrderedElement(), false);
17443        composeBooleanExtras("ordered", element.getOrderedElement(), false);
17444      }
17445      if (element.hasRulesElement()) {
17446        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
17447        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
17448      }
17449  }
17450
17451  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
17452    if (element != null) {
17453      open(name);
17454      composeElementDefinitionElementDefinitionBaseComponentInner(element);
17455      close();
17456    }
17457  }
17458
17459  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
17460      composeElement(element);
17461      if (element.hasPathElement()) {
17462        composeStringCore("path", element.getPathElement(), false);
17463        composeStringExtras("path", element.getPathElement(), false);
17464      }
17465      if (element.hasMinElement()) {
17466        composeIntegerCore("min", element.getMinElement(), false);
17467        composeIntegerExtras("min", element.getMinElement(), false);
17468      }
17469      if (element.hasMaxElement()) {
17470        composeStringCore("max", element.getMaxElement(), false);
17471        composeStringExtras("max", element.getMaxElement(), false);
17472      }
17473  }
17474
17475  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
17476    if (element != null) {
17477      open(name);
17478      composeElementDefinitionTypeRefComponentInner(element);
17479      close();
17480    }
17481  }
17482
17483  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
17484      composeElement(element);
17485      if (element.hasCodeElement()) {
17486        composeCodeCore("code", element.getCodeElement(), false);
17487        composeCodeExtras("code", element.getCodeElement(), false);
17488      }
17489      if (element.hasProfile()) {
17490        openArray("profile");
17491        for (UriType e : element.getProfile()) 
17492          composeUriCore(null, e, true);
17493        closeArray();
17494        if (anyHasExtras(element.getProfile())) {
17495          openArray("_profile");
17496          for (UriType e : element.getProfile()) 
17497            composeUriExtras(null, e, true);
17498          closeArray();
17499        }
17500      };
17501      if (element.hasAggregation()) {
17502        openArray("aggregation");
17503        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
17504          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
17505        closeArray();
17506        if (anyHasExtras(element.getAggregation())) {
17507          openArray("_aggregation");
17508          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
17509            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
17510          closeArray();
17511        }
17512      };
17513      if (element.hasVersioningElement()) {
17514        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
17515        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
17516      }
17517  }
17518
17519  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
17520    if (element != null) {
17521      open(name);
17522      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
17523      close();
17524    }
17525  }
17526
17527  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
17528      composeElement(element);
17529      if (element.hasKeyElement()) {
17530        composeIdCore("key", element.getKeyElement(), false);
17531        composeIdExtras("key", element.getKeyElement(), false);
17532      }
17533      if (element.hasRequirementsElement()) {
17534        composeStringCore("requirements", element.getRequirementsElement(), false);
17535        composeStringExtras("requirements", element.getRequirementsElement(), false);
17536      }
17537      if (element.hasSeverityElement()) {
17538        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
17539        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
17540      }
17541      if (element.hasHumanElement()) {
17542        composeStringCore("human", element.getHumanElement(), false);
17543        composeStringExtras("human", element.getHumanElement(), false);
17544      }
17545      if (element.hasExpressionElement()) {
17546        composeStringCore("expression", element.getExpressionElement(), false);
17547        composeStringExtras("expression", element.getExpressionElement(), false);
17548      }
17549      if (element.hasXpathElement()) {
17550        composeStringCore("xpath", element.getXpathElement(), false);
17551        composeStringExtras("xpath", element.getXpathElement(), false);
17552      }
17553  }
17554
17555  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
17556    if (element != null) {
17557      open(name);
17558      composeElementDefinitionElementDefinitionBindingComponentInner(element);
17559      close();
17560    }
17561  }
17562
17563  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
17564      composeElement(element);
17565      if (element.hasStrengthElement()) {
17566        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
17567        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
17568      }
17569      if (element.hasDescriptionElement()) {
17570        composeStringCore("description", element.getDescriptionElement(), false);
17571        composeStringExtras("description", element.getDescriptionElement(), false);
17572      }
17573      if (element.hasValueSet()) {
17574        composeType("valueSet", element.getValueSet());
17575      }
17576  }
17577
17578  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
17579    if (element != null) {
17580      open(name);
17581      composeElementDefinitionElementDefinitionMappingComponentInner(element);
17582      close();
17583    }
17584  }
17585
17586  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
17587      composeElement(element);
17588      if (element.hasIdentityElement()) {
17589        composeIdCore("identity", element.getIdentityElement(), false);
17590        composeIdExtras("identity", element.getIdentityElement(), false);
17591      }
17592      if (element.hasLanguageElement()) {
17593        composeCodeCore("language", element.getLanguageElement(), false);
17594        composeCodeExtras("language", element.getLanguageElement(), false);
17595      }
17596      if (element.hasMapElement()) {
17597        composeStringCore("map", element.getMapElement(), false);
17598        composeStringExtras("map", element.getMapElement(), false);
17599      }
17600  }
17601
17602  protected void composeTiming(String name, Timing element) throws IOException {
17603    if (element != null) {
17604      open(name);
17605      composeTimingInner(element);
17606      close();
17607    }
17608  }
17609
17610  protected void composeTimingInner(Timing element) throws IOException {
17611      composeElement(element);
17612      if (element.hasEvent()) {
17613        openArray("event");
17614        for (DateTimeType e : element.getEvent()) 
17615          composeDateTimeCore(null, e, true);
17616        closeArray();
17617        if (anyHasExtras(element.getEvent())) {
17618          openArray("_event");
17619          for (DateTimeType e : element.getEvent()) 
17620            composeDateTimeExtras(null, e, true);
17621          closeArray();
17622        }
17623      };
17624      if (element.hasRepeat()) {
17625        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
17626      }
17627      if (element.hasCode()) {
17628        composeCodeableConcept("code", element.getCode());
17629      }
17630  }
17631
17632  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
17633    if (element != null) {
17634      open(name);
17635      composeTimingTimingRepeatComponentInner(element);
17636      close();
17637    }
17638  }
17639
17640  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
17641      composeElement(element);
17642      if (element.hasBounds()) {
17643        composeType("bounds", element.getBounds());
17644      }
17645      if (element.hasCountElement()) {
17646        composeIntegerCore("count", element.getCountElement(), false);
17647        composeIntegerExtras("count", element.getCountElement(), false);
17648      }
17649      if (element.hasCountMaxElement()) {
17650        composeIntegerCore("countMax", element.getCountMaxElement(), false);
17651        composeIntegerExtras("countMax", element.getCountMaxElement(), false);
17652      }
17653      if (element.hasDurationElement()) {
17654        composeDecimalCore("duration", element.getDurationElement(), false);
17655        composeDecimalExtras("duration", element.getDurationElement(), false);
17656      }
17657      if (element.hasDurationMaxElement()) {
17658        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
17659        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
17660      }
17661      if (element.hasDurationUnitElement()) {
17662        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
17663        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
17664      }
17665      if (element.hasFrequencyElement()) {
17666        composeIntegerCore("frequency", element.getFrequencyElement(), false);
17667        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
17668      }
17669      if (element.hasFrequencyMaxElement()) {
17670        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
17671        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
17672      }
17673      if (element.hasPeriodElement()) {
17674        composeDecimalCore("period", element.getPeriodElement(), false);
17675        composeDecimalExtras("period", element.getPeriodElement(), false);
17676      }
17677      if (element.hasPeriodMaxElement()) {
17678        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
17679        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
17680      }
17681      if (element.hasPeriodUnitElement()) {
17682        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
17683        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
17684      }
17685      if (element.hasWhenElement()) {
17686        composeEnumerationCore("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
17687        composeEnumerationExtras("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
17688      }
17689      if (element.hasOffsetElement()) {
17690        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
17691        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
17692      }
17693  }
17694
17695  protected void composeModuleMetadata(String name, ModuleMetadata element) throws IOException {
17696    if (element != null) {
17697      open(name);
17698      composeModuleMetadataInner(element);
17699      close();
17700    }
17701  }
17702
17703  protected void composeModuleMetadataInner(ModuleMetadata element) throws IOException {
17704      composeElement(element);
17705      if (element.hasUrlElement()) {
17706        composeUriCore("url", element.getUrlElement(), false);
17707        composeUriExtras("url", element.getUrlElement(), false);
17708      }
17709      if (element.hasIdentifier()) {
17710        openArray("identifier");
17711        for (Identifier e : element.getIdentifier()) 
17712          composeIdentifier(null, e);
17713        closeArray();
17714      };
17715      if (element.hasVersionElement()) {
17716        composeStringCore("version", element.getVersionElement(), false);
17717        composeStringExtras("version", element.getVersionElement(), false);
17718      }
17719      if (element.hasNameElement()) {
17720        composeStringCore("name", element.getNameElement(), false);
17721        composeStringExtras("name", element.getNameElement(), false);
17722      }
17723      if (element.hasTitleElement()) {
17724        composeStringCore("title", element.getTitleElement(), false);
17725        composeStringExtras("title", element.getTitleElement(), false);
17726      }
17727      if (element.hasTypeElement()) {
17728        composeEnumerationCore("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataTypeEnumFactory(), false);
17729        composeEnumerationExtras("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataTypeEnumFactory(), false);
17730      }
17731      if (element.hasStatusElement()) {
17732        composeEnumerationCore("status", element.getStatusElement(), new ModuleMetadata.ModuleMetadataStatusEnumFactory(), false);
17733        composeEnumerationExtras("status", element.getStatusElement(), new ModuleMetadata.ModuleMetadataStatusEnumFactory(), false);
17734      }
17735      if (element.hasExperimentalElement()) {
17736        composeBooleanCore("experimental", element.getExperimentalElement(), false);
17737        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
17738      }
17739      if (element.hasDescriptionElement()) {
17740        composeStringCore("description", element.getDescriptionElement(), false);
17741        composeStringExtras("description", element.getDescriptionElement(), false);
17742      }
17743      if (element.hasPurposeElement()) {
17744        composeStringCore("purpose", element.getPurposeElement(), false);
17745        composeStringExtras("purpose", element.getPurposeElement(), false);
17746      }
17747      if (element.hasUsageElement()) {
17748        composeStringCore("usage", element.getUsageElement(), false);
17749        composeStringExtras("usage", element.getUsageElement(), false);
17750      }
17751      if (element.hasPublicationDateElement()) {
17752        composeDateCore("publicationDate", element.getPublicationDateElement(), false);
17753        composeDateExtras("publicationDate", element.getPublicationDateElement(), false);
17754      }
17755      if (element.hasLastReviewDateElement()) {
17756        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
17757        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
17758      }
17759      if (element.hasEffectivePeriod()) {
17760        composePeriod("effectivePeriod", element.getEffectivePeriod());
17761      }
17762      if (element.hasCoverage()) {
17763        openArray("coverage");
17764        for (ModuleMetadata.ModuleMetadataCoverageComponent e : element.getCoverage()) 
17765          composeModuleMetadataModuleMetadataCoverageComponent(null, e);
17766        closeArray();
17767      };
17768      if (element.hasTopic()) {
17769        openArray("topic");
17770        for (CodeableConcept e : element.getTopic()) 
17771          composeCodeableConcept(null, e);
17772        closeArray();
17773      };
17774      if (element.hasContributor()) {
17775        openArray("contributor");
17776        for (ModuleMetadata.ModuleMetadataContributorComponent e : element.getContributor()) 
17777          composeModuleMetadataModuleMetadataContributorComponent(null, e);
17778        closeArray();
17779      };
17780      if (element.hasPublisherElement()) {
17781        composeStringCore("publisher", element.getPublisherElement(), false);
17782        composeStringExtras("publisher", element.getPublisherElement(), false);
17783      }
17784      if (element.hasContact()) {
17785        openArray("contact");
17786        for (ModuleMetadata.ModuleMetadataContactComponent e : element.getContact()) 
17787          composeModuleMetadataModuleMetadataContactComponent(null, e);
17788        closeArray();
17789      };
17790      if (element.hasCopyrightElement()) {
17791        composeStringCore("copyright", element.getCopyrightElement(), false);
17792        composeStringExtras("copyright", element.getCopyrightElement(), false);
17793      }
17794      if (element.hasRelatedResource()) {
17795        openArray("relatedResource");
17796        for (ModuleMetadata.ModuleMetadataRelatedResourceComponent e : element.getRelatedResource()) 
17797          composeModuleMetadataModuleMetadataRelatedResourceComponent(null, e);
17798        closeArray();
17799      };
17800  }
17801
17802  protected void composeModuleMetadataModuleMetadataCoverageComponent(String name, ModuleMetadata.ModuleMetadataCoverageComponent element) throws IOException {
17803    if (element != null) {
17804      open(name);
17805      composeModuleMetadataModuleMetadataCoverageComponentInner(element);
17806      close();
17807    }
17808  }
17809
17810  protected void composeModuleMetadataModuleMetadataCoverageComponentInner(ModuleMetadata.ModuleMetadataCoverageComponent element) throws IOException {
17811      composeElement(element);
17812      if (element.hasFocus()) {
17813        composeCoding("focus", element.getFocus());
17814      }
17815      if (element.hasValue()) {
17816        composeCodeableConcept("value", element.getValue());
17817      }
17818  }
17819
17820  protected void composeModuleMetadataModuleMetadataContributorComponent(String name, ModuleMetadata.ModuleMetadataContributorComponent element) throws IOException {
17821    if (element != null) {
17822      open(name);
17823      composeModuleMetadataModuleMetadataContributorComponentInner(element);
17824      close();
17825    }
17826  }
17827
17828  protected void composeModuleMetadataModuleMetadataContributorComponentInner(ModuleMetadata.ModuleMetadataContributorComponent element) throws IOException {
17829      composeElement(element);
17830      if (element.hasTypeElement()) {
17831        composeEnumerationCore("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataContributorTypeEnumFactory(), false);
17832        composeEnumerationExtras("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataContributorTypeEnumFactory(), false);
17833      }
17834      if (element.hasNameElement()) {
17835        composeStringCore("name", element.getNameElement(), false);
17836        composeStringExtras("name", element.getNameElement(), false);
17837      }
17838      if (element.hasContact()) {
17839        openArray("contact");
17840        for (ModuleMetadata.ModuleMetadataContributorContactComponent e : element.getContact()) 
17841          composeModuleMetadataModuleMetadataContributorContactComponent(null, e);
17842        closeArray();
17843      };
17844  }
17845
17846  protected void composeModuleMetadataModuleMetadataContributorContactComponent(String name, ModuleMetadata.ModuleMetadataContributorContactComponent element) throws IOException {
17847    if (element != null) {
17848      open(name);
17849      composeModuleMetadataModuleMetadataContributorContactComponentInner(element);
17850      close();
17851    }
17852  }
17853
17854  protected void composeModuleMetadataModuleMetadataContributorContactComponentInner(ModuleMetadata.ModuleMetadataContributorContactComponent element) throws IOException {
17855      composeElement(element);
17856      if (element.hasNameElement()) {
17857        composeStringCore("name", element.getNameElement(), false);
17858        composeStringExtras("name", element.getNameElement(), false);
17859      }
17860      if (element.hasTelecom()) {
17861        openArray("telecom");
17862        for (ContactPoint e : element.getTelecom()) 
17863          composeContactPoint(null, e);
17864        closeArray();
17865      };
17866  }
17867
17868  protected void composeModuleMetadataModuleMetadataContactComponent(String name, ModuleMetadata.ModuleMetadataContactComponent element) throws IOException {
17869    if (element != null) {
17870      open(name);
17871      composeModuleMetadataModuleMetadataContactComponentInner(element);
17872      close();
17873    }
17874  }
17875
17876  protected void composeModuleMetadataModuleMetadataContactComponentInner(ModuleMetadata.ModuleMetadataContactComponent element) throws IOException {
17877      composeElement(element);
17878      if (element.hasNameElement()) {
17879        composeStringCore("name", element.getNameElement(), false);
17880        composeStringExtras("name", element.getNameElement(), false);
17881      }
17882      if (element.hasTelecom()) {
17883        openArray("telecom");
17884        for (ContactPoint e : element.getTelecom()) 
17885          composeContactPoint(null, e);
17886        closeArray();
17887      };
17888  }
17889
17890  protected void composeModuleMetadataModuleMetadataRelatedResourceComponent(String name, ModuleMetadata.ModuleMetadataRelatedResourceComponent element) throws IOException {
17891    if (element != null) {
17892      open(name);
17893      composeModuleMetadataModuleMetadataRelatedResourceComponentInner(element);
17894      close();
17895    }
17896  }
17897
17898  protected void composeModuleMetadataModuleMetadataRelatedResourceComponentInner(ModuleMetadata.ModuleMetadataRelatedResourceComponent element) throws IOException {
17899      composeElement(element);
17900      if (element.hasTypeElement()) {
17901        composeEnumerationCore("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataResourceTypeEnumFactory(), false);
17902        composeEnumerationExtras("type", element.getTypeElement(), new ModuleMetadata.ModuleMetadataResourceTypeEnumFactory(), false);
17903      }
17904      if (element.hasDocument()) {
17905        composeAttachment("document", element.getDocument());
17906      }
17907      if (element.hasResource()) {
17908        composeReference("resource", element.getResource());
17909      }
17910  }
17911
17912  protected void composeActionDefinition(String name, ActionDefinition element) throws IOException {
17913    if (element != null) {
17914      open(name);
17915      composeActionDefinitionInner(element);
17916      close();
17917    }
17918  }
17919
17920  protected void composeActionDefinitionInner(ActionDefinition element) throws IOException {
17921      composeElement(element);
17922      if (element.hasActionIdentifier()) {
17923        composeIdentifier("actionIdentifier", element.getActionIdentifier());
17924      }
17925      if (element.hasLabelElement()) {
17926        composeStringCore("label", element.getLabelElement(), false);
17927        composeStringExtras("label", element.getLabelElement(), false);
17928      }
17929      if (element.hasTitleElement()) {
17930        composeStringCore("title", element.getTitleElement(), false);
17931        composeStringExtras("title", element.getTitleElement(), false);
17932      }
17933      if (element.hasDescriptionElement()) {
17934        composeStringCore("description", element.getDescriptionElement(), false);
17935        composeStringExtras("description", element.getDescriptionElement(), false);
17936      }
17937      if (element.hasTextEquivalentElement()) {
17938        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
17939        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
17940      }
17941      if (element.hasConcept()) {
17942        openArray("concept");
17943        for (CodeableConcept e : element.getConcept()) 
17944          composeCodeableConcept(null, e);
17945        closeArray();
17946      };
17947      if (element.hasSupportingEvidence()) {
17948        openArray("supportingEvidence");
17949        for (Attachment e : element.getSupportingEvidence()) 
17950          composeAttachment(null, e);
17951        closeArray();
17952      };
17953      if (element.hasDocumentation()) {
17954        openArray("documentation");
17955        for (Attachment e : element.getDocumentation()) 
17956          composeAttachment(null, e);
17957        closeArray();
17958      };
17959      if (element.hasRelatedAction()) {
17960        composeActionDefinitionActionDefinitionRelatedActionComponent("relatedAction", element.getRelatedAction());
17961      }
17962      if (element.hasParticipantType()) {
17963        openArray("participantType");
17964        for (Enumeration<ActionDefinition.ParticipantType> e : element.getParticipantType()) 
17965          composeEnumerationCore(null, e, new ActionDefinition.ParticipantTypeEnumFactory(), true);
17966        closeArray();
17967        if (anyHasExtras(element.getParticipantType())) {
17968          openArray("_participantType");
17969          for (Enumeration<ActionDefinition.ParticipantType> e : element.getParticipantType()) 
17970            composeEnumerationExtras(null, e, new ActionDefinition.ParticipantTypeEnumFactory(), true);
17971          closeArray();
17972        }
17973      };
17974      if (element.hasTypeElement()) {
17975        composeEnumerationCore("type", element.getTypeElement(), new ActionDefinition.ActionTypeEnumFactory(), false);
17976        composeEnumerationExtras("type", element.getTypeElement(), new ActionDefinition.ActionTypeEnumFactory(), false);
17977      }
17978      if (element.hasBehavior()) {
17979        openArray("behavior");
17980        for (ActionDefinition.ActionDefinitionBehaviorComponent e : element.getBehavior()) 
17981          composeActionDefinitionActionDefinitionBehaviorComponent(null, e);
17982        closeArray();
17983      };
17984      if (element.hasResource()) {
17985        composeReference("resource", element.getResource());
17986      }
17987      if (element.hasCustomization()) {
17988        openArray("customization");
17989        for (ActionDefinition.ActionDefinitionCustomizationComponent e : element.getCustomization()) 
17990          composeActionDefinitionActionDefinitionCustomizationComponent(null, e);
17991        closeArray();
17992      };
17993      if (element.hasAction()) {
17994        openArray("action");
17995        for (ActionDefinition e : element.getAction()) 
17996          composeActionDefinition(null, e);
17997        closeArray();
17998      };
17999  }
18000
18001  protected void composeActionDefinitionActionDefinitionRelatedActionComponent(String name, ActionDefinition.ActionDefinitionRelatedActionComponent element) throws IOException {
18002    if (element != null) {
18003      open(name);
18004      composeActionDefinitionActionDefinitionRelatedActionComponentInner(element);
18005      close();
18006    }
18007  }
18008
18009  protected void composeActionDefinitionActionDefinitionRelatedActionComponentInner(ActionDefinition.ActionDefinitionRelatedActionComponent element) throws IOException {
18010      composeElement(element);
18011      if (element.hasActionIdentifier()) {
18012        composeIdentifier("actionIdentifier", element.getActionIdentifier());
18013      }
18014      if (element.hasRelationshipElement()) {
18015        composeEnumerationCore("relationship", element.getRelationshipElement(), new ActionDefinition.ActionRelationshipTypeEnumFactory(), false);
18016        composeEnumerationExtras("relationship", element.getRelationshipElement(), new ActionDefinition.ActionRelationshipTypeEnumFactory(), false);
18017      }
18018      if (element.hasOffset()) {
18019        composeType("offset", element.getOffset());
18020      }
18021      if (element.hasAnchorElement()) {
18022        composeEnumerationCore("anchor", element.getAnchorElement(), new ActionDefinition.ActionRelationshipAnchorEnumFactory(), false);
18023        composeEnumerationExtras("anchor", element.getAnchorElement(), new ActionDefinition.ActionRelationshipAnchorEnumFactory(), false);
18024      }
18025  }
18026
18027  protected void composeActionDefinitionActionDefinitionBehaviorComponent(String name, ActionDefinition.ActionDefinitionBehaviorComponent element) throws IOException {
18028    if (element != null) {
18029      open(name);
18030      composeActionDefinitionActionDefinitionBehaviorComponentInner(element);
18031      close();
18032    }
18033  }
18034
18035  protected void composeActionDefinitionActionDefinitionBehaviorComponentInner(ActionDefinition.ActionDefinitionBehaviorComponent element) throws IOException {
18036      composeElement(element);
18037      if (element.hasType()) {
18038        composeCoding("type", element.getType());
18039      }
18040      if (element.hasValue()) {
18041        composeCoding("value", element.getValue());
18042      }
18043  }
18044
18045  protected void composeActionDefinitionActionDefinitionCustomizationComponent(String name, ActionDefinition.ActionDefinitionCustomizationComponent element) throws IOException {
18046    if (element != null) {
18047      open(name);
18048      composeActionDefinitionActionDefinitionCustomizationComponentInner(element);
18049      close();
18050    }
18051  }
18052
18053  protected void composeActionDefinitionActionDefinitionCustomizationComponentInner(ActionDefinition.ActionDefinitionCustomizationComponent element) throws IOException {
18054      composeElement(element);
18055      if (element.hasPathElement()) {
18056        composeStringCore("path", element.getPathElement(), false);
18057        composeStringExtras("path", element.getPathElement(), false);
18058      }
18059      if (element.hasExpressionElement()) {
18060        composeStringCore("expression", element.getExpressionElement(), false);
18061        composeStringExtras("expression", element.getExpressionElement(), false);
18062      }
18063  }
18064
18065  protected void composeAddress(String name, Address element) throws IOException {
18066    if (element != null) {
18067      open(name);
18068      composeAddressInner(element);
18069      close();
18070    }
18071  }
18072
18073  protected void composeAddressInner(Address element) throws IOException {
18074      composeElement(element);
18075      if (element.hasUseElement()) {
18076        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
18077        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
18078      }
18079      if (element.hasTypeElement()) {
18080        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
18081        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
18082      }
18083      if (element.hasTextElement()) {
18084        composeStringCore("text", element.getTextElement(), false);
18085        composeStringExtras("text", element.getTextElement(), false);
18086      }
18087      if (element.hasLine()) {
18088        openArray("line");
18089        for (StringType e : element.getLine()) 
18090          composeStringCore(null, e, true);
18091        closeArray();
18092        if (anyHasExtras(element.getLine())) {
18093          openArray("_line");
18094          for (StringType e : element.getLine()) 
18095            composeStringExtras(null, e, true);
18096          closeArray();
18097        }
18098      };
18099      if (element.hasCityElement()) {
18100        composeStringCore("city", element.getCityElement(), false);
18101        composeStringExtras("city", element.getCityElement(), false);
18102      }
18103      if (element.hasDistrictElement()) {
18104        composeStringCore("district", element.getDistrictElement(), false);
18105        composeStringExtras("district", element.getDistrictElement(), false);
18106      }
18107      if (element.hasStateElement()) {
18108        composeStringCore("state", element.getStateElement(), false);
18109        composeStringExtras("state", element.getStateElement(), false);
18110      }
18111      if (element.hasPostalCodeElement()) {
18112        composeStringCore("postalCode", element.getPostalCodeElement(), false);
18113        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
18114      }
18115      if (element.hasCountryElement()) {
18116        composeStringCore("country", element.getCountryElement(), false);
18117        composeStringExtras("country", element.getCountryElement(), false);
18118      }
18119      if (element.hasPeriod()) {
18120        composePeriod("period", element.getPeriod());
18121      }
18122  }
18123
18124  protected void composeHumanName(String name, HumanName element) throws IOException {
18125    if (element != null) {
18126      open(name);
18127      composeHumanNameInner(element);
18128      close();
18129    }
18130  }
18131
18132  protected void composeHumanNameInner(HumanName element) throws IOException {
18133      composeElement(element);
18134      if (element.hasUseElement()) {
18135        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
18136        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
18137      }
18138      if (element.hasTextElement()) {
18139        composeStringCore("text", element.getTextElement(), false);
18140        composeStringExtras("text", element.getTextElement(), false);
18141      }
18142      if (element.hasFamily()) {
18143        openArray("family");
18144        for (StringType e : element.getFamily()) 
18145          composeStringCore(null, e, true);
18146        closeArray();
18147        if (anyHasExtras(element.getFamily())) {
18148          openArray("_family");
18149          for (StringType e : element.getFamily()) 
18150            composeStringExtras(null, e, true);
18151          closeArray();
18152        }
18153      };
18154      if (element.hasGiven()) {
18155        openArray("given");
18156        for (StringType e : element.getGiven()) 
18157          composeStringCore(null, e, true);
18158        closeArray();
18159        if (anyHasExtras(element.getGiven())) {
18160          openArray("_given");
18161          for (StringType e : element.getGiven()) 
18162            composeStringExtras(null, e, true);
18163          closeArray();
18164        }
18165      };
18166      if (element.hasPrefix()) {
18167        openArray("prefix");
18168        for (StringType e : element.getPrefix()) 
18169          composeStringCore(null, e, true);
18170        closeArray();
18171        if (anyHasExtras(element.getPrefix())) {
18172          openArray("_prefix");
18173          for (StringType e : element.getPrefix()) 
18174            composeStringExtras(null, e, true);
18175          closeArray();
18176        }
18177      };
18178      if (element.hasSuffix()) {
18179        openArray("suffix");
18180        for (StringType e : element.getSuffix()) 
18181          composeStringCore(null, e, true);
18182        closeArray();
18183        if (anyHasExtras(element.getSuffix())) {
18184          openArray("_suffix");
18185          for (StringType e : element.getSuffix()) 
18186            composeStringExtras(null, e, true);
18187          closeArray();
18188        }
18189      };
18190      if (element.hasPeriod()) {
18191        composePeriod("period", element.getPeriod());
18192      }
18193  }
18194
18195  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
18196    if (element != null) {
18197      open(name);
18198      composeDataRequirementInner(element);
18199      close();
18200    }
18201  }
18202
18203  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
18204      composeElement(element);
18205      if (element.hasTypeElement()) {
18206        composeCodeCore("type", element.getTypeElement(), false);
18207        composeCodeExtras("type", element.getTypeElement(), false);
18208      }
18209      if (element.hasProfile()) {
18210        composeReference("profile", element.getProfile());
18211      }
18212      if (element.hasMustSupport()) {
18213        openArray("mustSupport");
18214        for (StringType e : element.getMustSupport()) 
18215          composeStringCore(null, e, true);
18216        closeArray();
18217        if (anyHasExtras(element.getMustSupport())) {
18218          openArray("_mustSupport");
18219          for (StringType e : element.getMustSupport()) 
18220            composeStringExtras(null, e, true);
18221          closeArray();
18222        }
18223      };
18224      if (element.hasCodeFilter()) {
18225        openArray("codeFilter");
18226        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
18227          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
18228        closeArray();
18229      };
18230      if (element.hasDateFilter()) {
18231        openArray("dateFilter");
18232        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
18233          composeDataRequirementDataRequirementDateFilterComponent(null, e);
18234        closeArray();
18235      };
18236  }
18237
18238  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
18239    if (element != null) {
18240      open(name);
18241      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
18242      close();
18243    }
18244  }
18245
18246  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
18247      composeElement(element);
18248      if (element.hasPathElement()) {
18249        composeStringCore("path", element.getPathElement(), false);
18250        composeStringExtras("path", element.getPathElement(), false);
18251      }
18252      if (element.hasValueSet()) {
18253        composeType("valueSet", element.getValueSet());
18254      }
18255      if (element.hasValueCode()) {
18256        openArray("valueCode");
18257        for (CodeType e : element.getValueCode()) 
18258          composeCodeCore(null, e, true);
18259        closeArray();
18260        if (anyHasExtras(element.getValueCode())) {
18261          openArray("_valueCode");
18262          for (CodeType e : element.getValueCode()) 
18263            composeCodeExtras(null, e, true);
18264          closeArray();
18265        }
18266      };
18267      if (element.hasValueCoding()) {
18268        openArray("valueCoding");
18269        for (Coding e : element.getValueCoding()) 
18270          composeCoding(null, e);
18271        closeArray();
18272      };
18273      if (element.hasValueCodeableConcept()) {
18274        openArray("valueCodeableConcept");
18275        for (CodeableConcept e : element.getValueCodeableConcept()) 
18276          composeCodeableConcept(null, e);
18277        closeArray();
18278      };
18279  }
18280
18281  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
18282    if (element != null) {
18283      open(name);
18284      composeDataRequirementDataRequirementDateFilterComponentInner(element);
18285      close();
18286    }
18287  }
18288
18289  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
18290      composeElement(element);
18291      if (element.hasPathElement()) {
18292        composeStringCore("path", element.getPathElement(), false);
18293        composeStringExtras("path", element.getPathElement(), false);
18294      }
18295      if (element.hasValue()) {
18296        composeType("value", element.getValue());
18297      }
18298  }
18299
18300  protected void composeMeta(String name, Meta element) throws IOException {
18301    if (element != null) {
18302      open(name);
18303      composeMetaInner(element);
18304      close();
18305    }
18306  }
18307
18308  protected void composeMetaInner(Meta element) throws IOException {
18309      composeElement(element);
18310      if (element.hasVersionIdElement()) {
18311        composeIdCore("versionId", element.getVersionIdElement(), false);
18312        composeIdExtras("versionId", element.getVersionIdElement(), false);
18313      }
18314      if (element.hasLastUpdatedElement()) {
18315        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
18316        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
18317      }
18318      if (element.hasProfile()) {
18319        openArray("profile");
18320        for (UriType e : element.getProfile()) 
18321          composeUriCore(null, e, true);
18322        closeArray();
18323        if (anyHasExtras(element.getProfile())) {
18324          openArray("_profile");
18325          for (UriType e : element.getProfile()) 
18326            composeUriExtras(null, e, true);
18327          closeArray();
18328        }
18329      };
18330      if (element.hasSecurity()) {
18331        openArray("security");
18332        for (Coding e : element.getSecurity()) 
18333          composeCoding(null, e);
18334        closeArray();
18335      };
18336      if (element.hasTag()) {
18337        openArray("tag");
18338        for (Coding e : element.getTag()) 
18339          composeCoding(null, e);
18340        closeArray();
18341      };
18342  }
18343
18344  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
18345    if (element != null) {
18346      open(name);
18347      composeParameterDefinitionInner(element);
18348      close();
18349    }
18350  }
18351
18352  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
18353      composeElement(element);
18354      if (element.hasNameElement()) {
18355        composeCodeCore("name", element.getNameElement(), false);
18356        composeCodeExtras("name", element.getNameElement(), false);
18357      }
18358      if (element.hasUseElement()) {
18359        composeCodeCore("use", element.getUseElement(), false);
18360        composeCodeExtras("use", element.getUseElement(), false);
18361      }
18362      if (element.hasMinElement()) {
18363        composeIntegerCore("min", element.getMinElement(), false);
18364        composeIntegerExtras("min", element.getMinElement(), false);
18365      }
18366      if (element.hasMaxElement()) {
18367        composeStringCore("max", element.getMaxElement(), false);
18368        composeStringExtras("max", element.getMaxElement(), false);
18369      }
18370      if (element.hasDocumentationElement()) {
18371        composeStringCore("documentation", element.getDocumentationElement(), false);
18372        composeStringExtras("documentation", element.getDocumentationElement(), false);
18373      }
18374      if (element.hasTypeElement()) {
18375        composeCodeCore("type", element.getTypeElement(), false);
18376        composeCodeExtras("type", element.getTypeElement(), false);
18377      }
18378      if (element.hasProfile()) {
18379        composeReference("profile", element.getProfile());
18380      }
18381  }
18382
18383  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
18384    if (element != null) {
18385      open(name);
18386      composeContactPointInner(element);
18387      close();
18388    }
18389  }
18390
18391  protected void composeContactPointInner(ContactPoint element) throws IOException {
18392      composeElement(element);
18393      if (element.hasSystemElement()) {
18394        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
18395        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
18396      }
18397      if (element.hasValueElement()) {
18398        composeStringCore("value", element.getValueElement(), false);
18399        composeStringExtras("value", element.getValueElement(), false);
18400      }
18401      if (element.hasUseElement()) {
18402        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
18403        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
18404      }
18405      if (element.hasRankElement()) {
18406        composePositiveIntCore("rank", element.getRankElement(), false);
18407        composePositiveIntExtras("rank", element.getRankElement(), false);
18408      }
18409      if (element.hasPeriod()) {
18410        composePeriod("period", element.getPeriod());
18411      }
18412  }
18413
18414  protected void composeParameters(String name, Parameters element) throws IOException {
18415    if (element != null) {
18416      prop("resourceType", name);
18417      composeParametersInner(element);
18418    }
18419  }
18420
18421  protected void composeParametersInner(Parameters element) throws IOException {
18422      composeResourceElements(element);
18423      if (element.hasParameter()) {
18424        openArray("parameter");
18425        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
18426          composeParametersParametersParameterComponent(null, e);
18427        closeArray();
18428      };
18429  }
18430
18431  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
18432    if (element != null) {
18433      open(name);
18434      composeParametersParametersParameterComponentInner(element);
18435      close();
18436    }
18437  }
18438
18439  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
18440      composeBackbone(element);
18441      if (element.hasNameElement()) {
18442        composeStringCore("name", element.getNameElement(), false);
18443        composeStringExtras("name", element.getNameElement(), false);
18444      }
18445      if (element.hasValue()) {
18446        composeType("value", element.getValue());
18447      }
18448        if (element.hasResource()) {
18449          open("resource");
18450          composeResource(element.getResource());
18451          close();
18452        }
18453      if (element.hasPart()) {
18454        openArray("part");
18455        for (Parameters.ParametersParameterComponent e : element.getPart()) 
18456          composeParametersParametersParameterComponent(null, e);
18457        closeArray();
18458      };
18459  }
18460
18461  protected void composeResourceElements(Resource element) throws IOException {
18462      if (element.hasIdElement()) {
18463        composeIdCore("id", element.getIdElement(), false);
18464        composeIdExtras("id", element.getIdElement(), false);
18465      }
18466      if (element.hasMeta()) {
18467        composeMeta("meta", element.getMeta());
18468      }
18469      if (element.hasImplicitRulesElement()) {
18470        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
18471        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
18472      }
18473      if (element.hasLanguageElement()) {
18474        composeCodeCore("language", element.getLanguageElement(), false);
18475        composeCodeExtras("language", element.getLanguageElement(), false);
18476      }
18477  }
18478
18479  protected void composeDomainResourceElements(DomainResource element) throws IOException {
18480      composeResourceElements(element);
18481      if (element.hasText()) {
18482        composeNarrative("text", element.getText());
18483      }
18484      if (element.hasContained()) {
18485        openArray("contained");
18486        for (Resource e : element.getContained()) {
18487          open(null);
18488          composeResource(e);
18489          close();
18490        }
18491        closeArray();
18492      };
18493      if (element.hasExtension()) {
18494        openArray("extension");
18495        for (Extension e : element.getExtension()) 
18496          composeExtension(null, e);
18497        closeArray();
18498      };
18499      if (element.hasModifierExtension()) {
18500        openArray("modifierExtension");
18501        for (Extension e : element.getModifierExtension()) 
18502          composeExtension(null, e);
18503        closeArray();
18504      };
18505  }
18506
18507  protected void composeAccount(String name, Account element) throws IOException {
18508    if (element != null) {
18509      prop("resourceType", name);
18510      composeAccountInner(element);
18511    }
18512  }
18513
18514  protected void composeAccountInner(Account element) throws IOException {
18515      composeDomainResourceElements(element);
18516      if (element.hasIdentifier()) {
18517        openArray("identifier");
18518        for (Identifier e : element.getIdentifier()) 
18519          composeIdentifier(null, e);
18520        closeArray();
18521      };
18522      if (element.hasNameElement()) {
18523        composeStringCore("name", element.getNameElement(), false);
18524        composeStringExtras("name", element.getNameElement(), false);
18525      }
18526      if (element.hasType()) {
18527        composeCodeableConcept("type", element.getType());
18528      }
18529      if (element.hasStatusElement()) {
18530        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
18531        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
18532      }
18533      if (element.hasActivePeriod()) {
18534        composePeriod("activePeriod", element.getActivePeriod());
18535      }
18536      if (element.hasCurrency()) {
18537        composeCoding("currency", element.getCurrency());
18538      }
18539      if (element.hasBalance()) {
18540        composeMoney("balance", element.getBalance());
18541      }
18542      if (element.hasCoveragePeriod()) {
18543        composePeriod("coveragePeriod", element.getCoveragePeriod());
18544      }
18545      if (element.hasSubject()) {
18546        composeReference("subject", element.getSubject());
18547      }
18548      if (element.hasOwner()) {
18549        composeReference("owner", element.getOwner());
18550      }
18551      if (element.hasDescriptionElement()) {
18552        composeStringCore("description", element.getDescriptionElement(), false);
18553        composeStringExtras("description", element.getDescriptionElement(), false);
18554      }
18555  }
18556
18557  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
18558    if (element != null) {
18559      prop("resourceType", name);
18560      composeAllergyIntoleranceInner(element);
18561    }
18562  }
18563
18564  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
18565      composeDomainResourceElements(element);
18566      if (element.hasIdentifier()) {
18567        openArray("identifier");
18568        for (Identifier e : element.getIdentifier()) 
18569          composeIdentifier(null, e);
18570        closeArray();
18571      };
18572      if (element.hasStatusElement()) {
18573        composeEnumerationCore("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
18574        composeEnumerationExtras("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
18575      }
18576      if (element.hasTypeElement()) {
18577        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
18578        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
18579      }
18580      if (element.hasCategoryElement()) {
18581        composeEnumerationCore("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
18582        composeEnumerationExtras("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
18583      }
18584      if (element.hasCriticalityElement()) {
18585        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
18586        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
18587      }
18588      if (element.hasSubstance()) {
18589        composeCodeableConcept("substance", element.getSubstance());
18590      }
18591      if (element.hasPatient()) {
18592        composeReference("patient", element.getPatient());
18593      }
18594      if (element.hasRecordedDateElement()) {
18595        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
18596        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
18597      }
18598      if (element.hasRecorder()) {
18599        composeReference("recorder", element.getRecorder());
18600      }
18601      if (element.hasReporter()) {
18602        composeReference("reporter", element.getReporter());
18603      }
18604      if (element.hasOnsetElement()) {
18605        composeDateTimeCore("onset", element.getOnsetElement(), false);
18606        composeDateTimeExtras("onset", element.getOnsetElement(), false);
18607      }
18608      if (element.hasLastOccurenceElement()) {
18609        composeDateTimeCore("lastOccurence", element.getLastOccurenceElement(), false);
18610        composeDateTimeExtras("lastOccurence", element.getLastOccurenceElement(), false);
18611      }
18612      if (element.hasNote()) {
18613        openArray("note");
18614        for (Annotation e : element.getNote()) 
18615          composeAnnotation(null, e);
18616        closeArray();
18617      };
18618      if (element.hasReaction()) {
18619        openArray("reaction");
18620        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
18621          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
18622        closeArray();
18623      };
18624  }
18625
18626  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
18627    if (element != null) {
18628      open(name);
18629      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
18630      close();
18631    }
18632  }
18633
18634  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
18635      composeBackbone(element);
18636      if (element.hasSubstance()) {
18637        composeCodeableConcept("substance", element.getSubstance());
18638      }
18639      if (element.hasCertaintyElement()) {
18640        composeEnumerationCore("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
18641        composeEnumerationExtras("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
18642      }
18643      if (element.hasManifestation()) {
18644        openArray("manifestation");
18645        for (CodeableConcept e : element.getManifestation()) 
18646          composeCodeableConcept(null, e);
18647        closeArray();
18648      };
18649      if (element.hasDescriptionElement()) {
18650        composeStringCore("description", element.getDescriptionElement(), false);
18651        composeStringExtras("description", element.getDescriptionElement(), false);
18652      }
18653      if (element.hasOnsetElement()) {
18654        composeDateTimeCore("onset", element.getOnsetElement(), false);
18655        composeDateTimeExtras("onset", element.getOnsetElement(), false);
18656      }
18657      if (element.hasSeverityElement()) {
18658        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
18659        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
18660      }
18661      if (element.hasExposureRoute()) {
18662        composeCodeableConcept("exposureRoute", element.getExposureRoute());
18663      }
18664      if (element.hasNote()) {
18665        openArray("note");
18666        for (Annotation e : element.getNote()) 
18667          composeAnnotation(null, e);
18668        closeArray();
18669      };
18670  }
18671
18672  protected void composeAppointment(String name, Appointment element) throws IOException {
18673    if (element != null) {
18674      prop("resourceType", name);
18675      composeAppointmentInner(element);
18676    }
18677  }
18678
18679  protected void composeAppointmentInner(Appointment element) throws IOException {
18680      composeDomainResourceElements(element);
18681      if (element.hasIdentifier()) {
18682        openArray("identifier");
18683        for (Identifier e : element.getIdentifier()) 
18684          composeIdentifier(null, e);
18685        closeArray();
18686      };
18687      if (element.hasStatusElement()) {
18688        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
18689        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
18690      }
18691      if (element.hasServiceCategory()) {
18692        composeCodeableConcept("serviceCategory", element.getServiceCategory());
18693      }
18694      if (element.hasServiceType()) {
18695        openArray("serviceType");
18696        for (CodeableConcept e : element.getServiceType()) 
18697          composeCodeableConcept(null, e);
18698        closeArray();
18699      };
18700      if (element.hasSpecialty()) {
18701        openArray("specialty");
18702        for (CodeableConcept e : element.getSpecialty()) 
18703          composeCodeableConcept(null, e);
18704        closeArray();
18705      };
18706      if (element.hasAppointmentType()) {
18707        composeCodeableConcept("appointmentType", element.getAppointmentType());
18708      }
18709      if (element.hasReason()) {
18710        composeCodeableConcept("reason", element.getReason());
18711      }
18712      if (element.hasPriorityElement()) {
18713        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
18714        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
18715      }
18716      if (element.hasDescriptionElement()) {
18717        composeStringCore("description", element.getDescriptionElement(), false);
18718        composeStringExtras("description", element.getDescriptionElement(), false);
18719      }
18720      if (element.hasStartElement()) {
18721        composeInstantCore("start", element.getStartElement(), false);
18722        composeInstantExtras("start", element.getStartElement(), false);
18723      }
18724      if (element.hasEndElement()) {
18725        composeInstantCore("end", element.getEndElement(), false);
18726        composeInstantExtras("end", element.getEndElement(), false);
18727      }
18728      if (element.hasMinutesDurationElement()) {
18729        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
18730        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
18731      }
18732      if (element.hasSlot()) {
18733        openArray("slot");
18734        for (Reference e : element.getSlot()) 
18735          composeReference(null, e);
18736        closeArray();
18737      };
18738      if (element.hasCreatedElement()) {
18739        composeDateTimeCore("created", element.getCreatedElement(), false);
18740        composeDateTimeExtras("created", element.getCreatedElement(), false);
18741      }
18742      if (element.hasCommentElement()) {
18743        composeStringCore("comment", element.getCommentElement(), false);
18744        composeStringExtras("comment", element.getCommentElement(), false);
18745      }
18746      if (element.hasParticipant()) {
18747        openArray("participant");
18748        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
18749          composeAppointmentAppointmentParticipantComponent(null, e);
18750        closeArray();
18751      };
18752  }
18753
18754  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
18755    if (element != null) {
18756      open(name);
18757      composeAppointmentAppointmentParticipantComponentInner(element);
18758      close();
18759    }
18760  }
18761
18762  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
18763      composeBackbone(element);
18764      if (element.hasType()) {
18765        openArray("type");
18766        for (CodeableConcept e : element.getType()) 
18767          composeCodeableConcept(null, e);
18768        closeArray();
18769      };
18770      if (element.hasActor()) {
18771        composeReference("actor", element.getActor());
18772      }
18773      if (element.hasRequiredElement()) {
18774        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
18775        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
18776      }
18777      if (element.hasStatusElement()) {
18778        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
18779        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
18780      }
18781  }
18782
18783  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
18784    if (element != null) {
18785      prop("resourceType", name);
18786      composeAppointmentResponseInner(element);
18787    }
18788  }
18789
18790  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
18791      composeDomainResourceElements(element);
18792      if (element.hasIdentifier()) {
18793        openArray("identifier");
18794        for (Identifier e : element.getIdentifier()) 
18795          composeIdentifier(null, e);
18796        closeArray();
18797      };
18798      if (element.hasAppointment()) {
18799        composeReference("appointment", element.getAppointment());
18800      }
18801      if (element.hasStartElement()) {
18802        composeInstantCore("start", element.getStartElement(), false);
18803        composeInstantExtras("start", element.getStartElement(), false);
18804      }
18805      if (element.hasEndElement()) {
18806        composeInstantCore("end", element.getEndElement(), false);
18807        composeInstantExtras("end", element.getEndElement(), false);
18808      }
18809      if (element.hasParticipantType()) {
18810        openArray("participantType");
18811        for (CodeableConcept e : element.getParticipantType()) 
18812          composeCodeableConcept(null, e);
18813        closeArray();
18814      };
18815      if (element.hasActor()) {
18816        composeReference("actor", element.getActor());
18817      }
18818      if (element.hasParticipantStatusElement()) {
18819        composeCodeCore("participantStatus", element.getParticipantStatusElement(), false);
18820        composeCodeExtras("participantStatus", element.getParticipantStatusElement(), false);
18821      }
18822      if (element.hasCommentElement()) {
18823        composeStringCore("comment", element.getCommentElement(), false);
18824        composeStringExtras("comment", element.getCommentElement(), false);
18825      }
18826  }
18827
18828  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
18829    if (element != null) {
18830      prop("resourceType", name);
18831      composeAuditEventInner(element);
18832    }
18833  }
18834
18835  protected void composeAuditEventInner(AuditEvent element) throws IOException {
18836      composeDomainResourceElements(element);
18837      if (element.hasType()) {
18838        composeCoding("type", element.getType());
18839      }
18840      if (element.hasSubtype()) {
18841        openArray("subtype");
18842        for (Coding e : element.getSubtype()) 
18843          composeCoding(null, e);
18844        closeArray();
18845      };
18846      if (element.hasActionElement()) {
18847        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
18848        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
18849      }
18850      if (element.hasRecordedElement()) {
18851        composeInstantCore("recorded", element.getRecordedElement(), false);
18852        composeInstantExtras("recorded", element.getRecordedElement(), false);
18853      }
18854      if (element.hasOutcomeElement()) {
18855        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
18856        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
18857      }
18858      if (element.hasOutcomeDescElement()) {
18859        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
18860        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
18861      }
18862      if (element.hasPurposeOfEvent()) {
18863        openArray("purposeOfEvent");
18864        for (Coding e : element.getPurposeOfEvent()) 
18865          composeCoding(null, e);
18866        closeArray();
18867      };
18868      if (element.hasAgent()) {
18869        openArray("agent");
18870        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
18871          composeAuditEventAuditEventAgentComponent(null, e);
18872        closeArray();
18873      };
18874      if (element.hasSource()) {
18875        composeAuditEventAuditEventSourceComponent("source", element.getSource());
18876      }
18877      if (element.hasEntity()) {
18878        openArray("entity");
18879        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
18880          composeAuditEventAuditEventEntityComponent(null, e);
18881        closeArray();
18882      };
18883  }
18884
18885  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
18886    if (element != null) {
18887      open(name);
18888      composeAuditEventAuditEventAgentComponentInner(element);
18889      close();
18890    }
18891  }
18892
18893  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
18894      composeBackbone(element);
18895      if (element.hasRole()) {
18896        openArray("role");
18897        for (CodeableConcept e : element.getRole()) 
18898          composeCodeableConcept(null, e);
18899        closeArray();
18900      };
18901      if (element.hasReference()) {
18902        composeReference("reference", element.getReference());
18903      }
18904      if (element.hasUserId()) {
18905        composeIdentifier("userId", element.getUserId());
18906      }
18907      if (element.hasAltIdElement()) {
18908        composeStringCore("altId", element.getAltIdElement(), false);
18909        composeStringExtras("altId", element.getAltIdElement(), false);
18910      }
18911      if (element.hasNameElement()) {
18912        composeStringCore("name", element.getNameElement(), false);
18913        composeStringExtras("name", element.getNameElement(), false);
18914      }
18915      if (element.hasRequestorElement()) {
18916        composeBooleanCore("requestor", element.getRequestorElement(), false);
18917        composeBooleanExtras("requestor", element.getRequestorElement(), false);
18918      }
18919      if (element.hasLocation()) {
18920        composeReference("location", element.getLocation());
18921      }
18922      if (element.hasPolicy()) {
18923        openArray("policy");
18924        for (UriType e : element.getPolicy()) 
18925          composeUriCore(null, e, true);
18926        closeArray();
18927        if (anyHasExtras(element.getPolicy())) {
18928          openArray("_policy");
18929          for (UriType e : element.getPolicy()) 
18930            composeUriExtras(null, e, true);
18931          closeArray();
18932        }
18933      };
18934      if (element.hasMedia()) {
18935        composeCoding("media", element.getMedia());
18936      }
18937      if (element.hasNetwork()) {
18938        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
18939      }
18940      if (element.hasPurposeOfUse()) {
18941        openArray("purposeOfUse");
18942        for (Coding e : element.getPurposeOfUse()) 
18943          composeCoding(null, e);
18944        closeArray();
18945      };
18946  }
18947
18948  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
18949    if (element != null) {
18950      open(name);
18951      composeAuditEventAuditEventAgentNetworkComponentInner(element);
18952      close();
18953    }
18954  }
18955
18956  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
18957      composeBackbone(element);
18958      if (element.hasAddressElement()) {
18959        composeStringCore("address", element.getAddressElement(), false);
18960        composeStringExtras("address", element.getAddressElement(), false);
18961      }
18962      if (element.hasTypeElement()) {
18963        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
18964        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
18965      }
18966  }
18967
18968  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
18969    if (element != null) {
18970      open(name);
18971      composeAuditEventAuditEventSourceComponentInner(element);
18972      close();
18973    }
18974  }
18975
18976  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
18977      composeBackbone(element);
18978      if (element.hasSiteElement()) {
18979        composeStringCore("site", element.getSiteElement(), false);
18980        composeStringExtras("site", element.getSiteElement(), false);
18981      }
18982      if (element.hasIdentifier()) {
18983        composeIdentifier("identifier", element.getIdentifier());
18984      }
18985      if (element.hasType()) {
18986        openArray("type");
18987        for (Coding e : element.getType()) 
18988          composeCoding(null, e);
18989        closeArray();
18990      };
18991  }
18992
18993  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
18994    if (element != null) {
18995      open(name);
18996      composeAuditEventAuditEventEntityComponentInner(element);
18997      close();
18998    }
18999  }
19000
19001  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
19002      composeBackbone(element);
19003      if (element.hasIdentifier()) {
19004        composeIdentifier("identifier", element.getIdentifier());
19005      }
19006      if (element.hasReference()) {
19007        composeReference("reference", element.getReference());
19008      }
19009      if (element.hasType()) {
19010        composeCoding("type", element.getType());
19011      }
19012      if (element.hasRole()) {
19013        composeCoding("role", element.getRole());
19014      }
19015      if (element.hasLifecycle()) {
19016        composeCoding("lifecycle", element.getLifecycle());
19017      }
19018      if (element.hasSecurityLabel()) {
19019        openArray("securityLabel");
19020        for (Coding e : element.getSecurityLabel()) 
19021          composeCoding(null, e);
19022        closeArray();
19023      };
19024      if (element.hasNameElement()) {
19025        composeStringCore("name", element.getNameElement(), false);
19026        composeStringExtras("name", element.getNameElement(), false);
19027      }
19028      if (element.hasDescriptionElement()) {
19029        composeStringCore("description", element.getDescriptionElement(), false);
19030        composeStringExtras("description", element.getDescriptionElement(), false);
19031      }
19032      if (element.hasQueryElement()) {
19033        composeBase64BinaryCore("query", element.getQueryElement(), false);
19034        composeBase64BinaryExtras("query", element.getQueryElement(), false);
19035      }
19036      if (element.hasDetail()) {
19037        openArray("detail");
19038        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
19039          composeAuditEventAuditEventEntityDetailComponent(null, e);
19040        closeArray();
19041      };
19042  }
19043
19044  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
19045    if (element != null) {
19046      open(name);
19047      composeAuditEventAuditEventEntityDetailComponentInner(element);
19048      close();
19049    }
19050  }
19051
19052  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
19053      composeBackbone(element);
19054      if (element.hasTypeElement()) {
19055        composeStringCore("type", element.getTypeElement(), false);
19056        composeStringExtras("type", element.getTypeElement(), false);
19057      }
19058      if (element.hasValueElement()) {
19059        composeBase64BinaryCore("value", element.getValueElement(), false);
19060        composeBase64BinaryExtras("value", element.getValueElement(), false);
19061      }
19062  }
19063
19064  protected void composeBasic(String name, Basic element) throws IOException {
19065    if (element != null) {
19066      prop("resourceType", name);
19067      composeBasicInner(element);
19068    }
19069  }
19070
19071  protected void composeBasicInner(Basic element) throws IOException {
19072      composeDomainResourceElements(element);
19073      if (element.hasIdentifier()) {
19074        openArray("identifier");
19075        for (Identifier e : element.getIdentifier()) 
19076          composeIdentifier(null, e);
19077        closeArray();
19078      };
19079      if (element.hasCode()) {
19080        composeCodeableConcept("code", element.getCode());
19081      }
19082      if (element.hasSubject()) {
19083        composeReference("subject", element.getSubject());
19084      }
19085      if (element.hasCreatedElement()) {
19086        composeDateCore("created", element.getCreatedElement(), false);
19087        composeDateExtras("created", element.getCreatedElement(), false);
19088      }
19089      if (element.hasAuthor()) {
19090        composeReference("author", element.getAuthor());
19091      }
19092  }
19093
19094  protected void composeBinary(String name, Binary element) throws IOException {
19095    if (element != null) {
19096      prop("resourceType", name);
19097      composeBinaryInner(element);
19098    }
19099  }
19100
19101  protected void composeBinaryInner(Binary element) throws IOException {
19102      composeResourceElements(element);
19103      if (element.hasContentTypeElement()) {
19104        composeCodeCore("contentType", element.getContentTypeElement(), false);
19105        composeCodeExtras("contentType", element.getContentTypeElement(), false);
19106      }
19107      if (element.hasContentElement()) {
19108        composeBase64BinaryCore("content", element.getContentElement(), false);
19109        composeBase64BinaryExtras("content", element.getContentElement(), false);
19110      }
19111  }
19112
19113  protected void composeBodySite(String name, BodySite element) throws IOException {
19114    if (element != null) {
19115      prop("resourceType", name);
19116      composeBodySiteInner(element);
19117    }
19118  }
19119
19120  protected void composeBodySiteInner(BodySite element) throws IOException {
19121      composeDomainResourceElements(element);
19122      if (element.hasPatient()) {
19123        composeReference("patient", element.getPatient());
19124      }
19125      if (element.hasIdentifier()) {
19126        openArray("identifier");
19127        for (Identifier e : element.getIdentifier()) 
19128          composeIdentifier(null, e);
19129        closeArray();
19130      };
19131      if (element.hasCode()) {
19132        composeCodeableConcept("code", element.getCode());
19133      }
19134      if (element.hasModifier()) {
19135        openArray("modifier");
19136        for (CodeableConcept e : element.getModifier()) 
19137          composeCodeableConcept(null, e);
19138        closeArray();
19139      };
19140      if (element.hasDescriptionElement()) {
19141        composeStringCore("description", element.getDescriptionElement(), false);
19142        composeStringExtras("description", element.getDescriptionElement(), false);
19143      }
19144      if (element.hasImage()) {
19145        openArray("image");
19146        for (Attachment e : element.getImage()) 
19147          composeAttachment(null, e);
19148        closeArray();
19149      };
19150  }
19151
19152  protected void composeBundle(String name, Bundle element) throws IOException {
19153    if (element != null) {
19154      prop("resourceType", name);
19155      composeBundleInner(element);
19156    }
19157  }
19158
19159  protected void composeBundleInner(Bundle element) throws IOException {
19160      composeResourceElements(element);
19161      if (element.hasTypeElement()) {
19162        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
19163        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
19164      }
19165      if (element.hasTotalElement()) {
19166        composeUnsignedIntCore("total", element.getTotalElement(), false);
19167        composeUnsignedIntExtras("total", element.getTotalElement(), false);
19168      }
19169      if (element.hasLink()) {
19170        openArray("link");
19171        for (Bundle.BundleLinkComponent e : element.getLink()) 
19172          composeBundleBundleLinkComponent(null, e);
19173        closeArray();
19174      };
19175      if (element.hasEntry()) {
19176        openArray("entry");
19177        for (Bundle.BundleEntryComponent e : element.getEntry()) 
19178          composeBundleBundleEntryComponent(null, e);
19179        closeArray();
19180      };
19181      if (element.hasSignature()) {
19182        composeSignature("signature", element.getSignature());
19183      }
19184  }
19185
19186  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
19187    if (element != null) {
19188      open(name);
19189      composeBundleBundleLinkComponentInner(element);
19190      close();
19191    }
19192  }
19193
19194  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
19195      composeBackbone(element);
19196      if (element.hasRelationElement()) {
19197        composeStringCore("relation", element.getRelationElement(), false);
19198        composeStringExtras("relation", element.getRelationElement(), false);
19199      }
19200      if (element.hasUrlElement()) {
19201        composeUriCore("url", element.getUrlElement(), false);
19202        composeUriExtras("url", element.getUrlElement(), false);
19203      }
19204  }
19205
19206  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
19207    if (element != null) {
19208      open(name);
19209      composeBundleBundleEntryComponentInner(element);
19210      close();
19211    }
19212  }
19213
19214  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
19215      composeBackbone(element);
19216      if (element.hasLink()) {
19217        openArray("link");
19218        for (Bundle.BundleLinkComponent e : element.getLink()) 
19219          composeBundleBundleLinkComponent(null, e);
19220        closeArray();
19221      };
19222      if (element.hasFullUrlElement()) {
19223        composeUriCore("fullUrl", element.getFullUrlElement(), false);
19224        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
19225      }
19226        if (element.hasResource()) {
19227          open("resource");
19228          composeResource(element.getResource());
19229          close();
19230        }
19231      if (element.hasSearch()) {
19232        composeBundleBundleEntrySearchComponent("search", element.getSearch());
19233      }
19234      if (element.hasRequest()) {
19235        composeBundleBundleEntryRequestComponent("request", element.getRequest());
19236      }
19237      if (element.hasResponse()) {
19238        composeBundleBundleEntryResponseComponent("response", element.getResponse());
19239      }
19240  }
19241
19242  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
19243    if (element != null) {
19244      open(name);
19245      composeBundleBundleEntrySearchComponentInner(element);
19246      close();
19247    }
19248  }
19249
19250  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
19251      composeBackbone(element);
19252      if (element.hasModeElement()) {
19253        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
19254        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
19255      }
19256      if (element.hasScoreElement()) {
19257        composeDecimalCore("score", element.getScoreElement(), false);
19258        composeDecimalExtras("score", element.getScoreElement(), false);
19259      }
19260  }
19261
19262  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
19263    if (element != null) {
19264      open(name);
19265      composeBundleBundleEntryRequestComponentInner(element);
19266      close();
19267    }
19268  }
19269
19270  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
19271      composeBackbone(element);
19272      if (element.hasMethodElement()) {
19273        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
19274        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
19275      }
19276      if (element.hasUrlElement()) {
19277        composeUriCore("url", element.getUrlElement(), false);
19278        composeUriExtras("url", element.getUrlElement(), false);
19279      }
19280      if (element.hasIfNoneMatchElement()) {
19281        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
19282        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
19283      }
19284      if (element.hasIfModifiedSinceElement()) {
19285        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
19286        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
19287      }
19288      if (element.hasIfMatchElement()) {
19289        composeStringCore("ifMatch", element.getIfMatchElement(), false);
19290        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
19291      }
19292      if (element.hasIfNoneExistElement()) {
19293        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
19294        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
19295      }
19296  }
19297
19298  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
19299    if (element != null) {
19300      open(name);
19301      composeBundleBundleEntryResponseComponentInner(element);
19302      close();
19303    }
19304  }
19305
19306  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
19307      composeBackbone(element);
19308      if (element.hasStatusElement()) {
19309        composeStringCore("status", element.getStatusElement(), false);
19310        composeStringExtras("status", element.getStatusElement(), false);
19311      }
19312      if (element.hasLocationElement()) {
19313        composeUriCore("location", element.getLocationElement(), false);
19314        composeUriExtras("location", element.getLocationElement(), false);
19315      }
19316      if (element.hasEtagElement()) {
19317        composeStringCore("etag", element.getEtagElement(), false);
19318        composeStringExtras("etag", element.getEtagElement(), false);
19319      }
19320      if (element.hasLastModifiedElement()) {
19321        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
19322        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
19323      }
19324  }
19325
19326  protected void composeCarePlan(String name, CarePlan element) throws IOException {
19327    if (element != null) {
19328      prop("resourceType", name);
19329      composeCarePlanInner(element);
19330    }
19331  }
19332
19333  protected void composeCarePlanInner(CarePlan element) throws IOException {
19334      composeDomainResourceElements(element);
19335      if (element.hasIdentifier()) {
19336        openArray("identifier");
19337        for (Identifier e : element.getIdentifier()) 
19338          composeIdentifier(null, e);
19339        closeArray();
19340      };
19341      if (element.hasSubject()) {
19342        composeReference("subject", element.getSubject());
19343      }
19344      if (element.hasStatusElement()) {
19345        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
19346        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
19347      }
19348      if (element.hasContext()) {
19349        composeReference("context", element.getContext());
19350      }
19351      if (element.hasPeriod()) {
19352        composePeriod("period", element.getPeriod());
19353      }
19354      if (element.hasAuthor()) {
19355        openArray("author");
19356        for (Reference e : element.getAuthor()) 
19357          composeReference(null, e);
19358        closeArray();
19359      };
19360      if (element.hasModifiedElement()) {
19361        composeDateTimeCore("modified", element.getModifiedElement(), false);
19362        composeDateTimeExtras("modified", element.getModifiedElement(), false);
19363      }
19364      if (element.hasCategory()) {
19365        openArray("category");
19366        for (CodeableConcept e : element.getCategory()) 
19367          composeCodeableConcept(null, e);
19368        closeArray();
19369      };
19370      if (element.hasDescriptionElement()) {
19371        composeStringCore("description", element.getDescriptionElement(), false);
19372        composeStringExtras("description", element.getDescriptionElement(), false);
19373      }
19374      if (element.hasAddresses()) {
19375        openArray("addresses");
19376        for (Reference e : element.getAddresses()) 
19377          composeReference(null, e);
19378        closeArray();
19379      };
19380      if (element.hasSupport()) {
19381        openArray("support");
19382        for (Reference e : element.getSupport()) 
19383          composeReference(null, e);
19384        closeArray();
19385      };
19386      if (element.hasRelatedPlan()) {
19387        openArray("relatedPlan");
19388        for (CarePlan.CarePlanRelatedPlanComponent e : element.getRelatedPlan()) 
19389          composeCarePlanCarePlanRelatedPlanComponent(null, e);
19390        closeArray();
19391      };
19392      if (element.hasParticipant()) {
19393        openArray("participant");
19394        for (CarePlan.CarePlanParticipantComponent e : element.getParticipant()) 
19395          composeCarePlanCarePlanParticipantComponent(null, e);
19396        closeArray();
19397      };
19398      if (element.hasGoal()) {
19399        openArray("goal");
19400        for (Reference e : element.getGoal()) 
19401          composeReference(null, e);
19402        closeArray();
19403      };
19404      if (element.hasActivity()) {
19405        openArray("activity");
19406        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
19407          composeCarePlanCarePlanActivityComponent(null, e);
19408        closeArray();
19409      };
19410      if (element.hasNote()) {
19411        composeAnnotation("note", element.getNote());
19412      }
19413  }
19414
19415  protected void composeCarePlanCarePlanRelatedPlanComponent(String name, CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
19416    if (element != null) {
19417      open(name);
19418      composeCarePlanCarePlanRelatedPlanComponentInner(element);
19419      close();
19420    }
19421  }
19422
19423  protected void composeCarePlanCarePlanRelatedPlanComponentInner(CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
19424      composeBackbone(element);
19425      if (element.hasCodeElement()) {
19426        composeEnumerationCore("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
19427        composeEnumerationExtras("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
19428      }
19429      if (element.hasPlan()) {
19430        composeReference("plan", element.getPlan());
19431      }
19432  }
19433
19434  protected void composeCarePlanCarePlanParticipantComponent(String name, CarePlan.CarePlanParticipantComponent element) throws IOException {
19435    if (element != null) {
19436      open(name);
19437      composeCarePlanCarePlanParticipantComponentInner(element);
19438      close();
19439    }
19440  }
19441
19442  protected void composeCarePlanCarePlanParticipantComponentInner(CarePlan.CarePlanParticipantComponent element) throws IOException {
19443      composeBackbone(element);
19444      if (element.hasRole()) {
19445        composeCodeableConcept("role", element.getRole());
19446      }
19447      if (element.hasMember()) {
19448        composeReference("member", element.getMember());
19449      }
19450  }
19451
19452  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
19453    if (element != null) {
19454      open(name);
19455      composeCarePlanCarePlanActivityComponentInner(element);
19456      close();
19457    }
19458  }
19459
19460  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
19461      composeBackbone(element);
19462      if (element.hasActionResulting()) {
19463        openArray("actionResulting");
19464        for (Reference e : element.getActionResulting()) 
19465          composeReference(null, e);
19466        closeArray();
19467      };
19468      if (element.hasProgress()) {
19469        openArray("progress");
19470        for (Annotation e : element.getProgress()) 
19471          composeAnnotation(null, e);
19472        closeArray();
19473      };
19474      if (element.hasReference()) {
19475        composeReference("reference", element.getReference());
19476      }
19477      if (element.hasDetail()) {
19478        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
19479      }
19480  }
19481
19482  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
19483    if (element != null) {
19484      open(name);
19485      composeCarePlanCarePlanActivityDetailComponentInner(element);
19486      close();
19487    }
19488  }
19489
19490  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
19491      composeBackbone(element);
19492      if (element.hasCategory()) {
19493        composeCodeableConcept("category", element.getCategory());
19494      }
19495      if (element.hasCode()) {
19496        composeCodeableConcept("code", element.getCode());
19497      }
19498      if (element.hasReasonCode()) {
19499        openArray("reasonCode");
19500        for (CodeableConcept e : element.getReasonCode()) 
19501          composeCodeableConcept(null, e);
19502        closeArray();
19503      };
19504      if (element.hasReasonReference()) {
19505        openArray("reasonReference");
19506        for (Reference e : element.getReasonReference()) 
19507          composeReference(null, e);
19508        closeArray();
19509      };
19510      if (element.hasGoal()) {
19511        openArray("goal");
19512        for (Reference e : element.getGoal()) 
19513          composeReference(null, e);
19514        closeArray();
19515      };
19516      if (element.hasStatusElement()) {
19517        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
19518        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
19519      }
19520      if (element.hasStatusReason()) {
19521        composeCodeableConcept("statusReason", element.getStatusReason());
19522      }
19523      if (element.hasProhibitedElement()) {
19524        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
19525        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
19526      }
19527      if (element.hasScheduled()) {
19528        composeType("scheduled", element.getScheduled());
19529      }
19530      if (element.hasLocation()) {
19531        composeReference("location", element.getLocation());
19532      }
19533      if (element.hasPerformer()) {
19534        openArray("performer");
19535        for (Reference e : element.getPerformer()) 
19536          composeReference(null, e);
19537        closeArray();
19538      };
19539      if (element.hasProduct()) {
19540        composeType("product", element.getProduct());
19541      }
19542      if (element.hasDailyAmount()) {
19543        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
19544      }
19545      if (element.hasQuantity()) {
19546        composeSimpleQuantity("quantity", element.getQuantity());
19547      }
19548      if (element.hasDescriptionElement()) {
19549        composeStringCore("description", element.getDescriptionElement(), false);
19550        composeStringExtras("description", element.getDescriptionElement(), false);
19551      }
19552  }
19553
19554  protected void composeCareTeam(String name, CareTeam element) throws IOException {
19555    if (element != null) {
19556      prop("resourceType", name);
19557      composeCareTeamInner(element);
19558    }
19559  }
19560
19561  protected void composeCareTeamInner(CareTeam element) throws IOException {
19562      composeDomainResourceElements(element);
19563      if (element.hasIdentifier()) {
19564        openArray("identifier");
19565        for (Identifier e : element.getIdentifier()) 
19566          composeIdentifier(null, e);
19567        closeArray();
19568      };
19569      if (element.hasStatus()) {
19570        composeCodeableConcept("status", element.getStatus());
19571      }
19572      if (element.hasType()) {
19573        openArray("type");
19574        for (CodeableConcept e : element.getType()) 
19575          composeCodeableConcept(null, e);
19576        closeArray();
19577      };
19578      if (element.hasNameElement()) {
19579        composeStringCore("name", element.getNameElement(), false);
19580        composeStringExtras("name", element.getNameElement(), false);
19581      }
19582      if (element.hasSubject()) {
19583        composeReference("subject", element.getSubject());
19584      }
19585      if (element.hasPeriod()) {
19586        composePeriod("period", element.getPeriod());
19587      }
19588      if (element.hasParticipant()) {
19589        openArray("participant");
19590        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
19591          composeCareTeamCareTeamParticipantComponent(null, e);
19592        closeArray();
19593      };
19594      if (element.hasManagingOrganization()) {
19595        composeReference("managingOrganization", element.getManagingOrganization());
19596      }
19597  }
19598
19599  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
19600    if (element != null) {
19601      open(name);
19602      composeCareTeamCareTeamParticipantComponentInner(element);
19603      close();
19604    }
19605  }
19606
19607  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
19608      composeBackbone(element);
19609      if (element.hasRole()) {
19610        composeCodeableConcept("role", element.getRole());
19611      }
19612      if (element.hasMember()) {
19613        composeReference("member", element.getMember());
19614      }
19615      if (element.hasPeriod()) {
19616        composePeriod("period", element.getPeriod());
19617      }
19618  }
19619
19620  protected void composeClaim(String name, Claim element) throws IOException {
19621    if (element != null) {
19622      prop("resourceType", name);
19623      composeClaimInner(element);
19624    }
19625  }
19626
19627  protected void composeClaimInner(Claim element) throws IOException {
19628      composeDomainResourceElements(element);
19629      if (element.hasTypeElement()) {
19630        composeEnumerationCore("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
19631        composeEnumerationExtras("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
19632      }
19633      if (element.hasSubType()) {
19634        openArray("subType");
19635        for (Coding e : element.getSubType()) 
19636          composeCoding(null, e);
19637        closeArray();
19638      };
19639      if (element.hasIdentifier()) {
19640        openArray("identifier");
19641        for (Identifier e : element.getIdentifier()) 
19642          composeIdentifier(null, e);
19643        closeArray();
19644      };
19645      if (element.hasRuleset()) {
19646        composeCoding("ruleset", element.getRuleset());
19647      }
19648      if (element.hasOriginalRuleset()) {
19649        composeCoding("originalRuleset", element.getOriginalRuleset());
19650      }
19651      if (element.hasCreatedElement()) {
19652        composeDateTimeCore("created", element.getCreatedElement(), false);
19653        composeDateTimeExtras("created", element.getCreatedElement(), false);
19654      }
19655      if (element.hasBillablePeriod()) {
19656        composePeriod("billablePeriod", element.getBillablePeriod());
19657      }
19658      if (element.hasTarget()) {
19659        composeType("target", element.getTarget());
19660      }
19661      if (element.hasProvider()) {
19662        composeType("provider", element.getProvider());
19663      }
19664      if (element.hasOrganization()) {
19665        composeType("organization", element.getOrganization());
19666      }
19667      if (element.hasUseElement()) {
19668        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
19669        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
19670      }
19671      if (element.hasPriority()) {
19672        composeCoding("priority", element.getPriority());
19673      }
19674      if (element.hasFundsReserve()) {
19675        composeCoding("fundsReserve", element.getFundsReserve());
19676      }
19677      if (element.hasEnterer()) {
19678        composeType("enterer", element.getEnterer());
19679      }
19680      if (element.hasFacility()) {
19681        composeType("facility", element.getFacility());
19682      }
19683      if (element.hasRelated()) {
19684        openArray("related");
19685        for (Claim.RelatedClaimsComponent e : element.getRelated()) 
19686          composeClaimRelatedClaimsComponent(null, e);
19687        closeArray();
19688      };
19689      if (element.hasPrescription()) {
19690        composeType("prescription", element.getPrescription());
19691      }
19692      if (element.hasOriginalPrescription()) {
19693        composeType("originalPrescription", element.getOriginalPrescription());
19694      }
19695      if (element.hasPayee()) {
19696        composeClaimPayeeComponent("payee", element.getPayee());
19697      }
19698      if (element.hasReferral()) {
19699        composeType("referral", element.getReferral());
19700      }
19701      if (element.hasOccurrenceCode()) {
19702        openArray("occurrenceCode");
19703        for (Coding e : element.getOccurrenceCode()) 
19704          composeCoding(null, e);
19705        closeArray();
19706      };
19707      if (element.hasOccurenceSpanCode()) {
19708        openArray("occurenceSpanCode");
19709        for (Coding e : element.getOccurenceSpanCode()) 
19710          composeCoding(null, e);
19711        closeArray();
19712      };
19713      if (element.hasValueCode()) {
19714        openArray("valueCode");
19715        for (Coding e : element.getValueCode()) 
19716          composeCoding(null, e);
19717        closeArray();
19718      };
19719      if (element.hasDiagnosis()) {
19720        openArray("diagnosis");
19721        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
19722          composeClaimDiagnosisComponent(null, e);
19723        closeArray();
19724      };
19725      if (element.hasProcedure()) {
19726        openArray("procedure");
19727        for (Claim.ProcedureComponent e : element.getProcedure()) 
19728          composeClaimProcedureComponent(null, e);
19729        closeArray();
19730      };
19731      if (element.hasSpecialCondition()) {
19732        openArray("specialCondition");
19733        for (Coding e : element.getSpecialCondition()) 
19734          composeCoding(null, e);
19735        closeArray();
19736      };
19737      if (element.hasPatient()) {
19738        composeType("patient", element.getPatient());
19739      }
19740      if (element.hasCoverage()) {
19741        openArray("coverage");
19742        for (Claim.CoverageComponent e : element.getCoverage()) 
19743          composeClaimCoverageComponent(null, e);
19744        closeArray();
19745      };
19746      if (element.hasAccidentDateElement()) {
19747        composeDateCore("accidentDate", element.getAccidentDateElement(), false);
19748        composeDateExtras("accidentDate", element.getAccidentDateElement(), false);
19749      }
19750      if (element.hasAccidentType()) {
19751        composeCoding("accidentType", element.getAccidentType());
19752      }
19753      if (element.hasAccidentLocation()) {
19754        composeType("accidentLocation", element.getAccidentLocation());
19755      }
19756      if (element.hasInterventionException()) {
19757        openArray("interventionException");
19758        for (Coding e : element.getInterventionException()) 
19759          composeCoding(null, e);
19760        closeArray();
19761      };
19762      if (element.hasOnset()) {
19763        openArray("onset");
19764        for (Claim.OnsetComponent e : element.getOnset()) 
19765          composeClaimOnsetComponent(null, e);
19766        closeArray();
19767      };
19768      if (element.hasEmploymentImpacted()) {
19769        composePeriod("employmentImpacted", element.getEmploymentImpacted());
19770      }
19771      if (element.hasHospitalization()) {
19772        composePeriod("hospitalization", element.getHospitalization());
19773      }
19774      if (element.hasItem()) {
19775        openArray("item");
19776        for (Claim.ItemsComponent e : element.getItem()) 
19777          composeClaimItemsComponent(null, e);
19778        closeArray();
19779      };
19780      if (element.hasTotal()) {
19781        composeMoney("total", element.getTotal());
19782      }
19783      if (element.hasAdditionalMaterial()) {
19784        openArray("additionalMaterial");
19785        for (Coding e : element.getAdditionalMaterial()) 
19786          composeCoding(null, e);
19787        closeArray();
19788      };
19789      if (element.hasMissingTeeth()) {
19790        openArray("missingTeeth");
19791        for (Claim.MissingTeethComponent e : element.getMissingTeeth()) 
19792          composeClaimMissingTeethComponent(null, e);
19793        closeArray();
19794      };
19795  }
19796
19797  protected void composeClaimRelatedClaimsComponent(String name, Claim.RelatedClaimsComponent element) throws IOException {
19798    if (element != null) {
19799      open(name);
19800      composeClaimRelatedClaimsComponentInner(element);
19801      close();
19802    }
19803  }
19804
19805  protected void composeClaimRelatedClaimsComponentInner(Claim.RelatedClaimsComponent element) throws IOException {
19806      composeBackbone(element);
19807      if (element.hasClaim()) {
19808        composeType("claim", element.getClaim());
19809      }
19810      if (element.hasRelationship()) {
19811        composeCoding("relationship", element.getRelationship());
19812      }
19813      if (element.hasReference()) {
19814        composeIdentifier("reference", element.getReference());
19815      }
19816  }
19817
19818  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
19819    if (element != null) {
19820      open(name);
19821      composeClaimPayeeComponentInner(element);
19822      close();
19823    }
19824  }
19825
19826  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
19827      composeBackbone(element);
19828      if (element.hasType()) {
19829        composeCoding("type", element.getType());
19830      }
19831      if (element.hasParty()) {
19832        composeType("party", element.getParty());
19833      }
19834  }
19835
19836  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
19837    if (element != null) {
19838      open(name);
19839      composeClaimDiagnosisComponentInner(element);
19840      close();
19841    }
19842  }
19843
19844  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
19845      composeBackbone(element);
19846      if (element.hasSequenceElement()) {
19847        composePositiveIntCore("sequence", element.getSequenceElement(), false);
19848        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
19849      }
19850      if (element.hasDiagnosis()) {
19851        composeCoding("diagnosis", element.getDiagnosis());
19852      }
19853  }
19854
19855  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
19856    if (element != null) {
19857      open(name);
19858      composeClaimProcedureComponentInner(element);
19859      close();
19860    }
19861  }
19862
19863  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
19864      composeBackbone(element);
19865      if (element.hasSequenceElement()) {
19866        composePositiveIntCore("sequence", element.getSequenceElement(), false);
19867        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
19868      }
19869      if (element.hasDateElement()) {
19870        composeDateTimeCore("date", element.getDateElement(), false);
19871        composeDateTimeExtras("date", element.getDateElement(), false);
19872      }
19873      if (element.hasProcedure()) {
19874        composeType("procedure", element.getProcedure());
19875      }
19876  }
19877
19878  protected void composeClaimCoverageComponent(String name, Claim.CoverageComponent element) throws IOException {
19879    if (element != null) {
19880      open(name);
19881      composeClaimCoverageComponentInner(element);
19882      close();
19883    }
19884  }
19885
19886  protected void composeClaimCoverageComponentInner(Claim.CoverageComponent element) throws IOException {
19887      composeBackbone(element);
19888      if (element.hasSequenceElement()) {
19889        composePositiveIntCore("sequence", element.getSequenceElement(), false);
19890        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
19891      }
19892      if (element.hasFocalElement()) {
19893        composeBooleanCore("focal", element.getFocalElement(), false);
19894        composeBooleanExtras("focal", element.getFocalElement(), false);
19895      }
19896      if (element.hasCoverage()) {
19897        composeType("coverage", element.getCoverage());
19898      }
19899      if (element.hasBusinessArrangementElement()) {
19900        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
19901        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
19902      }
19903      if (element.hasPreAuthRef()) {
19904        openArray("preAuthRef");
19905        for (StringType e : element.getPreAuthRef()) 
19906          composeStringCore(null, e, true);
19907        closeArray();
19908        if (anyHasExtras(element.getPreAuthRef())) {
19909          openArray("_preAuthRef");
19910          for (StringType e : element.getPreAuthRef()) 
19911            composeStringExtras(null, e, true);
19912          closeArray();
19913        }
19914      };
19915      if (element.hasClaimResponse()) {
19916        composeReference("claimResponse", element.getClaimResponse());
19917      }
19918      if (element.hasOriginalRuleset()) {
19919        composeCoding("originalRuleset", element.getOriginalRuleset());
19920      }
19921  }
19922
19923  protected void composeClaimOnsetComponent(String name, Claim.OnsetComponent element) throws IOException {
19924    if (element != null) {
19925      open(name);
19926      composeClaimOnsetComponentInner(element);
19927      close();
19928    }
19929  }
19930
19931  protected void composeClaimOnsetComponentInner(Claim.OnsetComponent element) throws IOException {
19932      composeBackbone(element);
19933      if (element.hasTime()) {
19934        composeType("time", element.getTime());
19935      }
19936      if (element.hasType()) {
19937        composeCoding("type", element.getType());
19938      }
19939  }
19940
19941  protected void composeClaimItemsComponent(String name, Claim.ItemsComponent element) throws IOException {
19942    if (element != null) {
19943      open(name);
19944      composeClaimItemsComponentInner(element);
19945      close();
19946    }
19947  }
19948
19949  protected void composeClaimItemsComponentInner(Claim.ItemsComponent element) throws IOException {
19950      composeBackbone(element);
19951      if (element.hasSequenceElement()) {
19952        composePositiveIntCore("sequence", element.getSequenceElement(), false);
19953        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
19954      }
19955      if (element.hasType()) {
19956        composeCoding("type", element.getType());
19957      }
19958      if (element.hasProvider()) {
19959        composeType("provider", element.getProvider());
19960      }
19961      if (element.hasSupervisor()) {
19962        composeType("supervisor", element.getSupervisor());
19963      }
19964      if (element.hasProviderQualification()) {
19965        composeCoding("providerQualification", element.getProviderQualification());
19966      }
19967      if (element.hasDiagnosisLinkId()) {
19968        openArray("diagnosisLinkId");
19969        for (PositiveIntType e : element.getDiagnosisLinkId()) 
19970          composePositiveIntCore(null, e, true);
19971        closeArray();
19972        if (anyHasExtras(element.getDiagnosisLinkId())) {
19973          openArray("_diagnosisLinkId");
19974          for (PositiveIntType e : element.getDiagnosisLinkId()) 
19975            composePositiveIntExtras(null, e, true);
19976          closeArray();
19977        }
19978      };
19979      if (element.hasService()) {
19980        composeCoding("service", element.getService());
19981      }
19982      if (element.hasServiceModifier()) {
19983        openArray("serviceModifier");
19984        for (Coding e : element.getServiceModifier()) 
19985          composeCoding(null, e);
19986        closeArray();
19987      };
19988      if (element.hasModifier()) {
19989        openArray("modifier");
19990        for (Coding e : element.getModifier()) 
19991          composeCoding(null, e);
19992        closeArray();
19993      };
19994      if (element.hasProgramCode()) {
19995        openArray("programCode");
19996        for (Coding e : element.getProgramCode()) 
19997          composeCoding(null, e);
19998        closeArray();
19999      };
20000      if (element.hasServiced()) {
20001        composeType("serviced", element.getServiced());
20002      }
20003      if (element.hasPlace()) {
20004        composeCoding("place", element.getPlace());
20005      }
20006      if (element.hasQuantity()) {
20007        composeSimpleQuantity("quantity", element.getQuantity());
20008      }
20009      if (element.hasUnitPrice()) {
20010        composeMoney("unitPrice", element.getUnitPrice());
20011      }
20012      if (element.hasFactorElement()) {
20013        composeDecimalCore("factor", element.getFactorElement(), false);
20014        composeDecimalExtras("factor", element.getFactorElement(), false);
20015      }
20016      if (element.hasPointsElement()) {
20017        composeDecimalCore("points", element.getPointsElement(), false);
20018        composeDecimalExtras("points", element.getPointsElement(), false);
20019      }
20020      if (element.hasNet()) {
20021        composeMoney("net", element.getNet());
20022      }
20023      if (element.hasUdi()) {
20024        openArray("udi");
20025        for (Reference e : element.getUdi()) 
20026          composeReference(null, e);
20027        closeArray();
20028      };
20029      if (element.hasBodySite()) {
20030        composeCoding("bodySite", element.getBodySite());
20031      }
20032      if (element.hasSubSite()) {
20033        openArray("subSite");
20034        for (Coding e : element.getSubSite()) 
20035          composeCoding(null, e);
20036        closeArray();
20037      };
20038      if (element.hasDetail()) {
20039        openArray("detail");
20040        for (Claim.DetailComponent e : element.getDetail()) 
20041          composeClaimDetailComponent(null, e);
20042        closeArray();
20043      };
20044      if (element.hasProsthesis()) {
20045        composeClaimProsthesisComponent("prosthesis", element.getProsthesis());
20046      }
20047  }
20048
20049  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
20050    if (element != null) {
20051      open(name);
20052      composeClaimDetailComponentInner(element);
20053      close();
20054    }
20055  }
20056
20057  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
20058      composeBackbone(element);
20059      if (element.hasSequenceElement()) {
20060        composePositiveIntCore("sequence", element.getSequenceElement(), false);
20061        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
20062      }
20063      if (element.hasType()) {
20064        composeCoding("type", element.getType());
20065      }
20066      if (element.hasService()) {
20067        composeCoding("service", element.getService());
20068      }
20069      if (element.hasProgramCode()) {
20070        openArray("programCode");
20071        for (Coding e : element.getProgramCode()) 
20072          composeCoding(null, e);
20073        closeArray();
20074      };
20075      if (element.hasQuantity()) {
20076        composeSimpleQuantity("quantity", element.getQuantity());
20077      }
20078      if (element.hasUnitPrice()) {
20079        composeMoney("unitPrice", element.getUnitPrice());
20080      }
20081      if (element.hasFactorElement()) {
20082        composeDecimalCore("factor", element.getFactorElement(), false);
20083        composeDecimalExtras("factor", element.getFactorElement(), false);
20084      }
20085      if (element.hasPointsElement()) {
20086        composeDecimalCore("points", element.getPointsElement(), false);
20087        composeDecimalExtras("points", element.getPointsElement(), false);
20088      }
20089      if (element.hasNet()) {
20090        composeMoney("net", element.getNet());
20091      }
20092      if (element.hasUdi()) {
20093        openArray("udi");
20094        for (Reference e : element.getUdi()) 
20095          composeReference(null, e);
20096        closeArray();
20097      };
20098      if (element.hasSubDetail()) {
20099        openArray("subDetail");
20100        for (Claim.SubDetailComponent e : element.getSubDetail()) 
20101          composeClaimSubDetailComponent(null, e);
20102        closeArray();
20103      };
20104  }
20105
20106  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
20107    if (element != null) {
20108      open(name);
20109      composeClaimSubDetailComponentInner(element);
20110      close();
20111    }
20112  }
20113
20114  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
20115      composeBackbone(element);
20116      if (element.hasSequenceElement()) {
20117        composePositiveIntCore("sequence", element.getSequenceElement(), false);
20118        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
20119      }
20120      if (element.hasType()) {
20121        composeCoding("type", element.getType());
20122      }
20123      if (element.hasService()) {
20124        composeCoding("service", element.getService());
20125      }
20126      if (element.hasProgramCode()) {
20127        openArray("programCode");
20128        for (Coding e : element.getProgramCode()) 
20129          composeCoding(null, e);
20130        closeArray();
20131      };
20132      if (element.hasQuantity()) {
20133        composeSimpleQuantity("quantity", element.getQuantity());
20134      }
20135      if (element.hasUnitPrice()) {
20136        composeMoney("unitPrice", element.getUnitPrice());
20137      }
20138      if (element.hasFactorElement()) {
20139        composeDecimalCore("factor", element.getFactorElement(), false);
20140        composeDecimalExtras("factor", element.getFactorElement(), false);
20141      }
20142      if (element.hasPointsElement()) {
20143        composeDecimalCore("points", element.getPointsElement(), false);
20144        composeDecimalExtras("points", element.getPointsElement(), false);
20145      }
20146      if (element.hasNet()) {
20147        composeMoney("net", element.getNet());
20148      }
20149      if (element.hasUdi()) {
20150        openArray("udi");
20151        for (Reference e : element.getUdi()) 
20152          composeReference(null, e);
20153        closeArray();
20154      };
20155  }
20156
20157  protected void composeClaimProsthesisComponent(String name, Claim.ProsthesisComponent element) throws IOException {
20158    if (element != null) {
20159      open(name);
20160      composeClaimProsthesisComponentInner(element);
20161      close();
20162    }
20163  }
20164
20165  protected void composeClaimProsthesisComponentInner(Claim.ProsthesisComponent element) throws IOException {
20166      composeBackbone(element);
20167      if (element.hasInitialElement()) {
20168        composeBooleanCore("initial", element.getInitialElement(), false);
20169        composeBooleanExtras("initial", element.getInitialElement(), false);
20170      }
20171      if (element.hasPriorDateElement()) {
20172        composeDateCore("priorDate", element.getPriorDateElement(), false);
20173        composeDateExtras("priorDate", element.getPriorDateElement(), false);
20174      }
20175      if (element.hasPriorMaterial()) {
20176        composeCoding("priorMaterial", element.getPriorMaterial());
20177      }
20178  }
20179
20180  protected void composeClaimMissingTeethComponent(String name, Claim.MissingTeethComponent element) throws IOException {
20181    if (element != null) {
20182      open(name);
20183      composeClaimMissingTeethComponentInner(element);
20184      close();
20185    }
20186  }
20187
20188  protected void composeClaimMissingTeethComponentInner(Claim.MissingTeethComponent element) throws IOException {
20189      composeBackbone(element);
20190      if (element.hasTooth()) {
20191        composeCoding("tooth", element.getTooth());
20192      }
20193      if (element.hasReason()) {
20194        composeCoding("reason", element.getReason());
20195      }
20196      if (element.hasExtractionDateElement()) {
20197        composeDateCore("extractionDate", element.getExtractionDateElement(), false);
20198        composeDateExtras("extractionDate", element.getExtractionDateElement(), false);
20199      }
20200  }
20201
20202  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
20203    if (element != null) {
20204      prop("resourceType", name);
20205      composeClaimResponseInner(element);
20206    }
20207  }
20208
20209  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
20210      composeDomainResourceElements(element);
20211      if (element.hasIdentifier()) {
20212        openArray("identifier");
20213        for (Identifier e : element.getIdentifier()) 
20214          composeIdentifier(null, e);
20215        closeArray();
20216      };
20217      if (element.hasRequest()) {
20218        composeType("request", element.getRequest());
20219      }
20220      if (element.hasRuleset()) {
20221        composeCoding("ruleset", element.getRuleset());
20222      }
20223      if (element.hasOriginalRuleset()) {
20224        composeCoding("originalRuleset", element.getOriginalRuleset());
20225      }
20226      if (element.hasCreatedElement()) {
20227        composeDateTimeCore("created", element.getCreatedElement(), false);
20228        composeDateTimeExtras("created", element.getCreatedElement(), false);
20229      }
20230      if (element.hasOrganization()) {
20231        composeType("organization", element.getOrganization());
20232      }
20233      if (element.hasRequestProvider()) {
20234        composeType("requestProvider", element.getRequestProvider());
20235      }
20236      if (element.hasRequestOrganization()) {
20237        composeType("requestOrganization", element.getRequestOrganization());
20238      }
20239      if (element.hasOutcomeElement()) {
20240        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
20241        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
20242      }
20243      if (element.hasDispositionElement()) {
20244        composeStringCore("disposition", element.getDispositionElement(), false);
20245        composeStringExtras("disposition", element.getDispositionElement(), false);
20246      }
20247      if (element.hasPayeeType()) {
20248        composeCoding("payeeType", element.getPayeeType());
20249      }
20250      if (element.hasItem()) {
20251        openArray("item");
20252        for (ClaimResponse.ItemsComponent e : element.getItem()) 
20253          composeClaimResponseItemsComponent(null, e);
20254        closeArray();
20255      };
20256      if (element.hasAddItem()) {
20257        openArray("addItem");
20258        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
20259          composeClaimResponseAddedItemComponent(null, e);
20260        closeArray();
20261      };
20262      if (element.hasError()) {
20263        openArray("error");
20264        for (ClaimResponse.ErrorsComponent e : element.getError()) 
20265          composeClaimResponseErrorsComponent(null, e);
20266        closeArray();
20267      };
20268      if (element.hasTotalCost()) {
20269        composeMoney("totalCost", element.getTotalCost());
20270      }
20271      if (element.hasUnallocDeductable()) {
20272        composeMoney("unallocDeductable", element.getUnallocDeductable());
20273      }
20274      if (element.hasTotalBenefit()) {
20275        composeMoney("totalBenefit", element.getTotalBenefit());
20276      }
20277      if (element.hasPaymentAdjustment()) {
20278        composeMoney("paymentAdjustment", element.getPaymentAdjustment());
20279      }
20280      if (element.hasPaymentAdjustmentReason()) {
20281        composeCoding("paymentAdjustmentReason", element.getPaymentAdjustmentReason());
20282      }
20283      if (element.hasPaymentDateElement()) {
20284        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
20285        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
20286      }
20287      if (element.hasPaymentAmount()) {
20288        composeMoney("paymentAmount", element.getPaymentAmount());
20289      }
20290      if (element.hasPaymentRef()) {
20291        composeIdentifier("paymentRef", element.getPaymentRef());
20292      }
20293      if (element.hasReserved()) {
20294        composeCoding("reserved", element.getReserved());
20295      }
20296      if (element.hasForm()) {
20297        composeCoding("form", element.getForm());
20298      }
20299      if (element.hasNote()) {
20300        openArray("note");
20301        for (ClaimResponse.NotesComponent e : element.getNote()) 
20302          composeClaimResponseNotesComponent(null, e);
20303        closeArray();
20304      };
20305      if (element.hasCoverage()) {
20306        openArray("coverage");
20307        for (ClaimResponse.CoverageComponent e : element.getCoverage()) 
20308          composeClaimResponseCoverageComponent(null, e);
20309        closeArray();
20310      };
20311  }
20312
20313  protected void composeClaimResponseItemsComponent(String name, ClaimResponse.ItemsComponent element) throws IOException {
20314    if (element != null) {
20315      open(name);
20316      composeClaimResponseItemsComponentInner(element);
20317      close();
20318    }
20319  }
20320
20321  protected void composeClaimResponseItemsComponentInner(ClaimResponse.ItemsComponent element) throws IOException {
20322      composeBackbone(element);
20323      if (element.hasSequenceLinkIdElement()) {
20324        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20325        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20326      }
20327      if (element.hasNoteNumber()) {
20328        openArray("noteNumber");
20329        for (PositiveIntType e : element.getNoteNumber()) 
20330          composePositiveIntCore(null, e, true);
20331        closeArray();
20332        if (anyHasExtras(element.getNoteNumber())) {
20333          openArray("_noteNumber");
20334          for (PositiveIntType e : element.getNoteNumber()) 
20335            composePositiveIntExtras(null, e, true);
20336          closeArray();
20337        }
20338      };
20339      if (element.hasAdjudication()) {
20340        openArray("adjudication");
20341        for (ClaimResponse.ItemAdjudicationComponent e : element.getAdjudication()) 
20342          composeClaimResponseItemAdjudicationComponent(null, e);
20343        closeArray();
20344      };
20345      if (element.hasDetail()) {
20346        openArray("detail");
20347        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
20348          composeClaimResponseItemDetailComponent(null, e);
20349        closeArray();
20350      };
20351  }
20352
20353  protected void composeClaimResponseItemAdjudicationComponent(String name, ClaimResponse.ItemAdjudicationComponent element) throws IOException {
20354    if (element != null) {
20355      open(name);
20356      composeClaimResponseItemAdjudicationComponentInner(element);
20357      close();
20358    }
20359  }
20360
20361  protected void composeClaimResponseItemAdjudicationComponentInner(ClaimResponse.ItemAdjudicationComponent element) throws IOException {
20362      composeBackbone(element);
20363      if (element.hasCategory()) {
20364        composeCoding("category", element.getCategory());
20365      }
20366      if (element.hasReason()) {
20367        composeCoding("reason", element.getReason());
20368      }
20369      if (element.hasAmount()) {
20370        composeMoney("amount", element.getAmount());
20371      }
20372      if (element.hasValueElement()) {
20373        composeDecimalCore("value", element.getValueElement(), false);
20374        composeDecimalExtras("value", element.getValueElement(), false);
20375      }
20376  }
20377
20378  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
20379    if (element != null) {
20380      open(name);
20381      composeClaimResponseItemDetailComponentInner(element);
20382      close();
20383    }
20384  }
20385
20386  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
20387      composeBackbone(element);
20388      if (element.hasSequenceLinkIdElement()) {
20389        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20390        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20391      }
20392      if (element.hasAdjudication()) {
20393        openArray("adjudication");
20394        for (ClaimResponse.DetailAdjudicationComponent e : element.getAdjudication()) 
20395          composeClaimResponseDetailAdjudicationComponent(null, e);
20396        closeArray();
20397      };
20398      if (element.hasSubDetail()) {
20399        openArray("subDetail");
20400        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
20401          composeClaimResponseSubDetailComponent(null, e);
20402        closeArray();
20403      };
20404  }
20405
20406  protected void composeClaimResponseDetailAdjudicationComponent(String name, ClaimResponse.DetailAdjudicationComponent element) throws IOException {
20407    if (element != null) {
20408      open(name);
20409      composeClaimResponseDetailAdjudicationComponentInner(element);
20410      close();
20411    }
20412  }
20413
20414  protected void composeClaimResponseDetailAdjudicationComponentInner(ClaimResponse.DetailAdjudicationComponent element) throws IOException {
20415      composeBackbone(element);
20416      if (element.hasCategory()) {
20417        composeCoding("category", element.getCategory());
20418      }
20419      if (element.hasReason()) {
20420        composeCoding("reason", element.getReason());
20421      }
20422      if (element.hasAmount()) {
20423        composeMoney("amount", element.getAmount());
20424      }
20425      if (element.hasValueElement()) {
20426        composeDecimalCore("value", element.getValueElement(), false);
20427        composeDecimalExtras("value", element.getValueElement(), false);
20428      }
20429  }
20430
20431  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
20432    if (element != null) {
20433      open(name);
20434      composeClaimResponseSubDetailComponentInner(element);
20435      close();
20436    }
20437  }
20438
20439  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
20440      composeBackbone(element);
20441      if (element.hasSequenceLinkIdElement()) {
20442        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20443        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20444      }
20445      if (element.hasAdjudication()) {
20446        openArray("adjudication");
20447        for (ClaimResponse.SubdetailAdjudicationComponent e : element.getAdjudication()) 
20448          composeClaimResponseSubdetailAdjudicationComponent(null, e);
20449        closeArray();
20450      };
20451  }
20452
20453  protected void composeClaimResponseSubdetailAdjudicationComponent(String name, ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
20454    if (element != null) {
20455      open(name);
20456      composeClaimResponseSubdetailAdjudicationComponentInner(element);
20457      close();
20458    }
20459  }
20460
20461  protected void composeClaimResponseSubdetailAdjudicationComponentInner(ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
20462      composeBackbone(element);
20463      if (element.hasCategory()) {
20464        composeCoding("category", element.getCategory());
20465      }
20466      if (element.hasReason()) {
20467        composeCoding("reason", element.getReason());
20468      }
20469      if (element.hasAmount()) {
20470        composeMoney("amount", element.getAmount());
20471      }
20472      if (element.hasValueElement()) {
20473        composeDecimalCore("value", element.getValueElement(), false);
20474        composeDecimalExtras("value", element.getValueElement(), false);
20475      }
20476  }
20477
20478  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
20479    if (element != null) {
20480      open(name);
20481      composeClaimResponseAddedItemComponentInner(element);
20482      close();
20483    }
20484  }
20485
20486  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
20487      composeBackbone(element);
20488      if (element.hasSequenceLinkId()) {
20489        openArray("sequenceLinkId");
20490        for (PositiveIntType e : element.getSequenceLinkId()) 
20491          composePositiveIntCore(null, e, true);
20492        closeArray();
20493        if (anyHasExtras(element.getSequenceLinkId())) {
20494          openArray("_sequenceLinkId");
20495          for (PositiveIntType e : element.getSequenceLinkId()) 
20496            composePositiveIntExtras(null, e, true);
20497          closeArray();
20498        }
20499      };
20500      if (element.hasService()) {
20501        composeCoding("service", element.getService());
20502      }
20503      if (element.hasFee()) {
20504        composeMoney("fee", element.getFee());
20505      }
20506      if (element.hasNoteNumberLinkId()) {
20507        openArray("noteNumberLinkId");
20508        for (PositiveIntType e : element.getNoteNumberLinkId()) 
20509          composePositiveIntCore(null, e, true);
20510        closeArray();
20511        if (anyHasExtras(element.getNoteNumberLinkId())) {
20512          openArray("_noteNumberLinkId");
20513          for (PositiveIntType e : element.getNoteNumberLinkId()) 
20514            composePositiveIntExtras(null, e, true);
20515          closeArray();
20516        }
20517      };
20518      if (element.hasAdjudication()) {
20519        openArray("adjudication");
20520        for (ClaimResponse.AddedItemAdjudicationComponent e : element.getAdjudication()) 
20521          composeClaimResponseAddedItemAdjudicationComponent(null, e);
20522        closeArray();
20523      };
20524      if (element.hasDetail()) {
20525        openArray("detail");
20526        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
20527          composeClaimResponseAddedItemsDetailComponent(null, e);
20528        closeArray();
20529      };
20530  }
20531
20532  protected void composeClaimResponseAddedItemAdjudicationComponent(String name, ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
20533    if (element != null) {
20534      open(name);
20535      composeClaimResponseAddedItemAdjudicationComponentInner(element);
20536      close();
20537    }
20538  }
20539
20540  protected void composeClaimResponseAddedItemAdjudicationComponentInner(ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
20541      composeBackbone(element);
20542      if (element.hasCategory()) {
20543        composeCoding("category", element.getCategory());
20544      }
20545      if (element.hasReason()) {
20546        composeCoding("reason", element.getReason());
20547      }
20548      if (element.hasAmount()) {
20549        composeMoney("amount", element.getAmount());
20550      }
20551      if (element.hasValueElement()) {
20552        composeDecimalCore("value", element.getValueElement(), false);
20553        composeDecimalExtras("value", element.getValueElement(), false);
20554      }
20555  }
20556
20557  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
20558    if (element != null) {
20559      open(name);
20560      composeClaimResponseAddedItemsDetailComponentInner(element);
20561      close();
20562    }
20563  }
20564
20565  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
20566      composeBackbone(element);
20567      if (element.hasService()) {
20568        composeCoding("service", element.getService());
20569      }
20570      if (element.hasFee()) {
20571        composeMoney("fee", element.getFee());
20572      }
20573      if (element.hasAdjudication()) {
20574        openArray("adjudication");
20575        for (ClaimResponse.AddedItemDetailAdjudicationComponent e : element.getAdjudication()) 
20576          composeClaimResponseAddedItemDetailAdjudicationComponent(null, e);
20577        closeArray();
20578      };
20579  }
20580
20581  protected void composeClaimResponseAddedItemDetailAdjudicationComponent(String name, ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
20582    if (element != null) {
20583      open(name);
20584      composeClaimResponseAddedItemDetailAdjudicationComponentInner(element);
20585      close();
20586    }
20587  }
20588
20589  protected void composeClaimResponseAddedItemDetailAdjudicationComponentInner(ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
20590      composeBackbone(element);
20591      if (element.hasCategory()) {
20592        composeCoding("category", element.getCategory());
20593      }
20594      if (element.hasReason()) {
20595        composeCoding("reason", element.getReason());
20596      }
20597      if (element.hasAmount()) {
20598        composeMoney("amount", element.getAmount());
20599      }
20600      if (element.hasValueElement()) {
20601        composeDecimalCore("value", element.getValueElement(), false);
20602        composeDecimalExtras("value", element.getValueElement(), false);
20603      }
20604  }
20605
20606  protected void composeClaimResponseErrorsComponent(String name, ClaimResponse.ErrorsComponent element) throws IOException {
20607    if (element != null) {
20608      open(name);
20609      composeClaimResponseErrorsComponentInner(element);
20610      close();
20611    }
20612  }
20613
20614  protected void composeClaimResponseErrorsComponentInner(ClaimResponse.ErrorsComponent element) throws IOException {
20615      composeBackbone(element);
20616      if (element.hasSequenceLinkIdElement()) {
20617        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20618        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
20619      }
20620      if (element.hasDetailSequenceLinkIdElement()) {
20621        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
20622        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
20623      }
20624      if (element.hasSubdetailSequenceLinkIdElement()) {
20625        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
20626        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
20627      }
20628      if (element.hasCode()) {
20629        composeCoding("code", element.getCode());
20630      }
20631  }
20632
20633  protected void composeClaimResponseNotesComponent(String name, ClaimResponse.NotesComponent element) throws IOException {
20634    if (element != null) {
20635      open(name);
20636      composeClaimResponseNotesComponentInner(element);
20637      close();
20638    }
20639  }
20640
20641  protected void composeClaimResponseNotesComponentInner(ClaimResponse.NotesComponent element) throws IOException {
20642      composeBackbone(element);
20643      if (element.hasNumberElement()) {
20644        composePositiveIntCore("number", element.getNumberElement(), false);
20645        composePositiveIntExtras("number", element.getNumberElement(), false);
20646      }
20647      if (element.hasType()) {
20648        composeCoding("type", element.getType());
20649      }
20650      if (element.hasTextElement()) {
20651        composeStringCore("text", element.getTextElement(), false);
20652        composeStringExtras("text", element.getTextElement(), false);
20653      }
20654  }
20655
20656  protected void composeClaimResponseCoverageComponent(String name, ClaimResponse.CoverageComponent element) throws IOException {
20657    if (element != null) {
20658      open(name);
20659      composeClaimResponseCoverageComponentInner(element);
20660      close();
20661    }
20662  }
20663
20664  protected void composeClaimResponseCoverageComponentInner(ClaimResponse.CoverageComponent element) throws IOException {
20665      composeBackbone(element);
20666      if (element.hasSequenceElement()) {
20667        composePositiveIntCore("sequence", element.getSequenceElement(), false);
20668        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
20669      }
20670      if (element.hasFocalElement()) {
20671        composeBooleanCore("focal", element.getFocalElement(), false);
20672        composeBooleanExtras("focal", element.getFocalElement(), false);
20673      }
20674      if (element.hasCoverage()) {
20675        composeType("coverage", element.getCoverage());
20676      }
20677      if (element.hasBusinessArrangementElement()) {
20678        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
20679        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
20680      }
20681      if (element.hasPreAuthRef()) {
20682        openArray("preAuthRef");
20683        for (StringType e : element.getPreAuthRef()) 
20684          composeStringCore(null, e, true);
20685        closeArray();
20686        if (anyHasExtras(element.getPreAuthRef())) {
20687          openArray("_preAuthRef");
20688          for (StringType e : element.getPreAuthRef()) 
20689            composeStringExtras(null, e, true);
20690          closeArray();
20691        }
20692      };
20693      if (element.hasClaimResponse()) {
20694        composeReference("claimResponse", element.getClaimResponse());
20695      }
20696  }
20697
20698  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
20699    if (element != null) {
20700      prop("resourceType", name);
20701      composeClinicalImpressionInner(element);
20702    }
20703  }
20704
20705  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
20706      composeDomainResourceElements(element);
20707      if (element.hasPatient()) {
20708        composeReference("patient", element.getPatient());
20709      }
20710      if (element.hasAssessor()) {
20711        composeReference("assessor", element.getAssessor());
20712      }
20713      if (element.hasStatusElement()) {
20714        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
20715        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
20716      }
20717      if (element.hasDateElement()) {
20718        composeDateTimeCore("date", element.getDateElement(), false);
20719        composeDateTimeExtras("date", element.getDateElement(), false);
20720      }
20721      if (element.hasDescriptionElement()) {
20722        composeStringCore("description", element.getDescriptionElement(), false);
20723        composeStringExtras("description", element.getDescriptionElement(), false);
20724      }
20725      if (element.hasPrevious()) {
20726        composeReference("previous", element.getPrevious());
20727      }
20728      if (element.hasProblem()) {
20729        openArray("problem");
20730        for (Reference e : element.getProblem()) 
20731          composeReference(null, e);
20732        closeArray();
20733      };
20734      if (element.hasTrigger()) {
20735        composeType("trigger", element.getTrigger());
20736      }
20737      if (element.hasInvestigations()) {
20738        openArray("investigations");
20739        for (ClinicalImpression.ClinicalImpressionInvestigationsComponent e : element.getInvestigations()) 
20740          composeClinicalImpressionClinicalImpressionInvestigationsComponent(null, e);
20741        closeArray();
20742      };
20743      if (element.hasProtocolElement()) {
20744        composeUriCore("protocol", element.getProtocolElement(), false);
20745        composeUriExtras("protocol", element.getProtocolElement(), false);
20746      }
20747      if (element.hasSummaryElement()) {
20748        composeStringCore("summary", element.getSummaryElement(), false);
20749        composeStringExtras("summary", element.getSummaryElement(), false);
20750      }
20751      if (element.hasFinding()) {
20752        openArray("finding");
20753        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
20754          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
20755        closeArray();
20756      };
20757      if (element.hasResolved()) {
20758        openArray("resolved");
20759        for (CodeableConcept e : element.getResolved()) 
20760          composeCodeableConcept(null, e);
20761        closeArray();
20762      };
20763      if (element.hasRuledOut()) {
20764        openArray("ruledOut");
20765        for (ClinicalImpression.ClinicalImpressionRuledOutComponent e : element.getRuledOut()) 
20766          composeClinicalImpressionClinicalImpressionRuledOutComponent(null, e);
20767        closeArray();
20768      };
20769      if (element.hasPrognosisElement()) {
20770        composeStringCore("prognosis", element.getPrognosisElement(), false);
20771        composeStringExtras("prognosis", element.getPrognosisElement(), false);
20772      }
20773      if (element.hasPlan()) {
20774        openArray("plan");
20775        for (Reference e : element.getPlan()) 
20776          composeReference(null, e);
20777        closeArray();
20778      };
20779      if (element.hasAction()) {
20780        openArray("action");
20781        for (Reference e : element.getAction()) 
20782          composeReference(null, e);
20783        closeArray();
20784      };
20785  }
20786
20787  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
20788    if (element != null) {
20789      open(name);
20790      composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(element);
20791      close();
20792    }
20793  }
20794
20795  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
20796      composeBackbone(element);
20797      if (element.hasCode()) {
20798        composeCodeableConcept("code", element.getCode());
20799      }
20800      if (element.hasItem()) {
20801        openArray("item");
20802        for (Reference e : element.getItem()) 
20803          composeReference(null, e);
20804        closeArray();
20805      };
20806  }
20807
20808  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
20809    if (element != null) {
20810      open(name);
20811      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
20812      close();
20813    }
20814  }
20815
20816  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
20817      composeBackbone(element);
20818      if (element.hasItem()) {
20819        composeCodeableConcept("item", element.getItem());
20820      }
20821      if (element.hasCauseElement()) {
20822        composeStringCore("cause", element.getCauseElement(), false);
20823        composeStringExtras("cause", element.getCauseElement(), false);
20824      }
20825  }
20826
20827  protected void composeClinicalImpressionClinicalImpressionRuledOutComponent(String name, ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
20828    if (element != null) {
20829      open(name);
20830      composeClinicalImpressionClinicalImpressionRuledOutComponentInner(element);
20831      close();
20832    }
20833  }
20834
20835  protected void composeClinicalImpressionClinicalImpressionRuledOutComponentInner(ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
20836      composeBackbone(element);
20837      if (element.hasItem()) {
20838        composeCodeableConcept("item", element.getItem());
20839      }
20840      if (element.hasReasonElement()) {
20841        composeStringCore("reason", element.getReasonElement(), false);
20842        composeStringExtras("reason", element.getReasonElement(), false);
20843      }
20844  }
20845
20846  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
20847    if (element != null) {
20848      prop("resourceType", name);
20849      composeCodeSystemInner(element);
20850    }
20851  }
20852
20853  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
20854      composeDomainResourceElements(element);
20855      if (element.hasUrlElement()) {
20856        composeUriCore("url", element.getUrlElement(), false);
20857        composeUriExtras("url", element.getUrlElement(), false);
20858      }
20859      if (element.hasIdentifier()) {
20860        composeIdentifier("identifier", element.getIdentifier());
20861      }
20862      if (element.hasVersionElement()) {
20863        composeStringCore("version", element.getVersionElement(), false);
20864        composeStringExtras("version", element.getVersionElement(), false);
20865      }
20866      if (element.hasNameElement()) {
20867        composeStringCore("name", element.getNameElement(), false);
20868        composeStringExtras("name", element.getNameElement(), false);
20869      }
20870      if (element.hasStatusElement()) {
20871        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
20872        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
20873      }
20874      if (element.hasExperimentalElement()) {
20875        composeBooleanCore("experimental", element.getExperimentalElement(), false);
20876        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
20877      }
20878      if (element.hasPublisherElement()) {
20879        composeStringCore("publisher", element.getPublisherElement(), false);
20880        composeStringExtras("publisher", element.getPublisherElement(), false);
20881      }
20882      if (element.hasContact()) {
20883        openArray("contact");
20884        for (CodeSystem.CodeSystemContactComponent e : element.getContact()) 
20885          composeCodeSystemCodeSystemContactComponent(null, e);
20886        closeArray();
20887      };
20888      if (element.hasDateElement()) {
20889        composeDateTimeCore("date", element.getDateElement(), false);
20890        composeDateTimeExtras("date", element.getDateElement(), false);
20891      }
20892      if (element.hasDescriptionElement()) {
20893        composeStringCore("description", element.getDescriptionElement(), false);
20894        composeStringExtras("description", element.getDescriptionElement(), false);
20895      }
20896      if (element.hasUseContext()) {
20897        openArray("useContext");
20898        for (CodeableConcept e : element.getUseContext()) 
20899          composeCodeableConcept(null, e);
20900        closeArray();
20901      };
20902      if (element.hasRequirementsElement()) {
20903        composeStringCore("requirements", element.getRequirementsElement(), false);
20904        composeStringExtras("requirements", element.getRequirementsElement(), false);
20905      }
20906      if (element.hasCopyrightElement()) {
20907        composeStringCore("copyright", element.getCopyrightElement(), false);
20908        composeStringExtras("copyright", element.getCopyrightElement(), false);
20909      }
20910      if (element.hasCaseSensitiveElement()) {
20911        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
20912        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
20913      }
20914      if (element.hasValueSetElement()) {
20915        composeUriCore("valueSet", element.getValueSetElement(), false);
20916        composeUriExtras("valueSet", element.getValueSetElement(), false);
20917      }
20918      if (element.hasCompositionalElement()) {
20919        composeBooleanCore("compositional", element.getCompositionalElement(), false);
20920        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
20921      }
20922      if (element.hasVersionNeededElement()) {
20923        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
20924        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
20925      }
20926      if (element.hasContentElement()) {
20927        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
20928        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
20929      }
20930      if (element.hasCountElement()) {
20931        composeUnsignedIntCore("count", element.getCountElement(), false);
20932        composeUnsignedIntExtras("count", element.getCountElement(), false);
20933      }
20934      if (element.hasFilter()) {
20935        openArray("filter");
20936        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
20937          composeCodeSystemCodeSystemFilterComponent(null, e);
20938        closeArray();
20939      };
20940      if (element.hasProperty()) {
20941        openArray("property");
20942        for (CodeSystem.CodeSystemPropertyComponent e : element.getProperty()) 
20943          composeCodeSystemCodeSystemPropertyComponent(null, e);
20944        closeArray();
20945      };
20946      if (element.hasConcept()) {
20947        openArray("concept");
20948        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
20949          composeCodeSystemConceptDefinitionComponent(null, e);
20950        closeArray();
20951      };
20952  }
20953
20954  protected void composeCodeSystemCodeSystemContactComponent(String name, CodeSystem.CodeSystemContactComponent element) throws IOException {
20955    if (element != null) {
20956      open(name);
20957      composeCodeSystemCodeSystemContactComponentInner(element);
20958      close();
20959    }
20960  }
20961
20962  protected void composeCodeSystemCodeSystemContactComponentInner(CodeSystem.CodeSystemContactComponent element) throws IOException {
20963      composeBackbone(element);
20964      if (element.hasNameElement()) {
20965        composeStringCore("name", element.getNameElement(), false);
20966        composeStringExtras("name", element.getNameElement(), false);
20967      }
20968      if (element.hasTelecom()) {
20969        openArray("telecom");
20970        for (ContactPoint e : element.getTelecom()) 
20971          composeContactPoint(null, e);
20972        closeArray();
20973      };
20974  }
20975
20976  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
20977    if (element != null) {
20978      open(name);
20979      composeCodeSystemCodeSystemFilterComponentInner(element);
20980      close();
20981    }
20982  }
20983
20984  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
20985      composeBackbone(element);
20986      if (element.hasCodeElement()) {
20987        composeCodeCore("code", element.getCodeElement(), false);
20988        composeCodeExtras("code", element.getCodeElement(), false);
20989      }
20990      if (element.hasDescriptionElement()) {
20991        composeStringCore("description", element.getDescriptionElement(), false);
20992        composeStringExtras("description", element.getDescriptionElement(), false);
20993      }
20994      if (element.hasOperator()) {
20995        openArray("operator");
20996        for (CodeType e : element.getOperator()) 
20997          composeCodeCore(null, e, true);
20998        closeArray();
20999        if (anyHasExtras(element.getOperator())) {
21000          openArray("_operator");
21001          for (CodeType e : element.getOperator()) 
21002            composeCodeExtras(null, e, true);
21003          closeArray();
21004        }
21005      };
21006      if (element.hasValueElement()) {
21007        composeStringCore("value", element.getValueElement(), false);
21008        composeStringExtras("value", element.getValueElement(), false);
21009      }
21010  }
21011
21012  protected void composeCodeSystemCodeSystemPropertyComponent(String name, CodeSystem.CodeSystemPropertyComponent element) throws IOException {
21013    if (element != null) {
21014      open(name);
21015      composeCodeSystemCodeSystemPropertyComponentInner(element);
21016      close();
21017    }
21018  }
21019
21020  protected void composeCodeSystemCodeSystemPropertyComponentInner(CodeSystem.CodeSystemPropertyComponent element) throws IOException {
21021      composeBackbone(element);
21022      if (element.hasCodeElement()) {
21023        composeCodeCore("code", element.getCodeElement(), false);
21024        composeCodeExtras("code", element.getCodeElement(), false);
21025      }
21026      if (element.hasDescriptionElement()) {
21027        composeStringCore("description", element.getDescriptionElement(), false);
21028        composeStringExtras("description", element.getDescriptionElement(), false);
21029      }
21030      if (element.hasTypeElement()) {
21031        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
21032        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
21033      }
21034  }
21035
21036  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
21037    if (element != null) {
21038      open(name);
21039      composeCodeSystemConceptDefinitionComponentInner(element);
21040      close();
21041    }
21042  }
21043
21044  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
21045      composeBackbone(element);
21046      if (element.hasCodeElement()) {
21047        composeCodeCore("code", element.getCodeElement(), false);
21048        composeCodeExtras("code", element.getCodeElement(), false);
21049      }
21050      if (element.hasDisplayElement()) {
21051        composeStringCore("display", element.getDisplayElement(), false);
21052        composeStringExtras("display", element.getDisplayElement(), false);
21053      }
21054      if (element.hasDefinitionElement()) {
21055        composeStringCore("definition", element.getDefinitionElement(), false);
21056        composeStringExtras("definition", element.getDefinitionElement(), false);
21057      }
21058      if (element.hasDesignation()) {
21059        openArray("designation");
21060        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
21061          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
21062        closeArray();
21063      };
21064      if (element.hasProperty()) {
21065        openArray("property");
21066        for (CodeSystem.ConceptDefinitionPropertyComponent e : element.getProperty()) 
21067          composeCodeSystemConceptDefinitionPropertyComponent(null, e);
21068        closeArray();
21069      };
21070      if (element.hasConcept()) {
21071        openArray("concept");
21072        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
21073          composeCodeSystemConceptDefinitionComponent(null, e);
21074        closeArray();
21075      };
21076  }
21077
21078  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
21079    if (element != null) {
21080      open(name);
21081      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
21082      close();
21083    }
21084  }
21085
21086  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
21087      composeBackbone(element);
21088      if (element.hasLanguageElement()) {
21089        composeCodeCore("language", element.getLanguageElement(), false);
21090        composeCodeExtras("language", element.getLanguageElement(), false);
21091      }
21092      if (element.hasUse()) {
21093        composeCoding("use", element.getUse());
21094      }
21095      if (element.hasValueElement()) {
21096        composeStringCore("value", element.getValueElement(), false);
21097        composeStringExtras("value", element.getValueElement(), false);
21098      }
21099  }
21100
21101  protected void composeCodeSystemConceptDefinitionPropertyComponent(String name, CodeSystem.ConceptDefinitionPropertyComponent element) throws IOException {
21102    if (element != null) {
21103      open(name);
21104      composeCodeSystemConceptDefinitionPropertyComponentInner(element);
21105      close();
21106    }
21107  }
21108
21109  protected void composeCodeSystemConceptDefinitionPropertyComponentInner(CodeSystem.ConceptDefinitionPropertyComponent element) throws IOException {
21110      composeBackbone(element);
21111      if (element.hasCodeElement()) {
21112        composeCodeCore("code", element.getCodeElement(), false);
21113        composeCodeExtras("code", element.getCodeElement(), false);
21114      }
21115      if (element.hasValue()) {
21116        composeType("value", element.getValue());
21117      }
21118  }
21119
21120  protected void composeCommunication(String name, Communication element) throws IOException {
21121    if (element != null) {
21122      prop("resourceType", name);
21123      composeCommunicationInner(element);
21124    }
21125  }
21126
21127  protected void composeCommunicationInner(Communication element) throws IOException {
21128      composeDomainResourceElements(element);
21129      if (element.hasIdentifier()) {
21130        openArray("identifier");
21131        for (Identifier e : element.getIdentifier()) 
21132          composeIdentifier(null, e);
21133        closeArray();
21134      };
21135      if (element.hasCategory()) {
21136        composeCodeableConcept("category", element.getCategory());
21137      }
21138      if (element.hasSender()) {
21139        composeReference("sender", element.getSender());
21140      }
21141      if (element.hasRecipient()) {
21142        openArray("recipient");
21143        for (Reference e : element.getRecipient()) 
21144          composeReference(null, e);
21145        closeArray();
21146      };
21147      if (element.hasPayload()) {
21148        openArray("payload");
21149        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
21150          composeCommunicationCommunicationPayloadComponent(null, e);
21151        closeArray();
21152      };
21153      if (element.hasMedium()) {
21154        openArray("medium");
21155        for (CodeableConcept e : element.getMedium()) 
21156          composeCodeableConcept(null, e);
21157        closeArray();
21158      };
21159      if (element.hasStatusElement()) {
21160        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
21161        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
21162      }
21163      if (element.hasEncounter()) {
21164        composeReference("encounter", element.getEncounter());
21165      }
21166      if (element.hasSentElement()) {
21167        composeDateTimeCore("sent", element.getSentElement(), false);
21168        composeDateTimeExtras("sent", element.getSentElement(), false);
21169      }
21170      if (element.hasReceivedElement()) {
21171        composeDateTimeCore("received", element.getReceivedElement(), false);
21172        composeDateTimeExtras("received", element.getReceivedElement(), false);
21173      }
21174      if (element.hasReason()) {
21175        openArray("reason");
21176        for (CodeableConcept e : element.getReason()) 
21177          composeCodeableConcept(null, e);
21178        closeArray();
21179      };
21180      if (element.hasSubject()) {
21181        composeReference("subject", element.getSubject());
21182      }
21183      if (element.hasRequestDetail()) {
21184        composeReference("requestDetail", element.getRequestDetail());
21185      }
21186  }
21187
21188  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
21189    if (element != null) {
21190      open(name);
21191      composeCommunicationCommunicationPayloadComponentInner(element);
21192      close();
21193    }
21194  }
21195
21196  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
21197      composeBackbone(element);
21198      if (element.hasContent()) {
21199        composeType("content", element.getContent());
21200      }
21201  }
21202
21203  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
21204    if (element != null) {
21205      prop("resourceType", name);
21206      composeCommunicationRequestInner(element);
21207    }
21208  }
21209
21210  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
21211      composeDomainResourceElements(element);
21212      if (element.hasIdentifier()) {
21213        openArray("identifier");
21214        for (Identifier e : element.getIdentifier()) 
21215          composeIdentifier(null, e);
21216        closeArray();
21217      };
21218      if (element.hasCategory()) {
21219        composeCodeableConcept("category", element.getCategory());
21220      }
21221      if (element.hasSender()) {
21222        composeReference("sender", element.getSender());
21223      }
21224      if (element.hasRecipient()) {
21225        openArray("recipient");
21226        for (Reference e : element.getRecipient()) 
21227          composeReference(null, e);
21228        closeArray();
21229      };
21230      if (element.hasPayload()) {
21231        openArray("payload");
21232        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
21233          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
21234        closeArray();
21235      };
21236      if (element.hasMedium()) {
21237        openArray("medium");
21238        for (CodeableConcept e : element.getMedium()) 
21239          composeCodeableConcept(null, e);
21240        closeArray();
21241      };
21242      if (element.hasRequester()) {
21243        composeReference("requester", element.getRequester());
21244      }
21245      if (element.hasStatusElement()) {
21246        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
21247        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
21248      }
21249      if (element.hasEncounter()) {
21250        composeReference("encounter", element.getEncounter());
21251      }
21252      if (element.hasScheduled()) {
21253        composeType("scheduled", element.getScheduled());
21254      }
21255      if (element.hasReason()) {
21256        openArray("reason");
21257        for (CodeableConcept e : element.getReason()) 
21258          composeCodeableConcept(null, e);
21259        closeArray();
21260      };
21261      if (element.hasRequestedOnElement()) {
21262        composeDateTimeCore("requestedOn", element.getRequestedOnElement(), false);
21263        composeDateTimeExtras("requestedOn", element.getRequestedOnElement(), false);
21264      }
21265      if (element.hasSubject()) {
21266        composeReference("subject", element.getSubject());
21267      }
21268      if (element.hasPriority()) {
21269        composeCodeableConcept("priority", element.getPriority());
21270      }
21271  }
21272
21273  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
21274    if (element != null) {
21275      open(name);
21276      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
21277      close();
21278    }
21279  }
21280
21281  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
21282      composeBackbone(element);
21283      if (element.hasContent()) {
21284        composeType("content", element.getContent());
21285      }
21286  }
21287
21288  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
21289    if (element != null) {
21290      prop("resourceType", name);
21291      composeCompartmentDefinitionInner(element);
21292    }
21293  }
21294
21295  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
21296      composeDomainResourceElements(element);
21297      if (element.hasUrlElement()) {
21298        composeUriCore("url", element.getUrlElement(), false);
21299        composeUriExtras("url", element.getUrlElement(), false);
21300      }
21301      if (element.hasNameElement()) {
21302        composeStringCore("name", element.getNameElement(), false);
21303        composeStringExtras("name", element.getNameElement(), false);
21304      }
21305      if (element.hasStatusElement()) {
21306        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21307        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21308      }
21309      if (element.hasExperimentalElement()) {
21310        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21311        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21312      }
21313      if (element.hasPublisherElement()) {
21314        composeStringCore("publisher", element.getPublisherElement(), false);
21315        composeStringExtras("publisher", element.getPublisherElement(), false);
21316      }
21317      if (element.hasContact()) {
21318        openArray("contact");
21319        for (CompartmentDefinition.CompartmentDefinitionContactComponent e : element.getContact()) 
21320          composeCompartmentDefinitionCompartmentDefinitionContactComponent(null, e);
21321        closeArray();
21322      };
21323      if (element.hasDateElement()) {
21324        composeDateTimeCore("date", element.getDateElement(), false);
21325        composeDateTimeExtras("date", element.getDateElement(), false);
21326      }
21327      if (element.hasDescriptionElement()) {
21328        composeStringCore("description", element.getDescriptionElement(), false);
21329        composeStringExtras("description", element.getDescriptionElement(), false);
21330      }
21331      if (element.hasRequirementsElement()) {
21332        composeStringCore("requirements", element.getRequirementsElement(), false);
21333        composeStringExtras("requirements", element.getRequirementsElement(), false);
21334      }
21335      if (element.hasCodeElement()) {
21336        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
21337        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
21338      }
21339      if (element.hasSearchElement()) {
21340        composeBooleanCore("search", element.getSearchElement(), false);
21341        composeBooleanExtras("search", element.getSearchElement(), false);
21342      }
21343      if (element.hasResource()) {
21344        openArray("resource");
21345        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
21346          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
21347        closeArray();
21348      };
21349  }
21350
21351  protected void composeCompartmentDefinitionCompartmentDefinitionContactComponent(String name, CompartmentDefinition.CompartmentDefinitionContactComponent element) throws IOException {
21352    if (element != null) {
21353      open(name);
21354      composeCompartmentDefinitionCompartmentDefinitionContactComponentInner(element);
21355      close();
21356    }
21357  }
21358
21359  protected void composeCompartmentDefinitionCompartmentDefinitionContactComponentInner(CompartmentDefinition.CompartmentDefinitionContactComponent element) throws IOException {
21360      composeBackbone(element);
21361      if (element.hasNameElement()) {
21362        composeStringCore("name", element.getNameElement(), false);
21363        composeStringExtras("name", element.getNameElement(), false);
21364      }
21365      if (element.hasTelecom()) {
21366        openArray("telecom");
21367        for (ContactPoint e : element.getTelecom()) 
21368          composeContactPoint(null, e);
21369        closeArray();
21370      };
21371  }
21372
21373  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
21374    if (element != null) {
21375      open(name);
21376      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
21377      close();
21378    }
21379  }
21380
21381  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
21382      composeBackbone(element);
21383      if (element.hasCodeElement()) {
21384        composeCodeCore("code", element.getCodeElement(), false);
21385        composeCodeExtras("code", element.getCodeElement(), false);
21386      }
21387      if (element.hasParam()) {
21388        openArray("param");
21389        for (StringType e : element.getParam()) 
21390          composeStringCore(null, e, true);
21391        closeArray();
21392        if (anyHasExtras(element.getParam())) {
21393          openArray("_param");
21394          for (StringType e : element.getParam()) 
21395            composeStringExtras(null, e, true);
21396          closeArray();
21397        }
21398      };
21399      if (element.hasDocumentationElement()) {
21400        composeStringCore("documentation", element.getDocumentationElement(), false);
21401        composeStringExtras("documentation", element.getDocumentationElement(), false);
21402      }
21403  }
21404
21405  protected void composeComposition(String name, Composition element) throws IOException {
21406    if (element != null) {
21407      prop("resourceType", name);
21408      composeCompositionInner(element);
21409    }
21410  }
21411
21412  protected void composeCompositionInner(Composition element) throws IOException {
21413      composeDomainResourceElements(element);
21414      if (element.hasIdentifier()) {
21415        composeIdentifier("identifier", element.getIdentifier());
21416      }
21417      if (element.hasDateElement()) {
21418        composeDateTimeCore("date", element.getDateElement(), false);
21419        composeDateTimeExtras("date", element.getDateElement(), false);
21420      }
21421      if (element.hasType()) {
21422        composeCodeableConcept("type", element.getType());
21423      }
21424      if (element.hasClass_()) {
21425        composeCodeableConcept("class", element.getClass_());
21426      }
21427      if (element.hasTitleElement()) {
21428        composeStringCore("title", element.getTitleElement(), false);
21429        composeStringExtras("title", element.getTitleElement(), false);
21430      }
21431      if (element.hasStatusElement()) {
21432        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
21433        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
21434      }
21435      if (element.hasConfidentialityElement()) {
21436        composeCodeCore("confidentiality", element.getConfidentialityElement(), false);
21437        composeCodeExtras("confidentiality", element.getConfidentialityElement(), false);
21438      }
21439      if (element.hasSubject()) {
21440        composeReference("subject", element.getSubject());
21441      }
21442      if (element.hasAuthor()) {
21443        openArray("author");
21444        for (Reference e : element.getAuthor()) 
21445          composeReference(null, e);
21446        closeArray();
21447      };
21448      if (element.hasAttester()) {
21449        openArray("attester");
21450        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
21451          composeCompositionCompositionAttesterComponent(null, e);
21452        closeArray();
21453      };
21454      if (element.hasCustodian()) {
21455        composeReference("custodian", element.getCustodian());
21456      }
21457      if (element.hasEvent()) {
21458        openArray("event");
21459        for (Composition.CompositionEventComponent e : element.getEvent()) 
21460          composeCompositionCompositionEventComponent(null, e);
21461        closeArray();
21462      };
21463      if (element.hasEncounter()) {
21464        composeReference("encounter", element.getEncounter());
21465      }
21466      if (element.hasSection()) {
21467        openArray("section");
21468        for (Composition.SectionComponent e : element.getSection()) 
21469          composeCompositionSectionComponent(null, e);
21470        closeArray();
21471      };
21472  }
21473
21474  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
21475    if (element != null) {
21476      open(name);
21477      composeCompositionCompositionAttesterComponentInner(element);
21478      close();
21479    }
21480  }
21481
21482  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
21483      composeBackbone(element);
21484      if (element.hasMode()) {
21485        openArray("mode");
21486        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
21487          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
21488        closeArray();
21489        if (anyHasExtras(element.getMode())) {
21490          openArray("_mode");
21491          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
21492            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
21493          closeArray();
21494        }
21495      };
21496      if (element.hasTimeElement()) {
21497        composeDateTimeCore("time", element.getTimeElement(), false);
21498        composeDateTimeExtras("time", element.getTimeElement(), false);
21499      }
21500      if (element.hasParty()) {
21501        composeReference("party", element.getParty());
21502      }
21503  }
21504
21505  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
21506    if (element != null) {
21507      open(name);
21508      composeCompositionCompositionEventComponentInner(element);
21509      close();
21510    }
21511  }
21512
21513  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
21514      composeBackbone(element);
21515      if (element.hasCode()) {
21516        openArray("code");
21517        for (CodeableConcept e : element.getCode()) 
21518          composeCodeableConcept(null, e);
21519        closeArray();
21520      };
21521      if (element.hasPeriod()) {
21522        composePeriod("period", element.getPeriod());
21523      }
21524      if (element.hasDetail()) {
21525        openArray("detail");
21526        for (Reference e : element.getDetail()) 
21527          composeReference(null, e);
21528        closeArray();
21529      };
21530  }
21531
21532  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
21533    if (element != null) {
21534      open(name);
21535      composeCompositionSectionComponentInner(element);
21536      close();
21537    }
21538  }
21539
21540  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
21541      composeBackbone(element);
21542      if (element.hasTitleElement()) {
21543        composeStringCore("title", element.getTitleElement(), false);
21544        composeStringExtras("title", element.getTitleElement(), false);
21545      }
21546      if (element.hasCode()) {
21547        composeCodeableConcept("code", element.getCode());
21548      }
21549      if (element.hasText()) {
21550        composeNarrative("text", element.getText());
21551      }
21552      if (element.hasModeElement()) {
21553        composeCodeCore("mode", element.getModeElement(), false);
21554        composeCodeExtras("mode", element.getModeElement(), false);
21555      }
21556      if (element.hasOrderedBy()) {
21557        composeCodeableConcept("orderedBy", element.getOrderedBy());
21558      }
21559      if (element.hasEntry()) {
21560        openArray("entry");
21561        for (Reference e : element.getEntry()) 
21562          composeReference(null, e);
21563        closeArray();
21564      };
21565      if (element.hasEmptyReason()) {
21566        composeCodeableConcept("emptyReason", element.getEmptyReason());
21567      }
21568      if (element.hasSection()) {
21569        openArray("section");
21570        for (Composition.SectionComponent e : element.getSection()) 
21571          composeCompositionSectionComponent(null, e);
21572        closeArray();
21573      };
21574  }
21575
21576  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
21577    if (element != null) {
21578      prop("resourceType", name);
21579      composeConceptMapInner(element);
21580    }
21581  }
21582
21583  protected void composeConceptMapInner(ConceptMap element) throws IOException {
21584      composeDomainResourceElements(element);
21585      if (element.hasUrlElement()) {
21586        composeUriCore("url", element.getUrlElement(), false);
21587        composeUriExtras("url", element.getUrlElement(), false);
21588      }
21589      if (element.hasIdentifier()) {
21590        composeIdentifier("identifier", element.getIdentifier());
21591      }
21592      if (element.hasVersionElement()) {
21593        composeStringCore("version", element.getVersionElement(), false);
21594        composeStringExtras("version", element.getVersionElement(), false);
21595      }
21596      if (element.hasNameElement()) {
21597        composeStringCore("name", element.getNameElement(), false);
21598        composeStringExtras("name", element.getNameElement(), false);
21599      }
21600      if (element.hasStatusElement()) {
21601        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21602        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21603      }
21604      if (element.hasExperimentalElement()) {
21605        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21606        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21607      }
21608      if (element.hasPublisherElement()) {
21609        composeStringCore("publisher", element.getPublisherElement(), false);
21610        composeStringExtras("publisher", element.getPublisherElement(), false);
21611      }
21612      if (element.hasContact()) {
21613        openArray("contact");
21614        for (ConceptMap.ConceptMapContactComponent e : element.getContact()) 
21615          composeConceptMapConceptMapContactComponent(null, e);
21616        closeArray();
21617      };
21618      if (element.hasDateElement()) {
21619        composeDateTimeCore("date", element.getDateElement(), false);
21620        composeDateTimeExtras("date", element.getDateElement(), false);
21621      }
21622      if (element.hasDescriptionElement()) {
21623        composeStringCore("description", element.getDescriptionElement(), false);
21624        composeStringExtras("description", element.getDescriptionElement(), false);
21625      }
21626      if (element.hasUseContext()) {
21627        openArray("useContext");
21628        for (CodeableConcept e : element.getUseContext()) 
21629          composeCodeableConcept(null, e);
21630        closeArray();
21631      };
21632      if (element.hasRequirementsElement()) {
21633        composeStringCore("requirements", element.getRequirementsElement(), false);
21634        composeStringExtras("requirements", element.getRequirementsElement(), false);
21635      }
21636      if (element.hasCopyrightElement()) {
21637        composeStringCore("copyright", element.getCopyrightElement(), false);
21638        composeStringExtras("copyright", element.getCopyrightElement(), false);
21639      }
21640      if (element.hasSource()) {
21641        composeType("source", element.getSource());
21642      }
21643      if (element.hasTarget()) {
21644        composeType("target", element.getTarget());
21645      }
21646      if (element.hasElement()) {
21647        openArray("element");
21648        for (ConceptMap.SourceElementComponent e : element.getElement()) 
21649          composeConceptMapSourceElementComponent(null, e);
21650        closeArray();
21651      };
21652  }
21653
21654  protected void composeConceptMapConceptMapContactComponent(String name, ConceptMap.ConceptMapContactComponent element) throws IOException {
21655    if (element != null) {
21656      open(name);
21657      composeConceptMapConceptMapContactComponentInner(element);
21658      close();
21659    }
21660  }
21661
21662  protected void composeConceptMapConceptMapContactComponentInner(ConceptMap.ConceptMapContactComponent element) throws IOException {
21663      composeBackbone(element);
21664      if (element.hasNameElement()) {
21665        composeStringCore("name", element.getNameElement(), false);
21666        composeStringExtras("name", element.getNameElement(), false);
21667      }
21668      if (element.hasTelecom()) {
21669        openArray("telecom");
21670        for (ContactPoint e : element.getTelecom()) 
21671          composeContactPoint(null, e);
21672        closeArray();
21673      };
21674  }
21675
21676  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
21677    if (element != null) {
21678      open(name);
21679      composeConceptMapSourceElementComponentInner(element);
21680      close();
21681    }
21682  }
21683
21684  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
21685      composeBackbone(element);
21686      if (element.hasSystemElement()) {
21687        composeUriCore("system", element.getSystemElement(), false);
21688        composeUriExtras("system", element.getSystemElement(), false);
21689      }
21690      if (element.hasVersionElement()) {
21691        composeStringCore("version", element.getVersionElement(), false);
21692        composeStringExtras("version", element.getVersionElement(), false);
21693      }
21694      if (element.hasCodeElement()) {
21695        composeCodeCore("code", element.getCodeElement(), false);
21696        composeCodeExtras("code", element.getCodeElement(), false);
21697      }
21698      if (element.hasTarget()) {
21699        openArray("target");
21700        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
21701          composeConceptMapTargetElementComponent(null, e);
21702        closeArray();
21703      };
21704  }
21705
21706  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
21707    if (element != null) {
21708      open(name);
21709      composeConceptMapTargetElementComponentInner(element);
21710      close();
21711    }
21712  }
21713
21714  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
21715      composeBackbone(element);
21716      if (element.hasSystemElement()) {
21717        composeUriCore("system", element.getSystemElement(), false);
21718        composeUriExtras("system", element.getSystemElement(), false);
21719      }
21720      if (element.hasVersionElement()) {
21721        composeStringCore("version", element.getVersionElement(), false);
21722        composeStringExtras("version", element.getVersionElement(), false);
21723      }
21724      if (element.hasCodeElement()) {
21725        composeCodeCore("code", element.getCodeElement(), false);
21726        composeCodeExtras("code", element.getCodeElement(), false);
21727      }
21728      if (element.hasEquivalenceElement()) {
21729        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
21730        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
21731      }
21732      if (element.hasCommentsElement()) {
21733        composeStringCore("comments", element.getCommentsElement(), false);
21734        composeStringExtras("comments", element.getCommentsElement(), false);
21735      }
21736      if (element.hasDependsOn()) {
21737        openArray("dependsOn");
21738        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
21739          composeConceptMapOtherElementComponent(null, e);
21740        closeArray();
21741      };
21742      if (element.hasProduct()) {
21743        openArray("product");
21744        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
21745          composeConceptMapOtherElementComponent(null, e);
21746        closeArray();
21747      };
21748  }
21749
21750  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
21751    if (element != null) {
21752      open(name);
21753      composeConceptMapOtherElementComponentInner(element);
21754      close();
21755    }
21756  }
21757
21758  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
21759      composeBackbone(element);
21760      if (element.hasElementElement()) {
21761        composeUriCore("element", element.getElementElement(), false);
21762        composeUriExtras("element", element.getElementElement(), false);
21763      }
21764      if (element.hasSystemElement()) {
21765        composeUriCore("system", element.getSystemElement(), false);
21766        composeUriExtras("system", element.getSystemElement(), false);
21767      }
21768      if (element.hasCodeElement()) {
21769        composeStringCore("code", element.getCodeElement(), false);
21770        composeStringExtras("code", element.getCodeElement(), false);
21771      }
21772  }
21773
21774  protected void composeCondition(String name, Condition element) throws IOException {
21775    if (element != null) {
21776      prop("resourceType", name);
21777      composeConditionInner(element);
21778    }
21779  }
21780
21781  protected void composeConditionInner(Condition element) throws IOException {
21782      composeDomainResourceElements(element);
21783      if (element.hasIdentifier()) {
21784        openArray("identifier");
21785        for (Identifier e : element.getIdentifier()) 
21786          composeIdentifier(null, e);
21787        closeArray();
21788      };
21789      if (element.hasPatient()) {
21790        composeReference("patient", element.getPatient());
21791      }
21792      if (element.hasEncounter()) {
21793        composeReference("encounter", element.getEncounter());
21794      }
21795      if (element.hasAsserter()) {
21796        composeReference("asserter", element.getAsserter());
21797      }
21798      if (element.hasDateRecordedElement()) {
21799        composeDateCore("dateRecorded", element.getDateRecordedElement(), false);
21800        composeDateExtras("dateRecorded", element.getDateRecordedElement(), false);
21801      }
21802      if (element.hasCode()) {
21803        composeCodeableConcept("code", element.getCode());
21804      }
21805      if (element.hasCategory()) {
21806        composeCodeableConcept("category", element.getCategory());
21807      }
21808      if (element.hasClinicalStatusElement()) {
21809        composeCodeCore("clinicalStatus", element.getClinicalStatusElement(), false);
21810        composeCodeExtras("clinicalStatus", element.getClinicalStatusElement(), false);
21811      }
21812      if (element.hasVerificationStatusElement()) {
21813        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
21814        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
21815      }
21816      if (element.hasSeverity()) {
21817        composeCodeableConcept("severity", element.getSeverity());
21818      }
21819      if (element.hasOnset()) {
21820        composeType("onset", element.getOnset());
21821      }
21822      if (element.hasAbatement()) {
21823        composeType("abatement", element.getAbatement());
21824      }
21825      if (element.hasStage()) {
21826        composeConditionConditionStageComponent("stage", element.getStage());
21827      }
21828      if (element.hasEvidence()) {
21829        openArray("evidence");
21830        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
21831          composeConditionConditionEvidenceComponent(null, e);
21832        closeArray();
21833      };
21834      if (element.hasBodySite()) {
21835        openArray("bodySite");
21836        for (CodeableConcept e : element.getBodySite()) 
21837          composeCodeableConcept(null, e);
21838        closeArray();
21839      };
21840      if (element.hasNotesElement()) {
21841        composeStringCore("notes", element.getNotesElement(), false);
21842        composeStringExtras("notes", element.getNotesElement(), false);
21843      }
21844  }
21845
21846  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
21847    if (element != null) {
21848      open(name);
21849      composeConditionConditionStageComponentInner(element);
21850      close();
21851    }
21852  }
21853
21854  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
21855      composeBackbone(element);
21856      if (element.hasSummary()) {
21857        composeCodeableConcept("summary", element.getSummary());
21858      }
21859      if (element.hasAssessment()) {
21860        openArray("assessment");
21861        for (Reference e : element.getAssessment()) 
21862          composeReference(null, e);
21863        closeArray();
21864      };
21865  }
21866
21867  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
21868    if (element != null) {
21869      open(name);
21870      composeConditionConditionEvidenceComponentInner(element);
21871      close();
21872    }
21873  }
21874
21875  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
21876      composeBackbone(element);
21877      if (element.hasCode()) {
21878        composeCodeableConcept("code", element.getCode());
21879      }
21880      if (element.hasDetail()) {
21881        openArray("detail");
21882        for (Reference e : element.getDetail()) 
21883          composeReference(null, e);
21884        closeArray();
21885      };
21886  }
21887
21888  protected void composeConformance(String name, Conformance element) throws IOException {
21889    if (element != null) {
21890      prop("resourceType", name);
21891      composeConformanceInner(element);
21892    }
21893  }
21894
21895  protected void composeConformanceInner(Conformance element) throws IOException {
21896      composeDomainResourceElements(element);
21897      if (element.hasUrlElement()) {
21898        composeUriCore("url", element.getUrlElement(), false);
21899        composeUriExtras("url", element.getUrlElement(), false);
21900      }
21901      if (element.hasVersionElement()) {
21902        composeStringCore("version", element.getVersionElement(), false);
21903        composeStringExtras("version", element.getVersionElement(), false);
21904      }
21905      if (element.hasNameElement()) {
21906        composeStringCore("name", element.getNameElement(), false);
21907        composeStringExtras("name", element.getNameElement(), false);
21908      }
21909      if (element.hasStatusElement()) {
21910        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21911        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21912      }
21913      if (element.hasExperimentalElement()) {
21914        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21915        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21916      }
21917      if (element.hasDateElement()) {
21918        composeDateTimeCore("date", element.getDateElement(), false);
21919        composeDateTimeExtras("date", element.getDateElement(), false);
21920      }
21921      if (element.hasPublisherElement()) {
21922        composeStringCore("publisher", element.getPublisherElement(), false);
21923        composeStringExtras("publisher", element.getPublisherElement(), false);
21924      }
21925      if (element.hasContact()) {
21926        openArray("contact");
21927        for (Conformance.ConformanceContactComponent e : element.getContact()) 
21928          composeConformanceConformanceContactComponent(null, e);
21929        closeArray();
21930      };
21931      if (element.hasDescriptionElement()) {
21932        composeStringCore("description", element.getDescriptionElement(), false);
21933        composeStringExtras("description", element.getDescriptionElement(), false);
21934      }
21935      if (element.hasUseContext()) {
21936        openArray("useContext");
21937        for (CodeableConcept e : element.getUseContext()) 
21938          composeCodeableConcept(null, e);
21939        closeArray();
21940      };
21941      if (element.hasRequirementsElement()) {
21942        composeStringCore("requirements", element.getRequirementsElement(), false);
21943        composeStringExtras("requirements", element.getRequirementsElement(), false);
21944      }
21945      if (element.hasCopyrightElement()) {
21946        composeStringCore("copyright", element.getCopyrightElement(), false);
21947        composeStringExtras("copyright", element.getCopyrightElement(), false);
21948      }
21949      if (element.hasKindElement()) {
21950        composeEnumerationCore("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
21951        composeEnumerationExtras("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
21952      }
21953      if (element.hasSoftware()) {
21954        composeConformanceConformanceSoftwareComponent("software", element.getSoftware());
21955      }
21956      if (element.hasImplementation()) {
21957        composeConformanceConformanceImplementationComponent("implementation", element.getImplementation());
21958      }
21959      if (element.hasFhirVersionElement()) {
21960        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
21961        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
21962      }
21963      if (element.hasAcceptUnknownElement()) {
21964        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
21965        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
21966      }
21967      if (element.hasFormat()) {
21968        openArray("format");
21969        for (CodeType e : element.getFormat()) 
21970          composeCodeCore(null, e, true);
21971        closeArray();
21972        if (anyHasExtras(element.getFormat())) {
21973          openArray("_format");
21974          for (CodeType e : element.getFormat()) 
21975            composeCodeExtras(null, e, true);
21976          closeArray();
21977        }
21978      };
21979      if (element.hasProfile()) {
21980        openArray("profile");
21981        for (Reference e : element.getProfile()) 
21982          composeReference(null, e);
21983        closeArray();
21984      };
21985      if (element.hasRest()) {
21986        openArray("rest");
21987        for (Conformance.ConformanceRestComponent e : element.getRest()) 
21988          composeConformanceConformanceRestComponent(null, e);
21989        closeArray();
21990      };
21991      if (element.hasMessaging()) {
21992        openArray("messaging");
21993        for (Conformance.ConformanceMessagingComponent e : element.getMessaging()) 
21994          composeConformanceConformanceMessagingComponent(null, e);
21995        closeArray();
21996      };
21997      if (element.hasDocument()) {
21998        openArray("document");
21999        for (Conformance.ConformanceDocumentComponent e : element.getDocument()) 
22000          composeConformanceConformanceDocumentComponent(null, e);
22001        closeArray();
22002      };
22003  }
22004
22005  protected void composeConformanceConformanceContactComponent(String name, Conformance.ConformanceContactComponent element) throws IOException {
22006    if (element != null) {
22007      open(name);
22008      composeConformanceConformanceContactComponentInner(element);
22009      close();
22010    }
22011  }
22012
22013  protected void composeConformanceConformanceContactComponentInner(Conformance.ConformanceContactComponent element) throws IOException {
22014      composeBackbone(element);
22015      if (element.hasNameElement()) {
22016        composeStringCore("name", element.getNameElement(), false);
22017        composeStringExtras("name", element.getNameElement(), false);
22018      }
22019      if (element.hasTelecom()) {
22020        openArray("telecom");
22021        for (ContactPoint e : element.getTelecom()) 
22022          composeContactPoint(null, e);
22023        closeArray();
22024      };
22025  }
22026
22027  protected void composeConformanceConformanceSoftwareComponent(String name, Conformance.ConformanceSoftwareComponent element) throws IOException {
22028    if (element != null) {
22029      open(name);
22030      composeConformanceConformanceSoftwareComponentInner(element);
22031      close();
22032    }
22033  }
22034
22035  protected void composeConformanceConformanceSoftwareComponentInner(Conformance.ConformanceSoftwareComponent element) throws IOException {
22036      composeBackbone(element);
22037      if (element.hasNameElement()) {
22038        composeStringCore("name", element.getNameElement(), false);
22039        composeStringExtras("name", element.getNameElement(), false);
22040      }
22041      if (element.hasVersionElement()) {
22042        composeStringCore("version", element.getVersionElement(), false);
22043        composeStringExtras("version", element.getVersionElement(), false);
22044      }
22045      if (element.hasReleaseDateElement()) {
22046        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
22047        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
22048      }
22049  }
22050
22051  protected void composeConformanceConformanceImplementationComponent(String name, Conformance.ConformanceImplementationComponent element) throws IOException {
22052    if (element != null) {
22053      open(name);
22054      composeConformanceConformanceImplementationComponentInner(element);
22055      close();
22056    }
22057  }
22058
22059  protected void composeConformanceConformanceImplementationComponentInner(Conformance.ConformanceImplementationComponent element) throws IOException {
22060      composeBackbone(element);
22061      if (element.hasDescriptionElement()) {
22062        composeStringCore("description", element.getDescriptionElement(), false);
22063        composeStringExtras("description", element.getDescriptionElement(), false);
22064      }
22065      if (element.hasUrlElement()) {
22066        composeUriCore("url", element.getUrlElement(), false);
22067        composeUriExtras("url", element.getUrlElement(), false);
22068      }
22069  }
22070
22071  protected void composeConformanceConformanceRestComponent(String name, Conformance.ConformanceRestComponent element) throws IOException {
22072    if (element != null) {
22073      open(name);
22074      composeConformanceConformanceRestComponentInner(element);
22075      close();
22076    }
22077  }
22078
22079  protected void composeConformanceConformanceRestComponentInner(Conformance.ConformanceRestComponent element) throws IOException {
22080      composeBackbone(element);
22081      if (element.hasModeElement()) {
22082        composeEnumerationCore("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
22083        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
22084      }
22085      if (element.hasDocumentationElement()) {
22086        composeStringCore("documentation", element.getDocumentationElement(), false);
22087        composeStringExtras("documentation", element.getDocumentationElement(), false);
22088      }
22089      if (element.hasSecurity()) {
22090        composeConformanceConformanceRestSecurityComponent("security", element.getSecurity());
22091      }
22092      if (element.hasResource()) {
22093        openArray("resource");
22094        for (Conformance.ConformanceRestResourceComponent e : element.getResource()) 
22095          composeConformanceConformanceRestResourceComponent(null, e);
22096        closeArray();
22097      };
22098      if (element.hasInteraction()) {
22099        openArray("interaction");
22100        for (Conformance.SystemInteractionComponent e : element.getInteraction()) 
22101          composeConformanceSystemInteractionComponent(null, e);
22102        closeArray();
22103      };
22104      if (element.hasTransactionModeElement()) {
22105        composeEnumerationCore("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
22106        composeEnumerationExtras("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
22107      }
22108      if (element.hasSearchParam()) {
22109        openArray("searchParam");
22110        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
22111          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
22112        closeArray();
22113      };
22114      if (element.hasOperation()) {
22115        openArray("operation");
22116        for (Conformance.ConformanceRestOperationComponent e : element.getOperation()) 
22117          composeConformanceConformanceRestOperationComponent(null, e);
22118        closeArray();
22119      };
22120      if (element.hasCompartment()) {
22121        openArray("compartment");
22122        for (UriType e : element.getCompartment()) 
22123          composeUriCore(null, e, true);
22124        closeArray();
22125        if (anyHasExtras(element.getCompartment())) {
22126          openArray("_compartment");
22127          for (UriType e : element.getCompartment()) 
22128            composeUriExtras(null, e, true);
22129          closeArray();
22130        }
22131      };
22132  }
22133
22134  protected void composeConformanceConformanceRestSecurityComponent(String name, Conformance.ConformanceRestSecurityComponent element) throws IOException {
22135    if (element != null) {
22136      open(name);
22137      composeConformanceConformanceRestSecurityComponentInner(element);
22138      close();
22139    }
22140  }
22141
22142  protected void composeConformanceConformanceRestSecurityComponentInner(Conformance.ConformanceRestSecurityComponent element) throws IOException {
22143      composeBackbone(element);
22144      if (element.hasCorsElement()) {
22145        composeBooleanCore("cors", element.getCorsElement(), false);
22146        composeBooleanExtras("cors", element.getCorsElement(), false);
22147      }
22148      if (element.hasService()) {
22149        openArray("service");
22150        for (CodeableConcept e : element.getService()) 
22151          composeCodeableConcept(null, e);
22152        closeArray();
22153      };
22154      if (element.hasDescriptionElement()) {
22155        composeStringCore("description", element.getDescriptionElement(), false);
22156        composeStringExtras("description", element.getDescriptionElement(), false);
22157      }
22158      if (element.hasCertificate()) {
22159        openArray("certificate");
22160        for (Conformance.ConformanceRestSecurityCertificateComponent e : element.getCertificate()) 
22161          composeConformanceConformanceRestSecurityCertificateComponent(null, e);
22162        closeArray();
22163      };
22164  }
22165
22166  protected void composeConformanceConformanceRestSecurityCertificateComponent(String name, Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
22167    if (element != null) {
22168      open(name);
22169      composeConformanceConformanceRestSecurityCertificateComponentInner(element);
22170      close();
22171    }
22172  }
22173
22174  protected void composeConformanceConformanceRestSecurityCertificateComponentInner(Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
22175      composeBackbone(element);
22176      if (element.hasTypeElement()) {
22177        composeCodeCore("type", element.getTypeElement(), false);
22178        composeCodeExtras("type", element.getTypeElement(), false);
22179      }
22180      if (element.hasBlobElement()) {
22181        composeBase64BinaryCore("blob", element.getBlobElement(), false);
22182        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
22183      }
22184  }
22185
22186  protected void composeConformanceConformanceRestResourceComponent(String name, Conformance.ConformanceRestResourceComponent element) throws IOException {
22187    if (element != null) {
22188      open(name);
22189      composeConformanceConformanceRestResourceComponentInner(element);
22190      close();
22191    }
22192  }
22193
22194  protected void composeConformanceConformanceRestResourceComponentInner(Conformance.ConformanceRestResourceComponent element) throws IOException {
22195      composeBackbone(element);
22196      if (element.hasTypeElement()) {
22197        composeCodeCore("type", element.getTypeElement(), false);
22198        composeCodeExtras("type", element.getTypeElement(), false);
22199      }
22200      if (element.hasProfile()) {
22201        composeReference("profile", element.getProfile());
22202      }
22203      if (element.hasInteraction()) {
22204        openArray("interaction");
22205        for (Conformance.ResourceInteractionComponent e : element.getInteraction()) 
22206          composeConformanceResourceInteractionComponent(null, e);
22207        closeArray();
22208      };
22209      if (element.hasVersioningElement()) {
22210        composeEnumerationCore("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
22211        composeEnumerationExtras("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
22212      }
22213      if (element.hasReadHistoryElement()) {
22214        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
22215        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
22216      }
22217      if (element.hasUpdateCreateElement()) {
22218        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
22219        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
22220      }
22221      if (element.hasConditionalCreateElement()) {
22222        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
22223        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
22224      }
22225      if (element.hasConditionalUpdateElement()) {
22226        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
22227        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
22228      }
22229      if (element.hasConditionalDeleteElement()) {
22230        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
22231        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
22232      }
22233      if (element.hasSearchInclude()) {
22234        openArray("searchInclude");
22235        for (StringType e : element.getSearchInclude()) 
22236          composeStringCore(null, e, true);
22237        closeArray();
22238        if (anyHasExtras(element.getSearchInclude())) {
22239          openArray("_searchInclude");
22240          for (StringType e : element.getSearchInclude()) 
22241            composeStringExtras(null, e, true);
22242          closeArray();
22243        }
22244      };
22245      if (element.hasSearchRevInclude()) {
22246        openArray("searchRevInclude");
22247        for (StringType e : element.getSearchRevInclude()) 
22248          composeStringCore(null, e, true);
22249        closeArray();
22250        if (anyHasExtras(element.getSearchRevInclude())) {
22251          openArray("_searchRevInclude");
22252          for (StringType e : element.getSearchRevInclude()) 
22253            composeStringExtras(null, e, true);
22254          closeArray();
22255        }
22256      };
22257      if (element.hasSearchParam()) {
22258        openArray("searchParam");
22259        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
22260          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
22261        closeArray();
22262      };
22263  }
22264
22265  protected void composeConformanceResourceInteractionComponent(String name, Conformance.ResourceInteractionComponent element) throws IOException {
22266    if (element != null) {
22267      open(name);
22268      composeConformanceResourceInteractionComponentInner(element);
22269      close();
22270    }
22271  }
22272
22273  protected void composeConformanceResourceInteractionComponentInner(Conformance.ResourceInteractionComponent element) throws IOException {
22274      composeBackbone(element);
22275      if (element.hasCodeElement()) {
22276        composeEnumerationCore("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
22277        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
22278      }
22279      if (element.hasDocumentationElement()) {
22280        composeStringCore("documentation", element.getDocumentationElement(), false);
22281        composeStringExtras("documentation", element.getDocumentationElement(), false);
22282      }
22283  }
22284
22285  protected void composeConformanceConformanceRestResourceSearchParamComponent(String name, Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
22286    if (element != null) {
22287      open(name);
22288      composeConformanceConformanceRestResourceSearchParamComponentInner(element);
22289      close();
22290    }
22291  }
22292
22293  protected void composeConformanceConformanceRestResourceSearchParamComponentInner(Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
22294      composeBackbone(element);
22295      if (element.hasNameElement()) {
22296        composeStringCore("name", element.getNameElement(), false);
22297        composeStringExtras("name", element.getNameElement(), false);
22298      }
22299      if (element.hasDefinitionElement()) {
22300        composeUriCore("definition", element.getDefinitionElement(), false);
22301        composeUriExtras("definition", element.getDefinitionElement(), false);
22302      }
22303      if (element.hasTypeElement()) {
22304        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
22305        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
22306      }
22307      if (element.hasDocumentationElement()) {
22308        composeStringCore("documentation", element.getDocumentationElement(), false);
22309        composeStringExtras("documentation", element.getDocumentationElement(), false);
22310      }
22311      if (element.hasTarget()) {
22312        openArray("target");
22313        for (CodeType e : element.getTarget()) 
22314          composeCodeCore(null, e, true);
22315        closeArray();
22316        if (anyHasExtras(element.getTarget())) {
22317          openArray("_target");
22318          for (CodeType e : element.getTarget()) 
22319            composeCodeExtras(null, e, true);
22320          closeArray();
22321        }
22322      };
22323      if (element.hasModifier()) {
22324        openArray("modifier");
22325        for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
22326          composeEnumerationCore(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
22327        closeArray();
22328        if (anyHasExtras(element.getModifier())) {
22329          openArray("_modifier");
22330          for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
22331            composeEnumerationExtras(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
22332          closeArray();
22333        }
22334      };
22335      if (element.hasChain()) {
22336        openArray("chain");
22337        for (StringType e : element.getChain()) 
22338          composeStringCore(null, e, true);
22339        closeArray();
22340        if (anyHasExtras(element.getChain())) {
22341          openArray("_chain");
22342          for (StringType e : element.getChain()) 
22343            composeStringExtras(null, e, true);
22344          closeArray();
22345        }
22346      };
22347  }
22348
22349  protected void composeConformanceSystemInteractionComponent(String name, Conformance.SystemInteractionComponent element) throws IOException {
22350    if (element != null) {
22351      open(name);
22352      composeConformanceSystemInteractionComponentInner(element);
22353      close();
22354    }
22355  }
22356
22357  protected void composeConformanceSystemInteractionComponentInner(Conformance.SystemInteractionComponent element) throws IOException {
22358      composeBackbone(element);
22359      if (element.hasCodeElement()) {
22360        composeEnumerationCore("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
22361        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
22362      }
22363      if (element.hasDocumentationElement()) {
22364        composeStringCore("documentation", element.getDocumentationElement(), false);
22365        composeStringExtras("documentation", element.getDocumentationElement(), false);
22366      }
22367  }
22368
22369  protected void composeConformanceConformanceRestOperationComponent(String name, Conformance.ConformanceRestOperationComponent element) throws IOException {
22370    if (element != null) {
22371      open(name);
22372      composeConformanceConformanceRestOperationComponentInner(element);
22373      close();
22374    }
22375  }
22376
22377  protected void composeConformanceConformanceRestOperationComponentInner(Conformance.ConformanceRestOperationComponent element) throws IOException {
22378      composeBackbone(element);
22379      if (element.hasNameElement()) {
22380        composeStringCore("name", element.getNameElement(), false);
22381        composeStringExtras("name", element.getNameElement(), false);
22382      }
22383      if (element.hasDefinition()) {
22384        composeReference("definition", element.getDefinition());
22385      }
22386  }
22387
22388  protected void composeConformanceConformanceMessagingComponent(String name, Conformance.ConformanceMessagingComponent element) throws IOException {
22389    if (element != null) {
22390      open(name);
22391      composeConformanceConformanceMessagingComponentInner(element);
22392      close();
22393    }
22394  }
22395
22396  protected void composeConformanceConformanceMessagingComponentInner(Conformance.ConformanceMessagingComponent element) throws IOException {
22397      composeBackbone(element);
22398      if (element.hasEndpoint()) {
22399        openArray("endpoint");
22400        for (Conformance.ConformanceMessagingEndpointComponent e : element.getEndpoint()) 
22401          composeConformanceConformanceMessagingEndpointComponent(null, e);
22402        closeArray();
22403      };
22404      if (element.hasReliableCacheElement()) {
22405        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
22406        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
22407      }
22408      if (element.hasDocumentationElement()) {
22409        composeStringCore("documentation", element.getDocumentationElement(), false);
22410        composeStringExtras("documentation", element.getDocumentationElement(), false);
22411      }
22412      if (element.hasEvent()) {
22413        openArray("event");
22414        for (Conformance.ConformanceMessagingEventComponent e : element.getEvent()) 
22415          composeConformanceConformanceMessagingEventComponent(null, e);
22416        closeArray();
22417      };
22418  }
22419
22420  protected void composeConformanceConformanceMessagingEndpointComponent(String name, Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
22421    if (element != null) {
22422      open(name);
22423      composeConformanceConformanceMessagingEndpointComponentInner(element);
22424      close();
22425    }
22426  }
22427
22428  protected void composeConformanceConformanceMessagingEndpointComponentInner(Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
22429      composeBackbone(element);
22430      if (element.hasProtocol()) {
22431        composeCoding("protocol", element.getProtocol());
22432      }
22433      if (element.hasAddressElement()) {
22434        composeUriCore("address", element.getAddressElement(), false);
22435        composeUriExtras("address", element.getAddressElement(), false);
22436      }
22437  }
22438
22439  protected void composeConformanceConformanceMessagingEventComponent(String name, Conformance.ConformanceMessagingEventComponent element) throws IOException {
22440    if (element != null) {
22441      open(name);
22442      composeConformanceConformanceMessagingEventComponentInner(element);
22443      close();
22444    }
22445  }
22446
22447  protected void composeConformanceConformanceMessagingEventComponentInner(Conformance.ConformanceMessagingEventComponent element) throws IOException {
22448      composeBackbone(element);
22449      if (element.hasCode()) {
22450        composeCoding("code", element.getCode());
22451      }
22452      if (element.hasCategoryElement()) {
22453        composeEnumerationCore("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
22454        composeEnumerationExtras("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
22455      }
22456      if (element.hasModeElement()) {
22457        composeEnumerationCore("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
22458        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
22459      }
22460      if (element.hasFocusElement()) {
22461        composeCodeCore("focus", element.getFocusElement(), false);
22462        composeCodeExtras("focus", element.getFocusElement(), false);
22463      }
22464      if (element.hasRequest()) {
22465        composeReference("request", element.getRequest());
22466      }
22467      if (element.hasResponse()) {
22468        composeReference("response", element.getResponse());
22469      }
22470      if (element.hasDocumentationElement()) {
22471        composeStringCore("documentation", element.getDocumentationElement(), false);
22472        composeStringExtras("documentation", element.getDocumentationElement(), false);
22473      }
22474  }
22475
22476  protected void composeConformanceConformanceDocumentComponent(String name, Conformance.ConformanceDocumentComponent element) throws IOException {
22477    if (element != null) {
22478      open(name);
22479      composeConformanceConformanceDocumentComponentInner(element);
22480      close();
22481    }
22482  }
22483
22484  protected void composeConformanceConformanceDocumentComponentInner(Conformance.ConformanceDocumentComponent element) throws IOException {
22485      composeBackbone(element);
22486      if (element.hasModeElement()) {
22487        composeEnumerationCore("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
22488        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
22489      }
22490      if (element.hasDocumentationElement()) {
22491        composeStringCore("documentation", element.getDocumentationElement(), false);
22492        composeStringExtras("documentation", element.getDocumentationElement(), false);
22493      }
22494      if (element.hasProfile()) {
22495        composeReference("profile", element.getProfile());
22496      }
22497  }
22498
22499  protected void composeContract(String name, Contract element) throws IOException {
22500    if (element != null) {
22501      prop("resourceType", name);
22502      composeContractInner(element);
22503    }
22504  }
22505
22506  protected void composeContractInner(Contract element) throws IOException {
22507      composeDomainResourceElements(element);
22508      if (element.hasIdentifier()) {
22509        composeIdentifier("identifier", element.getIdentifier());
22510      }
22511      if (element.hasIssuedElement()) {
22512        composeDateTimeCore("issued", element.getIssuedElement(), false);
22513        composeDateTimeExtras("issued", element.getIssuedElement(), false);
22514      }
22515      if (element.hasApplies()) {
22516        composePeriod("applies", element.getApplies());
22517      }
22518      if (element.hasSubject()) {
22519        openArray("subject");
22520        for (Reference e : element.getSubject()) 
22521          composeReference(null, e);
22522        closeArray();
22523      };
22524      if (element.hasTopic()) {
22525        openArray("topic");
22526        for (Reference e : element.getTopic()) 
22527          composeReference(null, e);
22528        closeArray();
22529      };
22530      if (element.hasAuthority()) {
22531        openArray("authority");
22532        for (Reference e : element.getAuthority()) 
22533          composeReference(null, e);
22534        closeArray();
22535      };
22536      if (element.hasDomain()) {
22537        openArray("domain");
22538        for (Reference e : element.getDomain()) 
22539          composeReference(null, e);
22540        closeArray();
22541      };
22542      if (element.hasType()) {
22543        composeCodeableConcept("type", element.getType());
22544      }
22545      if (element.hasSubType()) {
22546        openArray("subType");
22547        for (CodeableConcept e : element.getSubType()) 
22548          composeCodeableConcept(null, e);
22549        closeArray();
22550      };
22551      if (element.hasAction()) {
22552        openArray("action");
22553        for (CodeableConcept e : element.getAction()) 
22554          composeCodeableConcept(null, e);
22555        closeArray();
22556      };
22557      if (element.hasActionReason()) {
22558        openArray("actionReason");
22559        for (CodeableConcept e : element.getActionReason()) 
22560          composeCodeableConcept(null, e);
22561        closeArray();
22562      };
22563      if (element.hasAgent()) {
22564        openArray("agent");
22565        for (Contract.AgentComponent e : element.getAgent()) 
22566          composeContractAgentComponent(null, e);
22567        closeArray();
22568      };
22569      if (element.hasSigner()) {
22570        openArray("signer");
22571        for (Contract.SignatoryComponent e : element.getSigner()) 
22572          composeContractSignatoryComponent(null, e);
22573        closeArray();
22574      };
22575      if (element.hasValuedItem()) {
22576        openArray("valuedItem");
22577        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
22578          composeContractValuedItemComponent(null, e);
22579        closeArray();
22580      };
22581      if (element.hasTerm()) {
22582        openArray("term");
22583        for (Contract.TermComponent e : element.getTerm()) 
22584          composeContractTermComponent(null, e);
22585        closeArray();
22586      };
22587      if (element.hasBinding()) {
22588        composeType("binding", element.getBinding());
22589      }
22590      if (element.hasFriendly()) {
22591        openArray("friendly");
22592        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
22593          composeContractFriendlyLanguageComponent(null, e);
22594        closeArray();
22595      };
22596      if (element.hasLegal()) {
22597        openArray("legal");
22598        for (Contract.LegalLanguageComponent e : element.getLegal()) 
22599          composeContractLegalLanguageComponent(null, e);
22600        closeArray();
22601      };
22602      if (element.hasRule()) {
22603        openArray("rule");
22604        for (Contract.ComputableLanguageComponent e : element.getRule()) 
22605          composeContractComputableLanguageComponent(null, e);
22606        closeArray();
22607      };
22608  }
22609
22610  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
22611    if (element != null) {
22612      open(name);
22613      composeContractAgentComponentInner(element);
22614      close();
22615    }
22616  }
22617
22618  protected void composeContractAgentComponentInner(Contract.AgentComponent element) throws IOException {
22619      composeBackbone(element);
22620      if (element.hasActor()) {
22621        composeReference("actor", element.getActor());
22622      }
22623      if (element.hasRole()) {
22624        openArray("role");
22625        for (CodeableConcept e : element.getRole()) 
22626          composeCodeableConcept(null, e);
22627        closeArray();
22628      };
22629  }
22630
22631  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
22632    if (element != null) {
22633      open(name);
22634      composeContractSignatoryComponentInner(element);
22635      close();
22636    }
22637  }
22638
22639  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
22640      composeBackbone(element);
22641      if (element.hasType()) {
22642        composeCoding("type", element.getType());
22643      }
22644      if (element.hasParty()) {
22645        composeReference("party", element.getParty());
22646      }
22647      if (element.hasSignature()) {
22648        openArray("signature");
22649        for (Signature e : element.getSignature()) 
22650          composeSignature(null, e);
22651        closeArray();
22652      };
22653  }
22654
22655  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
22656    if (element != null) {
22657      open(name);
22658      composeContractValuedItemComponentInner(element);
22659      close();
22660    }
22661  }
22662
22663  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
22664      composeBackbone(element);
22665      if (element.hasEntity()) {
22666        composeType("entity", element.getEntity());
22667      }
22668      if (element.hasIdentifier()) {
22669        composeIdentifier("identifier", element.getIdentifier());
22670      }
22671      if (element.hasEffectiveTimeElement()) {
22672        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
22673        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
22674      }
22675      if (element.hasQuantity()) {
22676        composeSimpleQuantity("quantity", element.getQuantity());
22677      }
22678      if (element.hasUnitPrice()) {
22679        composeMoney("unitPrice", element.getUnitPrice());
22680      }
22681      if (element.hasFactorElement()) {
22682        composeDecimalCore("factor", element.getFactorElement(), false);
22683        composeDecimalExtras("factor", element.getFactorElement(), false);
22684      }
22685      if (element.hasPointsElement()) {
22686        composeDecimalCore("points", element.getPointsElement(), false);
22687        composeDecimalExtras("points", element.getPointsElement(), false);
22688      }
22689      if (element.hasNet()) {
22690        composeMoney("net", element.getNet());
22691      }
22692  }
22693
22694  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
22695    if (element != null) {
22696      open(name);
22697      composeContractTermComponentInner(element);
22698      close();
22699    }
22700  }
22701
22702  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
22703      composeBackbone(element);
22704      if (element.hasIdentifier()) {
22705        composeIdentifier("identifier", element.getIdentifier());
22706      }
22707      if (element.hasIssuedElement()) {
22708        composeDateTimeCore("issued", element.getIssuedElement(), false);
22709        composeDateTimeExtras("issued", element.getIssuedElement(), false);
22710      }
22711      if (element.hasApplies()) {
22712        composePeriod("applies", element.getApplies());
22713      }
22714      if (element.hasType()) {
22715        composeCodeableConcept("type", element.getType());
22716      }
22717      if (element.hasSubType()) {
22718        composeCodeableConcept("subType", element.getSubType());
22719      }
22720      if (element.hasTopic()) {
22721        openArray("topic");
22722        for (Reference e : element.getTopic()) 
22723          composeReference(null, e);
22724        closeArray();
22725      };
22726      if (element.hasAction()) {
22727        openArray("action");
22728        for (CodeableConcept e : element.getAction()) 
22729          composeCodeableConcept(null, e);
22730        closeArray();
22731      };
22732      if (element.hasActionReason()) {
22733        openArray("actionReason");
22734        for (CodeableConcept e : element.getActionReason()) 
22735          composeCodeableConcept(null, e);
22736        closeArray();
22737      };
22738      if (element.hasAgent()) {
22739        openArray("agent");
22740        for (Contract.TermAgentComponent e : element.getAgent()) 
22741          composeContractTermAgentComponent(null, e);
22742        closeArray();
22743      };
22744      if (element.hasTextElement()) {
22745        composeStringCore("text", element.getTextElement(), false);
22746        composeStringExtras("text", element.getTextElement(), false);
22747      }
22748      if (element.hasValuedItem()) {
22749        openArray("valuedItem");
22750        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
22751          composeContractTermValuedItemComponent(null, e);
22752        closeArray();
22753      };
22754      if (element.hasGroup()) {
22755        openArray("group");
22756        for (Contract.TermComponent e : element.getGroup()) 
22757          composeContractTermComponent(null, e);
22758        closeArray();
22759      };
22760  }
22761
22762  protected void composeContractTermAgentComponent(String name, Contract.TermAgentComponent element) throws IOException {
22763    if (element != null) {
22764      open(name);
22765      composeContractTermAgentComponentInner(element);
22766      close();
22767    }
22768  }
22769
22770  protected void composeContractTermAgentComponentInner(Contract.TermAgentComponent element) throws IOException {
22771      composeBackbone(element);
22772      if (element.hasActor()) {
22773        composeReference("actor", element.getActor());
22774      }
22775      if (element.hasRole()) {
22776        openArray("role");
22777        for (CodeableConcept e : element.getRole()) 
22778          composeCodeableConcept(null, e);
22779        closeArray();
22780      };
22781  }
22782
22783  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
22784    if (element != null) {
22785      open(name);
22786      composeContractTermValuedItemComponentInner(element);
22787      close();
22788    }
22789  }
22790
22791  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
22792      composeBackbone(element);
22793      if (element.hasEntity()) {
22794        composeType("entity", element.getEntity());
22795      }
22796      if (element.hasIdentifier()) {
22797        composeIdentifier("identifier", element.getIdentifier());
22798      }
22799      if (element.hasEffectiveTimeElement()) {
22800        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
22801        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
22802      }
22803      if (element.hasQuantity()) {
22804        composeSimpleQuantity("quantity", element.getQuantity());
22805      }
22806      if (element.hasUnitPrice()) {
22807        composeMoney("unitPrice", element.getUnitPrice());
22808      }
22809      if (element.hasFactorElement()) {
22810        composeDecimalCore("factor", element.getFactorElement(), false);
22811        composeDecimalExtras("factor", element.getFactorElement(), false);
22812      }
22813      if (element.hasPointsElement()) {
22814        composeDecimalCore("points", element.getPointsElement(), false);
22815        composeDecimalExtras("points", element.getPointsElement(), false);
22816      }
22817      if (element.hasNet()) {
22818        composeMoney("net", element.getNet());
22819      }
22820  }
22821
22822  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
22823    if (element != null) {
22824      open(name);
22825      composeContractFriendlyLanguageComponentInner(element);
22826      close();
22827    }
22828  }
22829
22830  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
22831      composeBackbone(element);
22832      if (element.hasContent()) {
22833        composeType("content", element.getContent());
22834      }
22835  }
22836
22837  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
22838    if (element != null) {
22839      open(name);
22840      composeContractLegalLanguageComponentInner(element);
22841      close();
22842    }
22843  }
22844
22845  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
22846      composeBackbone(element);
22847      if (element.hasContent()) {
22848        composeType("content", element.getContent());
22849      }
22850  }
22851
22852  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
22853    if (element != null) {
22854      open(name);
22855      composeContractComputableLanguageComponentInner(element);
22856      close();
22857    }
22858  }
22859
22860  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
22861      composeBackbone(element);
22862      if (element.hasContent()) {
22863        composeType("content", element.getContent());
22864      }
22865  }
22866
22867  protected void composeCoverage(String name, Coverage element) throws IOException {
22868    if (element != null) {
22869      prop("resourceType", name);
22870      composeCoverageInner(element);
22871    }
22872  }
22873
22874  protected void composeCoverageInner(Coverage element) throws IOException {
22875      composeDomainResourceElements(element);
22876      if (element.hasIssuer()) {
22877        composeType("issuer", element.getIssuer());
22878      }
22879      if (element.hasBinElement()) {
22880        composeStringCore("bin", element.getBinElement(), false);
22881        composeStringExtras("bin", element.getBinElement(), false);
22882      }
22883      if (element.hasPeriod()) {
22884        composePeriod("period", element.getPeriod());
22885      }
22886      if (element.hasType()) {
22887        composeCoding("type", element.getType());
22888      }
22889      if (element.hasPlanholder()) {
22890        composeType("planholder", element.getPlanholder());
22891      }
22892      if (element.hasBeneficiary()) {
22893        composeType("beneficiary", element.getBeneficiary());
22894      }
22895      if (element.hasRelationship()) {
22896        composeCoding("relationship", element.getRelationship());
22897      }
22898      if (element.hasIdentifier()) {
22899        openArray("identifier");
22900        for (Identifier e : element.getIdentifier()) 
22901          composeIdentifier(null, e);
22902        closeArray();
22903      };
22904      if (element.hasGroupElement()) {
22905        composeStringCore("group", element.getGroupElement(), false);
22906        composeStringExtras("group", element.getGroupElement(), false);
22907      }
22908      if (element.hasPlanElement()) {
22909        composeStringCore("plan", element.getPlanElement(), false);
22910        composeStringExtras("plan", element.getPlanElement(), false);
22911      }
22912      if (element.hasSubPlanElement()) {
22913        composeStringCore("subPlan", element.getSubPlanElement(), false);
22914        composeStringExtras("subPlan", element.getSubPlanElement(), false);
22915      }
22916      if (element.hasDependentElement()) {
22917        composePositiveIntCore("dependent", element.getDependentElement(), false);
22918        composePositiveIntExtras("dependent", element.getDependentElement(), false);
22919      }
22920      if (element.hasSequenceElement()) {
22921        composePositiveIntCore("sequence", element.getSequenceElement(), false);
22922        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
22923      }
22924      if (element.hasException()) {
22925        openArray("exception");
22926        for (Coding e : element.getException()) 
22927          composeCoding(null, e);
22928        closeArray();
22929      };
22930      if (element.hasSchoolElement()) {
22931        composeStringCore("school", element.getSchoolElement(), false);
22932        composeStringExtras("school", element.getSchoolElement(), false);
22933      }
22934      if (element.hasNetworkElement()) {
22935        composeStringCore("network", element.getNetworkElement(), false);
22936        composeStringExtras("network", element.getNetworkElement(), false);
22937      }
22938      if (element.hasContract()) {
22939        openArray("contract");
22940        for (Reference e : element.getContract()) 
22941          composeReference(null, e);
22942        closeArray();
22943      };
22944  }
22945
22946  protected void composeDataElement(String name, DataElement element) throws IOException {
22947    if (element != null) {
22948      prop("resourceType", name);
22949      composeDataElementInner(element);
22950    }
22951  }
22952
22953  protected void composeDataElementInner(DataElement element) throws IOException {
22954      composeDomainResourceElements(element);
22955      if (element.hasUrlElement()) {
22956        composeUriCore("url", element.getUrlElement(), false);
22957        composeUriExtras("url", element.getUrlElement(), false);
22958      }
22959      if (element.hasIdentifier()) {
22960        openArray("identifier");
22961        for (Identifier e : element.getIdentifier()) 
22962          composeIdentifier(null, e);
22963        closeArray();
22964      };
22965      if (element.hasVersionElement()) {
22966        composeStringCore("version", element.getVersionElement(), false);
22967        composeStringExtras("version", element.getVersionElement(), false);
22968      }
22969      if (element.hasStatusElement()) {
22970        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
22971        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
22972      }
22973      if (element.hasExperimentalElement()) {
22974        composeBooleanCore("experimental", element.getExperimentalElement(), false);
22975        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
22976      }
22977      if (element.hasPublisherElement()) {
22978        composeStringCore("publisher", element.getPublisherElement(), false);
22979        composeStringExtras("publisher", element.getPublisherElement(), false);
22980      }
22981      if (element.hasDateElement()) {
22982        composeDateTimeCore("date", element.getDateElement(), false);
22983        composeDateTimeExtras("date", element.getDateElement(), false);
22984      }
22985      if (element.hasNameElement()) {
22986        composeStringCore("name", element.getNameElement(), false);
22987        composeStringExtras("name", element.getNameElement(), false);
22988      }
22989      if (element.hasContact()) {
22990        openArray("contact");
22991        for (DataElement.DataElementContactComponent e : element.getContact()) 
22992          composeDataElementDataElementContactComponent(null, e);
22993        closeArray();
22994      };
22995      if (element.hasUseContext()) {
22996        openArray("useContext");
22997        for (CodeableConcept e : element.getUseContext()) 
22998          composeCodeableConcept(null, e);
22999        closeArray();
23000      };
23001      if (element.hasCopyrightElement()) {
23002        composeStringCore("copyright", element.getCopyrightElement(), false);
23003        composeStringExtras("copyright", element.getCopyrightElement(), false);
23004      }
23005      if (element.hasStringencyElement()) {
23006        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
23007        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
23008      }
23009      if (element.hasMapping()) {
23010        openArray("mapping");
23011        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
23012          composeDataElementDataElementMappingComponent(null, e);
23013        closeArray();
23014      };
23015      if (element.hasElement()) {
23016        openArray("element");
23017        for (ElementDefinition e : element.getElement()) 
23018          composeElementDefinition(null, e);
23019        closeArray();
23020      };
23021  }
23022
23023  protected void composeDataElementDataElementContactComponent(String name, DataElement.DataElementContactComponent element) throws IOException {
23024    if (element != null) {
23025      open(name);
23026      composeDataElementDataElementContactComponentInner(element);
23027      close();
23028    }
23029  }
23030
23031  protected void composeDataElementDataElementContactComponentInner(DataElement.DataElementContactComponent element) throws IOException {
23032      composeBackbone(element);
23033      if (element.hasNameElement()) {
23034        composeStringCore("name", element.getNameElement(), false);
23035        composeStringExtras("name", element.getNameElement(), false);
23036      }
23037      if (element.hasTelecom()) {
23038        openArray("telecom");
23039        for (ContactPoint e : element.getTelecom()) 
23040          composeContactPoint(null, e);
23041        closeArray();
23042      };
23043  }
23044
23045  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
23046    if (element != null) {
23047      open(name);
23048      composeDataElementDataElementMappingComponentInner(element);
23049      close();
23050    }
23051  }
23052
23053  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
23054      composeBackbone(element);
23055      if (element.hasIdentityElement()) {
23056        composeIdCore("identity", element.getIdentityElement(), false);
23057        composeIdExtras("identity", element.getIdentityElement(), false);
23058      }
23059      if (element.hasUriElement()) {
23060        composeUriCore("uri", element.getUriElement(), false);
23061        composeUriExtras("uri", element.getUriElement(), false);
23062      }
23063      if (element.hasNameElement()) {
23064        composeStringCore("name", element.getNameElement(), false);
23065        composeStringExtras("name", element.getNameElement(), false);
23066      }
23067      if (element.hasCommentElement()) {
23068        composeStringCore("comment", element.getCommentElement(), false);
23069        composeStringExtras("comment", element.getCommentElement(), false);
23070      }
23071  }
23072
23073  protected void composeDecisionSupportRule(String name, DecisionSupportRule element) throws IOException {
23074    if (element != null) {
23075      prop("resourceType", name);
23076      composeDecisionSupportRuleInner(element);
23077    }
23078  }
23079
23080  protected void composeDecisionSupportRuleInner(DecisionSupportRule element) throws IOException {
23081      composeDomainResourceElements(element);
23082      if (element.hasModuleMetadata()) {
23083        composeModuleMetadata("moduleMetadata", element.getModuleMetadata());
23084      }
23085      if (element.hasLibrary()) {
23086        openArray("library");
23087        for (Reference e : element.getLibrary()) 
23088          composeReference(null, e);
23089        closeArray();
23090      };
23091      if (element.hasTrigger()) {
23092        openArray("trigger");
23093        for (TriggerDefinition e : element.getTrigger()) 
23094          composeTriggerDefinition(null, e);
23095        closeArray();
23096      };
23097      if (element.hasConditionElement()) {
23098        composeStringCore("condition", element.getConditionElement(), false);
23099        composeStringExtras("condition", element.getConditionElement(), false);
23100      }
23101      if (element.hasAction()) {
23102        openArray("action");
23103        for (ActionDefinition e : element.getAction()) 
23104          composeActionDefinition(null, e);
23105        closeArray();
23106      };
23107  }
23108
23109  protected void composeDecisionSupportServiceModule(String name, DecisionSupportServiceModule element) throws IOException {
23110    if (element != null) {
23111      prop("resourceType", name);
23112      composeDecisionSupportServiceModuleInner(element);
23113    }
23114  }
23115
23116  protected void composeDecisionSupportServiceModuleInner(DecisionSupportServiceModule element) throws IOException {
23117      composeDomainResourceElements(element);
23118      if (element.hasModuleMetadata()) {
23119        composeModuleMetadata("moduleMetadata", element.getModuleMetadata());
23120      }
23121      if (element.hasTrigger()) {
23122        openArray("trigger");
23123        for (TriggerDefinition e : element.getTrigger()) 
23124          composeTriggerDefinition(null, e);
23125        closeArray();
23126      };
23127      if (element.hasParameter()) {
23128        openArray("parameter");
23129        for (ParameterDefinition e : element.getParameter()) 
23130          composeParameterDefinition(null, e);
23131        closeArray();
23132      };
23133      if (element.hasDataRequirement()) {
23134        openArray("dataRequirement");
23135        for (DataRequirement e : element.getDataRequirement()) 
23136          composeDataRequirement(null, e);
23137        closeArray();
23138      };
23139  }
23140
23141  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
23142    if (element != null) {
23143      prop("resourceType", name);
23144      composeDetectedIssueInner(element);
23145    }
23146  }
23147
23148  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
23149      composeDomainResourceElements(element);
23150      if (element.hasPatient()) {
23151        composeReference("patient", element.getPatient());
23152      }
23153      if (element.hasCategory()) {
23154        composeCodeableConcept("category", element.getCategory());
23155      }
23156      if (element.hasSeverityElement()) {
23157        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
23158        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
23159      }
23160      if (element.hasImplicated()) {
23161        openArray("implicated");
23162        for (Reference e : element.getImplicated()) 
23163          composeReference(null, e);
23164        closeArray();
23165      };
23166      if (element.hasDetailElement()) {
23167        composeStringCore("detail", element.getDetailElement(), false);
23168        composeStringExtras("detail", element.getDetailElement(), false);
23169      }
23170      if (element.hasDateElement()) {
23171        composeDateTimeCore("date", element.getDateElement(), false);
23172        composeDateTimeExtras("date", element.getDateElement(), false);
23173      }
23174      if (element.hasAuthor()) {
23175        composeReference("author", element.getAuthor());
23176      }
23177      if (element.hasIdentifier()) {
23178        composeIdentifier("identifier", element.getIdentifier());
23179      }
23180      if (element.hasReferenceElement()) {
23181        composeUriCore("reference", element.getReferenceElement(), false);
23182        composeUriExtras("reference", element.getReferenceElement(), false);
23183      }
23184      if (element.hasMitigation()) {
23185        openArray("mitigation");
23186        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
23187          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
23188        closeArray();
23189      };
23190  }
23191
23192  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
23193    if (element != null) {
23194      open(name);
23195      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
23196      close();
23197    }
23198  }
23199
23200  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
23201      composeBackbone(element);
23202      if (element.hasAction()) {
23203        composeCodeableConcept("action", element.getAction());
23204      }
23205      if (element.hasDateElement()) {
23206        composeDateTimeCore("date", element.getDateElement(), false);
23207        composeDateTimeExtras("date", element.getDateElement(), false);
23208      }
23209      if (element.hasAuthor()) {
23210        composeReference("author", element.getAuthor());
23211      }
23212  }
23213
23214  protected void composeDevice(String name, Device element) throws IOException {
23215    if (element != null) {
23216      prop("resourceType", name);
23217      composeDeviceInner(element);
23218    }
23219  }
23220
23221  protected void composeDeviceInner(Device element) throws IOException {
23222      composeDomainResourceElements(element);
23223      if (element.hasIdentifier()) {
23224        openArray("identifier");
23225        for (Identifier e : element.getIdentifier()) 
23226          composeIdentifier(null, e);
23227        closeArray();
23228      };
23229      if (element.hasUdiCarrier()) {
23230        composeIdentifier("udiCarrier", element.getUdiCarrier());
23231      }
23232      if (element.hasStatusElement()) {
23233        composeEnumerationCore("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
23234        composeEnumerationExtras("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
23235      }
23236      if (element.hasType()) {
23237        composeCodeableConcept("type", element.getType());
23238      }
23239      if (element.hasLotNumberElement()) {
23240        composeStringCore("lotNumber", element.getLotNumberElement(), false);
23241        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
23242      }
23243      if (element.hasManufacturerElement()) {
23244        composeStringCore("manufacturer", element.getManufacturerElement(), false);
23245        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
23246      }
23247      if (element.hasManufactureDateElement()) {
23248        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
23249        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
23250      }
23251      if (element.hasExpirationDateElement()) {
23252        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
23253        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
23254      }
23255      if (element.hasModelElement()) {
23256        composeStringCore("model", element.getModelElement(), false);
23257        composeStringExtras("model", element.getModelElement(), false);
23258      }
23259      if (element.hasVersionElement()) {
23260        composeStringCore("version", element.getVersionElement(), false);
23261        composeStringExtras("version", element.getVersionElement(), false);
23262      }
23263      if (element.hasPatient()) {
23264        composeReference("patient", element.getPatient());
23265      }
23266      if (element.hasOwner()) {
23267        composeReference("owner", element.getOwner());
23268      }
23269      if (element.hasContact()) {
23270        openArray("contact");
23271        for (ContactPoint e : element.getContact()) 
23272          composeContactPoint(null, e);
23273        closeArray();
23274      };
23275      if (element.hasLocation()) {
23276        composeReference("location", element.getLocation());
23277      }
23278      if (element.hasUrlElement()) {
23279        composeUriCore("url", element.getUrlElement(), false);
23280        composeUriExtras("url", element.getUrlElement(), false);
23281      }
23282      if (element.hasNote()) {
23283        openArray("note");
23284        for (Annotation e : element.getNote()) 
23285          composeAnnotation(null, e);
23286        closeArray();
23287      };
23288  }
23289
23290  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
23291    if (element != null) {
23292      prop("resourceType", name);
23293      composeDeviceComponentInner(element);
23294    }
23295  }
23296
23297  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
23298      composeDomainResourceElements(element);
23299      if (element.hasType()) {
23300        composeCodeableConcept("type", element.getType());
23301      }
23302      if (element.hasIdentifier()) {
23303        composeIdentifier("identifier", element.getIdentifier());
23304      }
23305      if (element.hasLastSystemChangeElement()) {
23306        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
23307        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
23308      }
23309      if (element.hasSource()) {
23310        composeReference("source", element.getSource());
23311      }
23312      if (element.hasParent()) {
23313        composeReference("parent", element.getParent());
23314      }
23315      if (element.hasOperationalStatus()) {
23316        openArray("operationalStatus");
23317        for (CodeableConcept e : element.getOperationalStatus()) 
23318          composeCodeableConcept(null, e);
23319        closeArray();
23320      };
23321      if (element.hasParameterGroup()) {
23322        composeCodeableConcept("parameterGroup", element.getParameterGroup());
23323      }
23324      if (element.hasMeasurementPrincipleElement()) {
23325        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
23326        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
23327      }
23328      if (element.hasProductionSpecification()) {
23329        openArray("productionSpecification");
23330        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
23331          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
23332        closeArray();
23333      };
23334      if (element.hasLanguageCode()) {
23335        composeCodeableConcept("languageCode", element.getLanguageCode());
23336      }
23337  }
23338
23339  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
23340    if (element != null) {
23341      open(name);
23342      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
23343      close();
23344    }
23345  }
23346
23347  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
23348      composeBackbone(element);
23349      if (element.hasSpecType()) {
23350        composeCodeableConcept("specType", element.getSpecType());
23351      }
23352      if (element.hasComponentId()) {
23353        composeIdentifier("componentId", element.getComponentId());
23354      }
23355      if (element.hasProductionSpecElement()) {
23356        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
23357        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
23358      }
23359  }
23360
23361  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
23362    if (element != null) {
23363      prop("resourceType", name);
23364      composeDeviceMetricInner(element);
23365    }
23366  }
23367
23368  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
23369      composeDomainResourceElements(element);
23370      if (element.hasType()) {
23371        composeCodeableConcept("type", element.getType());
23372      }
23373      if (element.hasIdentifier()) {
23374        composeIdentifier("identifier", element.getIdentifier());
23375      }
23376      if (element.hasUnit()) {
23377        composeCodeableConcept("unit", element.getUnit());
23378      }
23379      if (element.hasSource()) {
23380        composeReference("source", element.getSource());
23381      }
23382      if (element.hasParent()) {
23383        composeReference("parent", element.getParent());
23384      }
23385      if (element.hasOperationalStatusElement()) {
23386        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
23387        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
23388      }
23389      if (element.hasColorElement()) {
23390        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
23391        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
23392      }
23393      if (element.hasCategoryElement()) {
23394        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
23395        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
23396      }
23397      if (element.hasMeasurementPeriod()) {
23398        composeTiming("measurementPeriod", element.getMeasurementPeriod());
23399      }
23400      if (element.hasCalibration()) {
23401        openArray("calibration");
23402        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
23403          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
23404        closeArray();
23405      };
23406  }
23407
23408  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
23409    if (element != null) {
23410      open(name);
23411      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
23412      close();
23413    }
23414  }
23415
23416  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
23417      composeBackbone(element);
23418      if (element.hasTypeElement()) {
23419        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
23420        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
23421      }
23422      if (element.hasStateElement()) {
23423        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
23424        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
23425      }
23426      if (element.hasTimeElement()) {
23427        composeInstantCore("time", element.getTimeElement(), false);
23428        composeInstantExtras("time", element.getTimeElement(), false);
23429      }
23430  }
23431
23432  protected void composeDeviceUseRequest(String name, DeviceUseRequest element) throws IOException {
23433    if (element != null) {
23434      prop("resourceType", name);
23435      composeDeviceUseRequestInner(element);
23436    }
23437  }
23438
23439  protected void composeDeviceUseRequestInner(DeviceUseRequest element) throws IOException {
23440      composeDomainResourceElements(element);
23441      if (element.hasBodySite()) {
23442        composeType("bodySite", element.getBodySite());
23443      }
23444      if (element.hasStatusElement()) {
23445        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
23446        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
23447      }
23448      if (element.hasDevice()) {
23449        composeReference("device", element.getDevice());
23450      }
23451      if (element.hasEncounter()) {
23452        composeReference("encounter", element.getEncounter());
23453      }
23454      if (element.hasIdentifier()) {
23455        openArray("identifier");
23456        for (Identifier e : element.getIdentifier()) 
23457          composeIdentifier(null, e);
23458        closeArray();
23459      };
23460      if (element.hasIndication()) {
23461        openArray("indication");
23462        for (CodeableConcept e : element.getIndication()) 
23463          composeCodeableConcept(null, e);
23464        closeArray();
23465      };
23466      if (element.hasNotes()) {
23467        openArray("notes");
23468        for (StringType e : element.getNotes()) 
23469          composeStringCore(null, e, true);
23470        closeArray();
23471        if (anyHasExtras(element.getNotes())) {
23472          openArray("_notes");
23473          for (StringType e : element.getNotes()) 
23474            composeStringExtras(null, e, true);
23475          closeArray();
23476        }
23477      };
23478      if (element.hasPrnReason()) {
23479        openArray("prnReason");
23480        for (CodeableConcept e : element.getPrnReason()) 
23481          composeCodeableConcept(null, e);
23482        closeArray();
23483      };
23484      if (element.hasOrderedOnElement()) {
23485        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
23486        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
23487      }
23488      if (element.hasRecordedOnElement()) {
23489        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
23490        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
23491      }
23492      if (element.hasSubject()) {
23493        composeReference("subject", element.getSubject());
23494      }
23495      if (element.hasTiming()) {
23496        composeType("timing", element.getTiming());
23497      }
23498      if (element.hasPriorityElement()) {
23499        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
23500        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
23501      }
23502  }
23503
23504  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
23505    if (element != null) {
23506      prop("resourceType", name);
23507      composeDeviceUseStatementInner(element);
23508    }
23509  }
23510
23511  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
23512      composeDomainResourceElements(element);
23513      if (element.hasBodySite()) {
23514        composeType("bodySite", element.getBodySite());
23515      }
23516      if (element.hasWhenUsed()) {
23517        composePeriod("whenUsed", element.getWhenUsed());
23518      }
23519      if (element.hasDevice()) {
23520        composeReference("device", element.getDevice());
23521      }
23522      if (element.hasIdentifier()) {
23523        openArray("identifier");
23524        for (Identifier e : element.getIdentifier()) 
23525          composeIdentifier(null, e);
23526        closeArray();
23527      };
23528      if (element.hasIndication()) {
23529        openArray("indication");
23530        for (CodeableConcept e : element.getIndication()) 
23531          composeCodeableConcept(null, e);
23532        closeArray();
23533      };
23534      if (element.hasNotes()) {
23535        openArray("notes");
23536        for (StringType e : element.getNotes()) 
23537          composeStringCore(null, e, true);
23538        closeArray();
23539        if (anyHasExtras(element.getNotes())) {
23540          openArray("_notes");
23541          for (StringType e : element.getNotes()) 
23542            composeStringExtras(null, e, true);
23543          closeArray();
23544        }
23545      };
23546      if (element.hasRecordedOnElement()) {
23547        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
23548        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
23549      }
23550      if (element.hasSubject()) {
23551        composeReference("subject", element.getSubject());
23552      }
23553      if (element.hasTiming()) {
23554        composeType("timing", element.getTiming());
23555      }
23556  }
23557
23558  protected void composeDiagnosticOrder(String name, DiagnosticOrder element) throws IOException {
23559    if (element != null) {
23560      prop("resourceType", name);
23561      composeDiagnosticOrderInner(element);
23562    }
23563  }
23564
23565  protected void composeDiagnosticOrderInner(DiagnosticOrder element) throws IOException {
23566      composeDomainResourceElements(element);
23567      if (element.hasIdentifier()) {
23568        openArray("identifier");
23569        for (Identifier e : element.getIdentifier()) 
23570          composeIdentifier(null, e);
23571        closeArray();
23572      };
23573      if (element.hasStatusElement()) {
23574        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23575        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23576      }
23577      if (element.hasPriorityElement()) {
23578        composeEnumerationCore("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
23579        composeEnumerationExtras("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
23580      }
23581      if (element.hasSubject()) {
23582        composeReference("subject", element.getSubject());
23583      }
23584      if (element.hasEncounter()) {
23585        composeReference("encounter", element.getEncounter());
23586      }
23587      if (element.hasOrderer()) {
23588        composeReference("orderer", element.getOrderer());
23589      }
23590      if (element.hasReason()) {
23591        openArray("reason");
23592        for (CodeableConcept e : element.getReason()) 
23593          composeCodeableConcept(null, e);
23594        closeArray();
23595      };
23596      if (element.hasSupportingInformation()) {
23597        openArray("supportingInformation");
23598        for (Reference e : element.getSupportingInformation()) 
23599          composeReference(null, e);
23600        closeArray();
23601      };
23602      if (element.hasSpecimen()) {
23603        openArray("specimen");
23604        for (Reference e : element.getSpecimen()) 
23605          composeReference(null, e);
23606        closeArray();
23607      };
23608      if (element.hasEvent()) {
23609        openArray("event");
23610        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
23611          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
23612        closeArray();
23613      };
23614      if (element.hasItem()) {
23615        openArray("item");
23616        for (DiagnosticOrder.DiagnosticOrderItemComponent e : element.getItem()) 
23617          composeDiagnosticOrderDiagnosticOrderItemComponent(null, e);
23618        closeArray();
23619      };
23620      if (element.hasNote()) {
23621        openArray("note");
23622        for (Annotation e : element.getNote()) 
23623          composeAnnotation(null, e);
23624        closeArray();
23625      };
23626  }
23627
23628  protected void composeDiagnosticOrderDiagnosticOrderEventComponent(String name, DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
23629    if (element != null) {
23630      open(name);
23631      composeDiagnosticOrderDiagnosticOrderEventComponentInner(element);
23632      close();
23633    }
23634  }
23635
23636  protected void composeDiagnosticOrderDiagnosticOrderEventComponentInner(DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
23637      composeBackbone(element);
23638      if (element.hasStatusElement()) {
23639        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23640        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23641      }
23642      if (element.hasDescription()) {
23643        composeCodeableConcept("description", element.getDescription());
23644      }
23645      if (element.hasDateTimeElement()) {
23646        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
23647        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
23648      }
23649      if (element.hasActor()) {
23650        composeReference("actor", element.getActor());
23651      }
23652  }
23653
23654  protected void composeDiagnosticOrderDiagnosticOrderItemComponent(String name, DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
23655    if (element != null) {
23656      open(name);
23657      composeDiagnosticOrderDiagnosticOrderItemComponentInner(element);
23658      close();
23659    }
23660  }
23661
23662  protected void composeDiagnosticOrderDiagnosticOrderItemComponentInner(DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
23663      composeBackbone(element);
23664      if (element.hasCode()) {
23665        composeCodeableConcept("code", element.getCode());
23666      }
23667      if (element.hasSpecimen()) {
23668        openArray("specimen");
23669        for (Reference e : element.getSpecimen()) 
23670          composeReference(null, e);
23671        closeArray();
23672      };
23673      if (element.hasBodySite()) {
23674        composeCodeableConcept("bodySite", element.getBodySite());
23675      }
23676      if (element.hasStatusElement()) {
23677        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23678        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
23679      }
23680      if (element.hasEvent()) {
23681        openArray("event");
23682        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
23683          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
23684        closeArray();
23685      };
23686  }
23687
23688  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
23689    if (element != null) {
23690      prop("resourceType", name);
23691      composeDiagnosticReportInner(element);
23692    }
23693  }
23694
23695  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
23696      composeDomainResourceElements(element);
23697      if (element.hasIdentifier()) {
23698        openArray("identifier");
23699        for (Identifier e : element.getIdentifier()) 
23700          composeIdentifier(null, e);
23701        closeArray();
23702      };
23703      if (element.hasStatusElement()) {
23704        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
23705        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
23706      }
23707      if (element.hasCategory()) {
23708        composeCodeableConcept("category", element.getCategory());
23709      }
23710      if (element.hasCode()) {
23711        composeCodeableConcept("code", element.getCode());
23712      }
23713      if (element.hasSubject()) {
23714        composeReference("subject", element.getSubject());
23715      }
23716      if (element.hasEncounter()) {
23717        composeReference("encounter", element.getEncounter());
23718      }
23719      if (element.hasEffective()) {
23720        composeType("effective", element.getEffective());
23721      }
23722      if (element.hasIssuedElement()) {
23723        composeInstantCore("issued", element.getIssuedElement(), false);
23724        composeInstantExtras("issued", element.getIssuedElement(), false);
23725      }
23726      if (element.hasPerformer()) {
23727        composeReference("performer", element.getPerformer());
23728      }
23729      if (element.hasRequest()) {
23730        openArray("request");
23731        for (Reference e : element.getRequest()) 
23732          composeReference(null, e);
23733        closeArray();
23734      };
23735      if (element.hasSpecimen()) {
23736        openArray("specimen");
23737        for (Reference e : element.getSpecimen()) 
23738          composeReference(null, e);
23739        closeArray();
23740      };
23741      if (element.hasResult()) {
23742        openArray("result");
23743        for (Reference e : element.getResult()) 
23744          composeReference(null, e);
23745        closeArray();
23746      };
23747      if (element.hasImagingStudy()) {
23748        openArray("imagingStudy");
23749        for (Reference e : element.getImagingStudy()) 
23750          composeReference(null, e);
23751        closeArray();
23752      };
23753      if (element.hasImage()) {
23754        openArray("image");
23755        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
23756          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
23757        closeArray();
23758      };
23759      if (element.hasConclusionElement()) {
23760        composeStringCore("conclusion", element.getConclusionElement(), false);
23761        composeStringExtras("conclusion", element.getConclusionElement(), false);
23762      }
23763      if (element.hasCodedDiagnosis()) {
23764        openArray("codedDiagnosis");
23765        for (CodeableConcept e : element.getCodedDiagnosis()) 
23766          composeCodeableConcept(null, e);
23767        closeArray();
23768      };
23769      if (element.hasPresentedForm()) {
23770        openArray("presentedForm");
23771        for (Attachment e : element.getPresentedForm()) 
23772          composeAttachment(null, e);
23773        closeArray();
23774      };
23775  }
23776
23777  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
23778    if (element != null) {
23779      open(name);
23780      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
23781      close();
23782    }
23783  }
23784
23785  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
23786      composeBackbone(element);
23787      if (element.hasCommentElement()) {
23788        composeStringCore("comment", element.getCommentElement(), false);
23789        composeStringExtras("comment", element.getCommentElement(), false);
23790      }
23791      if (element.hasLink()) {
23792        composeReference("link", element.getLink());
23793      }
23794  }
23795
23796  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
23797    if (element != null) {
23798      prop("resourceType", name);
23799      composeDocumentManifestInner(element);
23800    }
23801  }
23802
23803  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
23804      composeDomainResourceElements(element);
23805      if (element.hasMasterIdentifier()) {
23806        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
23807      }
23808      if (element.hasIdentifier()) {
23809        openArray("identifier");
23810        for (Identifier e : element.getIdentifier()) 
23811          composeIdentifier(null, e);
23812        closeArray();
23813      };
23814      if (element.hasSubject()) {
23815        composeReference("subject", element.getSubject());
23816      }
23817      if (element.hasRecipient()) {
23818        openArray("recipient");
23819        for (Reference e : element.getRecipient()) 
23820          composeReference(null, e);
23821        closeArray();
23822      };
23823      if (element.hasType()) {
23824        composeCodeableConcept("type", element.getType());
23825      }
23826      if (element.hasAuthor()) {
23827        openArray("author");
23828        for (Reference e : element.getAuthor()) 
23829          composeReference(null, e);
23830        closeArray();
23831      };
23832      if (element.hasCreatedElement()) {
23833        composeDateTimeCore("created", element.getCreatedElement(), false);
23834        composeDateTimeExtras("created", element.getCreatedElement(), false);
23835      }
23836      if (element.hasSourceElement()) {
23837        composeUriCore("source", element.getSourceElement(), false);
23838        composeUriExtras("source", element.getSourceElement(), false);
23839      }
23840      if (element.hasStatusElement()) {
23841        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
23842        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
23843      }
23844      if (element.hasDescriptionElement()) {
23845        composeStringCore("description", element.getDescriptionElement(), false);
23846        composeStringExtras("description", element.getDescriptionElement(), false);
23847      }
23848      if (element.hasContent()) {
23849        openArray("content");
23850        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
23851          composeDocumentManifestDocumentManifestContentComponent(null, e);
23852        closeArray();
23853      };
23854      if (element.hasRelated()) {
23855        openArray("related");
23856        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
23857          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
23858        closeArray();
23859      };
23860  }
23861
23862  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
23863    if (element != null) {
23864      open(name);
23865      composeDocumentManifestDocumentManifestContentComponentInner(element);
23866      close();
23867    }
23868  }
23869
23870  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
23871      composeBackbone(element);
23872      if (element.hasP()) {
23873        composeType("p", element.getP());
23874      }
23875  }
23876
23877  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
23878    if (element != null) {
23879      open(name);
23880      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
23881      close();
23882    }
23883  }
23884
23885  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
23886      composeBackbone(element);
23887      if (element.hasIdentifier()) {
23888        composeIdentifier("identifier", element.getIdentifier());
23889      }
23890      if (element.hasRef()) {
23891        composeReference("ref", element.getRef());
23892      }
23893  }
23894
23895  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
23896    if (element != null) {
23897      prop("resourceType", name);
23898      composeDocumentReferenceInner(element);
23899    }
23900  }
23901
23902  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
23903      composeDomainResourceElements(element);
23904      if (element.hasMasterIdentifier()) {
23905        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
23906      }
23907      if (element.hasIdentifier()) {
23908        openArray("identifier");
23909        for (Identifier e : element.getIdentifier()) 
23910          composeIdentifier(null, e);
23911        closeArray();
23912      };
23913      if (element.hasSubject()) {
23914        composeReference("subject", element.getSubject());
23915      }
23916      if (element.hasType()) {
23917        composeCodeableConcept("type", element.getType());
23918      }
23919      if (element.hasClass_()) {
23920        composeCodeableConcept("class", element.getClass_());
23921      }
23922      if (element.hasAuthor()) {
23923        openArray("author");
23924        for (Reference e : element.getAuthor()) 
23925          composeReference(null, e);
23926        closeArray();
23927      };
23928      if (element.hasCustodian()) {
23929        composeReference("custodian", element.getCustodian());
23930      }
23931      if (element.hasAuthenticator()) {
23932        composeReference("authenticator", element.getAuthenticator());
23933      }
23934      if (element.hasCreatedElement()) {
23935        composeDateTimeCore("created", element.getCreatedElement(), false);
23936        composeDateTimeExtras("created", element.getCreatedElement(), false);
23937      }
23938      if (element.hasIndexedElement()) {
23939        composeInstantCore("indexed", element.getIndexedElement(), false);
23940        composeInstantExtras("indexed", element.getIndexedElement(), false);
23941      }
23942      if (element.hasStatusElement()) {
23943        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
23944        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
23945      }
23946      if (element.hasDocStatus()) {
23947        composeCodeableConcept("docStatus", element.getDocStatus());
23948      }
23949      if (element.hasRelatesTo()) {
23950        openArray("relatesTo");
23951        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
23952          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
23953        closeArray();
23954      };
23955      if (element.hasDescriptionElement()) {
23956        composeStringCore("description", element.getDescriptionElement(), false);
23957        composeStringExtras("description", element.getDescriptionElement(), false);
23958      }
23959      if (element.hasSecurityLabel()) {
23960        openArray("securityLabel");
23961        for (CodeableConcept e : element.getSecurityLabel()) 
23962          composeCodeableConcept(null, e);
23963        closeArray();
23964      };
23965      if (element.hasContent()) {
23966        openArray("content");
23967        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
23968          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
23969        closeArray();
23970      };
23971      if (element.hasContext()) {
23972        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
23973      }
23974  }
23975
23976  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
23977    if (element != null) {
23978      open(name);
23979      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
23980      close();
23981    }
23982  }
23983
23984  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
23985      composeBackbone(element);
23986      if (element.hasCodeElement()) {
23987        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
23988        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
23989      }
23990      if (element.hasTarget()) {
23991        composeReference("target", element.getTarget());
23992      }
23993  }
23994
23995  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
23996    if (element != null) {
23997      open(name);
23998      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
23999      close();
24000    }
24001  }
24002
24003  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
24004      composeBackbone(element);
24005      if (element.hasAttachment()) {
24006        composeAttachment("attachment", element.getAttachment());
24007      }
24008      if (element.hasFormat()) {
24009        openArray("format");
24010        for (Coding e : element.getFormat()) 
24011          composeCoding(null, e);
24012        closeArray();
24013      };
24014  }
24015
24016  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
24017    if (element != null) {
24018      open(name);
24019      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
24020      close();
24021    }
24022  }
24023
24024  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
24025      composeBackbone(element);
24026      if (element.hasEncounter()) {
24027        composeReference("encounter", element.getEncounter());
24028      }
24029      if (element.hasEvent()) {
24030        openArray("event");
24031        for (CodeableConcept e : element.getEvent()) 
24032          composeCodeableConcept(null, e);
24033        closeArray();
24034      };
24035      if (element.hasPeriod()) {
24036        composePeriod("period", element.getPeriod());
24037      }
24038      if (element.hasFacilityType()) {
24039        composeCodeableConcept("facilityType", element.getFacilityType());
24040      }
24041      if (element.hasPracticeSetting()) {
24042        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
24043      }
24044      if (element.hasSourcePatientInfo()) {
24045        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
24046      }
24047      if (element.hasRelated()) {
24048        openArray("related");
24049        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
24050          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
24051        closeArray();
24052      };
24053  }
24054
24055  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
24056    if (element != null) {
24057      open(name);
24058      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
24059      close();
24060    }
24061  }
24062
24063  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
24064      composeBackbone(element);
24065      if (element.hasIdentifier()) {
24066        composeIdentifier("identifier", element.getIdentifier());
24067      }
24068      if (element.hasRef()) {
24069        composeReference("ref", element.getRef());
24070      }
24071  }
24072
24073  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
24074    if (element != null) {
24075      prop("resourceType", name);
24076      composeEligibilityRequestInner(element);
24077    }
24078  }
24079
24080  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
24081      composeDomainResourceElements(element);
24082      if (element.hasIdentifier()) {
24083        openArray("identifier");
24084        for (Identifier e : element.getIdentifier()) 
24085          composeIdentifier(null, e);
24086        closeArray();
24087      };
24088      if (element.hasRuleset()) {
24089        composeCoding("ruleset", element.getRuleset());
24090      }
24091      if (element.hasOriginalRuleset()) {
24092        composeCoding("originalRuleset", element.getOriginalRuleset());
24093      }
24094      if (element.hasCreatedElement()) {
24095        composeDateTimeCore("created", element.getCreatedElement(), false);
24096        composeDateTimeExtras("created", element.getCreatedElement(), false);
24097      }
24098      if (element.hasTarget()) {
24099        composeType("target", element.getTarget());
24100      }
24101      if (element.hasProvider()) {
24102        composeType("provider", element.getProvider());
24103      }
24104      if (element.hasOrganization()) {
24105        composeType("organization", element.getOrganization());
24106      }
24107      if (element.hasPriority()) {
24108        composeCoding("priority", element.getPriority());
24109      }
24110      if (element.hasEnterer()) {
24111        composeType("enterer", element.getEnterer());
24112      }
24113      if (element.hasFacility()) {
24114        composeType("facility", element.getFacility());
24115      }
24116      if (element.hasPatient()) {
24117        composeType("patient", element.getPatient());
24118      }
24119      if (element.hasCoverage()) {
24120        composeType("coverage", element.getCoverage());
24121      }
24122      if (element.hasBusinessArrangementElement()) {
24123        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
24124        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
24125      }
24126      if (element.hasServiced()) {
24127        composeType("serviced", element.getServiced());
24128      }
24129      if (element.hasBenefitCategory()) {
24130        composeCoding("benefitCategory", element.getBenefitCategory());
24131      }
24132      if (element.hasBenefitSubCategory()) {
24133        composeCoding("benefitSubCategory", element.getBenefitSubCategory());
24134      }
24135  }
24136
24137  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
24138    if (element != null) {
24139      prop("resourceType", name);
24140      composeEligibilityResponseInner(element);
24141    }
24142  }
24143
24144  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
24145      composeDomainResourceElements(element);
24146      if (element.hasIdentifier()) {
24147        openArray("identifier");
24148        for (Identifier e : element.getIdentifier()) 
24149          composeIdentifier(null, e);
24150        closeArray();
24151      };
24152      if (element.hasRequest()) {
24153        composeType("request", element.getRequest());
24154      }
24155      if (element.hasOutcomeElement()) {
24156        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
24157        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
24158      }
24159      if (element.hasDispositionElement()) {
24160        composeStringCore("disposition", element.getDispositionElement(), false);
24161        composeStringExtras("disposition", element.getDispositionElement(), false);
24162      }
24163      if (element.hasRuleset()) {
24164        composeCoding("ruleset", element.getRuleset());
24165      }
24166      if (element.hasOriginalRuleset()) {
24167        composeCoding("originalRuleset", element.getOriginalRuleset());
24168      }
24169      if (element.hasCreatedElement()) {
24170        composeDateTimeCore("created", element.getCreatedElement(), false);
24171        composeDateTimeExtras("created", element.getCreatedElement(), false);
24172      }
24173      if (element.hasOrganization()) {
24174        composeType("organization", element.getOrganization());
24175      }
24176      if (element.hasRequestProvider()) {
24177        composeType("requestProvider", element.getRequestProvider());
24178      }
24179      if (element.hasRequestOrganization()) {
24180        composeType("requestOrganization", element.getRequestOrganization());
24181      }
24182      if (element.hasInforceElement()) {
24183        composeBooleanCore("inforce", element.getInforceElement(), false);
24184        composeBooleanExtras("inforce", element.getInforceElement(), false);
24185      }
24186      if (element.hasContract()) {
24187        composeReference("contract", element.getContract());
24188      }
24189      if (element.hasForm()) {
24190        composeCoding("form", element.getForm());
24191      }
24192      if (element.hasBenefitBalance()) {
24193        openArray("benefitBalance");
24194        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
24195          composeEligibilityResponseBenefitsComponent(null, e);
24196        closeArray();
24197      };
24198      if (element.hasError()) {
24199        openArray("error");
24200        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
24201          composeEligibilityResponseErrorsComponent(null, e);
24202        closeArray();
24203      };
24204  }
24205
24206  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
24207    if (element != null) {
24208      open(name);
24209      composeEligibilityResponseBenefitsComponentInner(element);
24210      close();
24211    }
24212  }
24213
24214  protected void composeEligibilityResponseBenefitsComponentInner(EligibilityResponse.BenefitsComponent element) throws IOException {
24215      composeBackbone(element);
24216      if (element.hasCategory()) {
24217        composeCoding("category", element.getCategory());
24218      }
24219      if (element.hasSubCategory()) {
24220        composeCoding("subCategory", element.getSubCategory());
24221      }
24222      if (element.hasNetwork()) {
24223        composeCoding("network", element.getNetwork());
24224      }
24225      if (element.hasUnit()) {
24226        composeCoding("unit", element.getUnit());
24227      }
24228      if (element.hasTerm()) {
24229        composeCoding("term", element.getTerm());
24230      }
24231      if (element.hasFinancial()) {
24232        openArray("financial");
24233        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
24234          composeEligibilityResponseBenefitComponent(null, e);
24235        closeArray();
24236      };
24237  }
24238
24239  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
24240    if (element != null) {
24241      open(name);
24242      composeEligibilityResponseBenefitComponentInner(element);
24243      close();
24244    }
24245  }
24246
24247  protected void composeEligibilityResponseBenefitComponentInner(EligibilityResponse.BenefitComponent element) throws IOException {
24248      composeBackbone(element);
24249      if (element.hasType()) {
24250        composeCoding("type", element.getType());
24251      }
24252      if (element.hasBenefit()) {
24253        composeType("benefit", element.getBenefit());
24254      }
24255      if (element.hasBenefitUsed()) {
24256        composeType("benefitUsed", element.getBenefitUsed());
24257      }
24258  }
24259
24260  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
24261    if (element != null) {
24262      open(name);
24263      composeEligibilityResponseErrorsComponentInner(element);
24264      close();
24265    }
24266  }
24267
24268  protected void composeEligibilityResponseErrorsComponentInner(EligibilityResponse.ErrorsComponent element) throws IOException {
24269      composeBackbone(element);
24270      if (element.hasCode()) {
24271        composeCoding("code", element.getCode());
24272      }
24273  }
24274
24275  protected void composeEncounter(String name, Encounter element) throws IOException {
24276    if (element != null) {
24277      prop("resourceType", name);
24278      composeEncounterInner(element);
24279    }
24280  }
24281
24282  protected void composeEncounterInner(Encounter element) throws IOException {
24283      composeDomainResourceElements(element);
24284      if (element.hasIdentifier()) {
24285        openArray("identifier");
24286        for (Identifier e : element.getIdentifier()) 
24287          composeIdentifier(null, e);
24288        closeArray();
24289      };
24290      if (element.hasStatusElement()) {
24291        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
24292        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
24293      }
24294      if (element.hasStatusHistory()) {
24295        openArray("statusHistory");
24296        for (Encounter.EncounterStatusHistoryComponent e : element.getStatusHistory()) 
24297          composeEncounterEncounterStatusHistoryComponent(null, e);
24298        closeArray();
24299      };
24300      if (element.hasClass_Element()) {
24301        composeEnumerationCore("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
24302        composeEnumerationExtras("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
24303      }
24304      if (element.hasType()) {
24305        openArray("type");
24306        for (CodeableConcept e : element.getType()) 
24307          composeCodeableConcept(null, e);
24308        closeArray();
24309      };
24310      if (element.hasPriority()) {
24311        composeCodeableConcept("priority", element.getPriority());
24312      }
24313      if (element.hasPatient()) {
24314        composeReference("patient", element.getPatient());
24315      }
24316      if (element.hasEpisodeOfCare()) {
24317        openArray("episodeOfCare");
24318        for (Reference e : element.getEpisodeOfCare()) 
24319          composeReference(null, e);
24320        closeArray();
24321      };
24322      if (element.hasIncomingReferral()) {
24323        openArray("incomingReferral");
24324        for (Reference e : element.getIncomingReferral()) 
24325          composeReference(null, e);
24326        closeArray();
24327      };
24328      if (element.hasParticipant()) {
24329        openArray("participant");
24330        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
24331          composeEncounterEncounterParticipantComponent(null, e);
24332        closeArray();
24333      };
24334      if (element.hasAppointment()) {
24335        composeReference("appointment", element.getAppointment());
24336      }
24337      if (element.hasPeriod()) {
24338        composePeriod("period", element.getPeriod());
24339      }
24340      if (element.hasLength()) {
24341        composeDuration("length", element.getLength());
24342      }
24343      if (element.hasReason()) {
24344        openArray("reason");
24345        for (CodeableConcept e : element.getReason()) 
24346          composeCodeableConcept(null, e);
24347        closeArray();
24348      };
24349      if (element.hasIndication()) {
24350        openArray("indication");
24351        for (Reference e : element.getIndication()) 
24352          composeReference(null, e);
24353        closeArray();
24354      };
24355      if (element.hasHospitalization()) {
24356        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
24357      }
24358      if (element.hasLocation()) {
24359        openArray("location");
24360        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
24361          composeEncounterEncounterLocationComponent(null, e);
24362        closeArray();
24363      };
24364      if (element.hasServiceProvider()) {
24365        composeReference("serviceProvider", element.getServiceProvider());
24366      }
24367      if (element.hasPartOf()) {
24368        composeReference("partOf", element.getPartOf());
24369      }
24370  }
24371
24372  protected void composeEncounterEncounterStatusHistoryComponent(String name, Encounter.EncounterStatusHistoryComponent element) throws IOException {
24373    if (element != null) {
24374      open(name);
24375      composeEncounterEncounterStatusHistoryComponentInner(element);
24376      close();
24377    }
24378  }
24379
24380  protected void composeEncounterEncounterStatusHistoryComponentInner(Encounter.EncounterStatusHistoryComponent element) throws IOException {
24381      composeBackbone(element);
24382      if (element.hasStatusElement()) {
24383        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
24384        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
24385      }
24386      if (element.hasPeriod()) {
24387        composePeriod("period", element.getPeriod());
24388      }
24389  }
24390
24391  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
24392    if (element != null) {
24393      open(name);
24394      composeEncounterEncounterParticipantComponentInner(element);
24395      close();
24396    }
24397  }
24398
24399  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
24400      composeBackbone(element);
24401      if (element.hasType()) {
24402        openArray("type");
24403        for (CodeableConcept e : element.getType()) 
24404          composeCodeableConcept(null, e);
24405        closeArray();
24406      };
24407      if (element.hasPeriod()) {
24408        composePeriod("period", element.getPeriod());
24409      }
24410      if (element.hasIndividual()) {
24411        composeReference("individual", element.getIndividual());
24412      }
24413  }
24414
24415  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
24416    if (element != null) {
24417      open(name);
24418      composeEncounterEncounterHospitalizationComponentInner(element);
24419      close();
24420    }
24421  }
24422
24423  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
24424      composeBackbone(element);
24425      if (element.hasPreAdmissionIdentifier()) {
24426        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
24427      }
24428      if (element.hasOrigin()) {
24429        composeReference("origin", element.getOrigin());
24430      }
24431      if (element.hasAdmitSource()) {
24432        composeCodeableConcept("admitSource", element.getAdmitSource());
24433      }
24434      if (element.hasAdmittingDiagnosis()) {
24435        openArray("admittingDiagnosis");
24436        for (Reference e : element.getAdmittingDiagnosis()) 
24437          composeReference(null, e);
24438        closeArray();
24439      };
24440      if (element.hasReAdmission()) {
24441        composeCodeableConcept("reAdmission", element.getReAdmission());
24442      }
24443      if (element.hasDietPreference()) {
24444        openArray("dietPreference");
24445        for (CodeableConcept e : element.getDietPreference()) 
24446          composeCodeableConcept(null, e);
24447        closeArray();
24448      };
24449      if (element.hasSpecialCourtesy()) {
24450        openArray("specialCourtesy");
24451        for (CodeableConcept e : element.getSpecialCourtesy()) 
24452          composeCodeableConcept(null, e);
24453        closeArray();
24454      };
24455      if (element.hasSpecialArrangement()) {
24456        openArray("specialArrangement");
24457        for (CodeableConcept e : element.getSpecialArrangement()) 
24458          composeCodeableConcept(null, e);
24459        closeArray();
24460      };
24461      if (element.hasDestination()) {
24462        composeReference("destination", element.getDestination());
24463      }
24464      if (element.hasDischargeDisposition()) {
24465        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
24466      }
24467      if (element.hasDischargeDiagnosis()) {
24468        openArray("dischargeDiagnosis");
24469        for (Reference e : element.getDischargeDiagnosis()) 
24470          composeReference(null, e);
24471        closeArray();
24472      };
24473  }
24474
24475  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
24476    if (element != null) {
24477      open(name);
24478      composeEncounterEncounterLocationComponentInner(element);
24479      close();
24480    }
24481  }
24482
24483  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
24484      composeBackbone(element);
24485      if (element.hasLocation()) {
24486        composeReference("location", element.getLocation());
24487      }
24488      if (element.hasStatusElement()) {
24489        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
24490        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
24491      }
24492      if (element.hasPeriod()) {
24493        composePeriod("period", element.getPeriod());
24494      }
24495  }
24496
24497  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
24498    if (element != null) {
24499      prop("resourceType", name);
24500      composeEnrollmentRequestInner(element);
24501    }
24502  }
24503
24504  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
24505      composeDomainResourceElements(element);
24506      if (element.hasIdentifier()) {
24507        openArray("identifier");
24508        for (Identifier e : element.getIdentifier()) 
24509          composeIdentifier(null, e);
24510        closeArray();
24511      };
24512      if (element.hasRuleset()) {
24513        composeCoding("ruleset", element.getRuleset());
24514      }
24515      if (element.hasOriginalRuleset()) {
24516        composeCoding("originalRuleset", element.getOriginalRuleset());
24517      }
24518      if (element.hasCreatedElement()) {
24519        composeDateTimeCore("created", element.getCreatedElement(), false);
24520        composeDateTimeExtras("created", element.getCreatedElement(), false);
24521      }
24522      if (element.hasTarget()) {
24523        composeReference("target", element.getTarget());
24524      }
24525      if (element.hasProvider()) {
24526        composeReference("provider", element.getProvider());
24527      }
24528      if (element.hasOrganization()) {
24529        composeReference("organization", element.getOrganization());
24530      }
24531      if (element.hasSubject()) {
24532        composeReference("subject", element.getSubject());
24533      }
24534      if (element.hasCoverage()) {
24535        composeReference("coverage", element.getCoverage());
24536      }
24537      if (element.hasRelationship()) {
24538        composeCoding("relationship", element.getRelationship());
24539      }
24540  }
24541
24542  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
24543    if (element != null) {
24544      prop("resourceType", name);
24545      composeEnrollmentResponseInner(element);
24546    }
24547  }
24548
24549  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
24550      composeDomainResourceElements(element);
24551      if (element.hasIdentifier()) {
24552        openArray("identifier");
24553        for (Identifier e : element.getIdentifier()) 
24554          composeIdentifier(null, e);
24555        closeArray();
24556      };
24557      if (element.hasRequest()) {
24558        composeReference("request", element.getRequest());
24559      }
24560      if (element.hasOutcomeElement()) {
24561        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
24562        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
24563      }
24564      if (element.hasDispositionElement()) {
24565        composeStringCore("disposition", element.getDispositionElement(), false);
24566        composeStringExtras("disposition", element.getDispositionElement(), false);
24567      }
24568      if (element.hasRuleset()) {
24569        composeCoding("ruleset", element.getRuleset());
24570      }
24571      if (element.hasOriginalRuleset()) {
24572        composeCoding("originalRuleset", element.getOriginalRuleset());
24573      }
24574      if (element.hasCreatedElement()) {
24575        composeDateTimeCore("created", element.getCreatedElement(), false);
24576        composeDateTimeExtras("created", element.getCreatedElement(), false);
24577      }
24578      if (element.hasOrganization()) {
24579        composeReference("organization", element.getOrganization());
24580      }
24581      if (element.hasRequestProvider()) {
24582        composeReference("requestProvider", element.getRequestProvider());
24583      }
24584      if (element.hasRequestOrganization()) {
24585        composeReference("requestOrganization", element.getRequestOrganization());
24586      }
24587  }
24588
24589  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
24590    if (element != null) {
24591      prop("resourceType", name);
24592      composeEpisodeOfCareInner(element);
24593    }
24594  }
24595
24596  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
24597      composeDomainResourceElements(element);
24598      if (element.hasIdentifier()) {
24599        openArray("identifier");
24600        for (Identifier e : element.getIdentifier()) 
24601          composeIdentifier(null, e);
24602        closeArray();
24603      };
24604      if (element.hasStatusElement()) {
24605        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
24606        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
24607      }
24608      if (element.hasStatusHistory()) {
24609        openArray("statusHistory");
24610        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
24611          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
24612        closeArray();
24613      };
24614      if (element.hasType()) {
24615        openArray("type");
24616        for (CodeableConcept e : element.getType()) 
24617          composeCodeableConcept(null, e);
24618        closeArray();
24619      };
24620      if (element.hasCondition()) {
24621        openArray("condition");
24622        for (Reference e : element.getCondition()) 
24623          composeReference(null, e);
24624        closeArray();
24625      };
24626      if (element.hasPatient()) {
24627        composeReference("patient", element.getPatient());
24628      }
24629      if (element.hasManagingOrganization()) {
24630        composeReference("managingOrganization", element.getManagingOrganization());
24631      }
24632      if (element.hasPeriod()) {
24633        composePeriod("period", element.getPeriod());
24634      }
24635      if (element.hasReferralRequest()) {
24636        openArray("referralRequest");
24637        for (Reference e : element.getReferralRequest()) 
24638          composeReference(null, e);
24639        closeArray();
24640      };
24641      if (element.hasCareManager()) {
24642        composeReference("careManager", element.getCareManager());
24643      }
24644      if (element.hasTeam()) {
24645        openArray("team");
24646        for (Reference e : element.getTeam()) 
24647          composeReference(null, e);
24648        closeArray();
24649      };
24650  }
24651
24652  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
24653    if (element != null) {
24654      open(name);
24655      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
24656      close();
24657    }
24658  }
24659
24660  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
24661      composeBackbone(element);
24662      if (element.hasStatusElement()) {
24663        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
24664        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
24665      }
24666      if (element.hasPeriod()) {
24667        composePeriod("period", element.getPeriod());
24668      }
24669  }
24670
24671  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
24672    if (element != null) {
24673      prop("resourceType", name);
24674      composeExpansionProfileInner(element);
24675    }
24676  }
24677
24678  protected void composeExpansionProfileInner(ExpansionProfile element) throws IOException {
24679      composeDomainResourceElements(element);
24680      if (element.hasUrlElement()) {
24681        composeUriCore("url", element.getUrlElement(), false);
24682        composeUriExtras("url", element.getUrlElement(), false);
24683      }
24684      if (element.hasIdentifier()) {
24685        composeIdentifier("identifier", element.getIdentifier());
24686      }
24687      if (element.hasVersionElement()) {
24688        composeStringCore("version", element.getVersionElement(), false);
24689        composeStringExtras("version", element.getVersionElement(), false);
24690      }
24691      if (element.hasNameElement()) {
24692        composeStringCore("name", element.getNameElement(), false);
24693        composeStringExtras("name", element.getNameElement(), false);
24694      }
24695      if (element.hasStatusElement()) {
24696        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24697        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24698      }
24699      if (element.hasExperimentalElement()) {
24700        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24701        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24702      }
24703      if (element.hasPublisherElement()) {
24704        composeStringCore("publisher", element.getPublisherElement(), false);
24705        composeStringExtras("publisher", element.getPublisherElement(), false);
24706      }
24707      if (element.hasContact()) {
24708        openArray("contact");
24709        for (ExpansionProfile.ExpansionProfileContactComponent e : element.getContact()) 
24710          composeExpansionProfileExpansionProfileContactComponent(null, e);
24711        closeArray();
24712      };
24713      if (element.hasDateElement()) {
24714        composeDateTimeCore("date", element.getDateElement(), false);
24715        composeDateTimeExtras("date", element.getDateElement(), false);
24716      }
24717      if (element.hasDescriptionElement()) {
24718        composeStringCore("description", element.getDescriptionElement(), false);
24719        composeStringExtras("description", element.getDescriptionElement(), false);
24720      }
24721      if (element.hasCodeSystem()) {
24722        composeExpansionProfileExpansionProfileCodeSystemComponent("codeSystem", element.getCodeSystem());
24723      }
24724      if (element.hasIncludeDesignationsElement()) {
24725        composeBooleanCore("includeDesignations", element.getIncludeDesignationsElement(), false);
24726        composeBooleanExtras("includeDesignations", element.getIncludeDesignationsElement(), false);
24727      }
24728      if (element.hasDesignation()) {
24729        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
24730      }
24731      if (element.hasIncludeDefinitionElement()) {
24732        composeBooleanCore("includeDefinition", element.getIncludeDefinitionElement(), false);
24733        composeBooleanExtras("includeDefinition", element.getIncludeDefinitionElement(), false);
24734      }
24735      if (element.hasIncludeInactiveElement()) {
24736        composeBooleanCore("includeInactive", element.getIncludeInactiveElement(), false);
24737        composeBooleanExtras("includeInactive", element.getIncludeInactiveElement(), false);
24738      }
24739      if (element.hasExcludeNestedElement()) {
24740        composeBooleanCore("excludeNested", element.getExcludeNestedElement(), false);
24741        composeBooleanExtras("excludeNested", element.getExcludeNestedElement(), false);
24742      }
24743      if (element.hasExcludeNotForUIElement()) {
24744        composeBooleanCore("excludeNotForUI", element.getExcludeNotForUIElement(), false);
24745        composeBooleanExtras("excludeNotForUI", element.getExcludeNotForUIElement(), false);
24746      }
24747      if (element.hasExcludePostCoordinatedElement()) {
24748        composeBooleanCore("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
24749        composeBooleanExtras("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
24750      }
24751      if (element.hasDisplayLanguageElement()) {
24752        composeCodeCore("displayLanguage", element.getDisplayLanguageElement(), false);
24753        composeCodeExtras("displayLanguage", element.getDisplayLanguageElement(), false);
24754      }
24755      if (element.hasLimitedExpansionElement()) {
24756        composeBooleanCore("limitedExpansion", element.getLimitedExpansionElement(), false);
24757        composeBooleanExtras("limitedExpansion", element.getLimitedExpansionElement(), false);
24758      }
24759  }
24760
24761  protected void composeExpansionProfileExpansionProfileContactComponent(String name, ExpansionProfile.ExpansionProfileContactComponent element) throws IOException {
24762    if (element != null) {
24763      open(name);
24764      composeExpansionProfileExpansionProfileContactComponentInner(element);
24765      close();
24766    }
24767  }
24768
24769  protected void composeExpansionProfileExpansionProfileContactComponentInner(ExpansionProfile.ExpansionProfileContactComponent element) throws IOException {
24770      composeBackbone(element);
24771      if (element.hasNameElement()) {
24772        composeStringCore("name", element.getNameElement(), false);
24773        composeStringExtras("name", element.getNameElement(), false);
24774      }
24775      if (element.hasTelecom()) {
24776        openArray("telecom");
24777        for (ContactPoint e : element.getTelecom()) 
24778          composeContactPoint(null, e);
24779        closeArray();
24780      };
24781  }
24782
24783  protected void composeExpansionProfileExpansionProfileCodeSystemComponent(String name, ExpansionProfile.ExpansionProfileCodeSystemComponent element) throws IOException {
24784    if (element != null) {
24785      open(name);
24786      composeExpansionProfileExpansionProfileCodeSystemComponentInner(element);
24787      close();
24788    }
24789  }
24790
24791  protected void composeExpansionProfileExpansionProfileCodeSystemComponentInner(ExpansionProfile.ExpansionProfileCodeSystemComponent element) throws IOException {
24792      composeBackbone(element);
24793      if (element.hasInclude()) {
24794        composeExpansionProfileCodeSystemIncludeComponent("include", element.getInclude());
24795      }
24796      if (element.hasExclude()) {
24797        composeExpansionProfileCodeSystemExcludeComponent("exclude", element.getExclude());
24798      }
24799  }
24800
24801  protected void composeExpansionProfileCodeSystemIncludeComponent(String name, ExpansionProfile.CodeSystemIncludeComponent element) throws IOException {
24802    if (element != null) {
24803      open(name);
24804      composeExpansionProfileCodeSystemIncludeComponentInner(element);
24805      close();
24806    }
24807  }
24808
24809  protected void composeExpansionProfileCodeSystemIncludeComponentInner(ExpansionProfile.CodeSystemIncludeComponent element) throws IOException {
24810      composeBackbone(element);
24811      if (element.hasCodeSystem()) {
24812        openArray("codeSystem");
24813        for (ExpansionProfile.CodeSystemIncludeCodeSystemComponent e : element.getCodeSystem()) 
24814          composeExpansionProfileCodeSystemIncludeCodeSystemComponent(null, e);
24815        closeArray();
24816      };
24817  }
24818
24819  protected void composeExpansionProfileCodeSystemIncludeCodeSystemComponent(String name, ExpansionProfile.CodeSystemIncludeCodeSystemComponent element) throws IOException {
24820    if (element != null) {
24821      open(name);
24822      composeExpansionProfileCodeSystemIncludeCodeSystemComponentInner(element);
24823      close();
24824    }
24825  }
24826
24827  protected void composeExpansionProfileCodeSystemIncludeCodeSystemComponentInner(ExpansionProfile.CodeSystemIncludeCodeSystemComponent element) throws IOException {
24828      composeBackbone(element);
24829      if (element.hasSystemElement()) {
24830        composeUriCore("system", element.getSystemElement(), false);
24831        composeUriExtras("system", element.getSystemElement(), false);
24832      }
24833      if (element.hasVersionElement()) {
24834        composeStringCore("version", element.getVersionElement(), false);
24835        composeStringExtras("version", element.getVersionElement(), false);
24836      }
24837  }
24838
24839  protected void composeExpansionProfileCodeSystemExcludeComponent(String name, ExpansionProfile.CodeSystemExcludeComponent element) throws IOException {
24840    if (element != null) {
24841      open(name);
24842      composeExpansionProfileCodeSystemExcludeComponentInner(element);
24843      close();
24844    }
24845  }
24846
24847  protected void composeExpansionProfileCodeSystemExcludeComponentInner(ExpansionProfile.CodeSystemExcludeComponent element) throws IOException {
24848      composeBackbone(element);
24849      if (element.hasCodeSystem()) {
24850        openArray("codeSystem");
24851        for (ExpansionProfile.CodeSystemExcludeCodeSystemComponent e : element.getCodeSystem()) 
24852          composeExpansionProfileCodeSystemExcludeCodeSystemComponent(null, e);
24853        closeArray();
24854      };
24855  }
24856
24857  protected void composeExpansionProfileCodeSystemExcludeCodeSystemComponent(String name, ExpansionProfile.CodeSystemExcludeCodeSystemComponent element) throws IOException {
24858    if (element != null) {
24859      open(name);
24860      composeExpansionProfileCodeSystemExcludeCodeSystemComponentInner(element);
24861      close();
24862    }
24863  }
24864
24865  protected void composeExpansionProfileCodeSystemExcludeCodeSystemComponentInner(ExpansionProfile.CodeSystemExcludeCodeSystemComponent element) throws IOException {
24866      composeBackbone(element);
24867      if (element.hasSystemElement()) {
24868        composeUriCore("system", element.getSystemElement(), false);
24869        composeUriExtras("system", element.getSystemElement(), false);
24870      }
24871      if (element.hasVersionElement()) {
24872        composeStringCore("version", element.getVersionElement(), false);
24873        composeStringExtras("version", element.getVersionElement(), false);
24874      }
24875  }
24876
24877  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
24878    if (element != null) {
24879      open(name);
24880      composeExpansionProfileExpansionProfileDesignationComponentInner(element);
24881      close();
24882    }
24883  }
24884
24885  protected void composeExpansionProfileExpansionProfileDesignationComponentInner(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
24886      composeBackbone(element);
24887      if (element.hasInclude()) {
24888        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
24889      }
24890      if (element.hasExclude()) {
24891        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
24892      }
24893  }
24894
24895  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
24896    if (element != null) {
24897      open(name);
24898      composeExpansionProfileDesignationIncludeComponentInner(element);
24899      close();
24900    }
24901  }
24902
24903  protected void composeExpansionProfileDesignationIncludeComponentInner(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
24904      composeBackbone(element);
24905      if (element.hasDesignation()) {
24906        openArray("designation");
24907        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
24908          composeExpansionProfileDesignationIncludeDesignationComponent(null, e);
24909        closeArray();
24910      };
24911  }
24912
24913  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
24914    if (element != null) {
24915      open(name);
24916      composeExpansionProfileDesignationIncludeDesignationComponentInner(element);
24917      close();
24918    }
24919  }
24920
24921  protected void composeExpansionProfileDesignationIncludeDesignationComponentInner(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
24922      composeBackbone(element);
24923      if (element.hasLanguageElement()) {
24924        composeCodeCore("language", element.getLanguageElement(), false);
24925        composeCodeExtras("language", element.getLanguageElement(), false);
24926      }
24927      if (element.hasUse()) {
24928        composeCoding("use", element.getUse());
24929      }
24930  }
24931
24932  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
24933    if (element != null) {
24934      open(name);
24935      composeExpansionProfileDesignationExcludeComponentInner(element);
24936      close();
24937    }
24938  }
24939
24940  protected void composeExpansionProfileDesignationExcludeComponentInner(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
24941      composeBackbone(element);
24942      if (element.hasDesignation()) {
24943        openArray("designation");
24944        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
24945          composeExpansionProfileDesignationExcludeDesignationComponent(null, e);
24946        closeArray();
24947      };
24948  }
24949
24950  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
24951    if (element != null) {
24952      open(name);
24953      composeExpansionProfileDesignationExcludeDesignationComponentInner(element);
24954      close();
24955    }
24956  }
24957
24958  protected void composeExpansionProfileDesignationExcludeDesignationComponentInner(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
24959      composeBackbone(element);
24960      if (element.hasLanguageElement()) {
24961        composeCodeCore("language", element.getLanguageElement(), false);
24962        composeCodeExtras("language", element.getLanguageElement(), false);
24963      }
24964      if (element.hasUse()) {
24965        composeCoding("use", element.getUse());
24966      }
24967  }
24968
24969  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
24970    if (element != null) {
24971      prop("resourceType", name);
24972      composeExplanationOfBenefitInner(element);
24973    }
24974  }
24975
24976  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
24977      composeDomainResourceElements(element);
24978      if (element.hasIdentifier()) {
24979        openArray("identifier");
24980        for (Identifier e : element.getIdentifier()) 
24981          composeIdentifier(null, e);
24982        closeArray();
24983      };
24984      if (element.hasClaim()) {
24985        composeType("claim", element.getClaim());
24986      }
24987      if (element.hasClaimResponse()) {
24988        composeType("claimResponse", element.getClaimResponse());
24989      }
24990      if (element.hasSubType()) {
24991        openArray("subType");
24992        for (Coding e : element.getSubType()) 
24993          composeCoding(null, e);
24994        closeArray();
24995      };
24996      if (element.hasRuleset()) {
24997        composeCoding("ruleset", element.getRuleset());
24998      }
24999      if (element.hasOriginalRuleset()) {
25000        composeCoding("originalRuleset", element.getOriginalRuleset());
25001      }
25002      if (element.hasCreatedElement()) {
25003        composeDateTimeCore("created", element.getCreatedElement(), false);
25004        composeDateTimeExtras("created", element.getCreatedElement(), false);
25005      }
25006      if (element.hasBillablePeriod()) {
25007        composePeriod("billablePeriod", element.getBillablePeriod());
25008      }
25009      if (element.hasDispositionElement()) {
25010        composeStringCore("disposition", element.getDispositionElement(), false);
25011        composeStringExtras("disposition", element.getDispositionElement(), false);
25012      }
25013      if (element.hasProvider()) {
25014        composeType("provider", element.getProvider());
25015      }
25016      if (element.hasOrganization()) {
25017        composeType("organization", element.getOrganization());
25018      }
25019      if (element.hasFacility()) {
25020        composeType("facility", element.getFacility());
25021      }
25022      if (element.hasRelated()) {
25023        openArray("related");
25024        for (ExplanationOfBenefit.RelatedClaimsComponent e : element.getRelated()) 
25025          composeExplanationOfBenefitRelatedClaimsComponent(null, e);
25026        closeArray();
25027      };
25028      if (element.hasPrescription()) {
25029        composeType("prescription", element.getPrescription());
25030      }
25031      if (element.hasOriginalPrescription()) {
25032        composeType("originalPrescription", element.getOriginalPrescription());
25033      }
25034      if (element.hasPayee()) {
25035        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
25036      }
25037      if (element.hasReferral()) {
25038        composeType("referral", element.getReferral());
25039      }
25040      if (element.hasOccurrenceCode()) {
25041        openArray("occurrenceCode");
25042        for (Coding e : element.getOccurrenceCode()) 
25043          composeCoding(null, e);
25044        closeArray();
25045      };
25046      if (element.hasOccurenceSpanCode()) {
25047        openArray("occurenceSpanCode");
25048        for (Coding e : element.getOccurenceSpanCode()) 
25049          composeCoding(null, e);
25050        closeArray();
25051      };
25052      if (element.hasValueCode()) {
25053        openArray("valueCode");
25054        for (Coding e : element.getValueCode()) 
25055          composeCoding(null, e);
25056        closeArray();
25057      };
25058      if (element.hasDiagnosis()) {
25059        openArray("diagnosis");
25060        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
25061          composeExplanationOfBenefitDiagnosisComponent(null, e);
25062        closeArray();
25063      };
25064      if (element.hasProcedure()) {
25065        openArray("procedure");
25066        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
25067          composeExplanationOfBenefitProcedureComponent(null, e);
25068        closeArray();
25069      };
25070      if (element.hasSpecialCondition()) {
25071        openArray("specialCondition");
25072        for (Coding e : element.getSpecialCondition()) 
25073          composeCoding(null, e);
25074        closeArray();
25075      };
25076      if (element.hasPatient()) {
25077        composeType("patient", element.getPatient());
25078      }
25079      if (element.hasPrecedenceElement()) {
25080        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
25081        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
25082      }
25083      if (element.hasCoverage()) {
25084        composeExplanationOfBenefitCoverageComponent("coverage", element.getCoverage());
25085      }
25086      if (element.hasAccidentDateElement()) {
25087        composeDateCore("accidentDate", element.getAccidentDateElement(), false);
25088        composeDateExtras("accidentDate", element.getAccidentDateElement(), false);
25089      }
25090      if (element.hasAccidentType()) {
25091        composeCoding("accidentType", element.getAccidentType());
25092      }
25093      if (element.hasAccidentLocation()) {
25094        composeType("accidentLocation", element.getAccidentLocation());
25095      }
25096      if (element.hasInterventionException()) {
25097        openArray("interventionException");
25098        for (Coding e : element.getInterventionException()) 
25099          composeCoding(null, e);
25100        closeArray();
25101      };
25102      if (element.hasOnset()) {
25103        openArray("onset");
25104        for (ExplanationOfBenefit.OnsetComponent e : element.getOnset()) 
25105          composeExplanationOfBenefitOnsetComponent(null, e);
25106        closeArray();
25107      };
25108      if (element.hasEmploymentImpacted()) {
25109        composePeriod("employmentImpacted", element.getEmploymentImpacted());
25110      }
25111      if (element.hasHospitalization()) {
25112        composePeriod("hospitalization", element.getHospitalization());
25113      }
25114      if (element.hasItem()) {
25115        openArray("item");
25116        for (ExplanationOfBenefit.ItemsComponent e : element.getItem()) 
25117          composeExplanationOfBenefitItemsComponent(null, e);
25118        closeArray();
25119      };
25120      if (element.hasAddItem()) {
25121        openArray("addItem");
25122        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
25123          composeExplanationOfBenefitAddedItemComponent(null, e);
25124        closeArray();
25125      };
25126      if (element.hasMissingTeeth()) {
25127        openArray("missingTeeth");
25128        for (ExplanationOfBenefit.MissingTeethComponent e : element.getMissingTeeth()) 
25129          composeExplanationOfBenefitMissingTeethComponent(null, e);
25130        closeArray();
25131      };
25132      if (element.hasTotalCost()) {
25133        composeMoney("totalCost", element.getTotalCost());
25134      }
25135      if (element.hasUnallocDeductable()) {
25136        composeMoney("unallocDeductable", element.getUnallocDeductable());
25137      }
25138      if (element.hasTotalBenefit()) {
25139        composeMoney("totalBenefit", element.getTotalBenefit());
25140      }
25141      if (element.hasPaymentAdjustment()) {
25142        composeMoney("paymentAdjustment", element.getPaymentAdjustment());
25143      }
25144      if (element.hasPaymentAdjustmentReason()) {
25145        composeCoding("paymentAdjustmentReason", element.getPaymentAdjustmentReason());
25146      }
25147      if (element.hasPaymentDateElement()) {
25148        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
25149        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
25150      }
25151      if (element.hasPaymentAmount()) {
25152        composeMoney("paymentAmount", element.getPaymentAmount());
25153      }
25154      if (element.hasPaymentRef()) {
25155        composeIdentifier("paymentRef", element.getPaymentRef());
25156      }
25157      if (element.hasReserved()) {
25158        composeCoding("reserved", element.getReserved());
25159      }
25160      if (element.hasForm()) {
25161        composeCoding("form", element.getForm());
25162      }
25163      if (element.hasNote()) {
25164        openArray("note");
25165        for (ExplanationOfBenefit.NotesComponent e : element.getNote()) 
25166          composeExplanationOfBenefitNotesComponent(null, e);
25167        closeArray();
25168      };
25169      if (element.hasBenefitBalance()) {
25170        openArray("benefitBalance");
25171        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
25172          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
25173        closeArray();
25174      };
25175  }
25176
25177  protected void composeExplanationOfBenefitRelatedClaimsComponent(String name, ExplanationOfBenefit.RelatedClaimsComponent element) throws IOException {
25178    if (element != null) {
25179      open(name);
25180      composeExplanationOfBenefitRelatedClaimsComponentInner(element);
25181      close();
25182    }
25183  }
25184
25185  protected void composeExplanationOfBenefitRelatedClaimsComponentInner(ExplanationOfBenefit.RelatedClaimsComponent element) throws IOException {
25186      composeBackbone(element);
25187      if (element.hasClaim()) {
25188        composeType("claim", element.getClaim());
25189      }
25190      if (element.hasRelationship()) {
25191        composeCoding("relationship", element.getRelationship());
25192      }
25193      if (element.hasReference()) {
25194        composeIdentifier("reference", element.getReference());
25195      }
25196  }
25197
25198  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
25199    if (element != null) {
25200      open(name);
25201      composeExplanationOfBenefitPayeeComponentInner(element);
25202      close();
25203    }
25204  }
25205
25206  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
25207      composeBackbone(element);
25208      if (element.hasType()) {
25209        composeCoding("type", element.getType());
25210      }
25211      if (element.hasParty()) {
25212        composeType("party", element.getParty());
25213      }
25214  }
25215
25216  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
25217    if (element != null) {
25218      open(name);
25219      composeExplanationOfBenefitDiagnosisComponentInner(element);
25220      close();
25221    }
25222  }
25223
25224  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
25225      composeBackbone(element);
25226      if (element.hasSequenceElement()) {
25227        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25228        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25229      }
25230      if (element.hasDiagnosis()) {
25231        composeCoding("diagnosis", element.getDiagnosis());
25232      }
25233  }
25234
25235  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
25236    if (element != null) {
25237      open(name);
25238      composeExplanationOfBenefitProcedureComponentInner(element);
25239      close();
25240    }
25241  }
25242
25243  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
25244      composeBackbone(element);
25245      if (element.hasSequenceElement()) {
25246        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25247        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25248      }
25249      if (element.hasDateElement()) {
25250        composeDateTimeCore("date", element.getDateElement(), false);
25251        composeDateTimeExtras("date", element.getDateElement(), false);
25252      }
25253      if (element.hasProcedure()) {
25254        composeType("procedure", element.getProcedure());
25255      }
25256  }
25257
25258  protected void composeExplanationOfBenefitCoverageComponent(String name, ExplanationOfBenefit.CoverageComponent element) throws IOException {
25259    if (element != null) {
25260      open(name);
25261      composeExplanationOfBenefitCoverageComponentInner(element);
25262      close();
25263    }
25264  }
25265
25266  protected void composeExplanationOfBenefitCoverageComponentInner(ExplanationOfBenefit.CoverageComponent element) throws IOException {
25267      composeBackbone(element);
25268      if (element.hasCoverage()) {
25269        composeType("coverage", element.getCoverage());
25270      }
25271      if (element.hasPreAuthRef()) {
25272        openArray("preAuthRef");
25273        for (StringType e : element.getPreAuthRef()) 
25274          composeStringCore(null, e, true);
25275        closeArray();
25276        if (anyHasExtras(element.getPreAuthRef())) {
25277          openArray("_preAuthRef");
25278          for (StringType e : element.getPreAuthRef()) 
25279            composeStringExtras(null, e, true);
25280          closeArray();
25281        }
25282      };
25283  }
25284
25285  protected void composeExplanationOfBenefitOnsetComponent(String name, ExplanationOfBenefit.OnsetComponent element) throws IOException {
25286    if (element != null) {
25287      open(name);
25288      composeExplanationOfBenefitOnsetComponentInner(element);
25289      close();
25290    }
25291  }
25292
25293  protected void composeExplanationOfBenefitOnsetComponentInner(ExplanationOfBenefit.OnsetComponent element) throws IOException {
25294      composeBackbone(element);
25295      if (element.hasTime()) {
25296        composeType("time", element.getTime());
25297      }
25298      if (element.hasType()) {
25299        composeCoding("type", element.getType());
25300      }
25301  }
25302
25303  protected void composeExplanationOfBenefitItemsComponent(String name, ExplanationOfBenefit.ItemsComponent element) throws IOException {
25304    if (element != null) {
25305      open(name);
25306      composeExplanationOfBenefitItemsComponentInner(element);
25307      close();
25308    }
25309  }
25310
25311  protected void composeExplanationOfBenefitItemsComponentInner(ExplanationOfBenefit.ItemsComponent element) throws IOException {
25312      composeBackbone(element);
25313      if (element.hasSequenceElement()) {
25314        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25315        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25316      }
25317      if (element.hasType()) {
25318        composeCoding("type", element.getType());
25319      }
25320      if (element.hasProvider()) {
25321        composeType("provider", element.getProvider());
25322      }
25323      if (element.hasSupervisor()) {
25324        composeType("supervisor", element.getSupervisor());
25325      }
25326      if (element.hasProviderQualification()) {
25327        composeCoding("providerQualification", element.getProviderQualification());
25328      }
25329      if (element.hasDiagnosisLinkId()) {
25330        openArray("diagnosisLinkId");
25331        for (PositiveIntType e : element.getDiagnosisLinkId()) 
25332          composePositiveIntCore(null, e, true);
25333        closeArray();
25334        if (anyHasExtras(element.getDiagnosisLinkId())) {
25335          openArray("_diagnosisLinkId");
25336          for (PositiveIntType e : element.getDiagnosisLinkId()) 
25337            composePositiveIntExtras(null, e, true);
25338          closeArray();
25339        }
25340      };
25341      if (element.hasService()) {
25342        composeCoding("service", element.getService());
25343      }
25344      if (element.hasServiceModifier()) {
25345        openArray("serviceModifier");
25346        for (Coding e : element.getServiceModifier()) 
25347          composeCoding(null, e);
25348        closeArray();
25349      };
25350      if (element.hasModifier()) {
25351        openArray("modifier");
25352        for (Coding e : element.getModifier()) 
25353          composeCoding(null, e);
25354        closeArray();
25355      };
25356      if (element.hasProgramCode()) {
25357        openArray("programCode");
25358        for (Coding e : element.getProgramCode()) 
25359          composeCoding(null, e);
25360        closeArray();
25361      };
25362      if (element.hasServiced()) {
25363        composeType("serviced", element.getServiced());
25364      }
25365      if (element.hasPlace()) {
25366        composeCoding("place", element.getPlace());
25367      }
25368      if (element.hasQuantity()) {
25369        composeSimpleQuantity("quantity", element.getQuantity());
25370      }
25371      if (element.hasUnitPrice()) {
25372        composeMoney("unitPrice", element.getUnitPrice());
25373      }
25374      if (element.hasFactorElement()) {
25375        composeDecimalCore("factor", element.getFactorElement(), false);
25376        composeDecimalExtras("factor", element.getFactorElement(), false);
25377      }
25378      if (element.hasPointsElement()) {
25379        composeDecimalCore("points", element.getPointsElement(), false);
25380        composeDecimalExtras("points", element.getPointsElement(), false);
25381      }
25382      if (element.hasNet()) {
25383        composeMoney("net", element.getNet());
25384      }
25385      if (element.hasUdi()) {
25386        openArray("udi");
25387        for (Reference e : element.getUdi()) 
25388          composeReference(null, e);
25389        closeArray();
25390      };
25391      if (element.hasBodySite()) {
25392        composeCoding("bodySite", element.getBodySite());
25393      }
25394      if (element.hasSubSite()) {
25395        openArray("subSite");
25396        for (Coding e : element.getSubSite()) 
25397          composeCoding(null, e);
25398        closeArray();
25399      };
25400      if (element.hasNoteNumber()) {
25401        openArray("noteNumber");
25402        for (PositiveIntType e : element.getNoteNumber()) 
25403          composePositiveIntCore(null, e, true);
25404        closeArray();
25405        if (anyHasExtras(element.getNoteNumber())) {
25406          openArray("_noteNumber");
25407          for (PositiveIntType e : element.getNoteNumber()) 
25408            composePositiveIntExtras(null, e, true);
25409          closeArray();
25410        }
25411      };
25412      if (element.hasAdjudication()) {
25413        openArray("adjudication");
25414        for (ExplanationOfBenefit.ItemAdjudicationComponent e : element.getAdjudication()) 
25415          composeExplanationOfBenefitItemAdjudicationComponent(null, e);
25416        closeArray();
25417      };
25418      if (element.hasDetail()) {
25419        openArray("detail");
25420        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
25421          composeExplanationOfBenefitDetailComponent(null, e);
25422        closeArray();
25423      };
25424      if (element.hasProsthesis()) {
25425        composeExplanationOfBenefitProsthesisComponent("prosthesis", element.getProsthesis());
25426      }
25427  }
25428
25429  protected void composeExplanationOfBenefitItemAdjudicationComponent(String name, ExplanationOfBenefit.ItemAdjudicationComponent element) throws IOException {
25430    if (element != null) {
25431      open(name);
25432      composeExplanationOfBenefitItemAdjudicationComponentInner(element);
25433      close();
25434    }
25435  }
25436
25437  protected void composeExplanationOfBenefitItemAdjudicationComponentInner(ExplanationOfBenefit.ItemAdjudicationComponent element) throws IOException {
25438      composeBackbone(element);
25439      if (element.hasCategory()) {
25440        composeCoding("category", element.getCategory());
25441      }
25442      if (element.hasReason()) {
25443        composeCoding("reason", element.getReason());
25444      }
25445      if (element.hasAmount()) {
25446        composeMoney("amount", element.getAmount());
25447      }
25448      if (element.hasValueElement()) {
25449        composeDecimalCore("value", element.getValueElement(), false);
25450        composeDecimalExtras("value", element.getValueElement(), false);
25451      }
25452  }
25453
25454  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
25455    if (element != null) {
25456      open(name);
25457      composeExplanationOfBenefitDetailComponentInner(element);
25458      close();
25459    }
25460  }
25461
25462  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
25463      composeBackbone(element);
25464      if (element.hasSequenceElement()) {
25465        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25466        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25467      }
25468      if (element.hasType()) {
25469        composeCoding("type", element.getType());
25470      }
25471      if (element.hasService()) {
25472        composeCoding("service", element.getService());
25473      }
25474      if (element.hasProgramCode()) {
25475        openArray("programCode");
25476        for (Coding e : element.getProgramCode()) 
25477          composeCoding(null, e);
25478        closeArray();
25479      };
25480      if (element.hasQuantity()) {
25481        composeSimpleQuantity("quantity", element.getQuantity());
25482      }
25483      if (element.hasUnitPrice()) {
25484        composeMoney("unitPrice", element.getUnitPrice());
25485      }
25486      if (element.hasFactorElement()) {
25487        composeDecimalCore("factor", element.getFactorElement(), false);
25488        composeDecimalExtras("factor", element.getFactorElement(), false);
25489      }
25490      if (element.hasPointsElement()) {
25491        composeDecimalCore("points", element.getPointsElement(), false);
25492        composeDecimalExtras("points", element.getPointsElement(), false);
25493      }
25494      if (element.hasNet()) {
25495        composeMoney("net", element.getNet());
25496      }
25497      if (element.hasUdi()) {
25498        openArray("udi");
25499        for (Reference e : element.getUdi()) 
25500          composeReference(null, e);
25501        closeArray();
25502      };
25503      if (element.hasAdjudication()) {
25504        openArray("adjudication");
25505        for (ExplanationOfBenefit.DetailAdjudicationComponent e : element.getAdjudication()) 
25506          composeExplanationOfBenefitDetailAdjudicationComponent(null, e);
25507        closeArray();
25508      };
25509      if (element.hasSubDetail()) {
25510        openArray("subDetail");
25511        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
25512          composeExplanationOfBenefitSubDetailComponent(null, e);
25513        closeArray();
25514      };
25515  }
25516
25517  protected void composeExplanationOfBenefitDetailAdjudicationComponent(String name, ExplanationOfBenefit.DetailAdjudicationComponent element) throws IOException {
25518    if (element != null) {
25519      open(name);
25520      composeExplanationOfBenefitDetailAdjudicationComponentInner(element);
25521      close();
25522    }
25523  }
25524
25525  protected void composeExplanationOfBenefitDetailAdjudicationComponentInner(ExplanationOfBenefit.DetailAdjudicationComponent element) throws IOException {
25526      composeBackbone(element);
25527      if (element.hasCategory()) {
25528        composeCoding("category", element.getCategory());
25529      }
25530      if (element.hasReason()) {
25531        composeCoding("reason", element.getReason());
25532      }
25533      if (element.hasAmount()) {
25534        composeMoney("amount", element.getAmount());
25535      }
25536      if (element.hasValueElement()) {
25537        composeDecimalCore("value", element.getValueElement(), false);
25538        composeDecimalExtras("value", element.getValueElement(), false);
25539      }
25540  }
25541
25542  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
25543    if (element != null) {
25544      open(name);
25545      composeExplanationOfBenefitSubDetailComponentInner(element);
25546      close();
25547    }
25548  }
25549
25550  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
25551      composeBackbone(element);
25552      if (element.hasSequenceElement()) {
25553        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25554        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25555      }
25556      if (element.hasType()) {
25557        composeCoding("type", element.getType());
25558      }
25559      if (element.hasService()) {
25560        composeCoding("service", element.getService());
25561      }
25562      if (element.hasProgramCode()) {
25563        openArray("programCode");
25564        for (Coding e : element.getProgramCode()) 
25565          composeCoding(null, e);
25566        closeArray();
25567      };
25568      if (element.hasQuantity()) {
25569        composeSimpleQuantity("quantity", element.getQuantity());
25570      }
25571      if (element.hasUnitPrice()) {
25572        composeMoney("unitPrice", element.getUnitPrice());
25573      }
25574      if (element.hasFactorElement()) {
25575        composeDecimalCore("factor", element.getFactorElement(), false);
25576        composeDecimalExtras("factor", element.getFactorElement(), false);
25577      }
25578      if (element.hasPointsElement()) {
25579        composeDecimalCore("points", element.getPointsElement(), false);
25580        composeDecimalExtras("points", element.getPointsElement(), false);
25581      }
25582      if (element.hasNet()) {
25583        composeMoney("net", element.getNet());
25584      }
25585      if (element.hasUdi()) {
25586        openArray("udi");
25587        for (Reference e : element.getUdi()) 
25588          composeReference(null, e);
25589        closeArray();
25590      };
25591      if (element.hasAdjudication()) {
25592        openArray("adjudication");
25593        for (ExplanationOfBenefit.SubDetailAdjudicationComponent e : element.getAdjudication()) 
25594          composeExplanationOfBenefitSubDetailAdjudicationComponent(null, e);
25595        closeArray();
25596      };
25597  }
25598
25599  protected void composeExplanationOfBenefitSubDetailAdjudicationComponent(String name, ExplanationOfBenefit.SubDetailAdjudicationComponent element) throws IOException {
25600    if (element != null) {
25601      open(name);
25602      composeExplanationOfBenefitSubDetailAdjudicationComponentInner(element);
25603      close();
25604    }
25605  }
25606
25607  protected void composeExplanationOfBenefitSubDetailAdjudicationComponentInner(ExplanationOfBenefit.SubDetailAdjudicationComponent element) throws IOException {
25608      composeBackbone(element);
25609      if (element.hasCategory()) {
25610        composeCoding("category", element.getCategory());
25611      }
25612      if (element.hasReason()) {
25613        composeCoding("reason", element.getReason());
25614      }
25615      if (element.hasAmount()) {
25616        composeMoney("amount", element.getAmount());
25617      }
25618      if (element.hasValueElement()) {
25619        composeDecimalCore("value", element.getValueElement(), false);
25620        composeDecimalExtras("value", element.getValueElement(), false);
25621      }
25622  }
25623
25624  protected void composeExplanationOfBenefitProsthesisComponent(String name, ExplanationOfBenefit.ProsthesisComponent element) throws IOException {
25625    if (element != null) {
25626      open(name);
25627      composeExplanationOfBenefitProsthesisComponentInner(element);
25628      close();
25629    }
25630  }
25631
25632  protected void composeExplanationOfBenefitProsthesisComponentInner(ExplanationOfBenefit.ProsthesisComponent element) throws IOException {
25633      composeBackbone(element);
25634      if (element.hasInitialElement()) {
25635        composeBooleanCore("initial", element.getInitialElement(), false);
25636        composeBooleanExtras("initial", element.getInitialElement(), false);
25637      }
25638      if (element.hasPriorDateElement()) {
25639        composeDateCore("priorDate", element.getPriorDateElement(), false);
25640        composeDateExtras("priorDate", element.getPriorDateElement(), false);
25641      }
25642      if (element.hasPriorMaterial()) {
25643        composeCoding("priorMaterial", element.getPriorMaterial());
25644      }
25645  }
25646
25647  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
25648    if (element != null) {
25649      open(name);
25650      composeExplanationOfBenefitAddedItemComponentInner(element);
25651      close();
25652    }
25653  }
25654
25655  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
25656      composeBackbone(element);
25657      if (element.hasSequenceLinkId()) {
25658        openArray("sequenceLinkId");
25659        for (PositiveIntType e : element.getSequenceLinkId()) 
25660          composePositiveIntCore(null, e, true);
25661        closeArray();
25662        if (anyHasExtras(element.getSequenceLinkId())) {
25663          openArray("_sequenceLinkId");
25664          for (PositiveIntType e : element.getSequenceLinkId()) 
25665            composePositiveIntExtras(null, e, true);
25666          closeArray();
25667        }
25668      };
25669      if (element.hasService()) {
25670        composeCoding("service", element.getService());
25671      }
25672      if (element.hasFee()) {
25673        composeMoney("fee", element.getFee());
25674      }
25675      if (element.hasNoteNumberLinkId()) {
25676        openArray("noteNumberLinkId");
25677        for (PositiveIntType e : element.getNoteNumberLinkId()) 
25678          composePositiveIntCore(null, e, true);
25679        closeArray();
25680        if (anyHasExtras(element.getNoteNumberLinkId())) {
25681          openArray("_noteNumberLinkId");
25682          for (PositiveIntType e : element.getNoteNumberLinkId()) 
25683            composePositiveIntExtras(null, e, true);
25684          closeArray();
25685        }
25686      };
25687      if (element.hasAdjudication()) {
25688        openArray("adjudication");
25689        for (ExplanationOfBenefit.AddedItemAdjudicationComponent e : element.getAdjudication()) 
25690          composeExplanationOfBenefitAddedItemAdjudicationComponent(null, e);
25691        closeArray();
25692      };
25693      if (element.hasDetail()) {
25694        openArray("detail");
25695        for (ExplanationOfBenefit.AddedItemsDetailComponent e : element.getDetail()) 
25696          composeExplanationOfBenefitAddedItemsDetailComponent(null, e);
25697        closeArray();
25698      };
25699  }
25700
25701  protected void composeExplanationOfBenefitAddedItemAdjudicationComponent(String name, ExplanationOfBenefit.AddedItemAdjudicationComponent element) throws IOException {
25702    if (element != null) {
25703      open(name);
25704      composeExplanationOfBenefitAddedItemAdjudicationComponentInner(element);
25705      close();
25706    }
25707  }
25708
25709  protected void composeExplanationOfBenefitAddedItemAdjudicationComponentInner(ExplanationOfBenefit.AddedItemAdjudicationComponent element) throws IOException {
25710      composeBackbone(element);
25711      if (element.hasCategory()) {
25712        composeCoding("category", element.getCategory());
25713      }
25714      if (element.hasReason()) {
25715        composeCoding("reason", element.getReason());
25716      }
25717      if (element.hasAmount()) {
25718        composeMoney("amount", element.getAmount());
25719      }
25720      if (element.hasValueElement()) {
25721        composeDecimalCore("value", element.getValueElement(), false);
25722        composeDecimalExtras("value", element.getValueElement(), false);
25723      }
25724  }
25725
25726  protected void composeExplanationOfBenefitAddedItemsDetailComponent(String name, ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
25727    if (element != null) {
25728      open(name);
25729      composeExplanationOfBenefitAddedItemsDetailComponentInner(element);
25730      close();
25731    }
25732  }
25733
25734  protected void composeExplanationOfBenefitAddedItemsDetailComponentInner(ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
25735      composeBackbone(element);
25736      if (element.hasService()) {
25737        composeCoding("service", element.getService());
25738      }
25739      if (element.hasFee()) {
25740        composeMoney("fee", element.getFee());
25741      }
25742      if (element.hasAdjudication()) {
25743        openArray("adjudication");
25744        for (ExplanationOfBenefit.AddedItemDetailAdjudicationComponent e : element.getAdjudication()) 
25745          composeExplanationOfBenefitAddedItemDetailAdjudicationComponent(null, e);
25746        closeArray();
25747      };
25748  }
25749
25750  protected void composeExplanationOfBenefitAddedItemDetailAdjudicationComponent(String name, ExplanationOfBenefit.AddedItemDetailAdjudicationComponent element) throws IOException {
25751    if (element != null) {
25752      open(name);
25753      composeExplanationOfBenefitAddedItemDetailAdjudicationComponentInner(element);
25754      close();
25755    }
25756  }
25757
25758  protected void composeExplanationOfBenefitAddedItemDetailAdjudicationComponentInner(ExplanationOfBenefit.AddedItemDetailAdjudicationComponent element) throws IOException {
25759      composeBackbone(element);
25760      if (element.hasCategory()) {
25761        composeCoding("category", element.getCategory());
25762      }
25763      if (element.hasReason()) {
25764        composeCoding("reason", element.getReason());
25765      }
25766      if (element.hasAmount()) {
25767        composeMoney("amount", element.getAmount());
25768      }
25769      if (element.hasValueElement()) {
25770        composeDecimalCore("value", element.getValueElement(), false);
25771        composeDecimalExtras("value", element.getValueElement(), false);
25772      }
25773  }
25774
25775  protected void composeExplanationOfBenefitMissingTeethComponent(String name, ExplanationOfBenefit.MissingTeethComponent element) throws IOException {
25776    if (element != null) {
25777      open(name);
25778      composeExplanationOfBenefitMissingTeethComponentInner(element);
25779      close();
25780    }
25781  }
25782
25783  protected void composeExplanationOfBenefitMissingTeethComponentInner(ExplanationOfBenefit.MissingTeethComponent element) throws IOException {
25784      composeBackbone(element);
25785      if (element.hasTooth()) {
25786        composeCoding("tooth", element.getTooth());
25787      }
25788      if (element.hasReason()) {
25789        composeCoding("reason", element.getReason());
25790      }
25791      if (element.hasExtractionDateElement()) {
25792        composeDateCore("extractionDate", element.getExtractionDateElement(), false);
25793        composeDateExtras("extractionDate", element.getExtractionDateElement(), false);
25794      }
25795  }
25796
25797  protected void composeExplanationOfBenefitNotesComponent(String name, ExplanationOfBenefit.NotesComponent element) throws IOException {
25798    if (element != null) {
25799      open(name);
25800      composeExplanationOfBenefitNotesComponentInner(element);
25801      close();
25802    }
25803  }
25804
25805  protected void composeExplanationOfBenefitNotesComponentInner(ExplanationOfBenefit.NotesComponent element) throws IOException {
25806      composeBackbone(element);
25807      if (element.hasNumberElement()) {
25808        composePositiveIntCore("number", element.getNumberElement(), false);
25809        composePositiveIntExtras("number", element.getNumberElement(), false);
25810      }
25811      if (element.hasType()) {
25812        composeCoding("type", element.getType());
25813      }
25814      if (element.hasTextElement()) {
25815        composeStringCore("text", element.getTextElement(), false);
25816        composeStringExtras("text", element.getTextElement(), false);
25817      }
25818  }
25819
25820  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
25821    if (element != null) {
25822      open(name);
25823      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
25824      close();
25825    }
25826  }
25827
25828  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
25829      composeBackbone(element);
25830      if (element.hasCategory()) {
25831        composeCoding("category", element.getCategory());
25832      }
25833      if (element.hasSubCategory()) {
25834        composeCoding("subCategory", element.getSubCategory());
25835      }
25836      if (element.hasNetwork()) {
25837        composeCoding("network", element.getNetwork());
25838      }
25839      if (element.hasUnit()) {
25840        composeCoding("unit", element.getUnit());
25841      }
25842      if (element.hasTerm()) {
25843        composeCoding("term", element.getTerm());
25844      }
25845      if (element.hasFinancial()) {
25846        openArray("financial");
25847        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
25848          composeExplanationOfBenefitBenefitComponent(null, e);
25849        closeArray();
25850      };
25851  }
25852
25853  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
25854    if (element != null) {
25855      open(name);
25856      composeExplanationOfBenefitBenefitComponentInner(element);
25857      close();
25858    }
25859  }
25860
25861  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
25862      composeBackbone(element);
25863      if (element.hasType()) {
25864        composeCoding("type", element.getType());
25865      }
25866      if (element.hasBenefit()) {
25867        composeType("benefit", element.getBenefit());
25868      }
25869      if (element.hasBenefitUsed()) {
25870        composeType("benefitUsed", element.getBenefitUsed());
25871      }
25872  }
25873
25874  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
25875    if (element != null) {
25876      prop("resourceType", name);
25877      composeFamilyMemberHistoryInner(element);
25878    }
25879  }
25880
25881  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
25882      composeDomainResourceElements(element);
25883      if (element.hasIdentifier()) {
25884        openArray("identifier");
25885        for (Identifier e : element.getIdentifier()) 
25886          composeIdentifier(null, e);
25887        closeArray();
25888      };
25889      if (element.hasPatient()) {
25890        composeReference("patient", element.getPatient());
25891      }
25892      if (element.hasDateElement()) {
25893        composeDateTimeCore("date", element.getDateElement(), false);
25894        composeDateTimeExtras("date", element.getDateElement(), false);
25895      }
25896      if (element.hasStatusElement()) {
25897        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
25898        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
25899      }
25900      if (element.hasNameElement()) {
25901        composeStringCore("name", element.getNameElement(), false);
25902        composeStringExtras("name", element.getNameElement(), false);
25903      }
25904      if (element.hasRelationship()) {
25905        composeCodeableConcept("relationship", element.getRelationship());
25906      }
25907      if (element.hasGenderElement()) {
25908        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
25909        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
25910      }
25911      if (element.hasBorn()) {
25912        composeType("born", element.getBorn());
25913      }
25914      if (element.hasAge()) {
25915        composeType("age", element.getAge());
25916      }
25917      if (element.hasDeceased()) {
25918        composeType("deceased", element.getDeceased());
25919      }
25920      if (element.hasNote()) {
25921        composeAnnotation("note", element.getNote());
25922      }
25923      if (element.hasCondition()) {
25924        openArray("condition");
25925        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
25926          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
25927        closeArray();
25928      };
25929  }
25930
25931  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
25932    if (element != null) {
25933      open(name);
25934      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
25935      close();
25936    }
25937  }
25938
25939  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
25940      composeBackbone(element);
25941      if (element.hasCode()) {
25942        composeCodeableConcept("code", element.getCode());
25943      }
25944      if (element.hasOutcome()) {
25945        composeCodeableConcept("outcome", element.getOutcome());
25946      }
25947      if (element.hasOnset()) {
25948        composeType("onset", element.getOnset());
25949      }
25950      if (element.hasNote()) {
25951        composeAnnotation("note", element.getNote());
25952      }
25953  }
25954
25955  protected void composeFlag(String name, Flag element) throws IOException {
25956    if (element != null) {
25957      prop("resourceType", name);
25958      composeFlagInner(element);
25959    }
25960  }
25961
25962  protected void composeFlagInner(Flag element) throws IOException {
25963      composeDomainResourceElements(element);
25964      if (element.hasIdentifier()) {
25965        openArray("identifier");
25966        for (Identifier e : element.getIdentifier()) 
25967          composeIdentifier(null, e);
25968        closeArray();
25969      };
25970      if (element.hasCategory()) {
25971        composeCodeableConcept("category", element.getCategory());
25972      }
25973      if (element.hasStatusElement()) {
25974        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
25975        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
25976      }
25977      if (element.hasPeriod()) {
25978        composePeriod("period", element.getPeriod());
25979      }
25980      if (element.hasSubject()) {
25981        composeReference("subject", element.getSubject());
25982      }
25983      if (element.hasEncounter()) {
25984        composeReference("encounter", element.getEncounter());
25985      }
25986      if (element.hasAuthor()) {
25987        composeReference("author", element.getAuthor());
25988      }
25989      if (element.hasCode()) {
25990        composeCodeableConcept("code", element.getCode());
25991      }
25992  }
25993
25994  protected void composeGoal(String name, Goal element) throws IOException {
25995    if (element != null) {
25996      prop("resourceType", name);
25997      composeGoalInner(element);
25998    }
25999  }
26000
26001  protected void composeGoalInner(Goal element) throws IOException {
26002      composeDomainResourceElements(element);
26003      if (element.hasIdentifier()) {
26004        openArray("identifier");
26005        for (Identifier e : element.getIdentifier()) 
26006          composeIdentifier(null, e);
26007        closeArray();
26008      };
26009      if (element.hasSubject()) {
26010        composeReference("subject", element.getSubject());
26011      }
26012      if (element.hasStart()) {
26013        composeType("start", element.getStart());
26014      }
26015      if (element.hasTarget()) {
26016        composeType("target", element.getTarget());
26017      }
26018      if (element.hasCategory()) {
26019        openArray("category");
26020        for (CodeableConcept e : element.getCategory()) 
26021          composeCodeableConcept(null, e);
26022        closeArray();
26023      };
26024      if (element.hasDescriptionElement()) {
26025        composeStringCore("description", element.getDescriptionElement(), false);
26026        composeStringExtras("description", element.getDescriptionElement(), false);
26027      }
26028      if (element.hasStatusElement()) {
26029        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
26030        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
26031      }
26032      if (element.hasStatusDateElement()) {
26033        composeDateCore("statusDate", element.getStatusDateElement(), false);
26034        composeDateExtras("statusDate", element.getStatusDateElement(), false);
26035      }
26036      if (element.hasStatusReason()) {
26037        composeCodeableConcept("statusReason", element.getStatusReason());
26038      }
26039      if (element.hasAuthor()) {
26040        composeReference("author", element.getAuthor());
26041      }
26042      if (element.hasPriority()) {
26043        composeCodeableConcept("priority", element.getPriority());
26044      }
26045      if (element.hasAddresses()) {
26046        openArray("addresses");
26047        for (Reference e : element.getAddresses()) 
26048          composeReference(null, e);
26049        closeArray();
26050      };
26051      if (element.hasNote()) {
26052        openArray("note");
26053        for (Annotation e : element.getNote()) 
26054          composeAnnotation(null, e);
26055        closeArray();
26056      };
26057      if (element.hasOutcome()) {
26058        openArray("outcome");
26059        for (Goal.GoalOutcomeComponent e : element.getOutcome()) 
26060          composeGoalGoalOutcomeComponent(null, e);
26061        closeArray();
26062      };
26063  }
26064
26065  protected void composeGoalGoalOutcomeComponent(String name, Goal.GoalOutcomeComponent element) throws IOException {
26066    if (element != null) {
26067      open(name);
26068      composeGoalGoalOutcomeComponentInner(element);
26069      close();
26070    }
26071  }
26072
26073  protected void composeGoalGoalOutcomeComponentInner(Goal.GoalOutcomeComponent element) throws IOException {
26074      composeBackbone(element);
26075      if (element.hasResult()) {
26076        composeType("result", element.getResult());
26077      }
26078  }
26079
26080  protected void composeGroup(String name, Group element) throws IOException {
26081    if (element != null) {
26082      prop("resourceType", name);
26083      composeGroupInner(element);
26084    }
26085  }
26086
26087  protected void composeGroupInner(Group element) throws IOException {
26088      composeDomainResourceElements(element);
26089      if (element.hasIdentifier()) {
26090        openArray("identifier");
26091        for (Identifier e : element.getIdentifier()) 
26092          composeIdentifier(null, e);
26093        closeArray();
26094      };
26095      if (element.hasTypeElement()) {
26096        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
26097        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
26098      }
26099      if (element.hasActualElement()) {
26100        composeBooleanCore("actual", element.getActualElement(), false);
26101        composeBooleanExtras("actual", element.getActualElement(), false);
26102      }
26103      if (element.hasActiveElement()) {
26104        composeBooleanCore("active", element.getActiveElement(), false);
26105        composeBooleanExtras("active", element.getActiveElement(), false);
26106      }
26107      if (element.hasCode()) {
26108        composeCodeableConcept("code", element.getCode());
26109      }
26110      if (element.hasNameElement()) {
26111        composeStringCore("name", element.getNameElement(), false);
26112        composeStringExtras("name", element.getNameElement(), false);
26113      }
26114      if (element.hasQuantityElement()) {
26115        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
26116        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
26117      }
26118      if (element.hasCharacteristic()) {
26119        openArray("characteristic");
26120        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
26121          composeGroupGroupCharacteristicComponent(null, e);
26122        closeArray();
26123      };
26124      if (element.hasMember()) {
26125        openArray("member");
26126        for (Group.GroupMemberComponent e : element.getMember()) 
26127          composeGroupGroupMemberComponent(null, e);
26128        closeArray();
26129      };
26130  }
26131
26132  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
26133    if (element != null) {
26134      open(name);
26135      composeGroupGroupCharacteristicComponentInner(element);
26136      close();
26137    }
26138  }
26139
26140  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
26141      composeBackbone(element);
26142      if (element.hasCode()) {
26143        composeCodeableConcept("code", element.getCode());
26144      }
26145      if (element.hasValue()) {
26146        composeType("value", element.getValue());
26147      }
26148      if (element.hasExcludeElement()) {
26149        composeBooleanCore("exclude", element.getExcludeElement(), false);
26150        composeBooleanExtras("exclude", element.getExcludeElement(), false);
26151      }
26152      if (element.hasPeriod()) {
26153        composePeriod("period", element.getPeriod());
26154      }
26155  }
26156
26157  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
26158    if (element != null) {
26159      open(name);
26160      composeGroupGroupMemberComponentInner(element);
26161      close();
26162    }
26163  }
26164
26165  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
26166      composeBackbone(element);
26167      if (element.hasEntity()) {
26168        composeReference("entity", element.getEntity());
26169      }
26170      if (element.hasPeriod()) {
26171        composePeriod("period", element.getPeriod());
26172      }
26173      if (element.hasInactiveElement()) {
26174        composeBooleanCore("inactive", element.getInactiveElement(), false);
26175        composeBooleanExtras("inactive", element.getInactiveElement(), false);
26176      }
26177  }
26178
26179  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
26180    if (element != null) {
26181      prop("resourceType", name);
26182      composeGuidanceResponseInner(element);
26183    }
26184  }
26185
26186  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
26187      composeDomainResourceElements(element);
26188      if (element.hasRequestIdElement()) {
26189        composeStringCore("requestId", element.getRequestIdElement(), false);
26190        composeStringExtras("requestId", element.getRequestIdElement(), false);
26191      }
26192      if (element.hasModule()) {
26193        composeReference("module", element.getModule());
26194      }
26195      if (element.hasStatusElement()) {
26196        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
26197        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
26198      }
26199      if (element.hasEvaluationMessage()) {
26200        openArray("evaluationMessage");
26201        for (Reference e : element.getEvaluationMessage()) 
26202          composeReference(null, e);
26203        closeArray();
26204      };
26205      if (element.hasOutputParameters()) {
26206        composeReference("outputParameters", element.getOutputParameters());
26207      }
26208      if (element.hasAction()) {
26209        openArray("action");
26210        for (GuidanceResponse.GuidanceResponseActionComponent e : element.getAction()) 
26211          composeGuidanceResponseGuidanceResponseActionComponent(null, e);
26212        closeArray();
26213      };
26214      if (element.hasDataRequirement()) {
26215        openArray("dataRequirement");
26216        for (DataRequirement e : element.getDataRequirement()) 
26217          composeDataRequirement(null, e);
26218        closeArray();
26219      };
26220  }
26221
26222  protected void composeGuidanceResponseGuidanceResponseActionComponent(String name, GuidanceResponse.GuidanceResponseActionComponent element) throws IOException {
26223    if (element != null) {
26224      open(name);
26225      composeGuidanceResponseGuidanceResponseActionComponentInner(element);
26226      close();
26227    }
26228  }
26229
26230  protected void composeGuidanceResponseGuidanceResponseActionComponentInner(GuidanceResponse.GuidanceResponseActionComponent element) throws IOException {
26231      composeBackbone(element);
26232      if (element.hasActionIdentifier()) {
26233        composeIdentifier("actionIdentifier", element.getActionIdentifier());
26234      }
26235      if (element.hasLabelElement()) {
26236        composeStringCore("label", element.getLabelElement(), false);
26237        composeStringExtras("label", element.getLabelElement(), false);
26238      }
26239      if (element.hasTitleElement()) {
26240        composeStringCore("title", element.getTitleElement(), false);
26241        composeStringExtras("title", element.getTitleElement(), false);
26242      }
26243      if (element.hasDescriptionElement()) {
26244        composeStringCore("description", element.getDescriptionElement(), false);
26245        composeStringExtras("description", element.getDescriptionElement(), false);
26246      }
26247      if (element.hasTextEquivalentElement()) {
26248        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
26249        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
26250      }
26251      if (element.hasConcept()) {
26252        openArray("concept");
26253        for (CodeableConcept e : element.getConcept()) 
26254          composeCodeableConcept(null, e);
26255        closeArray();
26256      };
26257      if (element.hasSupportingEvidence()) {
26258        openArray("supportingEvidence");
26259        for (Attachment e : element.getSupportingEvidence()) 
26260          composeAttachment(null, e);
26261        closeArray();
26262      };
26263      if (element.hasRelatedAction()) {
26264        composeGuidanceResponseGuidanceResponseActionRelatedActionComponent("relatedAction", element.getRelatedAction());
26265      }
26266      if (element.hasDocumentation()) {
26267        openArray("documentation");
26268        for (Attachment e : element.getDocumentation()) 
26269          composeAttachment(null, e);
26270        closeArray();
26271      };
26272      if (element.hasParticipant()) {
26273        openArray("participant");
26274        for (Reference e : element.getParticipant()) 
26275          composeReference(null, e);
26276        closeArray();
26277      };
26278      if (element.hasTypeElement()) {
26279        composeCodeCore("type", element.getTypeElement(), false);
26280        composeCodeExtras("type", element.getTypeElement(), false);
26281      }
26282      if (element.hasBehavior()) {
26283        openArray("behavior");
26284        for (GuidanceResponse.GuidanceResponseActionBehaviorComponent e : element.getBehavior()) 
26285          composeGuidanceResponseGuidanceResponseActionBehaviorComponent(null, e);
26286        closeArray();
26287      };
26288      if (element.hasResource()) {
26289        composeReference("resource", element.getResource());
26290      }
26291      if (element.hasAction()) {
26292        openArray("action");
26293        for (GuidanceResponse.GuidanceResponseActionComponent e : element.getAction()) 
26294          composeGuidanceResponseGuidanceResponseActionComponent(null, e);
26295        closeArray();
26296      };
26297  }
26298
26299  protected void composeGuidanceResponseGuidanceResponseActionRelatedActionComponent(String name, GuidanceResponse.GuidanceResponseActionRelatedActionComponent element) throws IOException {
26300    if (element != null) {
26301      open(name);
26302      composeGuidanceResponseGuidanceResponseActionRelatedActionComponentInner(element);
26303      close();
26304    }
26305  }
26306
26307  protected void composeGuidanceResponseGuidanceResponseActionRelatedActionComponentInner(GuidanceResponse.GuidanceResponseActionRelatedActionComponent element) throws IOException {
26308      composeBackbone(element);
26309      if (element.hasActionIdentifier()) {
26310        composeIdentifier("actionIdentifier", element.getActionIdentifier());
26311      }
26312      if (element.hasRelationshipElement()) {
26313        composeCodeCore("relationship", element.getRelationshipElement(), false);
26314        composeCodeExtras("relationship", element.getRelationshipElement(), false);
26315      }
26316      if (element.hasOffset()) {
26317        composeType("offset", element.getOffset());
26318      }
26319      if (element.hasAnchorElement()) {
26320        composeCodeCore("anchor", element.getAnchorElement(), false);
26321        composeCodeExtras("anchor", element.getAnchorElement(), false);
26322      }
26323  }
26324
26325  protected void composeGuidanceResponseGuidanceResponseActionBehaviorComponent(String name, GuidanceResponse.GuidanceResponseActionBehaviorComponent element) throws IOException {
26326    if (element != null) {
26327      open(name);
26328      composeGuidanceResponseGuidanceResponseActionBehaviorComponentInner(element);
26329      close();
26330    }
26331  }
26332
26333  protected void composeGuidanceResponseGuidanceResponseActionBehaviorComponentInner(GuidanceResponse.GuidanceResponseActionBehaviorComponent element) throws IOException {
26334      composeBackbone(element);
26335      if (element.hasType()) {
26336        composeCoding("type", element.getType());
26337      }
26338      if (element.hasValue()) {
26339        composeCoding("value", element.getValue());
26340      }
26341  }
26342
26343  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
26344    if (element != null) {
26345      prop("resourceType", name);
26346      composeHealthcareServiceInner(element);
26347    }
26348  }
26349
26350  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
26351      composeDomainResourceElements(element);
26352      if (element.hasIdentifier()) {
26353        openArray("identifier");
26354        for (Identifier e : element.getIdentifier()) 
26355          composeIdentifier(null, e);
26356        closeArray();
26357      };
26358      if (element.hasProvidedBy()) {
26359        composeReference("providedBy", element.getProvidedBy());
26360      }
26361      if (element.hasServiceCategory()) {
26362        composeCodeableConcept("serviceCategory", element.getServiceCategory());
26363      }
26364      if (element.hasServiceType()) {
26365        openArray("serviceType");
26366        for (CodeableConcept e : element.getServiceType()) 
26367          composeCodeableConcept(null, e);
26368        closeArray();
26369      };
26370      if (element.hasSpecialty()) {
26371        openArray("specialty");
26372        for (CodeableConcept e : element.getSpecialty()) 
26373          composeCodeableConcept(null, e);
26374        closeArray();
26375      };
26376      if (element.hasLocation()) {
26377        openArray("location");
26378        for (Reference e : element.getLocation()) 
26379          composeReference(null, e);
26380        closeArray();
26381      };
26382      if (element.hasServiceNameElement()) {
26383        composeStringCore("serviceName", element.getServiceNameElement(), false);
26384        composeStringExtras("serviceName", element.getServiceNameElement(), false);
26385      }
26386      if (element.hasCommentElement()) {
26387        composeStringCore("comment", element.getCommentElement(), false);
26388        composeStringExtras("comment", element.getCommentElement(), false);
26389      }
26390      if (element.hasExtraDetailsElement()) {
26391        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
26392        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
26393      }
26394      if (element.hasPhoto()) {
26395        composeAttachment("photo", element.getPhoto());
26396      }
26397      if (element.hasTelecom()) {
26398        openArray("telecom");
26399        for (ContactPoint e : element.getTelecom()) 
26400          composeContactPoint(null, e);
26401        closeArray();
26402      };
26403      if (element.hasCoverageArea()) {
26404        openArray("coverageArea");
26405        for (Reference e : element.getCoverageArea()) 
26406          composeReference(null, e);
26407        closeArray();
26408      };
26409      if (element.hasServiceProvisionCode()) {
26410        openArray("serviceProvisionCode");
26411        for (CodeableConcept e : element.getServiceProvisionCode()) 
26412          composeCodeableConcept(null, e);
26413        closeArray();
26414      };
26415      if (element.hasEligibility()) {
26416        composeCodeableConcept("eligibility", element.getEligibility());
26417      }
26418      if (element.hasEligibilityNoteElement()) {
26419        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
26420        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
26421      }
26422      if (element.hasProgramName()) {
26423        openArray("programName");
26424        for (StringType e : element.getProgramName()) 
26425          composeStringCore(null, e, true);
26426        closeArray();
26427        if (anyHasExtras(element.getProgramName())) {
26428          openArray("_programName");
26429          for (StringType e : element.getProgramName()) 
26430            composeStringExtras(null, e, true);
26431          closeArray();
26432        }
26433      };
26434      if (element.hasCharacteristic()) {
26435        openArray("characteristic");
26436        for (CodeableConcept e : element.getCharacteristic()) 
26437          composeCodeableConcept(null, e);
26438        closeArray();
26439      };
26440      if (element.hasReferralMethod()) {
26441        openArray("referralMethod");
26442        for (CodeableConcept e : element.getReferralMethod()) 
26443          composeCodeableConcept(null, e);
26444        closeArray();
26445      };
26446      if (element.hasPublicKeyElement()) {
26447        composeStringCore("publicKey", element.getPublicKeyElement(), false);
26448        composeStringExtras("publicKey", element.getPublicKeyElement(), false);
26449      }
26450      if (element.hasAppointmentRequiredElement()) {
26451        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
26452        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
26453      }
26454      if (element.hasAvailableTime()) {
26455        openArray("availableTime");
26456        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
26457          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
26458        closeArray();
26459      };
26460      if (element.hasNotAvailable()) {
26461        openArray("notAvailable");
26462        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
26463          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
26464        closeArray();
26465      };
26466      if (element.hasAvailabilityExceptionsElement()) {
26467        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
26468        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
26469      }
26470  }
26471
26472  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
26473    if (element != null) {
26474      open(name);
26475      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
26476      close();
26477    }
26478  }
26479
26480  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
26481      composeBackbone(element);
26482      if (element.hasDaysOfWeek()) {
26483        openArray("daysOfWeek");
26484        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
26485          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
26486        closeArray();
26487        if (anyHasExtras(element.getDaysOfWeek())) {
26488          openArray("_daysOfWeek");
26489          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
26490            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
26491          closeArray();
26492        }
26493      };
26494      if (element.hasAllDayElement()) {
26495        composeBooleanCore("allDay", element.getAllDayElement(), false);
26496        composeBooleanExtras("allDay", element.getAllDayElement(), false);
26497      }
26498      if (element.hasAvailableStartTimeElement()) {
26499        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
26500        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
26501      }
26502      if (element.hasAvailableEndTimeElement()) {
26503        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
26504        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
26505      }
26506  }
26507
26508  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
26509    if (element != null) {
26510      open(name);
26511      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
26512      close();
26513    }
26514  }
26515
26516  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
26517      composeBackbone(element);
26518      if (element.hasDescriptionElement()) {
26519        composeStringCore("description", element.getDescriptionElement(), false);
26520        composeStringExtras("description", element.getDescriptionElement(), false);
26521      }
26522      if (element.hasDuring()) {
26523        composePeriod("during", element.getDuring());
26524      }
26525  }
26526
26527  protected void composeImagingExcerpt(String name, ImagingExcerpt element) throws IOException {
26528    if (element != null) {
26529      prop("resourceType", name);
26530      composeImagingExcerptInner(element);
26531    }
26532  }
26533
26534  protected void composeImagingExcerptInner(ImagingExcerpt element) throws IOException {
26535      composeDomainResourceElements(element);
26536      if (element.hasUidElement()) {
26537        composeOidCore("uid", element.getUidElement(), false);
26538        composeOidExtras("uid", element.getUidElement(), false);
26539      }
26540      if (element.hasPatient()) {
26541        composeReference("patient", element.getPatient());
26542      }
26543      if (element.hasAuthoringTimeElement()) {
26544        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
26545        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
26546      }
26547      if (element.hasAuthor()) {
26548        composeReference("author", element.getAuthor());
26549      }
26550      if (element.hasTitle()) {
26551        composeCodeableConcept("title", element.getTitle());
26552      }
26553      if (element.hasDescriptionElement()) {
26554        composeStringCore("description", element.getDescriptionElement(), false);
26555        composeStringExtras("description", element.getDescriptionElement(), false);
26556      }
26557      if (element.hasStudy()) {
26558        openArray("study");
26559        for (ImagingExcerpt.StudyComponent e : element.getStudy()) 
26560          composeImagingExcerptStudyComponent(null, e);
26561        closeArray();
26562      };
26563  }
26564
26565  protected void composeImagingExcerptStudyComponent(String name, ImagingExcerpt.StudyComponent element) throws IOException {
26566    if (element != null) {
26567      open(name);
26568      composeImagingExcerptStudyComponentInner(element);
26569      close();
26570    }
26571  }
26572
26573  protected void composeImagingExcerptStudyComponentInner(ImagingExcerpt.StudyComponent element) throws IOException {
26574      composeBackbone(element);
26575      if (element.hasUidElement()) {
26576        composeOidCore("uid", element.getUidElement(), false);
26577        composeOidExtras("uid", element.getUidElement(), false);
26578      }
26579      if (element.hasImagingStudy()) {
26580        composeReference("imagingStudy", element.getImagingStudy());
26581      }
26582      if (element.hasDicom()) {
26583        openArray("dicom");
26584        for (ImagingExcerpt.StudyDicomComponent e : element.getDicom()) 
26585          composeImagingExcerptStudyDicomComponent(null, e);
26586        closeArray();
26587      };
26588      if (element.hasViewable()) {
26589        openArray("viewable");
26590        for (ImagingExcerpt.StudyViewableComponent e : element.getViewable()) 
26591          composeImagingExcerptStudyViewableComponent(null, e);
26592        closeArray();
26593      };
26594      if (element.hasSeries()) {
26595        openArray("series");
26596        for (ImagingExcerpt.SeriesComponent e : element.getSeries()) 
26597          composeImagingExcerptSeriesComponent(null, e);
26598        closeArray();
26599      };
26600  }
26601
26602  protected void composeImagingExcerptStudyDicomComponent(String name, ImagingExcerpt.StudyDicomComponent element) throws IOException {
26603    if (element != null) {
26604      open(name);
26605      composeImagingExcerptStudyDicomComponentInner(element);
26606      close();
26607    }
26608  }
26609
26610  protected void composeImagingExcerptStudyDicomComponentInner(ImagingExcerpt.StudyDicomComponent element) throws IOException {
26611      composeBackbone(element);
26612      if (element.hasTypeElement()) {
26613        composeEnumerationCore("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26614        composeEnumerationExtras("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26615      }
26616      if (element.hasUrlElement()) {
26617        composeUriCore("url", element.getUrlElement(), false);
26618        composeUriExtras("url", element.getUrlElement(), false);
26619      }
26620  }
26621
26622  protected void composeImagingExcerptStudyViewableComponent(String name, ImagingExcerpt.StudyViewableComponent element) throws IOException {
26623    if (element != null) {
26624      open(name);
26625      composeImagingExcerptStudyViewableComponentInner(element);
26626      close();
26627    }
26628  }
26629
26630  protected void composeImagingExcerptStudyViewableComponentInner(ImagingExcerpt.StudyViewableComponent element) throws IOException {
26631      composeBackbone(element);
26632      if (element.hasContentTypeElement()) {
26633        composeCodeCore("contentType", element.getContentTypeElement(), false);
26634        composeCodeExtras("contentType", element.getContentTypeElement(), false);
26635      }
26636      if (element.hasHeightElement()) {
26637        composePositiveIntCore("height", element.getHeightElement(), false);
26638        composePositiveIntExtras("height", element.getHeightElement(), false);
26639      }
26640      if (element.hasWidthElement()) {
26641        composePositiveIntCore("width", element.getWidthElement(), false);
26642        composePositiveIntExtras("width", element.getWidthElement(), false);
26643      }
26644      if (element.hasFramesElement()) {
26645        composePositiveIntCore("frames", element.getFramesElement(), false);
26646        composePositiveIntExtras("frames", element.getFramesElement(), false);
26647      }
26648      if (element.hasDurationElement()) {
26649        composeUnsignedIntCore("duration", element.getDurationElement(), false);
26650        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
26651      }
26652      if (element.hasSizeElement()) {
26653        composeUnsignedIntCore("size", element.getSizeElement(), false);
26654        composeUnsignedIntExtras("size", element.getSizeElement(), false);
26655      }
26656      if (element.hasTitleElement()) {
26657        composeStringCore("title", element.getTitleElement(), false);
26658        composeStringExtras("title", element.getTitleElement(), false);
26659      }
26660      if (element.hasUrlElement()) {
26661        composeUriCore("url", element.getUrlElement(), false);
26662        composeUriExtras("url", element.getUrlElement(), false);
26663      }
26664  }
26665
26666  protected void composeImagingExcerptSeriesComponent(String name, ImagingExcerpt.SeriesComponent element) throws IOException {
26667    if (element != null) {
26668      open(name);
26669      composeImagingExcerptSeriesComponentInner(element);
26670      close();
26671    }
26672  }
26673
26674  protected void composeImagingExcerptSeriesComponentInner(ImagingExcerpt.SeriesComponent element) throws IOException {
26675      composeBackbone(element);
26676      if (element.hasUidElement()) {
26677        composeOidCore("uid", element.getUidElement(), false);
26678        composeOidExtras("uid", element.getUidElement(), false);
26679      }
26680      if (element.hasDicom()) {
26681        openArray("dicom");
26682        for (ImagingExcerpt.SeriesDicomComponent e : element.getDicom()) 
26683          composeImagingExcerptSeriesDicomComponent(null, e);
26684        closeArray();
26685      };
26686      if (element.hasInstance()) {
26687        openArray("instance");
26688        for (ImagingExcerpt.InstanceComponent e : element.getInstance()) 
26689          composeImagingExcerptInstanceComponent(null, e);
26690        closeArray();
26691      };
26692  }
26693
26694  protected void composeImagingExcerptSeriesDicomComponent(String name, ImagingExcerpt.SeriesDicomComponent element) throws IOException {
26695    if (element != null) {
26696      open(name);
26697      composeImagingExcerptSeriesDicomComponentInner(element);
26698      close();
26699    }
26700  }
26701
26702  protected void composeImagingExcerptSeriesDicomComponentInner(ImagingExcerpt.SeriesDicomComponent element) throws IOException {
26703      composeBackbone(element);
26704      if (element.hasTypeElement()) {
26705        composeEnumerationCore("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26706        composeEnumerationExtras("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26707      }
26708      if (element.hasUrlElement()) {
26709        composeUriCore("url", element.getUrlElement(), false);
26710        composeUriExtras("url", element.getUrlElement(), false);
26711      }
26712  }
26713
26714  protected void composeImagingExcerptInstanceComponent(String name, ImagingExcerpt.InstanceComponent element) throws IOException {
26715    if (element != null) {
26716      open(name);
26717      composeImagingExcerptInstanceComponentInner(element);
26718      close();
26719    }
26720  }
26721
26722  protected void composeImagingExcerptInstanceComponentInner(ImagingExcerpt.InstanceComponent element) throws IOException {
26723      composeBackbone(element);
26724      if (element.hasSopClassElement()) {
26725        composeOidCore("sopClass", element.getSopClassElement(), false);
26726        composeOidExtras("sopClass", element.getSopClassElement(), false);
26727      }
26728      if (element.hasUidElement()) {
26729        composeOidCore("uid", element.getUidElement(), false);
26730        composeOidExtras("uid", element.getUidElement(), false);
26731      }
26732      if (element.hasDicom()) {
26733        openArray("dicom");
26734        for (ImagingExcerpt.InstanceDicomComponent e : element.getDicom()) 
26735          composeImagingExcerptInstanceDicomComponent(null, e);
26736        closeArray();
26737      };
26738      if (element.hasFrameNumbers()) {
26739        openArray("frameNumbers");
26740        for (UnsignedIntType e : element.getFrameNumbers()) 
26741          composeUnsignedIntCore(null, e, true);
26742        closeArray();
26743        if (anyHasExtras(element.getFrameNumbers())) {
26744          openArray("_frameNumbers");
26745          for (UnsignedIntType e : element.getFrameNumbers()) 
26746            composeUnsignedIntExtras(null, e, true);
26747          closeArray();
26748        }
26749      };
26750  }
26751
26752  protected void composeImagingExcerptInstanceDicomComponent(String name, ImagingExcerpt.InstanceDicomComponent element) throws IOException {
26753    if (element != null) {
26754      open(name);
26755      composeImagingExcerptInstanceDicomComponentInner(element);
26756      close();
26757    }
26758  }
26759
26760  protected void composeImagingExcerptInstanceDicomComponentInner(ImagingExcerpt.InstanceDicomComponent element) throws IOException {
26761      composeBackbone(element);
26762      if (element.hasTypeElement()) {
26763        composeEnumerationCore("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26764        composeEnumerationExtras("type", element.getTypeElement(), new ImagingExcerpt.DWebTypeEnumFactory(), false);
26765      }
26766      if (element.hasUrlElement()) {
26767        composeUriCore("url", element.getUrlElement(), false);
26768        composeUriExtras("url", element.getUrlElement(), false);
26769      }
26770  }
26771
26772  protected void composeImagingObjectSelection(String name, ImagingObjectSelection element) throws IOException {
26773    if (element != null) {
26774      prop("resourceType", name);
26775      composeImagingObjectSelectionInner(element);
26776    }
26777  }
26778
26779  protected void composeImagingObjectSelectionInner(ImagingObjectSelection element) throws IOException {
26780      composeDomainResourceElements(element);
26781      if (element.hasUidElement()) {
26782        composeOidCore("uid", element.getUidElement(), false);
26783        composeOidExtras("uid", element.getUidElement(), false);
26784      }
26785      if (element.hasPatient()) {
26786        composeReference("patient", element.getPatient());
26787      }
26788      if (element.hasAuthoringTimeElement()) {
26789        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
26790        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
26791      }
26792      if (element.hasAuthor()) {
26793        composeReference("author", element.getAuthor());
26794      }
26795      if (element.hasTitle()) {
26796        composeCodeableConcept("title", element.getTitle());
26797      }
26798      if (element.hasDescriptionElement()) {
26799        composeStringCore("description", element.getDescriptionElement(), false);
26800        composeStringExtras("description", element.getDescriptionElement(), false);
26801      }
26802      if (element.hasStudy()) {
26803        openArray("study");
26804        for (ImagingObjectSelection.StudyComponent e : element.getStudy()) 
26805          composeImagingObjectSelectionStudyComponent(null, e);
26806        closeArray();
26807      };
26808  }
26809
26810  protected void composeImagingObjectSelectionStudyComponent(String name, ImagingObjectSelection.StudyComponent element) throws IOException {
26811    if (element != null) {
26812      open(name);
26813      composeImagingObjectSelectionStudyComponentInner(element);
26814      close();
26815    }
26816  }
26817
26818  protected void composeImagingObjectSelectionStudyComponentInner(ImagingObjectSelection.StudyComponent element) throws IOException {
26819      composeBackbone(element);
26820      if (element.hasUidElement()) {
26821        composeOidCore("uid", element.getUidElement(), false);
26822        composeOidExtras("uid", element.getUidElement(), false);
26823      }
26824      if (element.hasUrlElement()) {
26825        composeUriCore("url", element.getUrlElement(), false);
26826        composeUriExtras("url", element.getUrlElement(), false);
26827      }
26828      if (element.hasImagingStudy()) {
26829        composeReference("imagingStudy", element.getImagingStudy());
26830      }
26831      if (element.hasSeries()) {
26832        openArray("series");
26833        for (ImagingObjectSelection.SeriesComponent e : element.getSeries()) 
26834          composeImagingObjectSelectionSeriesComponent(null, e);
26835        closeArray();
26836      };
26837  }
26838
26839  protected void composeImagingObjectSelectionSeriesComponent(String name, ImagingObjectSelection.SeriesComponent element) throws IOException {
26840    if (element != null) {
26841      open(name);
26842      composeImagingObjectSelectionSeriesComponentInner(element);
26843      close();
26844    }
26845  }
26846
26847  protected void composeImagingObjectSelectionSeriesComponentInner(ImagingObjectSelection.SeriesComponent element) throws IOException {
26848      composeBackbone(element);
26849      if (element.hasUidElement()) {
26850        composeOidCore("uid", element.getUidElement(), false);
26851        composeOidExtras("uid", element.getUidElement(), false);
26852      }
26853      if (element.hasUrlElement()) {
26854        composeUriCore("url", element.getUrlElement(), false);
26855        composeUriExtras("url", element.getUrlElement(), false);
26856      }
26857      if (element.hasInstance()) {
26858        openArray("instance");
26859        for (ImagingObjectSelection.InstanceComponent e : element.getInstance()) 
26860          composeImagingObjectSelectionInstanceComponent(null, e);
26861        closeArray();
26862      };
26863  }
26864
26865  protected void composeImagingObjectSelectionInstanceComponent(String name, ImagingObjectSelection.InstanceComponent element) throws IOException {
26866    if (element != null) {
26867      open(name);
26868      composeImagingObjectSelectionInstanceComponentInner(element);
26869      close();
26870    }
26871  }
26872
26873  protected void composeImagingObjectSelectionInstanceComponentInner(ImagingObjectSelection.InstanceComponent element) throws IOException {
26874      composeBackbone(element);
26875      if (element.hasSopClassElement()) {
26876        composeOidCore("sopClass", element.getSopClassElement(), false);
26877        composeOidExtras("sopClass", element.getSopClassElement(), false);
26878      }
26879      if (element.hasUidElement()) {
26880        composeOidCore("uid", element.getUidElement(), false);
26881        composeOidExtras("uid", element.getUidElement(), false);
26882      }
26883      if (element.hasUrlElement()) {
26884        composeUriCore("url", element.getUrlElement(), false);
26885        composeUriExtras("url", element.getUrlElement(), false);
26886      }
26887      if (element.hasFrame()) {
26888        openArray("frame");
26889        for (ImagingObjectSelection.FramesComponent e : element.getFrame()) 
26890          composeImagingObjectSelectionFramesComponent(null, e);
26891        closeArray();
26892      };
26893  }
26894
26895  protected void composeImagingObjectSelectionFramesComponent(String name, ImagingObjectSelection.FramesComponent element) throws IOException {
26896    if (element != null) {
26897      open(name);
26898      composeImagingObjectSelectionFramesComponentInner(element);
26899      close();
26900    }
26901  }
26902
26903  protected void composeImagingObjectSelectionFramesComponentInner(ImagingObjectSelection.FramesComponent element) throws IOException {
26904      composeBackbone(element);
26905      if (element.hasNumber()) {
26906        openArray("number");
26907        for (UnsignedIntType e : element.getNumber()) 
26908          composeUnsignedIntCore(null, e, true);
26909        closeArray();
26910        if (anyHasExtras(element.getNumber())) {
26911          openArray("_number");
26912          for (UnsignedIntType e : element.getNumber()) 
26913            composeUnsignedIntExtras(null, e, true);
26914          closeArray();
26915        }
26916      };
26917      if (element.hasUrlElement()) {
26918        composeUriCore("url", element.getUrlElement(), false);
26919        composeUriExtras("url", element.getUrlElement(), false);
26920      }
26921  }
26922
26923  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
26924    if (element != null) {
26925      prop("resourceType", name);
26926      composeImagingStudyInner(element);
26927    }
26928  }
26929
26930  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
26931      composeDomainResourceElements(element);
26932      if (element.hasUidElement()) {
26933        composeOidCore("uid", element.getUidElement(), false);
26934        composeOidExtras("uid", element.getUidElement(), false);
26935      }
26936      if (element.hasAccession()) {
26937        composeIdentifier("accession", element.getAccession());
26938      }
26939      if (element.hasIdentifier()) {
26940        openArray("identifier");
26941        for (Identifier e : element.getIdentifier()) 
26942          composeIdentifier(null, e);
26943        closeArray();
26944      };
26945      if (element.hasAvailabilityElement()) {
26946        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
26947        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
26948      }
26949      if (element.hasModalityList()) {
26950        openArray("modalityList");
26951        for (Coding e : element.getModalityList()) 
26952          composeCoding(null, e);
26953        closeArray();
26954      };
26955      if (element.hasPatient()) {
26956        composeReference("patient", element.getPatient());
26957      }
26958      if (element.hasStartedElement()) {
26959        composeDateTimeCore("started", element.getStartedElement(), false);
26960        composeDateTimeExtras("started", element.getStartedElement(), false);
26961      }
26962      if (element.hasOrder()) {
26963        openArray("order");
26964        for (Reference e : element.getOrder()) 
26965          composeReference(null, e);
26966        closeArray();
26967      };
26968      if (element.hasReferrer()) {
26969        composeReference("referrer", element.getReferrer());
26970      }
26971      if (element.hasInterpreter()) {
26972        composeReference("interpreter", element.getInterpreter());
26973      }
26974      if (element.hasUrlElement()) {
26975        composeUriCore("url", element.getUrlElement(), false);
26976        composeUriExtras("url", element.getUrlElement(), false);
26977      }
26978      if (element.hasNumberOfSeriesElement()) {
26979        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
26980        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
26981      }
26982      if (element.hasNumberOfInstancesElement()) {
26983        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
26984        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
26985      }
26986      if (element.hasProcedure()) {
26987        openArray("procedure");
26988        for (Reference e : element.getProcedure()) 
26989          composeReference(null, e);
26990        closeArray();
26991      };
26992      if (element.hasDescriptionElement()) {
26993        composeStringCore("description", element.getDescriptionElement(), false);
26994        composeStringExtras("description", element.getDescriptionElement(), false);
26995      }
26996      if (element.hasSeries()) {
26997        openArray("series");
26998        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
26999          composeImagingStudyImagingStudySeriesComponent(null, e);
27000        closeArray();
27001      };
27002  }
27003
27004  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
27005    if (element != null) {
27006      open(name);
27007      composeImagingStudyImagingStudySeriesComponentInner(element);
27008      close();
27009    }
27010  }
27011
27012  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
27013      composeBackbone(element);
27014      if (element.hasUidElement()) {
27015        composeOidCore("uid", element.getUidElement(), false);
27016        composeOidExtras("uid", element.getUidElement(), false);
27017      }
27018      if (element.hasNumberElement()) {
27019        composeUnsignedIntCore("number", element.getNumberElement(), false);
27020        composeUnsignedIntExtras("number", element.getNumberElement(), false);
27021      }
27022      if (element.hasModality()) {
27023        composeCoding("modality", element.getModality());
27024      }
27025      if (element.hasDescriptionElement()) {
27026        composeStringCore("description", element.getDescriptionElement(), false);
27027        composeStringExtras("description", element.getDescriptionElement(), false);
27028      }
27029      if (element.hasNumberOfInstancesElement()) {
27030        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
27031        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
27032      }
27033      if (element.hasAvailabilityElement()) {
27034        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
27035        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
27036      }
27037      if (element.hasUrlElement()) {
27038        composeUriCore("url", element.getUrlElement(), false);
27039        composeUriExtras("url", element.getUrlElement(), false);
27040      }
27041      if (element.hasBodySite()) {
27042        composeCoding("bodySite", element.getBodySite());
27043      }
27044      if (element.hasLaterality()) {
27045        composeCoding("laterality", element.getLaterality());
27046      }
27047      if (element.hasStartedElement()) {
27048        composeDateTimeCore("started", element.getStartedElement(), false);
27049        composeDateTimeExtras("started", element.getStartedElement(), false);
27050      }
27051      if (element.hasInstance()) {
27052        openArray("instance");
27053        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
27054          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
27055        closeArray();
27056      };
27057  }
27058
27059  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
27060    if (element != null) {
27061      open(name);
27062      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
27063      close();
27064    }
27065  }
27066
27067  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
27068      composeBackbone(element);
27069      if (element.hasUidElement()) {
27070        composeOidCore("uid", element.getUidElement(), false);
27071        composeOidExtras("uid", element.getUidElement(), false);
27072      }
27073      if (element.hasNumberElement()) {
27074        composeUnsignedIntCore("number", element.getNumberElement(), false);
27075        composeUnsignedIntExtras("number", element.getNumberElement(), false);
27076      }
27077      if (element.hasSopClassElement()) {
27078        composeOidCore("sopClass", element.getSopClassElement(), false);
27079        composeOidExtras("sopClass", element.getSopClassElement(), false);
27080      }
27081      if (element.hasTypeElement()) {
27082        composeStringCore("type", element.getTypeElement(), false);
27083        composeStringExtras("type", element.getTypeElement(), false);
27084      }
27085      if (element.hasTitleElement()) {
27086        composeStringCore("title", element.getTitleElement(), false);
27087        composeStringExtras("title", element.getTitleElement(), false);
27088      }
27089      if (element.hasContent()) {
27090        openArray("content");
27091        for (Attachment e : element.getContent()) 
27092          composeAttachment(null, e);
27093        closeArray();
27094      };
27095  }
27096
27097  protected void composeImmunization(String name, Immunization element) throws IOException {
27098    if (element != null) {
27099      prop("resourceType", name);
27100      composeImmunizationInner(element);
27101    }
27102  }
27103
27104  protected void composeImmunizationInner(Immunization element) throws IOException {
27105      composeDomainResourceElements(element);
27106      if (element.hasIdentifier()) {
27107        openArray("identifier");
27108        for (Identifier e : element.getIdentifier()) 
27109          composeIdentifier(null, e);
27110        closeArray();
27111      };
27112      if (element.hasStatusElement()) {
27113        composeCodeCore("status", element.getStatusElement(), false);
27114        composeCodeExtras("status", element.getStatusElement(), false);
27115      }
27116      if (element.hasDateElement()) {
27117        composeDateTimeCore("date", element.getDateElement(), false);
27118        composeDateTimeExtras("date", element.getDateElement(), false);
27119      }
27120      if (element.hasVaccineCode()) {
27121        composeCodeableConcept("vaccineCode", element.getVaccineCode());
27122      }
27123      if (element.hasPatient()) {
27124        composeReference("patient", element.getPatient());
27125      }
27126      if (element.hasWasNotGivenElement()) {
27127        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
27128        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
27129      }
27130      if (element.hasReportedElement()) {
27131        composeBooleanCore("reported", element.getReportedElement(), false);
27132        composeBooleanExtras("reported", element.getReportedElement(), false);
27133      }
27134      if (element.hasPerformer()) {
27135        composeReference("performer", element.getPerformer());
27136      }
27137      if (element.hasRequester()) {
27138        composeReference("requester", element.getRequester());
27139      }
27140      if (element.hasEncounter()) {
27141        composeReference("encounter", element.getEncounter());
27142      }
27143      if (element.hasManufacturer()) {
27144        composeReference("manufacturer", element.getManufacturer());
27145      }
27146      if (element.hasLocation()) {
27147        composeReference("location", element.getLocation());
27148      }
27149      if (element.hasLotNumberElement()) {
27150        composeStringCore("lotNumber", element.getLotNumberElement(), false);
27151        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
27152      }
27153      if (element.hasExpirationDateElement()) {
27154        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
27155        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
27156      }
27157      if (element.hasSite()) {
27158        composeCodeableConcept("site", element.getSite());
27159      }
27160      if (element.hasRoute()) {
27161        composeCodeableConcept("route", element.getRoute());
27162      }
27163      if (element.hasDoseQuantity()) {
27164        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
27165      }
27166      if (element.hasNote()) {
27167        openArray("note");
27168        for (Annotation e : element.getNote()) 
27169          composeAnnotation(null, e);
27170        closeArray();
27171      };
27172      if (element.hasExplanation()) {
27173        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
27174      }
27175      if (element.hasReaction()) {
27176        openArray("reaction");
27177        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
27178          composeImmunizationImmunizationReactionComponent(null, e);
27179        closeArray();
27180      };
27181      if (element.hasVaccinationProtocol()) {
27182        openArray("vaccinationProtocol");
27183        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
27184          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
27185        closeArray();
27186      };
27187  }
27188
27189  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
27190    if (element != null) {
27191      open(name);
27192      composeImmunizationImmunizationExplanationComponentInner(element);
27193      close();
27194    }
27195  }
27196
27197  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
27198      composeBackbone(element);
27199      if (element.hasReason()) {
27200        openArray("reason");
27201        for (CodeableConcept e : element.getReason()) 
27202          composeCodeableConcept(null, e);
27203        closeArray();
27204      };
27205      if (element.hasReasonNotGiven()) {
27206        openArray("reasonNotGiven");
27207        for (CodeableConcept e : element.getReasonNotGiven()) 
27208          composeCodeableConcept(null, e);
27209        closeArray();
27210      };
27211  }
27212
27213  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
27214    if (element != null) {
27215      open(name);
27216      composeImmunizationImmunizationReactionComponentInner(element);
27217      close();
27218    }
27219  }
27220
27221  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
27222      composeBackbone(element);
27223      if (element.hasDateElement()) {
27224        composeDateTimeCore("date", element.getDateElement(), false);
27225        composeDateTimeExtras("date", element.getDateElement(), false);
27226      }
27227      if (element.hasDetail()) {
27228        composeReference("detail", element.getDetail());
27229      }
27230      if (element.hasReportedElement()) {
27231        composeBooleanCore("reported", element.getReportedElement(), false);
27232        composeBooleanExtras("reported", element.getReportedElement(), false);
27233      }
27234  }
27235
27236  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
27237    if (element != null) {
27238      open(name);
27239      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
27240      close();
27241    }
27242  }
27243
27244  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
27245      composeBackbone(element);
27246      if (element.hasDoseSequenceElement()) {
27247        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
27248        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
27249      }
27250      if (element.hasDescriptionElement()) {
27251        composeStringCore("description", element.getDescriptionElement(), false);
27252        composeStringExtras("description", element.getDescriptionElement(), false);
27253      }
27254      if (element.hasAuthority()) {
27255        composeReference("authority", element.getAuthority());
27256      }
27257      if (element.hasSeriesElement()) {
27258        composeStringCore("series", element.getSeriesElement(), false);
27259        composeStringExtras("series", element.getSeriesElement(), false);
27260      }
27261      if (element.hasSeriesDosesElement()) {
27262        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
27263        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
27264      }
27265      if (element.hasTargetDisease()) {
27266        openArray("targetDisease");
27267        for (CodeableConcept e : element.getTargetDisease()) 
27268          composeCodeableConcept(null, e);
27269        closeArray();
27270      };
27271      if (element.hasDoseStatus()) {
27272        composeCodeableConcept("doseStatus", element.getDoseStatus());
27273      }
27274      if (element.hasDoseStatusReason()) {
27275        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
27276      }
27277  }
27278
27279  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
27280    if (element != null) {
27281      prop("resourceType", name);
27282      composeImmunizationRecommendationInner(element);
27283    }
27284  }
27285
27286  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
27287      composeDomainResourceElements(element);
27288      if (element.hasIdentifier()) {
27289        openArray("identifier");
27290        for (Identifier e : element.getIdentifier()) 
27291          composeIdentifier(null, e);
27292        closeArray();
27293      };
27294      if (element.hasPatient()) {
27295        composeReference("patient", element.getPatient());
27296      }
27297      if (element.hasRecommendation()) {
27298        openArray("recommendation");
27299        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
27300          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
27301        closeArray();
27302      };
27303  }
27304
27305  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
27306    if (element != null) {
27307      open(name);
27308      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
27309      close();
27310    }
27311  }
27312
27313  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
27314      composeBackbone(element);
27315      if (element.hasDateElement()) {
27316        composeDateTimeCore("date", element.getDateElement(), false);
27317        composeDateTimeExtras("date", element.getDateElement(), false);
27318      }
27319      if (element.hasVaccineCode()) {
27320        composeCodeableConcept("vaccineCode", element.getVaccineCode());
27321      }
27322      if (element.hasDoseNumberElement()) {
27323        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
27324        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
27325      }
27326      if (element.hasForecastStatus()) {
27327        composeCodeableConcept("forecastStatus", element.getForecastStatus());
27328      }
27329      if (element.hasDateCriterion()) {
27330        openArray("dateCriterion");
27331        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
27332          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
27333        closeArray();
27334      };
27335      if (element.hasProtocol()) {
27336        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
27337      }
27338      if (element.hasSupportingImmunization()) {
27339        openArray("supportingImmunization");
27340        for (Reference e : element.getSupportingImmunization()) 
27341          composeReference(null, e);
27342        closeArray();
27343      };
27344      if (element.hasSupportingPatientInformation()) {
27345        openArray("supportingPatientInformation");
27346        for (Reference e : element.getSupportingPatientInformation()) 
27347          composeReference(null, e);
27348        closeArray();
27349      };
27350  }
27351
27352  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
27353    if (element != null) {
27354      open(name);
27355      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
27356      close();
27357    }
27358  }
27359
27360  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
27361      composeBackbone(element);
27362      if (element.hasCode()) {
27363        composeCodeableConcept("code", element.getCode());
27364      }
27365      if (element.hasValueElement()) {
27366        composeDateTimeCore("value", element.getValueElement(), false);
27367        composeDateTimeExtras("value", element.getValueElement(), false);
27368      }
27369  }
27370
27371  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
27372    if (element != null) {
27373      open(name);
27374      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
27375      close();
27376    }
27377  }
27378
27379  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
27380      composeBackbone(element);
27381      if (element.hasDoseSequenceElement()) {
27382        composeIntegerCore("doseSequence", element.getDoseSequenceElement(), false);
27383        composeIntegerExtras("doseSequence", element.getDoseSequenceElement(), false);
27384      }
27385      if (element.hasDescriptionElement()) {
27386        composeStringCore("description", element.getDescriptionElement(), false);
27387        composeStringExtras("description", element.getDescriptionElement(), false);
27388      }
27389      if (element.hasAuthority()) {
27390        composeReference("authority", element.getAuthority());
27391      }
27392      if (element.hasSeriesElement()) {
27393        composeStringCore("series", element.getSeriesElement(), false);
27394        composeStringExtras("series", element.getSeriesElement(), false);
27395      }
27396  }
27397
27398  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
27399    if (element != null) {
27400      prop("resourceType", name);
27401      composeImplementationGuideInner(element);
27402    }
27403  }
27404
27405  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
27406      composeDomainResourceElements(element);
27407      if (element.hasUrlElement()) {
27408        composeUriCore("url", element.getUrlElement(), false);
27409        composeUriExtras("url", element.getUrlElement(), false);
27410      }
27411      if (element.hasVersionElement()) {
27412        composeStringCore("version", element.getVersionElement(), false);
27413        composeStringExtras("version", element.getVersionElement(), false);
27414      }
27415      if (element.hasNameElement()) {
27416        composeStringCore("name", element.getNameElement(), false);
27417        composeStringExtras("name", element.getNameElement(), false);
27418      }
27419      if (element.hasStatusElement()) {
27420        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
27421        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
27422      }
27423      if (element.hasExperimentalElement()) {
27424        composeBooleanCore("experimental", element.getExperimentalElement(), false);
27425        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
27426      }
27427      if (element.hasPublisherElement()) {
27428        composeStringCore("publisher", element.getPublisherElement(), false);
27429        composeStringExtras("publisher", element.getPublisherElement(), false);
27430      }
27431      if (element.hasContact()) {
27432        openArray("contact");
27433        for (ImplementationGuide.ImplementationGuideContactComponent e : element.getContact()) 
27434          composeImplementationGuideImplementationGuideContactComponent(null, e);
27435        closeArray();
27436      };
27437      if (element.hasDateElement()) {
27438        composeDateTimeCore("date", element.getDateElement(), false);
27439        composeDateTimeExtras("date", element.getDateElement(), false);
27440      }
27441      if (element.hasDescriptionElement()) {
27442        composeStringCore("description", element.getDescriptionElement(), false);
27443        composeStringExtras("description", element.getDescriptionElement(), false);
27444      }
27445      if (element.hasUseContext()) {
27446        openArray("useContext");
27447        for (CodeableConcept e : element.getUseContext()) 
27448          composeCodeableConcept(null, e);
27449        closeArray();
27450      };
27451      if (element.hasCopyrightElement()) {
27452        composeStringCore("copyright", element.getCopyrightElement(), false);
27453        composeStringExtras("copyright", element.getCopyrightElement(), false);
27454      }
27455      if (element.hasFhirVersionElement()) {
27456        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
27457        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
27458      }
27459      if (element.hasDependency()) {
27460        openArray("dependency");
27461        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
27462          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
27463        closeArray();
27464      };
27465      if (element.hasPackage()) {
27466        openArray("package");
27467        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
27468          composeImplementationGuideImplementationGuidePackageComponent(null, e);
27469        closeArray();
27470      };
27471      if (element.hasGlobal()) {
27472        openArray("global");
27473        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
27474          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
27475        closeArray();
27476      };
27477      if (element.hasBinary()) {
27478        openArray("binary");
27479        for (UriType e : element.getBinary()) 
27480          composeUriCore(null, e, true);
27481        closeArray();
27482        if (anyHasExtras(element.getBinary())) {
27483          openArray("_binary");
27484          for (UriType e : element.getBinary()) 
27485            composeUriExtras(null, e, true);
27486          closeArray();
27487        }
27488      };
27489      if (element.hasPage()) {
27490        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
27491      }
27492  }
27493
27494  protected void composeImplementationGuideImplementationGuideContactComponent(String name, ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
27495    if (element != null) {
27496      open(name);
27497      composeImplementationGuideImplementationGuideContactComponentInner(element);
27498      close();
27499    }
27500  }
27501
27502  protected void composeImplementationGuideImplementationGuideContactComponentInner(ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
27503      composeBackbone(element);
27504      if (element.hasNameElement()) {
27505        composeStringCore("name", element.getNameElement(), false);
27506        composeStringExtras("name", element.getNameElement(), false);
27507      }
27508      if (element.hasTelecom()) {
27509        openArray("telecom");
27510        for (ContactPoint e : element.getTelecom()) 
27511          composeContactPoint(null, e);
27512        closeArray();
27513      };
27514  }
27515
27516  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
27517    if (element != null) {
27518      open(name);
27519      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
27520      close();
27521    }
27522  }
27523
27524  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
27525      composeBackbone(element);
27526      if (element.hasTypeElement()) {
27527        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
27528        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
27529      }
27530      if (element.hasUriElement()) {
27531        composeUriCore("uri", element.getUriElement(), false);
27532        composeUriExtras("uri", element.getUriElement(), false);
27533      }
27534  }
27535
27536  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
27537    if (element != null) {
27538      open(name);
27539      composeImplementationGuideImplementationGuidePackageComponentInner(element);
27540      close();
27541    }
27542  }
27543
27544  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
27545      composeBackbone(element);
27546      if (element.hasNameElement()) {
27547        composeStringCore("name", element.getNameElement(), false);
27548        composeStringExtras("name", element.getNameElement(), false);
27549      }
27550      if (element.hasDescriptionElement()) {
27551        composeStringCore("description", element.getDescriptionElement(), false);
27552        composeStringExtras("description", element.getDescriptionElement(), false);
27553      }
27554      if (element.hasResource()) {
27555        openArray("resource");
27556        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
27557          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
27558        closeArray();
27559      };
27560  }
27561
27562  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
27563    if (element != null) {
27564      open(name);
27565      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
27566      close();
27567    }
27568  }
27569
27570  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
27571      composeBackbone(element);
27572      if (element.hasExampleElement()) {
27573        composeBooleanCore("example", element.getExampleElement(), false);
27574        composeBooleanExtras("example", element.getExampleElement(), false);
27575      }
27576      if (element.hasNameElement()) {
27577        composeStringCore("name", element.getNameElement(), false);
27578        composeStringExtras("name", element.getNameElement(), false);
27579      }
27580      if (element.hasDescriptionElement()) {
27581        composeStringCore("description", element.getDescriptionElement(), false);
27582        composeStringExtras("description", element.getDescriptionElement(), false);
27583      }
27584      if (element.hasAcronymElement()) {
27585        composeStringCore("acronym", element.getAcronymElement(), false);
27586        composeStringExtras("acronym", element.getAcronymElement(), false);
27587      }
27588      if (element.hasSource()) {
27589        composeType("source", element.getSource());
27590      }
27591      if (element.hasExampleFor()) {
27592        composeReference("exampleFor", element.getExampleFor());
27593      }
27594  }
27595
27596  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
27597    if (element != null) {
27598      open(name);
27599      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
27600      close();
27601    }
27602  }
27603
27604  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
27605      composeBackbone(element);
27606      if (element.hasTypeElement()) {
27607        composeCodeCore("type", element.getTypeElement(), false);
27608        composeCodeExtras("type", element.getTypeElement(), false);
27609      }
27610      if (element.hasProfile()) {
27611        composeReference("profile", element.getProfile());
27612      }
27613  }
27614
27615  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
27616    if (element != null) {
27617      open(name);
27618      composeImplementationGuideImplementationGuidePageComponentInner(element);
27619      close();
27620    }
27621  }
27622
27623  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
27624      composeBackbone(element);
27625      if (element.hasSourceElement()) {
27626        composeUriCore("source", element.getSourceElement(), false);
27627        composeUriExtras("source", element.getSourceElement(), false);
27628      }
27629      if (element.hasNameElement()) {
27630        composeStringCore("name", element.getNameElement(), false);
27631        composeStringExtras("name", element.getNameElement(), false);
27632      }
27633      if (element.hasKindElement()) {
27634        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
27635        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
27636      }
27637      if (element.hasType()) {
27638        openArray("type");
27639        for (CodeType e : element.getType()) 
27640          composeCodeCore(null, e, true);
27641        closeArray();
27642        if (anyHasExtras(element.getType())) {
27643          openArray("_type");
27644          for (CodeType e : element.getType()) 
27645            composeCodeExtras(null, e, true);
27646          closeArray();
27647        }
27648      };
27649      if (element.hasPackage()) {
27650        openArray("package");
27651        for (StringType e : element.getPackage()) 
27652          composeStringCore(null, e, true);
27653        closeArray();
27654        if (anyHasExtras(element.getPackage())) {
27655          openArray("_package");
27656          for (StringType e : element.getPackage()) 
27657            composeStringExtras(null, e, true);
27658          closeArray();
27659        }
27660      };
27661      if (element.hasFormatElement()) {
27662        composeCodeCore("format", element.getFormatElement(), false);
27663        composeCodeExtras("format", element.getFormatElement(), false);
27664      }
27665      if (element.hasPage()) {
27666        openArray("page");
27667        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
27668          composeImplementationGuideImplementationGuidePageComponent(null, e);
27669        closeArray();
27670      };
27671  }
27672
27673  protected void composeLibrary(String name, Library element) throws IOException {
27674    if (element != null) {
27675      prop("resourceType", name);
27676      composeLibraryInner(element);
27677    }
27678  }
27679
27680  protected void composeLibraryInner(Library element) throws IOException {
27681      composeDomainResourceElements(element);
27682      if (element.hasModuleMetadata()) {
27683        composeModuleMetadata("moduleMetadata", element.getModuleMetadata());
27684      }
27685      if (element.hasModel()) {
27686        openArray("model");
27687        for (Library.LibraryModelComponent e : element.getModel()) 
27688          composeLibraryLibraryModelComponent(null, e);
27689        closeArray();
27690      };
27691      if (element.hasLibrary()) {
27692        openArray("library");
27693        for (Library.LibraryLibraryComponent e : element.getLibrary()) 
27694          composeLibraryLibraryLibraryComponent(null, e);
27695        closeArray();
27696      };
27697      if (element.hasCodeSystem()) {
27698        openArray("codeSystem");
27699        for (Library.LibraryCodeSystemComponent e : element.getCodeSystem()) 
27700          composeLibraryLibraryCodeSystemComponent(null, e);
27701        closeArray();
27702      };
27703      if (element.hasValueSet()) {
27704        openArray("valueSet");
27705        for (Library.LibraryValueSetComponent e : element.getValueSet()) 
27706          composeLibraryLibraryValueSetComponent(null, e);
27707        closeArray();
27708      };
27709      if (element.hasParameter()) {
27710        openArray("parameter");
27711        for (ParameterDefinition e : element.getParameter()) 
27712          composeParameterDefinition(null, e);
27713        closeArray();
27714      };
27715      if (element.hasDataRequirement()) {
27716        openArray("dataRequirement");
27717        for (DataRequirement e : element.getDataRequirement()) 
27718          composeDataRequirement(null, e);
27719        closeArray();
27720      };
27721      if (element.hasDocument()) {
27722        composeAttachment("document", element.getDocument());
27723      }
27724  }
27725
27726  protected void composeLibraryLibraryModelComponent(String name, Library.LibraryModelComponent element) throws IOException {
27727    if (element != null) {
27728      open(name);
27729      composeLibraryLibraryModelComponentInner(element);
27730      close();
27731    }
27732  }
27733
27734  protected void composeLibraryLibraryModelComponentInner(Library.LibraryModelComponent element) throws IOException {
27735      composeBackbone(element);
27736      if (element.hasNameElement()) {
27737        composeStringCore("name", element.getNameElement(), false);
27738        composeStringExtras("name", element.getNameElement(), false);
27739      }
27740      if (element.hasIdentifierElement()) {
27741        composeStringCore("identifier", element.getIdentifierElement(), false);
27742        composeStringExtras("identifier", element.getIdentifierElement(), false);
27743      }
27744      if (element.hasVersionElement()) {
27745        composeStringCore("version", element.getVersionElement(), false);
27746        composeStringExtras("version", element.getVersionElement(), false);
27747      }
27748  }
27749
27750  protected void composeLibraryLibraryLibraryComponent(String name, Library.LibraryLibraryComponent element) throws IOException {
27751    if (element != null) {
27752      open(name);
27753      composeLibraryLibraryLibraryComponentInner(element);
27754      close();
27755    }
27756  }
27757
27758  protected void composeLibraryLibraryLibraryComponentInner(Library.LibraryLibraryComponent element) throws IOException {
27759      composeBackbone(element);
27760      if (element.hasNameElement()) {
27761        composeStringCore("name", element.getNameElement(), false);
27762        composeStringExtras("name", element.getNameElement(), false);
27763      }
27764      if (element.hasIdentifierElement()) {
27765        composeStringCore("identifier", element.getIdentifierElement(), false);
27766        composeStringExtras("identifier", element.getIdentifierElement(), false);
27767      }
27768      if (element.hasVersionElement()) {
27769        composeStringCore("version", element.getVersionElement(), false);
27770        composeStringExtras("version", element.getVersionElement(), false);
27771      }
27772      if (element.hasDocument()) {
27773        composeType("document", element.getDocument());
27774      }
27775  }
27776
27777  protected void composeLibraryLibraryCodeSystemComponent(String name, Library.LibraryCodeSystemComponent element) throws IOException {
27778    if (element != null) {
27779      open(name);
27780      composeLibraryLibraryCodeSystemComponentInner(element);
27781      close();
27782    }
27783  }
27784
27785  protected void composeLibraryLibraryCodeSystemComponentInner(Library.LibraryCodeSystemComponent element) throws IOException {
27786      composeBackbone(element);
27787      if (element.hasNameElement()) {
27788        composeStringCore("name", element.getNameElement(), false);
27789        composeStringExtras("name", element.getNameElement(), false);
27790      }
27791      if (element.hasIdentifierElement()) {
27792        composeStringCore("identifier", element.getIdentifierElement(), false);
27793        composeStringExtras("identifier", element.getIdentifierElement(), false);
27794      }
27795      if (element.hasVersionElement()) {
27796        composeStringCore("version", element.getVersionElement(), false);
27797        composeStringExtras("version", element.getVersionElement(), false);
27798      }
27799  }
27800
27801  protected void composeLibraryLibraryValueSetComponent(String name, Library.LibraryValueSetComponent element) throws IOException {
27802    if (element != null) {
27803      open(name);
27804      composeLibraryLibraryValueSetComponentInner(element);
27805      close();
27806    }
27807  }
27808
27809  protected void composeLibraryLibraryValueSetComponentInner(Library.LibraryValueSetComponent element) throws IOException {
27810      composeBackbone(element);
27811      if (element.hasNameElement()) {
27812        composeStringCore("name", element.getNameElement(), false);
27813        composeStringExtras("name", element.getNameElement(), false);
27814      }
27815      if (element.hasIdentifierElement()) {
27816        composeStringCore("identifier", element.getIdentifierElement(), false);
27817        composeStringExtras("identifier", element.getIdentifierElement(), false);
27818      }
27819      if (element.hasVersionElement()) {
27820        composeStringCore("version", element.getVersionElement(), false);
27821        composeStringExtras("version", element.getVersionElement(), false);
27822      }
27823      if (element.hasCodeSystem()) {
27824        openArray("codeSystem");
27825        for (StringType e : element.getCodeSystem()) 
27826          composeStringCore(null, e, true);
27827        closeArray();
27828        if (anyHasExtras(element.getCodeSystem())) {
27829          openArray("_codeSystem");
27830          for (StringType e : element.getCodeSystem()) 
27831            composeStringExtras(null, e, true);
27832          closeArray();
27833        }
27834      };
27835  }
27836
27837  protected void composeLinkage(String name, Linkage element) throws IOException {
27838    if (element != null) {
27839      prop("resourceType", name);
27840      composeLinkageInner(element);
27841    }
27842  }
27843
27844  protected void composeLinkageInner(Linkage element) throws IOException {
27845      composeDomainResourceElements(element);
27846      if (element.hasAuthor()) {
27847        composeReference("author", element.getAuthor());
27848      }
27849      if (element.hasItem()) {
27850        openArray("item");
27851        for (Linkage.LinkageItemComponent e : element.getItem()) 
27852          composeLinkageLinkageItemComponent(null, e);
27853        closeArray();
27854      };
27855  }
27856
27857  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
27858    if (element != null) {
27859      open(name);
27860      composeLinkageLinkageItemComponentInner(element);
27861      close();
27862    }
27863  }
27864
27865  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
27866      composeBackbone(element);
27867      if (element.hasTypeElement()) {
27868        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
27869        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
27870      }
27871      if (element.hasResource()) {
27872        composeReference("resource", element.getResource());
27873      }
27874  }
27875
27876  protected void composeListResource(String name, ListResource element) throws IOException {
27877    if (element != null) {
27878      prop("resourceType", name);
27879      composeListResourceInner(element);
27880    }
27881  }
27882
27883  protected void composeListResourceInner(ListResource element) throws IOException {
27884      composeDomainResourceElements(element);
27885      if (element.hasIdentifier()) {
27886        openArray("identifier");
27887        for (Identifier e : element.getIdentifier()) 
27888          composeIdentifier(null, e);
27889        closeArray();
27890      };
27891      if (element.hasStatusElement()) {
27892        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
27893        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
27894      }
27895      if (element.hasModeElement()) {
27896        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
27897        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
27898      }
27899      if (element.hasTitleElement()) {
27900        composeStringCore("title", element.getTitleElement(), false);
27901        composeStringExtras("title", element.getTitleElement(), false);
27902      }
27903      if (element.hasCode()) {
27904        composeCodeableConcept("code", element.getCode());
27905      }
27906      if (element.hasSubject()) {
27907        composeReference("subject", element.getSubject());
27908      }
27909      if (element.hasEncounter()) {
27910        composeReference("encounter", element.getEncounter());
27911      }
27912      if (element.hasDateElement()) {
27913        composeDateTimeCore("date", element.getDateElement(), false);
27914        composeDateTimeExtras("date", element.getDateElement(), false);
27915      }
27916      if (element.hasSource()) {
27917        composeReference("source", element.getSource());
27918      }
27919      if (element.hasOrderedBy()) {
27920        composeCodeableConcept("orderedBy", element.getOrderedBy());
27921      }
27922      if (element.hasNote()) {
27923        openArray("note");
27924        for (Annotation e : element.getNote()) 
27925          composeAnnotation(null, e);
27926        closeArray();
27927      };
27928      if (element.hasEntry()) {
27929        openArray("entry");
27930        for (ListResource.ListEntryComponent e : element.getEntry()) 
27931          composeListResourceListEntryComponent(null, e);
27932        closeArray();
27933      };
27934      if (element.hasEmptyReason()) {
27935        composeCodeableConcept("emptyReason", element.getEmptyReason());
27936      }
27937  }
27938
27939  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
27940    if (element != null) {
27941      open(name);
27942      composeListResourceListEntryComponentInner(element);
27943      close();
27944    }
27945  }
27946
27947  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
27948      composeBackbone(element);
27949      if (element.hasFlag()) {
27950        composeCodeableConcept("flag", element.getFlag());
27951      }
27952      if (element.hasDeletedElement()) {
27953        composeBooleanCore("deleted", element.getDeletedElement(), false);
27954        composeBooleanExtras("deleted", element.getDeletedElement(), false);
27955      }
27956      if (element.hasDateElement()) {
27957        composeDateTimeCore("date", element.getDateElement(), false);
27958        composeDateTimeExtras("date", element.getDateElement(), false);
27959      }
27960      if (element.hasItem()) {
27961        composeReference("item", element.getItem());
27962      }
27963  }
27964
27965  protected void composeLocation(String name, Location element) throws IOException {
27966    if (element != null) {
27967      prop("resourceType", name);
27968      composeLocationInner(element);
27969    }
27970  }
27971
27972  protected void composeLocationInner(Location element) throws IOException {
27973      composeDomainResourceElements(element);
27974      if (element.hasIdentifier()) {
27975        openArray("identifier");
27976        for (Identifier e : element.getIdentifier()) 
27977          composeIdentifier(null, e);
27978        closeArray();
27979      };
27980      if (element.hasStatusElement()) {
27981        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
27982        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
27983      }
27984      if (element.hasNameElement()) {
27985        composeStringCore("name", element.getNameElement(), false);
27986        composeStringExtras("name", element.getNameElement(), false);
27987      }
27988      if (element.hasDescriptionElement()) {
27989        composeStringCore("description", element.getDescriptionElement(), false);
27990        composeStringExtras("description", element.getDescriptionElement(), false);
27991      }
27992      if (element.hasModeElement()) {
27993        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
27994        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
27995      }
27996      if (element.hasType()) {
27997        composeCodeableConcept("type", element.getType());
27998      }
27999      if (element.hasTelecom()) {
28000        openArray("telecom");
28001        for (ContactPoint e : element.getTelecom()) 
28002          composeContactPoint(null, e);
28003        closeArray();
28004      };
28005      if (element.hasAddress()) {
28006        composeAddress("address", element.getAddress());
28007      }
28008      if (element.hasPhysicalType()) {
28009        composeCodeableConcept("physicalType", element.getPhysicalType());
28010      }
28011      if (element.hasPosition()) {
28012        composeLocationLocationPositionComponent("position", element.getPosition());
28013      }
28014      if (element.hasManagingOrganization()) {
28015        composeReference("managingOrganization", element.getManagingOrganization());
28016      }
28017      if (element.hasPartOf()) {
28018        composeReference("partOf", element.getPartOf());
28019      }
28020  }
28021
28022  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
28023    if (element != null) {
28024      open(name);
28025      composeLocationLocationPositionComponentInner(element);
28026      close();
28027    }
28028  }
28029
28030  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
28031      composeBackbone(element);
28032      if (element.hasLongitudeElement()) {
28033        composeDecimalCore("longitude", element.getLongitudeElement(), false);
28034        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
28035      }
28036      if (element.hasLatitudeElement()) {
28037        composeDecimalCore("latitude", element.getLatitudeElement(), false);
28038        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
28039      }
28040      if (element.hasAltitudeElement()) {
28041        composeDecimalCore("altitude", element.getAltitudeElement(), false);
28042        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
28043      }
28044  }
28045
28046  protected void composeMeasure(String name, Measure element) throws IOException {
28047    if (element != null) {
28048      prop("resourceType", name);
28049      composeMeasureInner(element);
28050    }
28051  }
28052
28053  protected void composeMeasureInner(Measure element) throws IOException {
28054      composeDomainResourceElements(element);
28055      if (element.hasModuleMetadata()) {
28056        composeModuleMetadata("moduleMetadata", element.getModuleMetadata());
28057      }
28058      if (element.hasLibrary()) {
28059        openArray("library");
28060        for (Reference e : element.getLibrary()) 
28061          composeReference(null, e);
28062        closeArray();
28063      };
28064      if (element.hasDisclaimerElement()) {
28065        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
28066        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
28067      }
28068      if (element.hasScoringElement()) {
28069        composeEnumerationCore("scoring", element.getScoringElement(), new Measure.MeasureScoringEnumFactory(), false);
28070        composeEnumerationExtras("scoring", element.getScoringElement(), new Measure.MeasureScoringEnumFactory(), false);
28071      }
28072      if (element.hasType()) {
28073        openArray("type");
28074        for (Enumeration<Measure.MeasureType> e : element.getType()) 
28075          composeEnumerationCore(null, e, new Measure.MeasureTypeEnumFactory(), true);
28076        closeArray();
28077        if (anyHasExtras(element.getType())) {
28078          openArray("_type");
28079          for (Enumeration<Measure.MeasureType> e : element.getType()) 
28080            composeEnumerationExtras(null, e, new Measure.MeasureTypeEnumFactory(), true);
28081          closeArray();
28082        }
28083      };
28084      if (element.hasRiskAdjustmentElement()) {
28085        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
28086        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
28087      }
28088      if (element.hasRateAggregationElement()) {
28089        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
28090        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
28091      }
28092      if (element.hasRationaleElement()) {
28093        composeMarkdownCore("rationale", element.getRationaleElement(), false);
28094        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
28095      }
28096      if (element.hasClinicalRecommendationStatementElement()) {
28097        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
28098        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
28099      }
28100      if (element.hasImprovementNotationElement()) {
28101        composeStringCore("improvementNotation", element.getImprovementNotationElement(), false);
28102        composeStringExtras("improvementNotation", element.getImprovementNotationElement(), false);
28103      }
28104      if (element.hasDefinitionElement()) {
28105        composeMarkdownCore("definition", element.getDefinitionElement(), false);
28106        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
28107      }
28108      if (element.hasGuidanceElement()) {
28109        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
28110        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
28111      }
28112      if (element.hasSetElement()) {
28113        composeStringCore("set", element.getSetElement(), false);
28114        composeStringExtras("set", element.getSetElement(), false);
28115      }
28116      if (element.hasGroup()) {
28117        openArray("group");
28118        for (Measure.MeasureGroupComponent e : element.getGroup()) 
28119          composeMeasureMeasureGroupComponent(null, e);
28120        closeArray();
28121      };
28122      if (element.hasSupplementalData()) {
28123        openArray("supplementalData");
28124        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
28125          composeMeasureMeasureSupplementalDataComponent(null, e);
28126        closeArray();
28127      };
28128  }
28129
28130  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
28131    if (element != null) {
28132      open(name);
28133      composeMeasureMeasureGroupComponentInner(element);
28134      close();
28135    }
28136  }
28137
28138  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
28139      composeBackbone(element);
28140      if (element.hasIdentifier()) {
28141        composeIdentifier("identifier", element.getIdentifier());
28142      }
28143      if (element.hasNameElement()) {
28144        composeStringCore("name", element.getNameElement(), false);
28145        composeStringExtras("name", element.getNameElement(), false);
28146      }
28147      if (element.hasDescriptionElement()) {
28148        composeStringCore("description", element.getDescriptionElement(), false);
28149        composeStringExtras("description", element.getDescriptionElement(), false);
28150      }
28151      if (element.hasPopulation()) {
28152        openArray("population");
28153        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
28154          composeMeasureMeasureGroupPopulationComponent(null, e);
28155        closeArray();
28156      };
28157      if (element.hasStratifier()) {
28158        openArray("stratifier");
28159        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
28160          composeMeasureMeasureGroupStratifierComponent(null, e);
28161        closeArray();
28162      };
28163  }
28164
28165  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
28166    if (element != null) {
28167      open(name);
28168      composeMeasureMeasureGroupPopulationComponentInner(element);
28169      close();
28170    }
28171  }
28172
28173  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
28174      composeBackbone(element);
28175      if (element.hasTypeElement()) {
28176        composeEnumerationCore("type", element.getTypeElement(), new Measure.MeasurePopulationTypeEnumFactory(), false);
28177        composeEnumerationExtras("type", element.getTypeElement(), new Measure.MeasurePopulationTypeEnumFactory(), false);
28178      }
28179      if (element.hasIdentifier()) {
28180        composeIdentifier("identifier", element.getIdentifier());
28181      }
28182      if (element.hasNameElement()) {
28183        composeStringCore("name", element.getNameElement(), false);
28184        composeStringExtras("name", element.getNameElement(), false);
28185      }
28186      if (element.hasDescriptionElement()) {
28187        composeStringCore("description", element.getDescriptionElement(), false);
28188        composeStringExtras("description", element.getDescriptionElement(), false);
28189      }
28190      if (element.hasCriteriaElement()) {
28191        composeStringCore("criteria", element.getCriteriaElement(), false);
28192        composeStringExtras("criteria", element.getCriteriaElement(), false);
28193      }
28194  }
28195
28196  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
28197    if (element != null) {
28198      open(name);
28199      composeMeasureMeasureGroupStratifierComponentInner(element);
28200      close();
28201    }
28202  }
28203
28204  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
28205      composeBackbone(element);
28206      if (element.hasIdentifier()) {
28207        composeIdentifier("identifier", element.getIdentifier());
28208      }
28209      if (element.hasCriteriaElement()) {
28210        composeStringCore("criteria", element.getCriteriaElement(), false);
28211        composeStringExtras("criteria", element.getCriteriaElement(), false);
28212      }
28213      if (element.hasPathElement()) {
28214        composeStringCore("path", element.getPathElement(), false);
28215        composeStringExtras("path", element.getPathElement(), false);
28216      }
28217  }
28218
28219  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
28220    if (element != null) {
28221      open(name);
28222      composeMeasureMeasureSupplementalDataComponentInner(element);
28223      close();
28224    }
28225  }
28226
28227  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
28228      composeBackbone(element);
28229      if (element.hasIdentifier()) {
28230        composeIdentifier("identifier", element.getIdentifier());
28231      }
28232      if (element.hasUsage()) {
28233        openArray("usage");
28234        for (Enumeration<Measure.MeasureDataUsage> e : element.getUsage()) 
28235          composeEnumerationCore(null, e, new Measure.MeasureDataUsageEnumFactory(), true);
28236        closeArray();
28237        if (anyHasExtras(element.getUsage())) {
28238          openArray("_usage");
28239          for (Enumeration<Measure.MeasureDataUsage> e : element.getUsage()) 
28240            composeEnumerationExtras(null, e, new Measure.MeasureDataUsageEnumFactory(), true);
28241          closeArray();
28242        }
28243      };
28244      if (element.hasCriteriaElement()) {
28245        composeStringCore("criteria", element.getCriteriaElement(), false);
28246        composeStringExtras("criteria", element.getCriteriaElement(), false);
28247      }
28248      if (element.hasPathElement()) {
28249        composeStringCore("path", element.getPathElement(), false);
28250        composeStringExtras("path", element.getPathElement(), false);
28251      }
28252  }
28253
28254  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
28255    if (element != null) {
28256      prop("resourceType", name);
28257      composeMeasureReportInner(element);
28258    }
28259  }
28260
28261  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
28262      composeDomainResourceElements(element);
28263      if (element.hasMeasure()) {
28264        composeReference("measure", element.getMeasure());
28265      }
28266      if (element.hasTypeElement()) {
28267        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
28268        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
28269      }
28270      if (element.hasPatient()) {
28271        composeReference("patient", element.getPatient());
28272      }
28273      if (element.hasPeriod()) {
28274        composePeriod("period", element.getPeriod());
28275      }
28276      if (element.hasStatusElement()) {
28277        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
28278        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
28279      }
28280      if (element.hasDateElement()) {
28281        composeDateTimeCore("date", element.getDateElement(), false);
28282        composeDateTimeExtras("date", element.getDateElement(), false);
28283      }
28284      if (element.hasReportingOrganization()) {
28285        composeReference("reportingOrganization", element.getReportingOrganization());
28286      }
28287      if (element.hasGroup()) {
28288        openArray("group");
28289        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
28290          composeMeasureReportMeasureReportGroupComponent(null, e);
28291        closeArray();
28292      };
28293      if (element.hasEvaluatedResources()) {
28294        composeReference("evaluatedResources", element.getEvaluatedResources());
28295      }
28296  }
28297
28298  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
28299    if (element != null) {
28300      open(name);
28301      composeMeasureReportMeasureReportGroupComponentInner(element);
28302      close();
28303    }
28304  }
28305
28306  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
28307      composeBackbone(element);
28308      if (element.hasIdentifier()) {
28309        composeIdentifier("identifier", element.getIdentifier());
28310      }
28311      if (element.hasPopulation()) {
28312        openArray("population");
28313        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
28314          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
28315        closeArray();
28316      };
28317      if (element.hasMeasureScoreElement()) {
28318        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
28319        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
28320      }
28321      if (element.hasStratifier()) {
28322        openArray("stratifier");
28323        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
28324          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
28325        closeArray();
28326      };
28327      if (element.hasSupplementalData()) {
28328        openArray("supplementalData");
28329        for (MeasureReport.MeasureReportGroupSupplementalDataComponent e : element.getSupplementalData()) 
28330          composeMeasureReportMeasureReportGroupSupplementalDataComponent(null, e);
28331        closeArray();
28332      };
28333  }
28334
28335  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
28336    if (element != null) {
28337      open(name);
28338      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
28339      close();
28340    }
28341  }
28342
28343  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
28344      composeBackbone(element);
28345      if (element.hasTypeElement()) {
28346        composeCodeCore("type", element.getTypeElement(), false);
28347        composeCodeExtras("type", element.getTypeElement(), false);
28348      }
28349      if (element.hasCountElement()) {
28350        composeIntegerCore("count", element.getCountElement(), false);
28351        composeIntegerExtras("count", element.getCountElement(), false);
28352      }
28353      if (element.hasPatients()) {
28354        composeReference("patients", element.getPatients());
28355      }
28356  }
28357
28358  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
28359    if (element != null) {
28360      open(name);
28361      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
28362      close();
28363    }
28364  }
28365
28366  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
28367      composeBackbone(element);
28368      if (element.hasIdentifier()) {
28369        composeIdentifier("identifier", element.getIdentifier());
28370      }
28371      if (element.hasGroup()) {
28372        openArray("group");
28373        for (MeasureReport.MeasureReportGroupStratifierGroupComponent e : element.getGroup()) 
28374          composeMeasureReportMeasureReportGroupStratifierGroupComponent(null, e);
28375        closeArray();
28376      };
28377  }
28378
28379  protected void composeMeasureReportMeasureReportGroupStratifierGroupComponent(String name, MeasureReport.MeasureReportGroupStratifierGroupComponent element) throws IOException {
28380    if (element != null) {
28381      open(name);
28382      composeMeasureReportMeasureReportGroupStratifierGroupComponentInner(element);
28383      close();
28384    }
28385  }
28386
28387  protected void composeMeasureReportMeasureReportGroupStratifierGroupComponentInner(MeasureReport.MeasureReportGroupStratifierGroupComponent element) throws IOException {
28388      composeBackbone(element);
28389      if (element.hasValueElement()) {
28390        composeStringCore("value", element.getValueElement(), false);
28391        composeStringExtras("value", element.getValueElement(), false);
28392      }
28393      if (element.hasPopulation()) {
28394        openArray("population");
28395        for (MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent e : element.getPopulation()) 
28396          composeMeasureReportMeasureReportGroupStratifierGroupPopulationComponent(null, e);
28397        closeArray();
28398      };
28399      if (element.hasMeasureScoreElement()) {
28400        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
28401        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
28402      }
28403  }
28404
28405  protected void composeMeasureReportMeasureReportGroupStratifierGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent element) throws IOException {
28406    if (element != null) {
28407      open(name);
28408      composeMeasureReportMeasureReportGroupStratifierGroupPopulationComponentInner(element);
28409      close();
28410    }
28411  }
28412
28413  protected void composeMeasureReportMeasureReportGroupStratifierGroupPopulationComponentInner(MeasureReport.MeasureReportGroupStratifierGroupPopulationComponent element) throws IOException {
28414      composeBackbone(element);
28415      if (element.hasTypeElement()) {
28416        composeCodeCore("type", element.getTypeElement(), false);
28417        composeCodeExtras("type", element.getTypeElement(), false);
28418      }
28419      if (element.hasCountElement()) {
28420        composeIntegerCore("count", element.getCountElement(), false);
28421        composeIntegerExtras("count", element.getCountElement(), false);
28422      }
28423      if (element.hasPatients()) {
28424        composeReference("patients", element.getPatients());
28425      }
28426  }
28427
28428  protected void composeMeasureReportMeasureReportGroupSupplementalDataComponent(String name, MeasureReport.MeasureReportGroupSupplementalDataComponent element) throws IOException {
28429    if (element != null) {
28430      open(name);
28431      composeMeasureReportMeasureReportGroupSupplementalDataComponentInner(element);
28432      close();
28433    }
28434  }
28435
28436  protected void composeMeasureReportMeasureReportGroupSupplementalDataComponentInner(MeasureReport.MeasureReportGroupSupplementalDataComponent element) throws IOException {
28437      composeBackbone(element);
28438      if (element.hasIdentifier()) {
28439        composeIdentifier("identifier", element.getIdentifier());
28440      }
28441      if (element.hasGroup()) {
28442        openArray("group");
28443        for (MeasureReport.MeasureReportGroupSupplementalDataGroupComponent e : element.getGroup()) 
28444          composeMeasureReportMeasureReportGroupSupplementalDataGroupComponent(null, e);
28445        closeArray();
28446      };
28447  }
28448
28449  protected void composeMeasureReportMeasureReportGroupSupplementalDataGroupComponent(String name, MeasureReport.MeasureReportGroupSupplementalDataGroupComponent element) throws IOException {
28450    if (element != null) {
28451      open(name);
28452      composeMeasureReportMeasureReportGroupSupplementalDataGroupComponentInner(element);
28453      close();
28454    }
28455  }
28456
28457  protected void composeMeasureReportMeasureReportGroupSupplementalDataGroupComponentInner(MeasureReport.MeasureReportGroupSupplementalDataGroupComponent element) throws IOException {
28458      composeBackbone(element);
28459      if (element.hasValueElement()) {
28460        composeStringCore("value", element.getValueElement(), false);
28461        composeStringExtras("value", element.getValueElement(), false);
28462      }
28463      if (element.hasCountElement()) {
28464        composeIntegerCore("count", element.getCountElement(), false);
28465        composeIntegerExtras("count", element.getCountElement(), false);
28466      }
28467      if (element.hasPatients()) {
28468        composeReference("patients", element.getPatients());
28469      }
28470  }
28471
28472  protected void composeMedia(String name, Media element) throws IOException {
28473    if (element != null) {
28474      prop("resourceType", name);
28475      composeMediaInner(element);
28476    }
28477  }
28478
28479  protected void composeMediaInner(Media element) throws IOException {
28480      composeDomainResourceElements(element);
28481      if (element.hasIdentifier()) {
28482        openArray("identifier");
28483        for (Identifier e : element.getIdentifier()) 
28484          composeIdentifier(null, e);
28485        closeArray();
28486      };
28487      if (element.hasTypeElement()) {
28488        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
28489        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
28490      }
28491      if (element.hasSubtype()) {
28492        composeCodeableConcept("subtype", element.getSubtype());
28493      }
28494      if (element.hasView()) {
28495        composeCodeableConcept("view", element.getView());
28496      }
28497      if (element.hasSubject()) {
28498        composeReference("subject", element.getSubject());
28499      }
28500      if (element.hasOperator()) {
28501        composeReference("operator", element.getOperator());
28502      }
28503      if (element.hasDeviceNameElement()) {
28504        composeStringCore("deviceName", element.getDeviceNameElement(), false);
28505        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
28506      }
28507      if (element.hasHeightElement()) {
28508        composePositiveIntCore("height", element.getHeightElement(), false);
28509        composePositiveIntExtras("height", element.getHeightElement(), false);
28510      }
28511      if (element.hasWidthElement()) {
28512        composePositiveIntCore("width", element.getWidthElement(), false);
28513        composePositiveIntExtras("width", element.getWidthElement(), false);
28514      }
28515      if (element.hasFramesElement()) {
28516        composePositiveIntCore("frames", element.getFramesElement(), false);
28517        composePositiveIntExtras("frames", element.getFramesElement(), false);
28518      }
28519      if (element.hasDurationElement()) {
28520        composeUnsignedIntCore("duration", element.getDurationElement(), false);
28521        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
28522      }
28523      if (element.hasContent()) {
28524        composeAttachment("content", element.getContent());
28525      }
28526  }
28527
28528  protected void composeMedication(String name, Medication element) throws IOException {
28529    if (element != null) {
28530      prop("resourceType", name);
28531      composeMedicationInner(element);
28532    }
28533  }
28534
28535  protected void composeMedicationInner(Medication element) throws IOException {
28536      composeDomainResourceElements(element);
28537      if (element.hasCode()) {
28538        composeCodeableConcept("code", element.getCode());
28539      }
28540      if (element.hasIsBrandElement()) {
28541        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
28542        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
28543      }
28544      if (element.hasManufacturer()) {
28545        composeReference("manufacturer", element.getManufacturer());
28546      }
28547      if (element.hasProduct()) {
28548        composeMedicationMedicationProductComponent("product", element.getProduct());
28549      }
28550      if (element.hasPackage()) {
28551        composeMedicationMedicationPackageComponent("package", element.getPackage());
28552      }
28553  }
28554
28555  protected void composeMedicationMedicationProductComponent(String name, Medication.MedicationProductComponent element) throws IOException {
28556    if (element != null) {
28557      open(name);
28558      composeMedicationMedicationProductComponentInner(element);
28559      close();
28560    }
28561  }
28562
28563  protected void composeMedicationMedicationProductComponentInner(Medication.MedicationProductComponent element) throws IOException {
28564      composeBackbone(element);
28565      if (element.hasForm()) {
28566        composeCodeableConcept("form", element.getForm());
28567      }
28568      if (element.hasIngredient()) {
28569        openArray("ingredient");
28570        for (Medication.MedicationProductIngredientComponent e : element.getIngredient()) 
28571          composeMedicationMedicationProductIngredientComponent(null, e);
28572        closeArray();
28573      };
28574      if (element.hasBatch()) {
28575        openArray("batch");
28576        for (Medication.MedicationProductBatchComponent e : element.getBatch()) 
28577          composeMedicationMedicationProductBatchComponent(null, e);
28578        closeArray();
28579      };
28580  }
28581
28582  protected void composeMedicationMedicationProductIngredientComponent(String name, Medication.MedicationProductIngredientComponent element) throws IOException {
28583    if (element != null) {
28584      open(name);
28585      composeMedicationMedicationProductIngredientComponentInner(element);
28586      close();
28587    }
28588  }
28589
28590  protected void composeMedicationMedicationProductIngredientComponentInner(Medication.MedicationProductIngredientComponent element) throws IOException {
28591      composeBackbone(element);
28592      if (element.hasItem()) {
28593        composeType("item", element.getItem());
28594      }
28595      if (element.hasAmount()) {
28596        composeRatio("amount", element.getAmount());
28597      }
28598  }
28599
28600  protected void composeMedicationMedicationProductBatchComponent(String name, Medication.MedicationProductBatchComponent element) throws IOException {
28601    if (element != null) {
28602      open(name);
28603      composeMedicationMedicationProductBatchComponentInner(element);
28604      close();
28605    }
28606  }
28607
28608  protected void composeMedicationMedicationProductBatchComponentInner(Medication.MedicationProductBatchComponent element) throws IOException {
28609      composeBackbone(element);
28610      if (element.hasLotNumberElement()) {
28611        composeStringCore("lotNumber", element.getLotNumberElement(), false);
28612        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
28613      }
28614      if (element.hasExpirationDateElement()) {
28615        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
28616        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
28617      }
28618  }
28619
28620  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
28621    if (element != null) {
28622      open(name);
28623      composeMedicationMedicationPackageComponentInner(element);
28624      close();
28625    }
28626  }
28627
28628  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
28629      composeBackbone(element);
28630      if (element.hasContainer()) {
28631        composeCodeableConcept("container", element.getContainer());
28632      }
28633      if (element.hasContent()) {
28634        openArray("content");
28635        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
28636          composeMedicationMedicationPackageContentComponent(null, e);
28637        closeArray();
28638      };
28639  }
28640
28641  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
28642    if (element != null) {
28643      open(name);
28644      composeMedicationMedicationPackageContentComponentInner(element);
28645      close();
28646    }
28647  }
28648
28649  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
28650      composeBackbone(element);
28651      if (element.hasItem()) {
28652        composeType("item", element.getItem());
28653      }
28654      if (element.hasAmount()) {
28655        composeSimpleQuantity("amount", element.getAmount());
28656      }
28657  }
28658
28659  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
28660    if (element != null) {
28661      prop("resourceType", name);
28662      composeMedicationAdministrationInner(element);
28663    }
28664  }
28665
28666  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
28667      composeDomainResourceElements(element);
28668      if (element.hasIdentifier()) {
28669        openArray("identifier");
28670        for (Identifier e : element.getIdentifier()) 
28671          composeIdentifier(null, e);
28672        closeArray();
28673      };
28674      if (element.hasStatusElement()) {
28675        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
28676        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
28677      }
28678      if (element.hasMedication()) {
28679        composeType("medication", element.getMedication());
28680      }
28681      if (element.hasPatient()) {
28682        composeReference("patient", element.getPatient());
28683      }
28684      if (element.hasEncounter()) {
28685        composeReference("encounter", element.getEncounter());
28686      }
28687      if (element.hasEffectiveTime()) {
28688        composeType("effectiveTime", element.getEffectiveTime());
28689      }
28690      if (element.hasPractitioner()) {
28691        composeReference("practitioner", element.getPractitioner());
28692      }
28693      if (element.hasPrescription()) {
28694        composeReference("prescription", element.getPrescription());
28695      }
28696      if (element.hasWasNotGivenElement()) {
28697        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
28698        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
28699      }
28700      if (element.hasReasonNotGiven()) {
28701        openArray("reasonNotGiven");
28702        for (CodeableConcept e : element.getReasonNotGiven()) 
28703          composeCodeableConcept(null, e);
28704        closeArray();
28705      };
28706      if (element.hasReasonGiven()) {
28707        openArray("reasonGiven");
28708        for (CodeableConcept e : element.getReasonGiven()) 
28709          composeCodeableConcept(null, e);
28710        closeArray();
28711      };
28712      if (element.hasDevice()) {
28713        openArray("device");
28714        for (Reference e : element.getDevice()) 
28715          composeReference(null, e);
28716        closeArray();
28717      };
28718      if (element.hasNote()) {
28719        openArray("note");
28720        for (Annotation e : element.getNote()) 
28721          composeAnnotation(null, e);
28722        closeArray();
28723      };
28724      if (element.hasDosage()) {
28725        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
28726      }
28727  }
28728
28729  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
28730    if (element != null) {
28731      open(name);
28732      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
28733      close();
28734    }
28735  }
28736
28737  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
28738      composeBackbone(element);
28739      if (element.hasTextElement()) {
28740        composeStringCore("text", element.getTextElement(), false);
28741        composeStringExtras("text", element.getTextElement(), false);
28742      }
28743      if (element.hasSite()) {
28744        composeType("site", element.getSite());
28745      }
28746      if (element.hasRoute()) {
28747        composeCodeableConcept("route", element.getRoute());
28748      }
28749      if (element.hasMethod()) {
28750        composeCodeableConcept("method", element.getMethod());
28751      }
28752      if (element.hasQuantity()) {
28753        composeSimpleQuantity("quantity", element.getQuantity());
28754      }
28755      if (element.hasRate()) {
28756        composeType("rate", element.getRate());
28757      }
28758  }
28759
28760  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
28761    if (element != null) {
28762      prop("resourceType", name);
28763      composeMedicationDispenseInner(element);
28764    }
28765  }
28766
28767  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
28768      composeDomainResourceElements(element);
28769      if (element.hasIdentifier()) {
28770        composeIdentifier("identifier", element.getIdentifier());
28771      }
28772      if (element.hasStatusElement()) {
28773        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
28774        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
28775      }
28776      if (element.hasMedication()) {
28777        composeType("medication", element.getMedication());
28778      }
28779      if (element.hasPatient()) {
28780        composeReference("patient", element.getPatient());
28781      }
28782      if (element.hasDispenser()) {
28783        composeReference("dispenser", element.getDispenser());
28784      }
28785      if (element.hasAuthorizingPrescription()) {
28786        openArray("authorizingPrescription");
28787        for (Reference e : element.getAuthorizingPrescription()) 
28788          composeReference(null, e);
28789        closeArray();
28790      };
28791      if (element.hasType()) {
28792        composeCodeableConcept("type", element.getType());
28793      }
28794      if (element.hasQuantity()) {
28795        composeSimpleQuantity("quantity", element.getQuantity());
28796      }
28797      if (element.hasDaysSupply()) {
28798        composeSimpleQuantity("daysSupply", element.getDaysSupply());
28799      }
28800      if (element.hasWhenPreparedElement()) {
28801        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
28802        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
28803      }
28804      if (element.hasWhenHandedOverElement()) {
28805        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
28806        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
28807      }
28808      if (element.hasDestination()) {
28809        composeReference("destination", element.getDestination());
28810      }
28811      if (element.hasReceiver()) {
28812        openArray("receiver");
28813        for (Reference e : element.getReceiver()) 
28814          composeReference(null, e);
28815        closeArray();
28816      };
28817      if (element.hasNote()) {
28818        openArray("note");
28819        for (Annotation e : element.getNote()) 
28820          composeAnnotation(null, e);
28821        closeArray();
28822      };
28823      if (element.hasDosageInstruction()) {
28824        openArray("dosageInstruction");
28825        for (MedicationDispense.MedicationDispenseDosageInstructionComponent e : element.getDosageInstruction()) 
28826          composeMedicationDispenseMedicationDispenseDosageInstructionComponent(null, e);
28827        closeArray();
28828      };
28829      if (element.hasSubstitution()) {
28830        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
28831      }
28832  }
28833
28834  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponent(String name, MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
28835    if (element != null) {
28836      open(name);
28837      composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(element);
28838      close();
28839    }
28840  }
28841
28842  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
28843      composeBackbone(element);
28844      if (element.hasTextElement()) {
28845        composeStringCore("text", element.getTextElement(), false);
28846        composeStringExtras("text", element.getTextElement(), false);
28847      }
28848      if (element.hasAdditionalInstructions()) {
28849        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
28850      }
28851      if (element.hasTiming()) {
28852        composeTiming("timing", element.getTiming());
28853      }
28854      if (element.hasAsNeeded()) {
28855        composeType("asNeeded", element.getAsNeeded());
28856      }
28857      if (element.hasSite()) {
28858        composeType("site", element.getSite());
28859      }
28860      if (element.hasRoute()) {
28861        composeCodeableConcept("route", element.getRoute());
28862      }
28863      if (element.hasMethod()) {
28864        composeCodeableConcept("method", element.getMethod());
28865      }
28866      if (element.hasDose()) {
28867        composeType("dose", element.getDose());
28868      }
28869      if (element.hasRate()) {
28870        composeType("rate", element.getRate());
28871      }
28872      if (element.hasMaxDosePerPeriod()) {
28873        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
28874      }
28875  }
28876
28877  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
28878    if (element != null) {
28879      open(name);
28880      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
28881      close();
28882    }
28883  }
28884
28885  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
28886      composeBackbone(element);
28887      if (element.hasType()) {
28888        composeCodeableConcept("type", element.getType());
28889      }
28890      if (element.hasReason()) {
28891        openArray("reason");
28892        for (CodeableConcept e : element.getReason()) 
28893          composeCodeableConcept(null, e);
28894        closeArray();
28895      };
28896      if (element.hasResponsibleParty()) {
28897        openArray("responsibleParty");
28898        for (Reference e : element.getResponsibleParty()) 
28899          composeReference(null, e);
28900        closeArray();
28901      };
28902  }
28903
28904  protected void composeMedicationOrder(String name, MedicationOrder element) throws IOException {
28905    if (element != null) {
28906      prop("resourceType", name);
28907      composeMedicationOrderInner(element);
28908    }
28909  }
28910
28911  protected void composeMedicationOrderInner(MedicationOrder element) throws IOException {
28912      composeDomainResourceElements(element);
28913      if (element.hasIdentifier()) {
28914        openArray("identifier");
28915        for (Identifier e : element.getIdentifier()) 
28916          composeIdentifier(null, e);
28917        closeArray();
28918      };
28919      if (element.hasStatusElement()) {
28920        composeEnumerationCore("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
28921        composeEnumerationExtras("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
28922      }
28923      if (element.hasMedication()) {
28924        composeType("medication", element.getMedication());
28925      }
28926      if (element.hasPatient()) {
28927        composeReference("patient", element.getPatient());
28928      }
28929      if (element.hasEncounter()) {
28930        composeReference("encounter", element.getEncounter());
28931      }
28932      if (element.hasDateWrittenElement()) {
28933        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
28934        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
28935      }
28936      if (element.hasPrescriber()) {
28937        composeReference("prescriber", element.getPrescriber());
28938      }
28939      if (element.hasReasonCode()) {
28940        openArray("reasonCode");
28941        for (CodeableConcept e : element.getReasonCode()) 
28942          composeCodeableConcept(null, e);
28943        closeArray();
28944      };
28945      if (element.hasReasonReference()) {
28946        openArray("reasonReference");
28947        for (Reference e : element.getReasonReference()) 
28948          composeReference(null, e);
28949        closeArray();
28950      };
28951      if (element.hasDateEndedElement()) {
28952        composeDateTimeCore("dateEnded", element.getDateEndedElement(), false);
28953        composeDateTimeExtras("dateEnded", element.getDateEndedElement(), false);
28954      }
28955      if (element.hasReasonEnded()) {
28956        composeCodeableConcept("reasonEnded", element.getReasonEnded());
28957      }
28958      if (element.hasNote()) {
28959        openArray("note");
28960        for (Annotation e : element.getNote()) 
28961          composeAnnotation(null, e);
28962        closeArray();
28963      };
28964      if (element.hasDosageInstruction()) {
28965        openArray("dosageInstruction");
28966        for (MedicationOrder.MedicationOrderDosageInstructionComponent e : element.getDosageInstruction()) 
28967          composeMedicationOrderMedicationOrderDosageInstructionComponent(null, e);
28968        closeArray();
28969      };
28970      if (element.hasDispenseRequest()) {
28971        composeMedicationOrderMedicationOrderDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
28972      }
28973      if (element.hasSubstitution()) {
28974        composeMedicationOrderMedicationOrderSubstitutionComponent("substitution", element.getSubstitution());
28975      }
28976      if (element.hasPriorPrescription()) {
28977        composeReference("priorPrescription", element.getPriorPrescription());
28978      }
28979  }
28980
28981  protected void composeMedicationOrderMedicationOrderDosageInstructionComponent(String name, MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
28982    if (element != null) {
28983      open(name);
28984      composeMedicationOrderMedicationOrderDosageInstructionComponentInner(element);
28985      close();
28986    }
28987  }
28988
28989  protected void composeMedicationOrderMedicationOrderDosageInstructionComponentInner(MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
28990      composeBackbone(element);
28991      if (element.hasTextElement()) {
28992        composeStringCore("text", element.getTextElement(), false);
28993        composeStringExtras("text", element.getTextElement(), false);
28994      }
28995      if (element.hasAdditionalInstructions()) {
28996        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
28997      }
28998      if (element.hasTiming()) {
28999        composeTiming("timing", element.getTiming());
29000      }
29001      if (element.hasAsNeeded()) {
29002        composeType("asNeeded", element.getAsNeeded());
29003      }
29004      if (element.hasSite()) {
29005        composeType("site", element.getSite());
29006      }
29007      if (element.hasRoute()) {
29008        composeCodeableConcept("route", element.getRoute());
29009      }
29010      if (element.hasMethod()) {
29011        composeCodeableConcept("method", element.getMethod());
29012      }
29013      if (element.hasDose()) {
29014        composeType("dose", element.getDose());
29015      }
29016      if (element.hasRate()) {
29017        composeType("rate", element.getRate());
29018      }
29019      if (element.hasMaxDosePerPeriod()) {
29020        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
29021      }
29022  }
29023
29024  protected void composeMedicationOrderMedicationOrderDispenseRequestComponent(String name, MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
29025    if (element != null) {
29026      open(name);
29027      composeMedicationOrderMedicationOrderDispenseRequestComponentInner(element);
29028      close();
29029    }
29030  }
29031
29032  protected void composeMedicationOrderMedicationOrderDispenseRequestComponentInner(MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
29033      composeBackbone(element);
29034      if (element.hasMedication()) {
29035        composeType("medication", element.getMedication());
29036      }
29037      if (element.hasValidityPeriod()) {
29038        composePeriod("validityPeriod", element.getValidityPeriod());
29039      }
29040      if (element.hasNumberOfRepeatsAllowedElement()) {
29041        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
29042        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
29043      }
29044      if (element.hasQuantity()) {
29045        composeSimpleQuantity("quantity", element.getQuantity());
29046      }
29047      if (element.hasExpectedSupplyDuration()) {
29048        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
29049      }
29050  }
29051
29052  protected void composeMedicationOrderMedicationOrderSubstitutionComponent(String name, MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
29053    if (element != null) {
29054      open(name);
29055      composeMedicationOrderMedicationOrderSubstitutionComponentInner(element);
29056      close();
29057    }
29058  }
29059
29060  protected void composeMedicationOrderMedicationOrderSubstitutionComponentInner(MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
29061      composeBackbone(element);
29062      if (element.hasType()) {
29063        composeCodeableConcept("type", element.getType());
29064      }
29065      if (element.hasReason()) {
29066        composeCodeableConcept("reason", element.getReason());
29067      }
29068  }
29069
29070  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
29071    if (element != null) {
29072      prop("resourceType", name);
29073      composeMedicationStatementInner(element);
29074    }
29075  }
29076
29077  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
29078      composeDomainResourceElements(element);
29079      if (element.hasIdentifier()) {
29080        openArray("identifier");
29081        for (Identifier e : element.getIdentifier()) 
29082          composeIdentifier(null, e);
29083        closeArray();
29084      };
29085      if (element.hasStatusElement()) {
29086        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
29087        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
29088      }
29089      if (element.hasMedication()) {
29090        composeType("medication", element.getMedication());
29091      }
29092      if (element.hasPatient()) {
29093        composeReference("patient", element.getPatient());
29094      }
29095      if (element.hasEffective()) {
29096        composeType("effective", element.getEffective());
29097      }
29098      if (element.hasInformationSource()) {
29099        composeReference("informationSource", element.getInformationSource());
29100      }
29101      if (element.hasSupportingInformation()) {
29102        openArray("supportingInformation");
29103        for (Reference e : element.getSupportingInformation()) 
29104          composeReference(null, e);
29105        closeArray();
29106      };
29107      if (element.hasDateAssertedElement()) {
29108        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
29109        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
29110      }
29111      if (element.hasWasNotTakenElement()) {
29112        composeBooleanCore("wasNotTaken", element.getWasNotTakenElement(), false);
29113        composeBooleanExtras("wasNotTaken", element.getWasNotTakenElement(), false);
29114      }
29115      if (element.hasReasonNotTaken()) {
29116        openArray("reasonNotTaken");
29117        for (CodeableConcept e : element.getReasonNotTaken()) 
29118          composeCodeableConcept(null, e);
29119        closeArray();
29120      };
29121      if (element.hasReasonForUse()) {
29122        composeType("reasonForUse", element.getReasonForUse());
29123      }
29124      if (element.hasNote()) {
29125        openArray("note");
29126        for (Annotation e : element.getNote()) 
29127          composeAnnotation(null, e);
29128        closeArray();
29129      };
29130      if (element.hasDosage()) {
29131        openArray("dosage");
29132        for (MedicationStatement.MedicationStatementDosageComponent e : element.getDosage()) 
29133          composeMedicationStatementMedicationStatementDosageComponent(null, e);
29134        closeArray();
29135      };
29136  }
29137
29138  protected void composeMedicationStatementMedicationStatementDosageComponent(String name, MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
29139    if (element != null) {
29140      open(name);
29141      composeMedicationStatementMedicationStatementDosageComponentInner(element);
29142      close();
29143    }
29144  }
29145
29146  protected void composeMedicationStatementMedicationStatementDosageComponentInner(MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
29147      composeBackbone(element);
29148      if (element.hasTextElement()) {
29149        composeStringCore("text", element.getTextElement(), false);
29150        composeStringExtras("text", element.getTextElement(), false);
29151      }
29152      if (element.hasTiming()) {
29153        composeTiming("timing", element.getTiming());
29154      }
29155      if (element.hasAsNeeded()) {
29156        composeType("asNeeded", element.getAsNeeded());
29157      }
29158      if (element.hasSite()) {
29159        composeType("site", element.getSite());
29160      }
29161      if (element.hasRoute()) {
29162        composeCodeableConcept("route", element.getRoute());
29163      }
29164      if (element.hasMethod()) {
29165        composeCodeableConcept("method", element.getMethod());
29166      }
29167      if (element.hasQuantity()) {
29168        composeType("quantity", element.getQuantity());
29169      }
29170      if (element.hasRate()) {
29171        composeType("rate", element.getRate());
29172      }
29173      if (element.hasMaxDosePerPeriod()) {
29174        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
29175      }
29176  }
29177
29178  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
29179    if (element != null) {
29180      prop("resourceType", name);
29181      composeMessageHeaderInner(element);
29182    }
29183  }
29184
29185  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
29186      composeDomainResourceElements(element);
29187      if (element.hasTimestampElement()) {
29188        composeInstantCore("timestamp", element.getTimestampElement(), false);
29189        composeInstantExtras("timestamp", element.getTimestampElement(), false);
29190      }
29191      if (element.hasEvent()) {
29192        composeCoding("event", element.getEvent());
29193      }
29194      if (element.hasResponse()) {
29195        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
29196      }
29197      if (element.hasSource()) {
29198        composeMessageHeaderMessageSourceComponent("source", element.getSource());
29199      }
29200      if (element.hasDestination()) {
29201        openArray("destination");
29202        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
29203          composeMessageHeaderMessageDestinationComponent(null, e);
29204        closeArray();
29205      };
29206      if (element.hasEnterer()) {
29207        composeReference("enterer", element.getEnterer());
29208      }
29209      if (element.hasAuthor()) {
29210        composeReference("author", element.getAuthor());
29211      }
29212      if (element.hasReceiver()) {
29213        composeReference("receiver", element.getReceiver());
29214      }
29215      if (element.hasResponsible()) {
29216        composeReference("responsible", element.getResponsible());
29217      }
29218      if (element.hasReason()) {
29219        composeCodeableConcept("reason", element.getReason());
29220      }
29221      if (element.hasData()) {
29222        openArray("data");
29223        for (Reference e : element.getData()) 
29224          composeReference(null, e);
29225        closeArray();
29226      };
29227  }
29228
29229  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
29230    if (element != null) {
29231      open(name);
29232      composeMessageHeaderMessageHeaderResponseComponentInner(element);
29233      close();
29234    }
29235  }
29236
29237  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
29238      composeBackbone(element);
29239      if (element.hasIdentifierElement()) {
29240        composeIdCore("identifier", element.getIdentifierElement(), false);
29241        composeIdExtras("identifier", element.getIdentifierElement(), false);
29242      }
29243      if (element.hasCodeElement()) {
29244        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
29245        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
29246      }
29247      if (element.hasDetails()) {
29248        composeReference("details", element.getDetails());
29249      }
29250  }
29251
29252  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
29253    if (element != null) {
29254      open(name);
29255      composeMessageHeaderMessageSourceComponentInner(element);
29256      close();
29257    }
29258  }
29259
29260  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
29261      composeBackbone(element);
29262      if (element.hasNameElement()) {
29263        composeStringCore("name", element.getNameElement(), false);
29264        composeStringExtras("name", element.getNameElement(), false);
29265      }
29266      if (element.hasSoftwareElement()) {
29267        composeStringCore("software", element.getSoftwareElement(), false);
29268        composeStringExtras("software", element.getSoftwareElement(), false);
29269      }
29270      if (element.hasVersionElement()) {
29271        composeStringCore("version", element.getVersionElement(), false);
29272        composeStringExtras("version", element.getVersionElement(), false);
29273      }
29274      if (element.hasContact()) {
29275        composeContactPoint("contact", element.getContact());
29276      }
29277      if (element.hasEndpointElement()) {
29278        composeUriCore("endpoint", element.getEndpointElement(), false);
29279        composeUriExtras("endpoint", element.getEndpointElement(), false);
29280      }
29281  }
29282
29283  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
29284    if (element != null) {
29285      open(name);
29286      composeMessageHeaderMessageDestinationComponentInner(element);
29287      close();
29288    }
29289  }
29290
29291  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
29292      composeBackbone(element);
29293      if (element.hasNameElement()) {
29294        composeStringCore("name", element.getNameElement(), false);
29295        composeStringExtras("name", element.getNameElement(), false);
29296      }
29297      if (element.hasTarget()) {
29298        composeReference("target", element.getTarget());
29299      }
29300      if (element.hasEndpointElement()) {
29301        composeUriCore("endpoint", element.getEndpointElement(), false);
29302        composeUriExtras("endpoint", element.getEndpointElement(), false);
29303      }
29304  }
29305
29306  protected void composeModuleDefinition(String name, ModuleDefinition element) throws IOException {
29307    if (element != null) {
29308      prop("resourceType", name);
29309      composeModuleDefinitionInner(element);
29310    }
29311  }
29312
29313  protected void composeModuleDefinitionInner(ModuleDefinition element) throws IOException {
29314      composeDomainResourceElements(element);
29315      if (element.hasIdentifier()) {
29316        openArray("identifier");
29317        for (Identifier e : element.getIdentifier()) 
29318          composeIdentifier(null, e);
29319        closeArray();
29320      };
29321      if (element.hasVersionElement()) {
29322        composeStringCore("version", element.getVersionElement(), false);
29323        composeStringExtras("version", element.getVersionElement(), false);
29324      }
29325      if (element.hasModel()) {
29326        openArray("model");
29327        for (ModuleDefinition.ModuleDefinitionModelComponent e : element.getModel()) 
29328          composeModuleDefinitionModuleDefinitionModelComponent(null, e);
29329        closeArray();
29330      };
29331      if (element.hasLibrary()) {
29332        openArray("library");
29333        for (ModuleDefinition.ModuleDefinitionLibraryComponent e : element.getLibrary()) 
29334          composeModuleDefinitionModuleDefinitionLibraryComponent(null, e);
29335        closeArray();
29336      };
29337      if (element.hasCodeSystem()) {
29338        openArray("codeSystem");
29339        for (ModuleDefinition.ModuleDefinitionCodeSystemComponent e : element.getCodeSystem()) 
29340          composeModuleDefinitionModuleDefinitionCodeSystemComponent(null, e);
29341        closeArray();
29342      };
29343      if (element.hasValueSet()) {
29344        openArray("valueSet");
29345        for (ModuleDefinition.ModuleDefinitionValueSetComponent e : element.getValueSet()) 
29346          composeModuleDefinitionModuleDefinitionValueSetComponent(null, e);
29347        closeArray();
29348      };
29349      if (element.hasParameter()) {
29350        openArray("parameter");
29351        for (ModuleDefinition.ModuleDefinitionParameterComponent e : element.getParameter()) 
29352          composeModuleDefinitionModuleDefinitionParameterComponent(null, e);
29353        closeArray();
29354      };
29355      if (element.hasData()) {
29356        openArray("data");
29357        for (ModuleDefinition.ModuleDefinitionDataComponent e : element.getData()) 
29358          composeModuleDefinitionModuleDefinitionDataComponent(null, e);
29359        closeArray();
29360      };
29361  }
29362
29363  protected void composeModuleDefinitionModuleDefinitionModelComponent(String name, ModuleDefinition.ModuleDefinitionModelComponent element) throws IOException {
29364    if (element != null) {
29365      open(name);
29366      composeModuleDefinitionModuleDefinitionModelComponentInner(element);
29367      close();
29368    }
29369  }
29370
29371  protected void composeModuleDefinitionModuleDefinitionModelComponentInner(ModuleDefinition.ModuleDefinitionModelComponent element) throws IOException {
29372      composeBackbone(element);
29373      if (element.hasNameElement()) {
29374        composeStringCore("name", element.getNameElement(), false);
29375        composeStringExtras("name", element.getNameElement(), false);
29376      }
29377      if (element.hasIdentifierElement()) {
29378        composeStringCore("identifier", element.getIdentifierElement(), false);
29379        composeStringExtras("identifier", element.getIdentifierElement(), false);
29380      }
29381      if (element.hasVersionElement()) {
29382        composeStringCore("version", element.getVersionElement(), false);
29383        composeStringExtras("version", element.getVersionElement(), false);
29384      }
29385  }
29386
29387  protected void composeModuleDefinitionModuleDefinitionLibraryComponent(String name, ModuleDefinition.ModuleDefinitionLibraryComponent element) throws IOException {
29388    if (element != null) {
29389      open(name);
29390      composeModuleDefinitionModuleDefinitionLibraryComponentInner(element);
29391      close();
29392    }
29393  }
29394
29395  protected void composeModuleDefinitionModuleDefinitionLibraryComponentInner(ModuleDefinition.ModuleDefinitionLibraryComponent element) throws IOException {
29396      composeBackbone(element);
29397      if (element.hasNameElement()) {
29398        composeStringCore("name", element.getNameElement(), false);
29399        composeStringExtras("name", element.getNameElement(), false);
29400      }
29401      if (element.hasIdentifierElement()) {
29402        composeStringCore("identifier", element.getIdentifierElement(), false);
29403        composeStringExtras("identifier", element.getIdentifierElement(), false);
29404      }
29405      if (element.hasVersionElement()) {
29406        composeStringCore("version", element.getVersionElement(), false);
29407        composeStringExtras("version", element.getVersionElement(), false);
29408      }
29409      if (element.hasDocument()) {
29410        composeType("document", element.getDocument());
29411      }
29412  }
29413
29414  protected void composeModuleDefinitionModuleDefinitionCodeSystemComponent(String name, ModuleDefinition.ModuleDefinitionCodeSystemComponent element) throws IOException {
29415    if (element != null) {
29416      open(name);
29417      composeModuleDefinitionModuleDefinitionCodeSystemComponentInner(element);
29418      close();
29419    }
29420  }
29421
29422  protected void composeModuleDefinitionModuleDefinitionCodeSystemComponentInner(ModuleDefinition.ModuleDefinitionCodeSystemComponent element) throws IOException {
29423      composeBackbone(element);
29424      if (element.hasNameElement()) {
29425        composeStringCore("name", element.getNameElement(), false);
29426        composeStringExtras("name", element.getNameElement(), false);
29427      }
29428      if (element.hasIdentifierElement()) {
29429        composeStringCore("identifier", element.getIdentifierElement(), false);
29430        composeStringExtras("identifier", element.getIdentifierElement(), false);
29431      }
29432      if (element.hasVersionElement()) {
29433        composeStringCore("version", element.getVersionElement(), false);
29434        composeStringExtras("version", element.getVersionElement(), false);
29435      }
29436  }
29437
29438  protected void composeModuleDefinitionModuleDefinitionValueSetComponent(String name, ModuleDefinition.ModuleDefinitionValueSetComponent element) throws IOException {
29439    if (element != null) {
29440      open(name);
29441      composeModuleDefinitionModuleDefinitionValueSetComponentInner(element);
29442      close();
29443    }
29444  }
29445
29446  protected void composeModuleDefinitionModuleDefinitionValueSetComponentInner(ModuleDefinition.ModuleDefinitionValueSetComponent element) throws IOException {
29447      composeBackbone(element);
29448      if (element.hasNameElement()) {
29449        composeStringCore("name", element.getNameElement(), false);
29450        composeStringExtras("name", element.getNameElement(), false);
29451      }
29452      if (element.hasIdentifierElement()) {
29453        composeStringCore("identifier", element.getIdentifierElement(), false);
29454        composeStringExtras("identifier", element.getIdentifierElement(), false);
29455      }
29456      if (element.hasVersionElement()) {
29457        composeStringCore("version", element.getVersionElement(), false);
29458        composeStringExtras("version", element.getVersionElement(), false);
29459      }
29460      if (element.hasCodeSystem()) {
29461        openArray("codeSystem");
29462        for (StringType e : element.getCodeSystem()) 
29463          composeStringCore(null, e, true);
29464        closeArray();
29465        if (anyHasExtras(element.getCodeSystem())) {
29466          openArray("_codeSystem");
29467          for (StringType e : element.getCodeSystem()) 
29468            composeStringExtras(null, e, true);
29469          closeArray();
29470        }
29471      };
29472  }
29473
29474  protected void composeModuleDefinitionModuleDefinitionParameterComponent(String name, ModuleDefinition.ModuleDefinitionParameterComponent element) throws IOException {
29475    if (element != null) {
29476      open(name);
29477      composeModuleDefinitionModuleDefinitionParameterComponentInner(element);
29478      close();
29479    }
29480  }
29481
29482  protected void composeModuleDefinitionModuleDefinitionParameterComponentInner(ModuleDefinition.ModuleDefinitionParameterComponent element) throws IOException {
29483      composeBackbone(element);
29484      if (element.hasNameElement()) {
29485        composeCodeCore("name", element.getNameElement(), false);
29486        composeCodeExtras("name", element.getNameElement(), false);
29487      }
29488      if (element.hasUseElement()) {
29489        composeCodeCore("use", element.getUseElement(), false);
29490        composeCodeExtras("use", element.getUseElement(), false);
29491      }
29492      if (element.hasDocumentationElement()) {
29493        composeStringCore("documentation", element.getDocumentationElement(), false);
29494        composeStringExtras("documentation", element.getDocumentationElement(), false);
29495      }
29496      if (element.hasTypeElement()) {
29497        composeCodeCore("type", element.getTypeElement(), false);
29498        composeCodeExtras("type", element.getTypeElement(), false);
29499      }
29500      if (element.hasProfile()) {
29501        composeReference("profile", element.getProfile());
29502      }
29503  }
29504
29505  protected void composeModuleDefinitionModuleDefinitionDataComponent(String name, ModuleDefinition.ModuleDefinitionDataComponent element) throws IOException {
29506    if (element != null) {
29507      open(name);
29508      composeModuleDefinitionModuleDefinitionDataComponentInner(element);
29509      close();
29510    }
29511  }
29512
29513  protected void composeModuleDefinitionModuleDefinitionDataComponentInner(ModuleDefinition.ModuleDefinitionDataComponent element) throws IOException {
29514      composeBackbone(element);
29515      if (element.hasTypeElement()) {
29516        composeCodeCore("type", element.getTypeElement(), false);
29517        composeCodeExtras("type", element.getTypeElement(), false);
29518      }
29519      if (element.hasProfile()) {
29520        composeReference("profile", element.getProfile());
29521      }
29522      if (element.hasMustSupport()) {
29523        openArray("mustSupport");
29524        for (StringType e : element.getMustSupport()) 
29525          composeStringCore(null, e, true);
29526        closeArray();
29527        if (anyHasExtras(element.getMustSupport())) {
29528          openArray("_mustSupport");
29529          for (StringType e : element.getMustSupport()) 
29530            composeStringExtras(null, e, true);
29531          closeArray();
29532        }
29533      };
29534      if (element.hasCodeFilter()) {
29535        openArray("codeFilter");
29536        for (ModuleDefinition.ModuleDefinitionDataCodeFilterComponent e : element.getCodeFilter()) 
29537          composeModuleDefinitionModuleDefinitionDataCodeFilterComponent(null, e);
29538        closeArray();
29539      };
29540      if (element.hasDateFilter()) {
29541        openArray("dateFilter");
29542        for (ModuleDefinition.ModuleDefinitionDataDateFilterComponent e : element.getDateFilter()) 
29543          composeModuleDefinitionModuleDefinitionDataDateFilterComponent(null, e);
29544        closeArray();
29545      };
29546  }
29547
29548  protected void composeModuleDefinitionModuleDefinitionDataCodeFilterComponent(String name, ModuleDefinition.ModuleDefinitionDataCodeFilterComponent element) throws IOException {
29549    if (element != null) {
29550      open(name);
29551      composeModuleDefinitionModuleDefinitionDataCodeFilterComponentInner(element);
29552      close();
29553    }
29554  }
29555
29556  protected void composeModuleDefinitionModuleDefinitionDataCodeFilterComponentInner(ModuleDefinition.ModuleDefinitionDataCodeFilterComponent element) throws IOException {
29557      composeBackbone(element);
29558      if (element.hasPathElement()) {
29559        composeStringCore("path", element.getPathElement(), false);
29560        composeStringExtras("path", element.getPathElement(), false);
29561      }
29562      if (element.hasValueSet()) {
29563        composeType("valueSet", element.getValueSet());
29564      }
29565      if (element.hasCodeableConcept()) {
29566        openArray("codeableConcept");
29567        for (CodeableConcept e : element.getCodeableConcept()) 
29568          composeCodeableConcept(null, e);
29569        closeArray();
29570      };
29571  }
29572
29573  protected void composeModuleDefinitionModuleDefinitionDataDateFilterComponent(String name, ModuleDefinition.ModuleDefinitionDataDateFilterComponent element) throws IOException {
29574    if (element != null) {
29575      open(name);
29576      composeModuleDefinitionModuleDefinitionDataDateFilterComponentInner(element);
29577      close();
29578    }
29579  }
29580
29581  protected void composeModuleDefinitionModuleDefinitionDataDateFilterComponentInner(ModuleDefinition.ModuleDefinitionDataDateFilterComponent element) throws IOException {
29582      composeBackbone(element);
29583      if (element.hasPathElement()) {
29584        composeStringCore("path", element.getPathElement(), false);
29585        composeStringExtras("path", element.getPathElement(), false);
29586      }
29587      if (element.hasValue()) {
29588        composeType("value", element.getValue());
29589      }
29590  }
29591
29592  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
29593    if (element != null) {
29594      prop("resourceType", name);
29595      composeNamingSystemInner(element);
29596    }
29597  }
29598
29599  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
29600      composeDomainResourceElements(element);
29601      if (element.hasNameElement()) {
29602        composeStringCore("name", element.getNameElement(), false);
29603        composeStringExtras("name", element.getNameElement(), false);
29604      }
29605      if (element.hasStatusElement()) {
29606        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
29607        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
29608      }
29609      if (element.hasKindElement()) {
29610        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
29611        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
29612      }
29613      if (element.hasDateElement()) {
29614        composeDateTimeCore("date", element.getDateElement(), false);
29615        composeDateTimeExtras("date", element.getDateElement(), false);
29616      }
29617      if (element.hasPublisherElement()) {
29618        composeStringCore("publisher", element.getPublisherElement(), false);
29619        composeStringExtras("publisher", element.getPublisherElement(), false);
29620      }
29621      if (element.hasContact()) {
29622        openArray("contact");
29623        for (NamingSystem.NamingSystemContactComponent e : element.getContact()) 
29624          composeNamingSystemNamingSystemContactComponent(null, e);
29625        closeArray();
29626      };
29627      if (element.hasResponsibleElement()) {
29628        composeStringCore("responsible", element.getResponsibleElement(), false);
29629        composeStringExtras("responsible", element.getResponsibleElement(), false);
29630      }
29631      if (element.hasType()) {
29632        composeCodeableConcept("type", element.getType());
29633      }
29634      if (element.hasDescriptionElement()) {
29635        composeStringCore("description", element.getDescriptionElement(), false);
29636        composeStringExtras("description", element.getDescriptionElement(), false);
29637      }
29638      if (element.hasUseContext()) {
29639        openArray("useContext");
29640        for (CodeableConcept e : element.getUseContext()) 
29641          composeCodeableConcept(null, e);
29642        closeArray();
29643      };
29644      if (element.hasUsageElement()) {
29645        composeStringCore("usage", element.getUsageElement(), false);
29646        composeStringExtras("usage", element.getUsageElement(), false);
29647      }
29648      if (element.hasUniqueId()) {
29649        openArray("uniqueId");
29650        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
29651          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
29652        closeArray();
29653      };
29654      if (element.hasReplacedBy()) {
29655        composeReference("replacedBy", element.getReplacedBy());
29656      }
29657  }
29658
29659  protected void composeNamingSystemNamingSystemContactComponent(String name, NamingSystem.NamingSystemContactComponent element) throws IOException {
29660    if (element != null) {
29661      open(name);
29662      composeNamingSystemNamingSystemContactComponentInner(element);
29663      close();
29664    }
29665  }
29666
29667  protected void composeNamingSystemNamingSystemContactComponentInner(NamingSystem.NamingSystemContactComponent element) throws IOException {
29668      composeBackbone(element);
29669      if (element.hasNameElement()) {
29670        composeStringCore("name", element.getNameElement(), false);
29671        composeStringExtras("name", element.getNameElement(), false);
29672      }
29673      if (element.hasTelecom()) {
29674        openArray("telecom");
29675        for (ContactPoint e : element.getTelecom()) 
29676          composeContactPoint(null, e);
29677        closeArray();
29678      };
29679  }
29680
29681  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
29682    if (element != null) {
29683      open(name);
29684      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
29685      close();
29686    }
29687  }
29688
29689  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
29690      composeBackbone(element);
29691      if (element.hasTypeElement()) {
29692        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
29693        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
29694      }
29695      if (element.hasValueElement()) {
29696        composeStringCore("value", element.getValueElement(), false);
29697        composeStringExtras("value", element.getValueElement(), false);
29698      }
29699      if (element.hasPreferredElement()) {
29700        composeBooleanCore("preferred", element.getPreferredElement(), false);
29701        composeBooleanExtras("preferred", element.getPreferredElement(), false);
29702      }
29703      if (element.hasPeriod()) {
29704        composePeriod("period", element.getPeriod());
29705      }
29706  }
29707
29708  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
29709    if (element != null) {
29710      prop("resourceType", name);
29711      composeNutritionOrderInner(element);
29712    }
29713  }
29714
29715  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
29716      composeDomainResourceElements(element);
29717      if (element.hasIdentifier()) {
29718        openArray("identifier");
29719        for (Identifier e : element.getIdentifier()) 
29720          composeIdentifier(null, e);
29721        closeArray();
29722      };
29723      if (element.hasStatusElement()) {
29724        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
29725        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
29726      }
29727      if (element.hasPatient()) {
29728        composeReference("patient", element.getPatient());
29729      }
29730      if (element.hasEncounter()) {
29731        composeReference("encounter", element.getEncounter());
29732      }
29733      if (element.hasDateTimeElement()) {
29734        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
29735        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
29736      }
29737      if (element.hasOrderer()) {
29738        composeReference("orderer", element.getOrderer());
29739      }
29740      if (element.hasAllergyIntolerance()) {
29741        openArray("allergyIntolerance");
29742        for (Reference e : element.getAllergyIntolerance()) 
29743          composeReference(null, e);
29744        closeArray();
29745      };
29746      if (element.hasFoodPreferenceModifier()) {
29747        openArray("foodPreferenceModifier");
29748        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
29749          composeCodeableConcept(null, e);
29750        closeArray();
29751      };
29752      if (element.hasExcludeFoodModifier()) {
29753        openArray("excludeFoodModifier");
29754        for (CodeableConcept e : element.getExcludeFoodModifier()) 
29755          composeCodeableConcept(null, e);
29756        closeArray();
29757      };
29758      if (element.hasOralDiet()) {
29759        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
29760      }
29761      if (element.hasSupplement()) {
29762        openArray("supplement");
29763        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
29764          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
29765        closeArray();
29766      };
29767      if (element.hasEnteralFormula()) {
29768        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
29769      }
29770  }
29771
29772  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
29773    if (element != null) {
29774      open(name);
29775      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
29776      close();
29777    }
29778  }
29779
29780  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
29781      composeBackbone(element);
29782      if (element.hasType()) {
29783        openArray("type");
29784        for (CodeableConcept e : element.getType()) 
29785          composeCodeableConcept(null, e);
29786        closeArray();
29787      };
29788      if (element.hasSchedule()) {
29789        openArray("schedule");
29790        for (Timing e : element.getSchedule()) 
29791          composeTiming(null, e);
29792        closeArray();
29793      };
29794      if (element.hasNutrient()) {
29795        openArray("nutrient");
29796        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
29797          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
29798        closeArray();
29799      };
29800      if (element.hasTexture()) {
29801        openArray("texture");
29802        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
29803          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
29804        closeArray();
29805      };
29806      if (element.hasFluidConsistencyType()) {
29807        openArray("fluidConsistencyType");
29808        for (CodeableConcept e : element.getFluidConsistencyType()) 
29809          composeCodeableConcept(null, e);
29810        closeArray();
29811      };
29812      if (element.hasInstructionElement()) {
29813        composeStringCore("instruction", element.getInstructionElement(), false);
29814        composeStringExtras("instruction", element.getInstructionElement(), false);
29815      }
29816  }
29817
29818  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
29819    if (element != null) {
29820      open(name);
29821      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
29822      close();
29823    }
29824  }
29825
29826  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
29827      composeBackbone(element);
29828      if (element.hasModifier()) {
29829        composeCodeableConcept("modifier", element.getModifier());
29830      }
29831      if (element.hasAmount()) {
29832        composeSimpleQuantity("amount", element.getAmount());
29833      }
29834  }
29835
29836  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
29837    if (element != null) {
29838      open(name);
29839      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
29840      close();
29841    }
29842  }
29843
29844  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
29845      composeBackbone(element);
29846      if (element.hasModifier()) {
29847        composeCodeableConcept("modifier", element.getModifier());
29848      }
29849      if (element.hasFoodType()) {
29850        composeCodeableConcept("foodType", element.getFoodType());
29851      }
29852  }
29853
29854  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
29855    if (element != null) {
29856      open(name);
29857      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
29858      close();
29859    }
29860  }
29861
29862  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
29863      composeBackbone(element);
29864      if (element.hasType()) {
29865        composeCodeableConcept("type", element.getType());
29866      }
29867      if (element.hasProductNameElement()) {
29868        composeStringCore("productName", element.getProductNameElement(), false);
29869        composeStringExtras("productName", element.getProductNameElement(), false);
29870      }
29871      if (element.hasSchedule()) {
29872        openArray("schedule");
29873        for (Timing e : element.getSchedule()) 
29874          composeTiming(null, e);
29875        closeArray();
29876      };
29877      if (element.hasQuantity()) {
29878        composeSimpleQuantity("quantity", element.getQuantity());
29879      }
29880      if (element.hasInstructionElement()) {
29881        composeStringCore("instruction", element.getInstructionElement(), false);
29882        composeStringExtras("instruction", element.getInstructionElement(), false);
29883      }
29884  }
29885
29886  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
29887    if (element != null) {
29888      open(name);
29889      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
29890      close();
29891    }
29892  }
29893
29894  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
29895      composeBackbone(element);
29896      if (element.hasBaseFormulaType()) {
29897        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
29898      }
29899      if (element.hasBaseFormulaProductNameElement()) {
29900        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
29901        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
29902      }
29903      if (element.hasAdditiveType()) {
29904        composeCodeableConcept("additiveType", element.getAdditiveType());
29905      }
29906      if (element.hasAdditiveProductNameElement()) {
29907        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
29908        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
29909      }
29910      if (element.hasCaloricDensity()) {
29911        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
29912      }
29913      if (element.hasRouteofAdministration()) {
29914        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
29915      }
29916      if (element.hasAdministration()) {
29917        openArray("administration");
29918        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
29919          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
29920        closeArray();
29921      };
29922      if (element.hasMaxVolumeToDeliver()) {
29923        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
29924      }
29925      if (element.hasAdministrationInstructionElement()) {
29926        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
29927        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
29928      }
29929  }
29930
29931  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
29932    if (element != null) {
29933      open(name);
29934      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
29935      close();
29936    }
29937  }
29938
29939  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
29940      composeBackbone(element);
29941      if (element.hasSchedule()) {
29942        composeTiming("schedule", element.getSchedule());
29943      }
29944      if (element.hasQuantity()) {
29945        composeSimpleQuantity("quantity", element.getQuantity());
29946      }
29947      if (element.hasRate()) {
29948        composeType("rate", element.getRate());
29949      }
29950  }
29951
29952  protected void composeObservation(String name, Observation element) throws IOException {
29953    if (element != null) {
29954      prop("resourceType", name);
29955      composeObservationInner(element);
29956    }
29957  }
29958
29959  protected void composeObservationInner(Observation element) throws IOException {
29960      composeDomainResourceElements(element);
29961      if (element.hasIdentifier()) {
29962        openArray("identifier");
29963        for (Identifier e : element.getIdentifier()) 
29964          composeIdentifier(null, e);
29965        closeArray();
29966      };
29967      if (element.hasStatusElement()) {
29968        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
29969        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
29970      }
29971      if (element.hasCategory()) {
29972        composeCodeableConcept("category", element.getCategory());
29973      }
29974      if (element.hasCode()) {
29975        composeCodeableConcept("code", element.getCode());
29976      }
29977      if (element.hasSubject()) {
29978        composeReference("subject", element.getSubject());
29979      }
29980      if (element.hasEncounter()) {
29981        composeReference("encounter", element.getEncounter());
29982      }
29983      if (element.hasEffective()) {
29984        composeType("effective", element.getEffective());
29985      }
29986      if (element.hasIssuedElement()) {
29987        composeInstantCore("issued", element.getIssuedElement(), false);
29988        composeInstantExtras("issued", element.getIssuedElement(), false);
29989      }
29990      if (element.hasPerformer()) {
29991        openArray("performer");
29992        for (Reference e : element.getPerformer()) 
29993          composeReference(null, e);
29994        closeArray();
29995      };
29996      if (element.hasValue()) {
29997        composeType("value", element.getValue());
29998      }
29999      if (element.hasDataAbsentReason()) {
30000        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
30001      }
30002      if (element.hasInterpretation()) {
30003        composeCodeableConcept("interpretation", element.getInterpretation());
30004      }
30005      if (element.hasCommentElement()) {
30006        composeStringCore("comment", element.getCommentElement(), false);
30007        composeStringExtras("comment", element.getCommentElement(), false);
30008      }
30009      if (element.hasBodySite()) {
30010        composeCodeableConcept("bodySite", element.getBodySite());
30011      }
30012      if (element.hasMethod()) {
30013        composeCodeableConcept("method", element.getMethod());
30014      }
30015      if (element.hasSpecimen()) {
30016        composeReference("specimen", element.getSpecimen());
30017      }
30018      if (element.hasDevice()) {
30019        composeReference("device", element.getDevice());
30020      }
30021      if (element.hasReferenceRange()) {
30022        openArray("referenceRange");
30023        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
30024          composeObservationObservationReferenceRangeComponent(null, e);
30025        closeArray();
30026      };
30027      if (element.hasRelated()) {
30028        openArray("related");
30029        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
30030          composeObservationObservationRelatedComponent(null, e);
30031        closeArray();
30032      };
30033      if (element.hasComponent()) {
30034        openArray("component");
30035        for (Observation.ObservationComponentComponent e : element.getComponent()) 
30036          composeObservationObservationComponentComponent(null, e);
30037        closeArray();
30038      };
30039  }
30040
30041  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
30042    if (element != null) {
30043      open(name);
30044      composeObservationObservationReferenceRangeComponentInner(element);
30045      close();
30046    }
30047  }
30048
30049  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
30050      composeBackbone(element);
30051      if (element.hasLow()) {
30052        composeSimpleQuantity("low", element.getLow());
30053      }
30054      if (element.hasHigh()) {
30055        composeSimpleQuantity("high", element.getHigh());
30056      }
30057      if (element.hasMeaning()) {
30058        composeCodeableConcept("meaning", element.getMeaning());
30059      }
30060      if (element.hasAge()) {
30061        composeRange("age", element.getAge());
30062      }
30063      if (element.hasTextElement()) {
30064        composeStringCore("text", element.getTextElement(), false);
30065        composeStringExtras("text", element.getTextElement(), false);
30066      }
30067  }
30068
30069  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
30070    if (element != null) {
30071      open(name);
30072      composeObservationObservationRelatedComponentInner(element);
30073      close();
30074    }
30075  }
30076
30077  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
30078      composeBackbone(element);
30079      if (element.hasTypeElement()) {
30080        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
30081        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
30082      }
30083      if (element.hasTarget()) {
30084        composeReference("target", element.getTarget());
30085      }
30086  }
30087
30088  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
30089    if (element != null) {
30090      open(name);
30091      composeObservationObservationComponentComponentInner(element);
30092      close();
30093    }
30094  }
30095
30096  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
30097      composeBackbone(element);
30098      if (element.hasCode()) {
30099        composeCodeableConcept("code", element.getCode());
30100      }
30101      if (element.hasValue()) {
30102        composeType("value", element.getValue());
30103      }
30104      if (element.hasDataAbsentReason()) {
30105        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
30106      }
30107      if (element.hasReferenceRange()) {
30108        openArray("referenceRange");
30109        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
30110          composeObservationObservationReferenceRangeComponent(null, e);
30111        closeArray();
30112      };
30113  }
30114
30115  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
30116    if (element != null) {
30117      prop("resourceType", name);
30118      composeOperationDefinitionInner(element);
30119    }
30120  }
30121
30122  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
30123      composeDomainResourceElements(element);
30124      if (element.hasUrlElement()) {
30125        composeUriCore("url", element.getUrlElement(), false);
30126        composeUriExtras("url", element.getUrlElement(), false);
30127      }
30128      if (element.hasVersionElement()) {
30129        composeStringCore("version", element.getVersionElement(), false);
30130        composeStringExtras("version", element.getVersionElement(), false);
30131      }
30132      if (element.hasNameElement()) {
30133        composeStringCore("name", element.getNameElement(), false);
30134        composeStringExtras("name", element.getNameElement(), false);
30135      }
30136      if (element.hasStatusElement()) {
30137        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
30138        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
30139      }
30140      if (element.hasKindElement()) {
30141        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
30142        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
30143      }
30144      if (element.hasExperimentalElement()) {
30145        composeBooleanCore("experimental", element.getExperimentalElement(), false);
30146        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
30147      }
30148      if (element.hasDateElement()) {
30149        composeDateTimeCore("date", element.getDateElement(), false);
30150        composeDateTimeExtras("date", element.getDateElement(), false);
30151      }
30152      if (element.hasPublisherElement()) {
30153        composeStringCore("publisher", element.getPublisherElement(), false);
30154        composeStringExtras("publisher", element.getPublisherElement(), false);
30155      }
30156      if (element.hasContact()) {
30157        openArray("contact");
30158        for (OperationDefinition.OperationDefinitionContactComponent e : element.getContact()) 
30159          composeOperationDefinitionOperationDefinitionContactComponent(null, e);
30160        closeArray();
30161      };
30162      if (element.hasDescriptionElement()) {
30163        composeStringCore("description", element.getDescriptionElement(), false);
30164        composeStringExtras("description", element.getDescriptionElement(), false);
30165      }
30166      if (element.hasUseContext()) {
30167        openArray("useContext");
30168        for (CodeableConcept e : element.getUseContext()) 
30169          composeCodeableConcept(null, e);
30170        closeArray();
30171      };
30172      if (element.hasRequirementsElement()) {
30173        composeStringCore("requirements", element.getRequirementsElement(), false);
30174        composeStringExtras("requirements", element.getRequirementsElement(), false);
30175      }
30176      if (element.hasIdempotentElement()) {
30177        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
30178        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
30179      }
30180      if (element.hasCodeElement()) {
30181        composeCodeCore("code", element.getCodeElement(), false);
30182        composeCodeExtras("code", element.getCodeElement(), false);
30183      }
30184      if (element.hasCommentElement()) {
30185        composeStringCore("comment", element.getCommentElement(), false);
30186        composeStringExtras("comment", element.getCommentElement(), false);
30187      }
30188      if (element.hasBase()) {
30189        composeReference("base", element.getBase());
30190      }
30191      if (element.hasSystemElement()) {
30192        composeBooleanCore("system", element.getSystemElement(), false);
30193        composeBooleanExtras("system", element.getSystemElement(), false);
30194      }
30195      if (element.hasType()) {
30196        openArray("type");
30197        for (CodeType e : element.getType()) 
30198          composeCodeCore(null, e, true);
30199        closeArray();
30200        if (anyHasExtras(element.getType())) {
30201          openArray("_type");
30202          for (CodeType e : element.getType()) 
30203            composeCodeExtras(null, e, true);
30204          closeArray();
30205        }
30206      };
30207      if (element.hasInstanceElement()) {
30208        composeBooleanCore("instance", element.getInstanceElement(), false);
30209        composeBooleanExtras("instance", element.getInstanceElement(), false);
30210      }
30211      if (element.hasParameter()) {
30212        openArray("parameter");
30213        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
30214          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
30215        closeArray();
30216      };
30217  }
30218
30219  protected void composeOperationDefinitionOperationDefinitionContactComponent(String name, OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
30220    if (element != null) {
30221      open(name);
30222      composeOperationDefinitionOperationDefinitionContactComponentInner(element);
30223      close();
30224    }
30225  }
30226
30227  protected void composeOperationDefinitionOperationDefinitionContactComponentInner(OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
30228      composeBackbone(element);
30229      if (element.hasNameElement()) {
30230        composeStringCore("name", element.getNameElement(), false);
30231        composeStringExtras("name", element.getNameElement(), false);
30232      }
30233      if (element.hasTelecom()) {
30234        openArray("telecom");
30235        for (ContactPoint e : element.getTelecom()) 
30236          composeContactPoint(null, e);
30237        closeArray();
30238      };
30239  }
30240
30241  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
30242    if (element != null) {
30243      open(name);
30244      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
30245      close();
30246    }
30247  }
30248
30249  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
30250      composeBackbone(element);
30251      if (element.hasNameElement()) {
30252        composeCodeCore("name", element.getNameElement(), false);
30253        composeCodeExtras("name", element.getNameElement(), false);
30254      }
30255      if (element.hasUseElement()) {
30256        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
30257        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
30258      }
30259      if (element.hasMinElement()) {
30260        composeIntegerCore("min", element.getMinElement(), false);
30261        composeIntegerExtras("min", element.getMinElement(), false);
30262      }
30263      if (element.hasMaxElement()) {
30264        composeStringCore("max", element.getMaxElement(), false);
30265        composeStringExtras("max", element.getMaxElement(), false);
30266      }
30267      if (element.hasDocumentationElement()) {
30268        composeStringCore("documentation", element.getDocumentationElement(), false);
30269        composeStringExtras("documentation", element.getDocumentationElement(), false);
30270      }
30271      if (element.hasTypeElement()) {
30272        composeCodeCore("type", element.getTypeElement(), false);
30273        composeCodeExtras("type", element.getTypeElement(), false);
30274      }
30275      if (element.hasSearchTypeElement()) {
30276        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
30277        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
30278      }
30279      if (element.hasProfile()) {
30280        composeReference("profile", element.getProfile());
30281      }
30282      if (element.hasBinding()) {
30283        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
30284      }
30285      if (element.hasPart()) {
30286        openArray("part");
30287        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
30288          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
30289        closeArray();
30290      };
30291  }
30292
30293  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
30294    if (element != null) {
30295      open(name);
30296      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
30297      close();
30298    }
30299  }
30300
30301  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
30302      composeBackbone(element);
30303      if (element.hasStrengthElement()) {
30304        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30305        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30306      }
30307      if (element.hasValueSet()) {
30308        composeType("valueSet", element.getValueSet());
30309      }
30310  }
30311
30312  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
30313    if (element != null) {
30314      prop("resourceType", name);
30315      composeOperationOutcomeInner(element);
30316    }
30317  }
30318
30319  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
30320      composeDomainResourceElements(element);
30321      if (element.hasIssue()) {
30322        openArray("issue");
30323        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
30324          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
30325        closeArray();
30326      };
30327  }
30328
30329  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
30330    if (element != null) {
30331      open(name);
30332      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
30333      close();
30334    }
30335  }
30336
30337  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
30338      composeBackbone(element);
30339      if (element.hasSeverityElement()) {
30340        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
30341        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
30342      }
30343      if (element.hasCodeElement()) {
30344        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
30345        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
30346      }
30347      if (element.hasDetails()) {
30348        composeCodeableConcept("details", element.getDetails());
30349      }
30350      if (element.hasDiagnosticsElement()) {
30351        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
30352        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
30353      }
30354      if (element.hasLocation()) {
30355        openArray("location");
30356        for (StringType e : element.getLocation()) 
30357          composeStringCore(null, e, true);
30358        closeArray();
30359        if (anyHasExtras(element.getLocation())) {
30360          openArray("_location");
30361          for (StringType e : element.getLocation()) 
30362            composeStringExtras(null, e, true);
30363          closeArray();
30364        }
30365      };
30366      if (element.hasExpression()) {
30367        openArray("expression");
30368        for (StringType e : element.getExpression()) 
30369          composeStringCore(null, e, true);
30370        closeArray();
30371        if (anyHasExtras(element.getExpression())) {
30372          openArray("_expression");
30373          for (StringType e : element.getExpression()) 
30374            composeStringExtras(null, e, true);
30375          closeArray();
30376        }
30377      };
30378  }
30379
30380  protected void composeOrder(String name, Order element) throws IOException {
30381    if (element != null) {
30382      prop("resourceType", name);
30383      composeOrderInner(element);
30384    }
30385  }
30386
30387  protected void composeOrderInner(Order element) throws IOException {
30388      composeDomainResourceElements(element);
30389      if (element.hasIdentifier()) {
30390        openArray("identifier");
30391        for (Identifier e : element.getIdentifier()) 
30392          composeIdentifier(null, e);
30393        closeArray();
30394      };
30395      if (element.hasDateElement()) {
30396        composeDateTimeCore("date", element.getDateElement(), false);
30397        composeDateTimeExtras("date", element.getDateElement(), false);
30398      }
30399      if (element.hasSubject()) {
30400        composeReference("subject", element.getSubject());
30401      }
30402      if (element.hasSource()) {
30403        composeReference("source", element.getSource());
30404      }
30405      if (element.hasTarget()) {
30406        composeReference("target", element.getTarget());
30407      }
30408      if (element.hasReason()) {
30409        composeType("reason", element.getReason());
30410      }
30411      if (element.hasWhen()) {
30412        composeOrderOrderWhenComponent("when", element.getWhen());
30413      }
30414      if (element.hasDetail()) {
30415        openArray("detail");
30416        for (Reference e : element.getDetail()) 
30417          composeReference(null, e);
30418        closeArray();
30419      };
30420  }
30421
30422  protected void composeOrderOrderWhenComponent(String name, Order.OrderWhenComponent element) throws IOException {
30423    if (element != null) {
30424      open(name);
30425      composeOrderOrderWhenComponentInner(element);
30426      close();
30427    }
30428  }
30429
30430  protected void composeOrderOrderWhenComponentInner(Order.OrderWhenComponent element) throws IOException {
30431      composeBackbone(element);
30432      if (element.hasCode()) {
30433        composeCodeableConcept("code", element.getCode());
30434      }
30435      if (element.hasSchedule()) {
30436        composeTiming("schedule", element.getSchedule());
30437      }
30438  }
30439
30440  protected void composeOrderResponse(String name, OrderResponse element) throws IOException {
30441    if (element != null) {
30442      prop("resourceType", name);
30443      composeOrderResponseInner(element);
30444    }
30445  }
30446
30447  protected void composeOrderResponseInner(OrderResponse element) throws IOException {
30448      composeDomainResourceElements(element);
30449      if (element.hasIdentifier()) {
30450        openArray("identifier");
30451        for (Identifier e : element.getIdentifier()) 
30452          composeIdentifier(null, e);
30453        closeArray();
30454      };
30455      if (element.hasRequest()) {
30456        composeReference("request", element.getRequest());
30457      }
30458      if (element.hasDateElement()) {
30459        composeDateTimeCore("date", element.getDateElement(), false);
30460        composeDateTimeExtras("date", element.getDateElement(), false);
30461      }
30462      if (element.hasWho()) {
30463        composeReference("who", element.getWho());
30464      }
30465      if (element.hasOrderStatusElement()) {
30466        composeEnumerationCore("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
30467        composeEnumerationExtras("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
30468      }
30469      if (element.hasDescriptionElement()) {
30470        composeStringCore("description", element.getDescriptionElement(), false);
30471        composeStringExtras("description", element.getDescriptionElement(), false);
30472      }
30473      if (element.hasFulfillment()) {
30474        openArray("fulfillment");
30475        for (Reference e : element.getFulfillment()) 
30476          composeReference(null, e);
30477        closeArray();
30478      };
30479  }
30480
30481  protected void composeOrderSet(String name, OrderSet element) throws IOException {
30482    if (element != null) {
30483      prop("resourceType", name);
30484      composeOrderSetInner(element);
30485    }
30486  }
30487
30488  protected void composeOrderSetInner(OrderSet element) throws IOException {
30489      composeDomainResourceElements(element);
30490      if (element.hasModuleMetadata()) {
30491        composeModuleMetadata("moduleMetadata", element.getModuleMetadata());
30492      }
30493      if (element.hasLibrary()) {
30494        openArray("library");
30495        for (Reference e : element.getLibrary()) 
30496          composeReference(null, e);
30497        closeArray();
30498      };
30499      if (element.hasAction()) {
30500        openArray("action");
30501        for (ActionDefinition e : element.getAction()) 
30502          composeActionDefinition(null, e);
30503        closeArray();
30504      };
30505  }
30506
30507  protected void composeOrganization(String name, Organization element) throws IOException {
30508    if (element != null) {
30509      prop("resourceType", name);
30510      composeOrganizationInner(element);
30511    }
30512  }
30513
30514  protected void composeOrganizationInner(Organization element) throws IOException {
30515      composeDomainResourceElements(element);
30516      if (element.hasIdentifier()) {
30517        openArray("identifier");
30518        for (Identifier e : element.getIdentifier()) 
30519          composeIdentifier(null, e);
30520        closeArray();
30521      };
30522      if (element.hasActiveElement()) {
30523        composeBooleanCore("active", element.getActiveElement(), false);
30524        composeBooleanExtras("active", element.getActiveElement(), false);
30525      }
30526      if (element.hasType()) {
30527        composeCodeableConcept("type", element.getType());
30528      }
30529      if (element.hasNameElement()) {
30530        composeStringCore("name", element.getNameElement(), false);
30531        composeStringExtras("name", element.getNameElement(), false);
30532      }
30533      if (element.hasTelecom()) {
30534        openArray("telecom");
30535        for (ContactPoint e : element.getTelecom()) 
30536          composeContactPoint(null, e);
30537        closeArray();
30538      };
30539      if (element.hasAddress()) {
30540        openArray("address");
30541        for (Address e : element.getAddress()) 
30542          composeAddress(null, e);
30543        closeArray();
30544      };
30545      if (element.hasPartOf()) {
30546        composeReference("partOf", element.getPartOf());
30547      }
30548      if (element.hasContact()) {
30549        openArray("contact");
30550        for (Organization.OrganizationContactComponent e : element.getContact()) 
30551          composeOrganizationOrganizationContactComponent(null, e);
30552        closeArray();
30553      };
30554  }
30555
30556  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
30557    if (element != null) {
30558      open(name);
30559      composeOrganizationOrganizationContactComponentInner(element);
30560      close();
30561    }
30562  }
30563
30564  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
30565      composeBackbone(element);
30566      if (element.hasPurpose()) {
30567        composeCodeableConcept("purpose", element.getPurpose());
30568      }
30569      if (element.hasName()) {
30570        composeHumanName("name", element.getName());
30571      }
30572      if (element.hasTelecom()) {
30573        openArray("telecom");
30574        for (ContactPoint e : element.getTelecom()) 
30575          composeContactPoint(null, e);
30576        closeArray();
30577      };
30578      if (element.hasAddress()) {
30579        composeAddress("address", element.getAddress());
30580      }
30581  }
30582
30583  protected void composePatient(String name, Patient element) throws IOException {
30584    if (element != null) {
30585      prop("resourceType", name);
30586      composePatientInner(element);
30587    }
30588  }
30589
30590  protected void composePatientInner(Patient element) throws IOException {
30591      composeDomainResourceElements(element);
30592      if (element.hasIdentifier()) {
30593        openArray("identifier");
30594        for (Identifier e : element.getIdentifier()) 
30595          composeIdentifier(null, e);
30596        closeArray();
30597      };
30598      if (element.hasActiveElement()) {
30599        composeBooleanCore("active", element.getActiveElement(), false);
30600        composeBooleanExtras("active", element.getActiveElement(), false);
30601      }
30602      if (element.hasName()) {
30603        openArray("name");
30604        for (HumanName e : element.getName()) 
30605          composeHumanName(null, e);
30606        closeArray();
30607      };
30608      if (element.hasTelecom()) {
30609        openArray("telecom");
30610        for (ContactPoint e : element.getTelecom()) 
30611          composeContactPoint(null, e);
30612        closeArray();
30613      };
30614      if (element.hasGenderElement()) {
30615        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30616        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30617      }
30618      if (element.hasBirthDateElement()) {
30619        composeDateCore("birthDate", element.getBirthDateElement(), false);
30620        composeDateExtras("birthDate", element.getBirthDateElement(), false);
30621      }
30622      if (element.hasDeceased()) {
30623        composeType("deceased", element.getDeceased());
30624      }
30625      if (element.hasAddress()) {
30626        openArray("address");
30627        for (Address e : element.getAddress()) 
30628          composeAddress(null, e);
30629        closeArray();
30630      };
30631      if (element.hasMaritalStatus()) {
30632        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
30633      }
30634      if (element.hasMultipleBirth()) {
30635        composeType("multipleBirth", element.getMultipleBirth());
30636      }
30637      if (element.hasPhoto()) {
30638        openArray("photo");
30639        for (Attachment e : element.getPhoto()) 
30640          composeAttachment(null, e);
30641        closeArray();
30642      };
30643      if (element.hasContact()) {
30644        openArray("contact");
30645        for (Patient.ContactComponent e : element.getContact()) 
30646          composePatientContactComponent(null, e);
30647        closeArray();
30648      };
30649      if (element.hasAnimal()) {
30650        composePatientAnimalComponent("animal", element.getAnimal());
30651      }
30652      if (element.hasCommunication()) {
30653        openArray("communication");
30654        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
30655          composePatientPatientCommunicationComponent(null, e);
30656        closeArray();
30657      };
30658      if (element.hasCareProvider()) {
30659        openArray("careProvider");
30660        for (Reference e : element.getCareProvider()) 
30661          composeReference(null, e);
30662        closeArray();
30663      };
30664      if (element.hasManagingOrganization()) {
30665        composeReference("managingOrganization", element.getManagingOrganization());
30666      }
30667      if (element.hasLink()) {
30668        openArray("link");
30669        for (Patient.PatientLinkComponent e : element.getLink()) 
30670          composePatientPatientLinkComponent(null, e);
30671        closeArray();
30672      };
30673  }
30674
30675  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
30676    if (element != null) {
30677      open(name);
30678      composePatientContactComponentInner(element);
30679      close();
30680    }
30681  }
30682
30683  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
30684      composeBackbone(element);
30685      if (element.hasRelationship()) {
30686        openArray("relationship");
30687        for (CodeableConcept e : element.getRelationship()) 
30688          composeCodeableConcept(null, e);
30689        closeArray();
30690      };
30691      if (element.hasName()) {
30692        composeHumanName("name", element.getName());
30693      }
30694      if (element.hasTelecom()) {
30695        openArray("telecom");
30696        for (ContactPoint e : element.getTelecom()) 
30697          composeContactPoint(null, e);
30698        closeArray();
30699      };
30700      if (element.hasAddress()) {
30701        composeAddress("address", element.getAddress());
30702      }
30703      if (element.hasGenderElement()) {
30704        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30705        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30706      }
30707      if (element.hasOrganization()) {
30708        composeReference("organization", element.getOrganization());
30709      }
30710      if (element.hasPeriod()) {
30711        composePeriod("period", element.getPeriod());
30712      }
30713  }
30714
30715  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
30716    if (element != null) {
30717      open(name);
30718      composePatientAnimalComponentInner(element);
30719      close();
30720    }
30721  }
30722
30723  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
30724      composeBackbone(element);
30725      if (element.hasSpecies()) {
30726        composeCodeableConcept("species", element.getSpecies());
30727      }
30728      if (element.hasBreed()) {
30729        composeCodeableConcept("breed", element.getBreed());
30730      }
30731      if (element.hasGenderStatus()) {
30732        composeCodeableConcept("genderStatus", element.getGenderStatus());
30733      }
30734  }
30735
30736  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
30737    if (element != null) {
30738      open(name);
30739      composePatientPatientCommunicationComponentInner(element);
30740      close();
30741    }
30742  }
30743
30744  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
30745      composeBackbone(element);
30746      if (element.hasLanguage()) {
30747        composeCodeableConcept("language", element.getLanguage());
30748      }
30749      if (element.hasPreferredElement()) {
30750        composeBooleanCore("preferred", element.getPreferredElement(), false);
30751        composeBooleanExtras("preferred", element.getPreferredElement(), false);
30752      }
30753  }
30754
30755  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
30756    if (element != null) {
30757      open(name);
30758      composePatientPatientLinkComponentInner(element);
30759      close();
30760    }
30761  }
30762
30763  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
30764      composeBackbone(element);
30765      if (element.hasOther()) {
30766        composeReference("other", element.getOther());
30767      }
30768      if (element.hasTypeElement()) {
30769        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
30770        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
30771      }
30772  }
30773
30774  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
30775    if (element != null) {
30776      prop("resourceType", name);
30777      composePaymentNoticeInner(element);
30778    }
30779  }
30780
30781  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
30782      composeDomainResourceElements(element);
30783      if (element.hasIdentifier()) {
30784        openArray("identifier");
30785        for (Identifier e : element.getIdentifier()) 
30786          composeIdentifier(null, e);
30787        closeArray();
30788      };
30789      if (element.hasRuleset()) {
30790        composeCoding("ruleset", element.getRuleset());
30791      }
30792      if (element.hasOriginalRuleset()) {
30793        composeCoding("originalRuleset", element.getOriginalRuleset());
30794      }
30795      if (element.hasCreatedElement()) {
30796        composeDateTimeCore("created", element.getCreatedElement(), false);
30797        composeDateTimeExtras("created", element.getCreatedElement(), false);
30798      }
30799      if (element.hasTarget()) {
30800        composeType("target", element.getTarget());
30801      }
30802      if (element.hasProvider()) {
30803        composeType("provider", element.getProvider());
30804      }
30805      if (element.hasOrganization()) {
30806        composeType("organization", element.getOrganization());
30807      }
30808      if (element.hasRequest()) {
30809        composeType("request", element.getRequest());
30810      }
30811      if (element.hasResponse()) {
30812        composeType("response", element.getResponse());
30813      }
30814      if (element.hasPaymentStatus()) {
30815        composeCoding("paymentStatus", element.getPaymentStatus());
30816      }
30817      if (element.hasStatusDateElement()) {
30818        composeDateCore("statusDate", element.getStatusDateElement(), false);
30819        composeDateExtras("statusDate", element.getStatusDateElement(), false);
30820      }
30821  }
30822
30823  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
30824    if (element != null) {
30825      prop("resourceType", name);
30826      composePaymentReconciliationInner(element);
30827    }
30828  }
30829
30830  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
30831      composeDomainResourceElements(element);
30832      if (element.hasIdentifier()) {
30833        openArray("identifier");
30834        for (Identifier e : element.getIdentifier()) 
30835          composeIdentifier(null, e);
30836        closeArray();
30837      };
30838      if (element.hasRequest()) {
30839        composeType("request", element.getRequest());
30840      }
30841      if (element.hasOutcomeElement()) {
30842        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
30843        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
30844      }
30845      if (element.hasDispositionElement()) {
30846        composeStringCore("disposition", element.getDispositionElement(), false);
30847        composeStringExtras("disposition", element.getDispositionElement(), false);
30848      }
30849      if (element.hasRuleset()) {
30850        composeCoding("ruleset", element.getRuleset());
30851      }
30852      if (element.hasOriginalRuleset()) {
30853        composeCoding("originalRuleset", element.getOriginalRuleset());
30854      }
30855      if (element.hasCreatedElement()) {
30856        composeDateTimeCore("created", element.getCreatedElement(), false);
30857        composeDateTimeExtras("created", element.getCreatedElement(), false);
30858      }
30859      if (element.hasPeriod()) {
30860        composePeriod("period", element.getPeriod());
30861      }
30862      if (element.hasOrganization()) {
30863        composeType("organization", element.getOrganization());
30864      }
30865      if (element.hasRequestProvider()) {
30866        composeType("requestProvider", element.getRequestProvider());
30867      }
30868      if (element.hasRequestOrganization()) {
30869        composeType("requestOrganization", element.getRequestOrganization());
30870      }
30871      if (element.hasDetail()) {
30872        openArray("detail");
30873        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
30874          composePaymentReconciliationDetailsComponent(null, e);
30875        closeArray();
30876      };
30877      if (element.hasForm()) {
30878        composeCoding("form", element.getForm());
30879      }
30880      if (element.hasTotal()) {
30881        composeMoney("total", element.getTotal());
30882      }
30883      if (element.hasNote()) {
30884        openArray("note");
30885        for (PaymentReconciliation.NotesComponent e : element.getNote()) 
30886          composePaymentReconciliationNotesComponent(null, e);
30887        closeArray();
30888      };
30889  }
30890
30891  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
30892    if (element != null) {
30893      open(name);
30894      composePaymentReconciliationDetailsComponentInner(element);
30895      close();
30896    }
30897  }
30898
30899  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
30900      composeBackbone(element);
30901      if (element.hasType()) {
30902        composeCoding("type", element.getType());
30903      }
30904      if (element.hasRequest()) {
30905        composeType("request", element.getRequest());
30906      }
30907      if (element.hasResponce()) {
30908        composeType("responce", element.getResponce());
30909      }
30910      if (element.hasSubmitter()) {
30911        composeType("submitter", element.getSubmitter());
30912      }
30913      if (element.hasPayee()) {
30914        composeType("payee", element.getPayee());
30915      }
30916      if (element.hasDateElement()) {
30917        composeDateCore("date", element.getDateElement(), false);
30918        composeDateExtras("date", element.getDateElement(), false);
30919      }
30920      if (element.hasAmount()) {
30921        composeMoney("amount", element.getAmount());
30922      }
30923  }
30924
30925  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
30926    if (element != null) {
30927      open(name);
30928      composePaymentReconciliationNotesComponentInner(element);
30929      close();
30930    }
30931  }
30932
30933  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
30934      composeBackbone(element);
30935      if (element.hasType()) {
30936        composeCoding("type", element.getType());
30937      }
30938      if (element.hasTextElement()) {
30939        composeStringCore("text", element.getTextElement(), false);
30940        composeStringExtras("text", element.getTextElement(), false);
30941      }
30942  }
30943
30944  protected void composePerson(String name, Person element) throws IOException {
30945    if (element != null) {
30946      prop("resourceType", name);
30947      composePersonInner(element);
30948    }
30949  }
30950
30951  protected void composePersonInner(Person element) throws IOException {
30952      composeDomainResourceElements(element);
30953      if (element.hasIdentifier()) {
30954        openArray("identifier");
30955        for (Identifier e : element.getIdentifier()) 
30956          composeIdentifier(null, e);
30957        closeArray();
30958      };
30959      if (element.hasName()) {
30960        openArray("name");
30961        for (HumanName e : element.getName()) 
30962          composeHumanName(null, e);
30963        closeArray();
30964      };
30965      if (element.hasTelecom()) {
30966        openArray("telecom");
30967        for (ContactPoint e : element.getTelecom()) 
30968          composeContactPoint(null, e);
30969        closeArray();
30970      };
30971      if (element.hasGenderElement()) {
30972        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30973        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30974      }
30975      if (element.hasBirthDateElement()) {
30976        composeDateCore("birthDate", element.getBirthDateElement(), false);
30977        composeDateExtras("birthDate", element.getBirthDateElement(), false);
30978      }
30979      if (element.hasAddress()) {
30980        openArray("address");
30981        for (Address e : element.getAddress()) 
30982          composeAddress(null, e);
30983        closeArray();
30984      };
30985      if (element.hasPhoto()) {
30986        composeAttachment("photo", element.getPhoto());
30987      }
30988      if (element.hasManagingOrganization()) {
30989        composeReference("managingOrganization", element.getManagingOrganization());
30990      }
30991      if (element.hasActiveElement()) {
30992        composeBooleanCore("active", element.getActiveElement(), false);
30993        composeBooleanExtras("active", element.getActiveElement(), false);
30994      }
30995      if (element.hasLink()) {
30996        openArray("link");
30997        for (Person.PersonLinkComponent e : element.getLink()) 
30998          composePersonPersonLinkComponent(null, e);
30999        closeArray();
31000      };
31001  }
31002
31003  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
31004    if (element != null) {
31005      open(name);
31006      composePersonPersonLinkComponentInner(element);
31007      close();
31008    }
31009  }
31010
31011  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
31012      composeBackbone(element);
31013      if (element.hasTarget()) {
31014        composeReference("target", element.getTarget());
31015      }
31016      if (element.hasAssuranceElement()) {
31017        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
31018        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
31019      }
31020  }
31021
31022  protected void composePractitioner(String name, Practitioner element) throws IOException {
31023    if (element != null) {
31024      prop("resourceType", name);
31025      composePractitionerInner(element);
31026    }
31027  }
31028
31029  protected void composePractitionerInner(Practitioner element) throws IOException {
31030      composeDomainResourceElements(element);
31031      if (element.hasIdentifier()) {
31032        openArray("identifier");
31033        for (Identifier e : element.getIdentifier()) 
31034          composeIdentifier(null, e);
31035        closeArray();
31036      };
31037      if (element.hasActiveElement()) {
31038        composeBooleanCore("active", element.getActiveElement(), false);
31039        composeBooleanExtras("active", element.getActiveElement(), false);
31040      }
31041      if (element.hasName()) {
31042        openArray("name");
31043        for (HumanName e : element.getName()) 
31044          composeHumanName(null, e);
31045        closeArray();
31046      };
31047      if (element.hasTelecom()) {
31048        openArray("telecom");
31049        for (ContactPoint e : element.getTelecom()) 
31050          composeContactPoint(null, e);
31051        closeArray();
31052      };
31053      if (element.hasAddress()) {
31054        openArray("address");
31055        for (Address e : element.getAddress()) 
31056          composeAddress(null, e);
31057        closeArray();
31058      };
31059      if (element.hasGenderElement()) {
31060        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
31061        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
31062      }
31063      if (element.hasBirthDateElement()) {
31064        composeDateCore("birthDate", element.getBirthDateElement(), false);
31065        composeDateExtras("birthDate", element.getBirthDateElement(), false);
31066      }
31067      if (element.hasPhoto()) {
31068        openArray("photo");
31069        for (Attachment e : element.getPhoto()) 
31070          composeAttachment(null, e);
31071        closeArray();
31072      };
31073      if (element.hasPractitionerRole()) {
31074        openArray("practitionerRole");
31075        for (Practitioner.PractitionerPractitionerRoleComponent e : element.getPractitionerRole()) 
31076          composePractitionerPractitionerPractitionerRoleComponent(null, e);
31077        closeArray();
31078      };
31079      if (element.hasQualification()) {
31080        openArray("qualification");
31081        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
31082          composePractitionerPractitionerQualificationComponent(null, e);
31083        closeArray();
31084      };
31085      if (element.hasCommunication()) {
31086        openArray("communication");
31087        for (CodeableConcept e : element.getCommunication()) 
31088          composeCodeableConcept(null, e);
31089        closeArray();
31090      };
31091  }
31092
31093  protected void composePractitionerPractitionerPractitionerRoleComponent(String name, Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
31094    if (element != null) {
31095      open(name);
31096      composePractitionerPractitionerPractitionerRoleComponentInner(element);
31097      close();
31098    }
31099  }
31100
31101  protected void composePractitionerPractitionerPractitionerRoleComponentInner(Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
31102      composeBackbone(element);
31103      if (element.hasOrganization()) {
31104        composeReference("organization", element.getOrganization());
31105      }
31106      if (element.hasRole()) {
31107        composeCodeableConcept("role", element.getRole());
31108      }
31109      if (element.hasSpecialty()) {
31110        openArray("specialty");
31111        for (CodeableConcept e : element.getSpecialty()) 
31112          composeCodeableConcept(null, e);
31113        closeArray();
31114      };
31115      if (element.hasIdentifier()) {
31116        openArray("identifier");
31117        for (Identifier e : element.getIdentifier()) 
31118          composeIdentifier(null, e);
31119        closeArray();
31120      };
31121      if (element.hasTelecom()) {
31122        openArray("telecom");
31123        for (ContactPoint e : element.getTelecom()) 
31124          composeContactPoint(null, e);
31125        closeArray();
31126      };
31127      if (element.hasPeriod()) {
31128        composePeriod("period", element.getPeriod());
31129      }
31130      if (element.hasLocation()) {
31131        openArray("location");
31132        for (Reference e : element.getLocation()) 
31133          composeReference(null, e);
31134        closeArray();
31135      };
31136      if (element.hasHealthcareService()) {
31137        openArray("healthcareService");
31138        for (Reference e : element.getHealthcareService()) 
31139          composeReference(null, e);
31140        closeArray();
31141      };
31142  }
31143
31144  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
31145    if (element != null) {
31146      open(name);
31147      composePractitionerPractitionerQualificationComponentInner(element);
31148      close();
31149    }
31150  }
31151
31152  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
31153      composeBackbone(element);
31154      if (element.hasIdentifier()) {
31155        openArray("identifier");
31156        for (Identifier e : element.getIdentifier()) 
31157          composeIdentifier(null, e);
31158        closeArray();
31159      };
31160      if (element.hasCode()) {
31161        composeCodeableConcept("code", element.getCode());
31162      }
31163      if (element.hasPeriod()) {
31164        composePeriod("period", element.getPeriod());
31165      }
31166      if (element.hasIssuer()) {
31167        composeReference("issuer", element.getIssuer());
31168      }
31169  }
31170
31171  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
31172    if (element != null) {
31173      prop("resourceType", name);
31174      composePractitionerRoleInner(element);
31175    }
31176  }
31177
31178  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
31179      composeDomainResourceElements(element);
31180      if (element.hasIdentifier()) {
31181        openArray("identifier");
31182        for (Identifier e : element.getIdentifier()) 
31183          composeIdentifier(null, e);
31184        closeArray();
31185      };
31186      if (element.hasActiveElement()) {
31187        composeBooleanCore("active", element.getActiveElement(), false);
31188        composeBooleanExtras("active", element.getActiveElement(), false);
31189      }
31190      if (element.hasPractitioner()) {
31191        composeReference("practitioner", element.getPractitioner());
31192      }
31193      if (element.hasOrganization()) {
31194        composeReference("organization", element.getOrganization());
31195      }
31196      if (element.hasRole()) {
31197        openArray("role");
31198        for (CodeableConcept e : element.getRole()) 
31199          composeCodeableConcept(null, e);
31200        closeArray();
31201      };
31202      if (element.hasSpecialty()) {
31203        openArray("specialty");
31204        for (CodeableConcept e : element.getSpecialty()) 
31205          composeCodeableConcept(null, e);
31206        closeArray();
31207      };
31208      if (element.hasLocation()) {
31209        openArray("location");
31210        for (Reference e : element.getLocation()) 
31211          composeReference(null, e);
31212        closeArray();
31213      };
31214      if (element.hasHealthcareService()) {
31215        openArray("healthcareService");
31216        for (Reference e : element.getHealthcareService()) 
31217          composeReference(null, e);
31218        closeArray();
31219      };
31220      if (element.hasTelecom()) {
31221        openArray("telecom");
31222        for (ContactPoint e : element.getTelecom()) 
31223          composeContactPoint(null, e);
31224        closeArray();
31225      };
31226      if (element.hasPeriod()) {
31227        composePeriod("period", element.getPeriod());
31228      }
31229      if (element.hasAvailableTime()) {
31230        openArray("availableTime");
31231        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
31232          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
31233        closeArray();
31234      };
31235      if (element.hasNotAvailable()) {
31236        openArray("notAvailable");
31237        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
31238          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
31239        closeArray();
31240      };
31241      if (element.hasAvailabilityExceptionsElement()) {
31242        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31243        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31244      }
31245  }
31246
31247  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
31248    if (element != null) {
31249      open(name);
31250      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
31251      close();
31252    }
31253  }
31254
31255  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
31256      composeBackbone(element);
31257      if (element.hasDaysOfWeek()) {
31258        openArray("daysOfWeek");
31259        for (CodeType e : element.getDaysOfWeek()) 
31260          composeCodeCore(null, e, true);
31261        closeArray();
31262        if (anyHasExtras(element.getDaysOfWeek())) {
31263          openArray("_daysOfWeek");
31264          for (CodeType e : element.getDaysOfWeek()) 
31265            composeCodeExtras(null, e, true);
31266          closeArray();
31267        }
31268      };
31269      if (element.hasAllDayElement()) {
31270        composeBooleanCore("allDay", element.getAllDayElement(), false);
31271        composeBooleanExtras("allDay", element.getAllDayElement(), false);
31272      }
31273      if (element.hasAvailableStartTimeElement()) {
31274        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
31275        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
31276      }
31277      if (element.hasAvailableEndTimeElement()) {
31278        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
31279        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
31280      }
31281  }
31282
31283  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
31284    if (element != null) {
31285      open(name);
31286      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
31287      close();
31288    }
31289  }
31290
31291  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
31292      composeBackbone(element);
31293      if (element.hasDescriptionElement()) {
31294        composeStringCore("description", element.getDescriptionElement(), false);
31295        composeStringExtras("description", element.getDescriptionElement(), false);
31296      }
31297      if (element.hasDuring()) {
31298        composePeriod("during", element.getDuring());
31299      }
31300  }
31301
31302  protected void composeProcedure(String name, Procedure element) throws IOException {
31303    if (element != null) {
31304      prop("resourceType", name);
31305      composeProcedureInner(element);
31306    }
31307  }
31308
31309  protected void composeProcedureInner(Procedure element) throws IOException {
31310      composeDomainResourceElements(element);
31311      if (element.hasIdentifier()) {
31312        openArray("identifier");
31313        for (Identifier e : element.getIdentifier()) 
31314          composeIdentifier(null, e);
31315        closeArray();
31316      };
31317      if (element.hasSubject()) {
31318        composeReference("subject", element.getSubject());
31319      }
31320      if (element.hasStatusElement()) {
31321        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
31322        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
31323      }
31324      if (element.hasCategory()) {
31325        composeCodeableConcept("category", element.getCategory());
31326      }
31327      if (element.hasCode()) {
31328        composeCodeableConcept("code", element.getCode());
31329      }
31330      if (element.hasNotPerformedElement()) {
31331        composeBooleanCore("notPerformed", element.getNotPerformedElement(), false);
31332        composeBooleanExtras("notPerformed", element.getNotPerformedElement(), false);
31333      }
31334      if (element.hasReasonNotPerformed()) {
31335        openArray("reasonNotPerformed");
31336        for (CodeableConcept e : element.getReasonNotPerformed()) 
31337          composeCodeableConcept(null, e);
31338        closeArray();
31339      };
31340      if (element.hasBodySite()) {
31341        openArray("bodySite");
31342        for (CodeableConcept e : element.getBodySite()) 
31343          composeCodeableConcept(null, e);
31344        closeArray();
31345      };
31346      if (element.hasReason()) {
31347        composeType("reason", element.getReason());
31348      }
31349      if (element.hasPerformer()) {
31350        openArray("performer");
31351        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
31352          composeProcedureProcedurePerformerComponent(null, e);
31353        closeArray();
31354      };
31355      if (element.hasPerformed()) {
31356        composeType("performed", element.getPerformed());
31357      }
31358      if (element.hasEncounter()) {
31359        composeReference("encounter", element.getEncounter());
31360      }
31361      if (element.hasLocation()) {
31362        composeReference("location", element.getLocation());
31363      }
31364      if (element.hasOutcome()) {
31365        composeCodeableConcept("outcome", element.getOutcome());
31366      }
31367      if (element.hasReport()) {
31368        openArray("report");
31369        for (Reference e : element.getReport()) 
31370          composeReference(null, e);
31371        closeArray();
31372      };
31373      if (element.hasComplication()) {
31374        openArray("complication");
31375        for (CodeableConcept e : element.getComplication()) 
31376          composeCodeableConcept(null, e);
31377        closeArray();
31378      };
31379      if (element.hasFollowUp()) {
31380        openArray("followUp");
31381        for (CodeableConcept e : element.getFollowUp()) 
31382          composeCodeableConcept(null, e);
31383        closeArray();
31384      };
31385      if (element.hasRequest()) {
31386        composeReference("request", element.getRequest());
31387      }
31388      if (element.hasNotes()) {
31389        openArray("notes");
31390        for (Annotation e : element.getNotes()) 
31391          composeAnnotation(null, e);
31392        closeArray();
31393      };
31394      if (element.hasFocalDevice()) {
31395        openArray("focalDevice");
31396        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
31397          composeProcedureProcedureFocalDeviceComponent(null, e);
31398        closeArray();
31399      };
31400      if (element.hasUsed()) {
31401        openArray("used");
31402        for (Reference e : element.getUsed()) 
31403          composeReference(null, e);
31404        closeArray();
31405      };
31406  }
31407
31408  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
31409    if (element != null) {
31410      open(name);
31411      composeProcedureProcedurePerformerComponentInner(element);
31412      close();
31413    }
31414  }
31415
31416  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
31417      composeBackbone(element);
31418      if (element.hasActor()) {
31419        composeReference("actor", element.getActor());
31420      }
31421      if (element.hasRole()) {
31422        composeCodeableConcept("role", element.getRole());
31423      }
31424  }
31425
31426  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
31427    if (element != null) {
31428      open(name);
31429      composeProcedureProcedureFocalDeviceComponentInner(element);
31430      close();
31431    }
31432  }
31433
31434  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
31435      composeBackbone(element);
31436      if (element.hasAction()) {
31437        composeCodeableConcept("action", element.getAction());
31438      }
31439      if (element.hasManipulated()) {
31440        composeReference("manipulated", element.getManipulated());
31441      }
31442  }
31443
31444  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
31445    if (element != null) {
31446      prop("resourceType", name);
31447      composeProcedureRequestInner(element);
31448    }
31449  }
31450
31451  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
31452      composeDomainResourceElements(element);
31453      if (element.hasIdentifier()) {
31454        openArray("identifier");
31455        for (Identifier e : element.getIdentifier()) 
31456          composeIdentifier(null, e);
31457        closeArray();
31458      };
31459      if (element.hasSubject()) {
31460        composeReference("subject", element.getSubject());
31461      }
31462      if (element.hasCode()) {
31463        composeCodeableConcept("code", element.getCode());
31464      }
31465      if (element.hasBodySite()) {
31466        openArray("bodySite");
31467        for (CodeableConcept e : element.getBodySite()) 
31468          composeCodeableConcept(null, e);
31469        closeArray();
31470      };
31471      if (element.hasReason()) {
31472        composeType("reason", element.getReason());
31473      }
31474      if (element.hasScheduled()) {
31475        composeType("scheduled", element.getScheduled());
31476      }
31477      if (element.hasEncounter()) {
31478        composeReference("encounter", element.getEncounter());
31479      }
31480      if (element.hasPerformer()) {
31481        composeReference("performer", element.getPerformer());
31482      }
31483      if (element.hasStatusElement()) {
31484        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
31485        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
31486      }
31487      if (element.hasNotes()) {
31488        openArray("notes");
31489        for (Annotation e : element.getNotes()) 
31490          composeAnnotation(null, e);
31491        closeArray();
31492      };
31493      if (element.hasAsNeeded()) {
31494        composeType("asNeeded", element.getAsNeeded());
31495      }
31496      if (element.hasOrderedOnElement()) {
31497        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
31498        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
31499      }
31500      if (element.hasOrderer()) {
31501        composeReference("orderer", element.getOrderer());
31502      }
31503      if (element.hasPriorityElement()) {
31504        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
31505        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
31506      }
31507  }
31508
31509  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
31510    if (element != null) {
31511      prop("resourceType", name);
31512      composeProcessRequestInner(element);
31513    }
31514  }
31515
31516  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
31517      composeDomainResourceElements(element);
31518      if (element.hasActionElement()) {
31519        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
31520        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
31521      }
31522      if (element.hasIdentifier()) {
31523        openArray("identifier");
31524        for (Identifier e : element.getIdentifier()) 
31525          composeIdentifier(null, e);
31526        closeArray();
31527      };
31528      if (element.hasRuleset()) {
31529        composeCoding("ruleset", element.getRuleset());
31530      }
31531      if (element.hasOriginalRuleset()) {
31532        composeCoding("originalRuleset", element.getOriginalRuleset());
31533      }
31534      if (element.hasCreatedElement()) {
31535        composeDateTimeCore("created", element.getCreatedElement(), false);
31536        composeDateTimeExtras("created", element.getCreatedElement(), false);
31537      }
31538      if (element.hasTarget()) {
31539        composeType("target", element.getTarget());
31540      }
31541      if (element.hasProvider()) {
31542        composeType("provider", element.getProvider());
31543      }
31544      if (element.hasOrganization()) {
31545        composeType("organization", element.getOrganization());
31546      }
31547      if (element.hasRequest()) {
31548        composeType("request", element.getRequest());
31549      }
31550      if (element.hasResponse()) {
31551        composeType("response", element.getResponse());
31552      }
31553      if (element.hasNullifyElement()) {
31554        composeBooleanCore("nullify", element.getNullifyElement(), false);
31555        composeBooleanExtras("nullify", element.getNullifyElement(), false);
31556      }
31557      if (element.hasReferenceElement()) {
31558        composeStringCore("reference", element.getReferenceElement(), false);
31559        composeStringExtras("reference", element.getReferenceElement(), false);
31560      }
31561      if (element.hasItem()) {
31562        openArray("item");
31563        for (ProcessRequest.ItemsComponent e : element.getItem()) 
31564          composeProcessRequestItemsComponent(null, e);
31565        closeArray();
31566      };
31567      if (element.hasInclude()) {
31568        openArray("include");
31569        for (StringType e : element.getInclude()) 
31570          composeStringCore(null, e, true);
31571        closeArray();
31572        if (anyHasExtras(element.getInclude())) {
31573          openArray("_include");
31574          for (StringType e : element.getInclude()) 
31575            composeStringExtras(null, e, true);
31576          closeArray();
31577        }
31578      };
31579      if (element.hasExclude()) {
31580        openArray("exclude");
31581        for (StringType e : element.getExclude()) 
31582          composeStringCore(null, e, true);
31583        closeArray();
31584        if (anyHasExtras(element.getExclude())) {
31585          openArray("_exclude");
31586          for (StringType e : element.getExclude()) 
31587            composeStringExtras(null, e, true);
31588          closeArray();
31589        }
31590      };
31591      if (element.hasPeriod()) {
31592        composePeriod("period", element.getPeriod());
31593      }
31594  }
31595
31596  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
31597    if (element != null) {
31598      open(name);
31599      composeProcessRequestItemsComponentInner(element);
31600      close();
31601    }
31602  }
31603
31604  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
31605      composeBackbone(element);
31606      if (element.hasSequenceLinkIdElement()) {
31607        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
31608        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
31609      }
31610  }
31611
31612  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
31613    if (element != null) {
31614      prop("resourceType", name);
31615      composeProcessResponseInner(element);
31616    }
31617  }
31618
31619  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
31620      composeDomainResourceElements(element);
31621      if (element.hasIdentifier()) {
31622        openArray("identifier");
31623        for (Identifier e : element.getIdentifier()) 
31624          composeIdentifier(null, e);
31625        closeArray();
31626      };
31627      if (element.hasRequest()) {
31628        composeType("request", element.getRequest());
31629      }
31630      if (element.hasOutcome()) {
31631        composeCoding("outcome", element.getOutcome());
31632      }
31633      if (element.hasDispositionElement()) {
31634        composeStringCore("disposition", element.getDispositionElement(), false);
31635        composeStringExtras("disposition", element.getDispositionElement(), false);
31636      }
31637      if (element.hasRuleset()) {
31638        composeCoding("ruleset", element.getRuleset());
31639      }
31640      if (element.hasOriginalRuleset()) {
31641        composeCoding("originalRuleset", element.getOriginalRuleset());
31642      }
31643      if (element.hasCreatedElement()) {
31644        composeDateTimeCore("created", element.getCreatedElement(), false);
31645        composeDateTimeExtras("created", element.getCreatedElement(), false);
31646      }
31647      if (element.hasOrganization()) {
31648        composeType("organization", element.getOrganization());
31649      }
31650      if (element.hasRequestProvider()) {
31651        composeType("requestProvider", element.getRequestProvider());
31652      }
31653      if (element.hasRequestOrganization()) {
31654        composeType("requestOrganization", element.getRequestOrganization());
31655      }
31656      if (element.hasForm()) {
31657        composeCoding("form", element.getForm());
31658      }
31659      if (element.hasNotes()) {
31660        openArray("notes");
31661        for (ProcessResponse.ProcessResponseNotesComponent e : element.getNotes()) 
31662          composeProcessResponseProcessResponseNotesComponent(null, e);
31663        closeArray();
31664      };
31665      if (element.hasError()) {
31666        openArray("error");
31667        for (Coding e : element.getError()) 
31668          composeCoding(null, e);
31669        closeArray();
31670      };
31671  }
31672
31673  protected void composeProcessResponseProcessResponseNotesComponent(String name, ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
31674    if (element != null) {
31675      open(name);
31676      composeProcessResponseProcessResponseNotesComponentInner(element);
31677      close();
31678    }
31679  }
31680
31681  protected void composeProcessResponseProcessResponseNotesComponentInner(ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
31682      composeBackbone(element);
31683      if (element.hasType()) {
31684        composeCoding("type", element.getType());
31685      }
31686      if (element.hasTextElement()) {
31687        composeStringCore("text", element.getTextElement(), false);
31688        composeStringExtras("text", element.getTextElement(), false);
31689      }
31690  }
31691
31692  protected void composeProtocol(String name, Protocol element) throws IOException {
31693    if (element != null) {
31694      prop("resourceType", name);
31695      composeProtocolInner(element);
31696    }
31697  }
31698
31699  protected void composeProtocolInner(Protocol element) throws IOException {
31700      composeDomainResourceElements(element);
31701      if (element.hasIdentifier()) {
31702        openArray("identifier");
31703        for (Identifier e : element.getIdentifier()) 
31704          composeIdentifier(null, e);
31705        closeArray();
31706      };
31707      if (element.hasTitleElement()) {
31708        composeStringCore("title", element.getTitleElement(), false);
31709        composeStringExtras("title", element.getTitleElement(), false);
31710      }
31711      if (element.hasStatusElement()) {
31712        composeEnumerationCore("status", element.getStatusElement(), new Protocol.ProtocolStatusEnumFactory(), false);
31713        composeEnumerationExtras("status", element.getStatusElement(), new Protocol.ProtocolStatusEnumFactory(), false);
31714      }
31715      if (element.hasTypeElement()) {
31716        composeEnumerationCore("type", element.getTypeElement(), new Protocol.ProtocolTypeEnumFactory(), false);
31717        composeEnumerationExtras("type", element.getTypeElement(), new Protocol.ProtocolTypeEnumFactory(), false);
31718      }
31719      if (element.hasSubject()) {
31720        composeReference("subject", element.getSubject());
31721      }
31722      if (element.hasGroup()) {
31723        composeReference("group", element.getGroup());
31724      }
31725      if (element.hasPurposeElement()) {
31726        composeStringCore("purpose", element.getPurposeElement(), false);
31727        composeStringExtras("purpose", element.getPurposeElement(), false);
31728      }
31729      if (element.hasAuthor()) {
31730        composeReference("author", element.getAuthor());
31731      }
31732      if (element.hasStep()) {
31733        openArray("step");
31734        for (Protocol.ProtocolStepComponent e : element.getStep()) 
31735          composeProtocolProtocolStepComponent(null, e);
31736        closeArray();
31737      };
31738  }
31739
31740  protected void composeProtocolProtocolStepComponent(String name, Protocol.ProtocolStepComponent element) throws IOException {
31741    if (element != null) {
31742      open(name);
31743      composeProtocolProtocolStepComponentInner(element);
31744      close();
31745    }
31746  }
31747
31748  protected void composeProtocolProtocolStepComponentInner(Protocol.ProtocolStepComponent element) throws IOException {
31749      composeBackbone(element);
31750      if (element.hasNameElement()) {
31751        composeStringCore("name", element.getNameElement(), false);
31752        composeStringExtras("name", element.getNameElement(), false);
31753      }
31754      if (element.hasDescriptionElement()) {
31755        composeStringCore("description", element.getDescriptionElement(), false);
31756        composeStringExtras("description", element.getDescriptionElement(), false);
31757      }
31758      if (element.hasDuration()) {
31759        composeDuration("duration", element.getDuration());
31760      }
31761      if (element.hasPrecondition()) {
31762        composeProtocolProtocolStepPreconditionComponent("precondition", element.getPrecondition());
31763      }
31764      if (element.hasExit()) {
31765        composeProtocolProtocolStepPreconditionComponent("exit", element.getExit());
31766      }
31767      if (element.hasFirstActivityElement()) {
31768        composeUriCore("firstActivity", element.getFirstActivityElement(), false);
31769        composeUriExtras("firstActivity", element.getFirstActivityElement(), false);
31770      }
31771      if (element.hasActivity()) {
31772        openArray("activity");
31773        for (Protocol.ProtocolStepActivityComponent e : element.getActivity()) 
31774          composeProtocolProtocolStepActivityComponent(null, e);
31775        closeArray();
31776      };
31777      if (element.hasNext()) {
31778        openArray("next");
31779        for (Protocol.ProtocolStepNextComponent e : element.getNext()) 
31780          composeProtocolProtocolStepNextComponent(null, e);
31781        closeArray();
31782      };
31783  }
31784
31785  protected void composeProtocolProtocolStepPreconditionComponent(String name, Protocol.ProtocolStepPreconditionComponent element) throws IOException {
31786    if (element != null) {
31787      open(name);
31788      composeProtocolProtocolStepPreconditionComponentInner(element);
31789      close();
31790    }
31791  }
31792
31793  protected void composeProtocolProtocolStepPreconditionComponentInner(Protocol.ProtocolStepPreconditionComponent element) throws IOException {
31794      composeBackbone(element);
31795      if (element.hasDescriptionElement()) {
31796        composeStringCore("description", element.getDescriptionElement(), false);
31797        composeStringExtras("description", element.getDescriptionElement(), false);
31798      }
31799      if (element.hasCondition()) {
31800        composeProtocolProtocolStepPreconditionConditionComponent("condition", element.getCondition());
31801      }
31802      if (element.hasIntersection()) {
31803        openArray("intersection");
31804        for (Protocol.ProtocolStepPreconditionComponent e : element.getIntersection()) 
31805          composeProtocolProtocolStepPreconditionComponent(null, e);
31806        closeArray();
31807      };
31808      if (element.hasUnion()) {
31809        openArray("union");
31810        for (Protocol.ProtocolStepPreconditionComponent e : element.getUnion()) 
31811          composeProtocolProtocolStepPreconditionComponent(null, e);
31812        closeArray();
31813      };
31814      if (element.hasExclude()) {
31815        openArray("exclude");
31816        for (Protocol.ProtocolStepPreconditionComponent e : element.getExclude()) 
31817          composeProtocolProtocolStepPreconditionComponent(null, e);
31818        closeArray();
31819      };
31820  }
31821
31822  protected void composeProtocolProtocolStepPreconditionConditionComponent(String name, Protocol.ProtocolStepPreconditionConditionComponent element) throws IOException {
31823    if (element != null) {
31824      open(name);
31825      composeProtocolProtocolStepPreconditionConditionComponentInner(element);
31826      close();
31827    }
31828  }
31829
31830  protected void composeProtocolProtocolStepPreconditionConditionComponentInner(Protocol.ProtocolStepPreconditionConditionComponent element) throws IOException {
31831      composeBackbone(element);
31832      if (element.hasType()) {
31833        composeCodeableConcept("type", element.getType());
31834      }
31835      if (element.hasValue()) {
31836        composeType("value", element.getValue());
31837      }
31838  }
31839
31840  protected void composeProtocolProtocolStepActivityComponent(String name, Protocol.ProtocolStepActivityComponent element) throws IOException {
31841    if (element != null) {
31842      open(name);
31843      composeProtocolProtocolStepActivityComponentInner(element);
31844      close();
31845    }
31846  }
31847
31848  protected void composeProtocolProtocolStepActivityComponentInner(Protocol.ProtocolStepActivityComponent element) throws IOException {
31849      composeBackbone(element);
31850      if (element.hasAlternative()) {
31851        openArray("alternative");
31852        for (UriType e : element.getAlternative()) 
31853          composeUriCore(null, e, true);
31854        closeArray();
31855        if (anyHasExtras(element.getAlternative())) {
31856          openArray("_alternative");
31857          for (UriType e : element.getAlternative()) 
31858            composeUriExtras(null, e, true);
31859          closeArray();
31860        }
31861      };
31862      if (element.hasComponent()) {
31863        openArray("component");
31864        for (Protocol.ProtocolStepActivityComponentComponent e : element.getComponent()) 
31865          composeProtocolProtocolStepActivityComponentComponent(null, e);
31866        closeArray();
31867      };
31868      if (element.hasFollowing()) {
31869        openArray("following");
31870        for (UriType e : element.getFollowing()) 
31871          composeUriCore(null, e, true);
31872        closeArray();
31873        if (anyHasExtras(element.getFollowing())) {
31874          openArray("_following");
31875          for (UriType e : element.getFollowing()) 
31876            composeUriExtras(null, e, true);
31877          closeArray();
31878        }
31879      };
31880      if (element.hasWait()) {
31881        composeDuration("wait", element.getWait());
31882      }
31883      if (element.hasDetail()) {
31884        composeProtocolProtocolStepActivityDetailComponent("detail", element.getDetail());
31885      }
31886  }
31887
31888  protected void composeProtocolProtocolStepActivityComponentComponent(String name, Protocol.ProtocolStepActivityComponentComponent element) throws IOException {
31889    if (element != null) {
31890      open(name);
31891      composeProtocolProtocolStepActivityComponentComponentInner(element);
31892      close();
31893    }
31894  }
31895
31896  protected void composeProtocolProtocolStepActivityComponentComponentInner(Protocol.ProtocolStepActivityComponentComponent element) throws IOException {
31897      composeBackbone(element);
31898      if (element.hasSequenceElement()) {
31899        composeIntegerCore("sequence", element.getSequenceElement(), false);
31900        composeIntegerExtras("sequence", element.getSequenceElement(), false);
31901      }
31902      if (element.hasActivityElement()) {
31903        composeUriCore("activity", element.getActivityElement(), false);
31904        composeUriExtras("activity", element.getActivityElement(), false);
31905      }
31906  }
31907
31908  protected void composeProtocolProtocolStepActivityDetailComponent(String name, Protocol.ProtocolStepActivityDetailComponent element) throws IOException {
31909    if (element != null) {
31910      open(name);
31911      composeProtocolProtocolStepActivityDetailComponentInner(element);
31912      close();
31913    }
31914  }
31915
31916  protected void composeProtocolProtocolStepActivityDetailComponentInner(Protocol.ProtocolStepActivityDetailComponent element) throws IOException {
31917      composeBackbone(element);
31918      if (element.hasCategoryElement()) {
31919        composeEnumerationCore("category", element.getCategoryElement(), new Protocol.ActivityDefinitionCategoryEnumFactory(), false);
31920        composeEnumerationExtras("category", element.getCategoryElement(), new Protocol.ActivityDefinitionCategoryEnumFactory(), false);
31921      }
31922      if (element.hasCode()) {
31923        composeCodeableConcept("code", element.getCode());
31924      }
31925      if (element.hasTiming()) {
31926        composeType("timing", element.getTiming());
31927      }
31928      if (element.hasLocation()) {
31929        composeReference("location", element.getLocation());
31930      }
31931      if (element.hasPerformer()) {
31932        openArray("performer");
31933        for (Reference e : element.getPerformer()) 
31934          composeReference(null, e);
31935        closeArray();
31936      };
31937      if (element.hasProduct()) {
31938        composeReference("product", element.getProduct());
31939      }
31940      if (element.hasQuantity()) {
31941        composeSimpleQuantity("quantity", element.getQuantity());
31942      }
31943      if (element.hasDescriptionElement()) {
31944        composeStringCore("description", element.getDescriptionElement(), false);
31945        composeStringExtras("description", element.getDescriptionElement(), false);
31946      }
31947  }
31948
31949  protected void composeProtocolProtocolStepNextComponent(String name, Protocol.ProtocolStepNextComponent element) throws IOException {
31950    if (element != null) {
31951      open(name);
31952      composeProtocolProtocolStepNextComponentInner(element);
31953      close();
31954    }
31955  }
31956
31957  protected void composeProtocolProtocolStepNextComponentInner(Protocol.ProtocolStepNextComponent element) throws IOException {
31958      composeBackbone(element);
31959      if (element.hasDescriptionElement()) {
31960        composeStringCore("description", element.getDescriptionElement(), false);
31961        composeStringExtras("description", element.getDescriptionElement(), false);
31962      }
31963      if (element.hasReferenceElement()) {
31964        composeUriCore("reference", element.getReferenceElement(), false);
31965        composeUriExtras("reference", element.getReferenceElement(), false);
31966      }
31967      if (element.hasCondition()) {
31968        composeProtocolProtocolStepPreconditionComponent("condition", element.getCondition());
31969      }
31970  }
31971
31972  protected void composeProvenance(String name, Provenance element) throws IOException {
31973    if (element != null) {
31974      prop("resourceType", name);
31975      composeProvenanceInner(element);
31976    }
31977  }
31978
31979  protected void composeProvenanceInner(Provenance element) throws IOException {
31980      composeDomainResourceElements(element);
31981      if (element.hasTarget()) {
31982        openArray("target");
31983        for (Reference e : element.getTarget()) 
31984          composeReference(null, e);
31985        closeArray();
31986      };
31987      if (element.hasPeriod()) {
31988        composePeriod("period", element.getPeriod());
31989      }
31990      if (element.hasRecordedElement()) {
31991        composeInstantCore("recorded", element.getRecordedElement(), false);
31992        composeInstantExtras("recorded", element.getRecordedElement(), false);
31993      }
31994      if (element.hasReason()) {
31995        openArray("reason");
31996        for (Coding e : element.getReason()) 
31997          composeCoding(null, e);
31998        closeArray();
31999      };
32000      if (element.hasActivity()) {
32001        composeCoding("activity", element.getActivity());
32002      }
32003      if (element.hasLocation()) {
32004        composeReference("location", element.getLocation());
32005      }
32006      if (element.hasPolicy()) {
32007        openArray("policy");
32008        for (UriType e : element.getPolicy()) 
32009          composeUriCore(null, e, true);
32010        closeArray();
32011        if (anyHasExtras(element.getPolicy())) {
32012          openArray("_policy");
32013          for (UriType e : element.getPolicy()) 
32014            composeUriExtras(null, e, true);
32015          closeArray();
32016        }
32017      };
32018      if (element.hasAgent()) {
32019        openArray("agent");
32020        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
32021          composeProvenanceProvenanceAgentComponent(null, e);
32022        closeArray();
32023      };
32024      if (element.hasEntity()) {
32025        openArray("entity");
32026        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
32027          composeProvenanceProvenanceEntityComponent(null, e);
32028        closeArray();
32029      };
32030      if (element.hasSignature()) {
32031        openArray("signature");
32032        for (Signature e : element.getSignature()) 
32033          composeSignature(null, e);
32034        closeArray();
32035      };
32036  }
32037
32038  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
32039    if (element != null) {
32040      open(name);
32041      composeProvenanceProvenanceAgentComponentInner(element);
32042      close();
32043    }
32044  }
32045
32046  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
32047      composeBackbone(element);
32048      if (element.hasRole()) {
32049        composeCoding("role", element.getRole());
32050      }
32051      if (element.hasActor()) {
32052        composeReference("actor", element.getActor());
32053      }
32054      if (element.hasUserId()) {
32055        composeIdentifier("userId", element.getUserId());
32056      }
32057      if (element.hasRelatedAgent()) {
32058        openArray("relatedAgent");
32059        for (Provenance.ProvenanceAgentRelatedAgentComponent e : element.getRelatedAgent()) 
32060          composeProvenanceProvenanceAgentRelatedAgentComponent(null, e);
32061        closeArray();
32062      };
32063  }
32064
32065  protected void composeProvenanceProvenanceAgentRelatedAgentComponent(String name, Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
32066    if (element != null) {
32067      open(name);
32068      composeProvenanceProvenanceAgentRelatedAgentComponentInner(element);
32069      close();
32070    }
32071  }
32072
32073  protected void composeProvenanceProvenanceAgentRelatedAgentComponentInner(Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
32074      composeBackbone(element);
32075      if (element.hasType()) {
32076        composeCodeableConcept("type", element.getType());
32077      }
32078      if (element.hasTargetElement()) {
32079        composeUriCore("target", element.getTargetElement(), false);
32080        composeUriExtras("target", element.getTargetElement(), false);
32081      }
32082  }
32083
32084  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
32085    if (element != null) {
32086      open(name);
32087      composeProvenanceProvenanceEntityComponentInner(element);
32088      close();
32089    }
32090  }
32091
32092  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
32093      composeBackbone(element);
32094      if (element.hasRoleElement()) {
32095        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
32096        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
32097      }
32098      if (element.hasType()) {
32099        composeCoding("type", element.getType());
32100      }
32101      if (element.hasReferenceElement()) {
32102        composeUriCore("reference", element.getReferenceElement(), false);
32103        composeUriExtras("reference", element.getReferenceElement(), false);
32104      }
32105      if (element.hasDisplayElement()) {
32106        composeStringCore("display", element.getDisplayElement(), false);
32107        composeStringExtras("display", element.getDisplayElement(), false);
32108      }
32109      if (element.hasAgent()) {
32110        composeProvenanceProvenanceAgentComponent("agent", element.getAgent());
32111      }
32112  }
32113
32114  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
32115    if (element != null) {
32116      prop("resourceType", name);
32117      composeQuestionnaireInner(element);
32118    }
32119  }
32120
32121  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
32122      composeDomainResourceElements(element);
32123      if (element.hasUrlElement()) {
32124        composeUriCore("url", element.getUrlElement(), false);
32125        composeUriExtras("url", element.getUrlElement(), false);
32126      }
32127      if (element.hasIdentifier()) {
32128        openArray("identifier");
32129        for (Identifier e : element.getIdentifier()) 
32130          composeIdentifier(null, e);
32131        closeArray();
32132      };
32133      if (element.hasVersionElement()) {
32134        composeStringCore("version", element.getVersionElement(), false);
32135        composeStringExtras("version", element.getVersionElement(), false);
32136      }
32137      if (element.hasStatusElement()) {
32138        composeEnumerationCore("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
32139        composeEnumerationExtras("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
32140      }
32141      if (element.hasDateElement()) {
32142        composeDateTimeCore("date", element.getDateElement(), false);
32143        composeDateTimeExtras("date", element.getDateElement(), false);
32144      }
32145      if (element.hasPublisherElement()) {
32146        composeStringCore("publisher", element.getPublisherElement(), false);
32147        composeStringExtras("publisher", element.getPublisherElement(), false);
32148      }
32149      if (element.hasTelecom()) {
32150        openArray("telecom");
32151        for (ContactPoint e : element.getTelecom()) 
32152          composeContactPoint(null, e);
32153        closeArray();
32154      };
32155      if (element.hasUseContext()) {
32156        openArray("useContext");
32157        for (CodeableConcept e : element.getUseContext()) 
32158          composeCodeableConcept(null, e);
32159        closeArray();
32160      };
32161      if (element.hasTitleElement()) {
32162        composeStringCore("title", element.getTitleElement(), false);
32163        composeStringExtras("title", element.getTitleElement(), false);
32164      }
32165      if (element.hasConcept()) {
32166        openArray("concept");
32167        for (Coding e : element.getConcept()) 
32168          composeCoding(null, e);
32169        closeArray();
32170      };
32171      if (element.hasSubjectType()) {
32172        openArray("subjectType");
32173        for (CodeType e : element.getSubjectType()) 
32174          composeCodeCore(null, e, true);
32175        closeArray();
32176        if (anyHasExtras(element.getSubjectType())) {
32177          openArray("_subjectType");
32178          for (CodeType e : element.getSubjectType()) 
32179            composeCodeExtras(null, e, true);
32180          closeArray();
32181        }
32182      };
32183      if (element.hasItem()) {
32184        openArray("item");
32185        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
32186          composeQuestionnaireQuestionnaireItemComponent(null, e);
32187        closeArray();
32188      };
32189  }
32190
32191  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
32192    if (element != null) {
32193      open(name);
32194      composeQuestionnaireQuestionnaireItemComponentInner(element);
32195      close();
32196    }
32197  }
32198
32199  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
32200      composeBackbone(element);
32201      if (element.hasLinkIdElement()) {
32202        composeStringCore("linkId", element.getLinkIdElement(), false);
32203        composeStringExtras("linkId", element.getLinkIdElement(), false);
32204      }
32205      if (element.hasConcept()) {
32206        openArray("concept");
32207        for (Coding e : element.getConcept()) 
32208          composeCoding(null, e);
32209        closeArray();
32210      };
32211      if (element.hasPrefixElement()) {
32212        composeStringCore("prefix", element.getPrefixElement(), false);
32213        composeStringExtras("prefix", element.getPrefixElement(), false);
32214      }
32215      if (element.hasTextElement()) {
32216        composeStringCore("text", element.getTextElement(), false);
32217        composeStringExtras("text", element.getTextElement(), false);
32218      }
32219      if (element.hasTypeElement()) {
32220        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
32221        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
32222      }
32223      if (element.hasEnableWhen()) {
32224        openArray("enableWhen");
32225        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
32226          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
32227        closeArray();
32228      };
32229      if (element.hasRequiredElement()) {
32230        composeBooleanCore("required", element.getRequiredElement(), false);
32231        composeBooleanExtras("required", element.getRequiredElement(), false);
32232      }
32233      if (element.hasRepeatsElement()) {
32234        composeBooleanCore("repeats", element.getRepeatsElement(), false);
32235        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
32236      }
32237      if (element.hasReadOnlyElement()) {
32238        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
32239        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
32240      }
32241      if (element.hasMaxLengthElement()) {
32242        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
32243        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
32244      }
32245      if (element.hasOptions()) {
32246        composeReference("options", element.getOptions());
32247      }
32248      if (element.hasOption()) {
32249        openArray("option");
32250        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
32251          composeQuestionnaireQuestionnaireItemOptionComponent(null, e);
32252        closeArray();
32253      };
32254      if (element.hasInitial()) {
32255        composeType("initial", element.getInitial());
32256      }
32257      if (element.hasItem()) {
32258        openArray("item");
32259        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
32260          composeQuestionnaireQuestionnaireItemComponent(null, e);
32261        closeArray();
32262      };
32263  }
32264
32265  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
32266    if (element != null) {
32267      open(name);
32268      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
32269      close();
32270    }
32271  }
32272
32273  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
32274      composeBackbone(element);
32275      if (element.hasQuestionElement()) {
32276        composeStringCore("question", element.getQuestionElement(), false);
32277        composeStringExtras("question", element.getQuestionElement(), false);
32278      }
32279      if (element.hasAnsweredElement()) {
32280        composeBooleanCore("answered", element.getAnsweredElement(), false);
32281        composeBooleanExtras("answered", element.getAnsweredElement(), false);
32282      }
32283      if (element.hasAnswer()) {
32284        composeType("answer", element.getAnswer());
32285      }
32286  }
32287
32288  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
32289    if (element != null) {
32290      open(name);
32291      composeQuestionnaireQuestionnaireItemOptionComponentInner(element);
32292      close();
32293    }
32294  }
32295
32296  protected void composeQuestionnaireQuestionnaireItemOptionComponentInner(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
32297      composeBackbone(element);
32298      if (element.hasValue()) {
32299        composeType("value", element.getValue());
32300      }
32301  }
32302
32303  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
32304    if (element != null) {
32305      prop("resourceType", name);
32306      composeQuestionnaireResponseInner(element);
32307    }
32308  }
32309
32310  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
32311      composeDomainResourceElements(element);
32312      if (element.hasIdentifier()) {
32313        composeIdentifier("identifier", element.getIdentifier());
32314      }
32315      if (element.hasQuestionnaire()) {
32316        composeReference("questionnaire", element.getQuestionnaire());
32317      }
32318      if (element.hasStatusElement()) {
32319        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
32320        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
32321      }
32322      if (element.hasSubject()) {
32323        composeReference("subject", element.getSubject());
32324      }
32325      if (element.hasAuthor()) {
32326        composeReference("author", element.getAuthor());
32327      }
32328      if (element.hasAuthoredElement()) {
32329        composeDateTimeCore("authored", element.getAuthoredElement(), false);
32330        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
32331      }
32332      if (element.hasSource()) {
32333        composeReference("source", element.getSource());
32334      }
32335      if (element.hasEncounter()) {
32336        composeReference("encounter", element.getEncounter());
32337      }
32338      if (element.hasItem()) {
32339        openArray("item");
32340        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
32341          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
32342        closeArray();
32343      };
32344  }
32345
32346  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
32347    if (element != null) {
32348      open(name);
32349      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
32350      close();
32351    }
32352  }
32353
32354  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
32355      composeBackbone(element);
32356      if (element.hasLinkIdElement()) {
32357        composeStringCore("linkId", element.getLinkIdElement(), false);
32358        composeStringExtras("linkId", element.getLinkIdElement(), false);
32359      }
32360      if (element.hasTextElement()) {
32361        composeStringCore("text", element.getTextElement(), false);
32362        composeStringExtras("text", element.getTextElement(), false);
32363      }
32364      if (element.hasSubject()) {
32365        composeReference("subject", element.getSubject());
32366      }
32367      if (element.hasAnswer()) {
32368        openArray("answer");
32369        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
32370          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
32371        closeArray();
32372      };
32373      if (element.hasItem()) {
32374        openArray("item");
32375        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
32376          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
32377        closeArray();
32378      };
32379  }
32380
32381  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
32382    if (element != null) {
32383      open(name);
32384      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
32385      close();
32386    }
32387  }
32388
32389  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
32390      composeBackbone(element);
32391      if (element.hasValue()) {
32392        composeType("value", element.getValue());
32393      }
32394      if (element.hasItem()) {
32395        openArray("item");
32396        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
32397          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
32398        closeArray();
32399      };
32400  }
32401
32402  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
32403    if (element != null) {
32404      prop("resourceType", name);
32405      composeReferralRequestInner(element);
32406    }
32407  }
32408
32409  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
32410      composeDomainResourceElements(element);
32411      if (element.hasIdentifier()) {
32412        openArray("identifier");
32413        for (Identifier e : element.getIdentifier()) 
32414          composeIdentifier(null, e);
32415        closeArray();
32416      };
32417      if (element.hasBasedOn()) {
32418        openArray("basedOn");
32419        for (Reference e : element.getBasedOn()) 
32420          composeReference(null, e);
32421        closeArray();
32422      };
32423      if (element.hasParent()) {
32424        composeIdentifier("parent", element.getParent());
32425      }
32426      if (element.hasStatusElement()) {
32427        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
32428        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
32429      }
32430      if (element.hasCategoryElement()) {
32431        composeEnumerationCore("category", element.getCategoryElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
32432        composeEnumerationExtras("category", element.getCategoryElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
32433      }
32434      if (element.hasType()) {
32435        composeCodeableConcept("type", element.getType());
32436      }
32437      if (element.hasPriority()) {
32438        composeCodeableConcept("priority", element.getPriority());
32439      }
32440      if (element.hasPatient()) {
32441        composeReference("patient", element.getPatient());
32442      }
32443      if (element.hasContext()) {
32444        composeReference("context", element.getContext());
32445      }
32446      if (element.hasFulfillmentTime()) {
32447        composePeriod("fulfillmentTime", element.getFulfillmentTime());
32448      }
32449      if (element.hasAuthoredElement()) {
32450        composeDateTimeCore("authored", element.getAuthoredElement(), false);
32451        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
32452      }
32453      if (element.hasRequester()) {
32454        composeReference("requester", element.getRequester());
32455      }
32456      if (element.hasSpecialty()) {
32457        composeCodeableConcept("specialty", element.getSpecialty());
32458      }
32459      if (element.hasRecipient()) {
32460        openArray("recipient");
32461        for (Reference e : element.getRecipient()) 
32462          composeReference(null, e);
32463        closeArray();
32464      };
32465      if (element.hasReason()) {
32466        composeCodeableConcept("reason", element.getReason());
32467      }
32468      if (element.hasDescriptionElement()) {
32469        composeStringCore("description", element.getDescriptionElement(), false);
32470        composeStringExtras("description", element.getDescriptionElement(), false);
32471      }
32472      if (element.hasServiceRequested()) {
32473        openArray("serviceRequested");
32474        for (CodeableConcept e : element.getServiceRequested()) 
32475          composeCodeableConcept(null, e);
32476        closeArray();
32477      };
32478      if (element.hasSupportingInformation()) {
32479        openArray("supportingInformation");
32480        for (Reference e : element.getSupportingInformation()) 
32481          composeReference(null, e);
32482        closeArray();
32483      };
32484  }
32485
32486  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
32487    if (element != null) {
32488      prop("resourceType", name);
32489      composeRelatedPersonInner(element);
32490    }
32491  }
32492
32493  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
32494      composeDomainResourceElements(element);
32495      if (element.hasIdentifier()) {
32496        openArray("identifier");
32497        for (Identifier e : element.getIdentifier()) 
32498          composeIdentifier(null, e);
32499        closeArray();
32500      };
32501      if (element.hasPatient()) {
32502        composeReference("patient", element.getPatient());
32503      }
32504      if (element.hasRelationship()) {
32505        composeCodeableConcept("relationship", element.getRelationship());
32506      }
32507      if (element.hasName()) {
32508        composeHumanName("name", element.getName());
32509      }
32510      if (element.hasTelecom()) {
32511        openArray("telecom");
32512        for (ContactPoint e : element.getTelecom()) 
32513          composeContactPoint(null, e);
32514        closeArray();
32515      };
32516      if (element.hasGenderElement()) {
32517        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
32518        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
32519      }
32520      if (element.hasBirthDateElement()) {
32521        composeDateCore("birthDate", element.getBirthDateElement(), false);
32522        composeDateExtras("birthDate", element.getBirthDateElement(), false);
32523      }
32524      if (element.hasAddress()) {
32525        openArray("address");
32526        for (Address e : element.getAddress()) 
32527          composeAddress(null, e);
32528        closeArray();
32529      };
32530      if (element.hasPhoto()) {
32531        openArray("photo");
32532        for (Attachment e : element.getPhoto()) 
32533          composeAttachment(null, e);
32534        closeArray();
32535      };
32536      if (element.hasPeriod()) {
32537        composePeriod("period", element.getPeriod());
32538      }
32539  }
32540
32541  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
32542    if (element != null) {
32543      prop("resourceType", name);
32544      composeRiskAssessmentInner(element);
32545    }
32546  }
32547
32548  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
32549      composeDomainResourceElements(element);
32550      if (element.hasSubject()) {
32551        composeReference("subject", element.getSubject());
32552      }
32553      if (element.hasDateElement()) {
32554        composeDateTimeCore("date", element.getDateElement(), false);
32555        composeDateTimeExtras("date", element.getDateElement(), false);
32556      }
32557      if (element.hasCondition()) {
32558        composeReference("condition", element.getCondition());
32559      }
32560      if (element.hasEncounter()) {
32561        composeReference("encounter", element.getEncounter());
32562      }
32563      if (element.hasPerformer()) {
32564        composeReference("performer", element.getPerformer());
32565      }
32566      if (element.hasIdentifier()) {
32567        composeIdentifier("identifier", element.getIdentifier());
32568      }
32569      if (element.hasMethod()) {
32570        composeCodeableConcept("method", element.getMethod());
32571      }
32572      if (element.hasBasis()) {
32573        openArray("basis");
32574        for (Reference e : element.getBasis()) 
32575          composeReference(null, e);
32576        closeArray();
32577      };
32578      if (element.hasPrediction()) {
32579        openArray("prediction");
32580        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
32581          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
32582        closeArray();
32583      };
32584      if (element.hasMitigationElement()) {
32585        composeStringCore("mitigation", element.getMitigationElement(), false);
32586        composeStringExtras("mitigation", element.getMitigationElement(), false);
32587      }
32588  }
32589
32590  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
32591    if (element != null) {
32592      open(name);
32593      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
32594      close();
32595    }
32596  }
32597
32598  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
32599      composeBackbone(element);
32600      if (element.hasOutcome()) {
32601        composeCodeableConcept("outcome", element.getOutcome());
32602      }
32603      if (element.hasProbability()) {
32604        composeType("probability", element.getProbability());
32605      }
32606      if (element.hasRelativeRiskElement()) {
32607        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
32608        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
32609      }
32610      if (element.hasWhen()) {
32611        composeType("when", element.getWhen());
32612      }
32613      if (element.hasRationaleElement()) {
32614        composeStringCore("rationale", element.getRationaleElement(), false);
32615        composeStringExtras("rationale", element.getRationaleElement(), false);
32616      }
32617  }
32618
32619  protected void composeSchedule(String name, Schedule element) throws IOException {
32620    if (element != null) {
32621      prop("resourceType", name);
32622      composeScheduleInner(element);
32623    }
32624  }
32625
32626  protected void composeScheduleInner(Schedule element) throws IOException {
32627      composeDomainResourceElements(element);
32628      if (element.hasIdentifier()) {
32629        openArray("identifier");
32630        for (Identifier e : element.getIdentifier()) 
32631          composeIdentifier(null, e);
32632        closeArray();
32633      };
32634      if (element.hasServiceCategory()) {
32635        composeCodeableConcept("serviceCategory", element.getServiceCategory());
32636      }
32637      if (element.hasServiceType()) {
32638        openArray("serviceType");
32639        for (CodeableConcept e : element.getServiceType()) 
32640          composeCodeableConcept(null, e);
32641        closeArray();
32642      };
32643      if (element.hasSpecialty()) {
32644        openArray("specialty");
32645        for (CodeableConcept e : element.getSpecialty()) 
32646          composeCodeableConcept(null, e);
32647        closeArray();
32648      };
32649      if (element.hasActor()) {
32650        composeReference("actor", element.getActor());
32651      }
32652      if (element.hasPlanningHorizon()) {
32653        composePeriod("planningHorizon", element.getPlanningHorizon());
32654      }
32655      if (element.hasCommentElement()) {
32656        composeStringCore("comment", element.getCommentElement(), false);
32657        composeStringExtras("comment", element.getCommentElement(), false);
32658      }
32659  }
32660
32661  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
32662    if (element != null) {
32663      prop("resourceType", name);
32664      composeSearchParameterInner(element);
32665    }
32666  }
32667
32668  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
32669      composeDomainResourceElements(element);
32670      if (element.hasUrlElement()) {
32671        composeUriCore("url", element.getUrlElement(), false);
32672        composeUriExtras("url", element.getUrlElement(), false);
32673      }
32674      if (element.hasNameElement()) {
32675        composeStringCore("name", element.getNameElement(), false);
32676        composeStringExtras("name", element.getNameElement(), false);
32677      }
32678      if (element.hasStatusElement()) {
32679        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
32680        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
32681      }
32682      if (element.hasExperimentalElement()) {
32683        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32684        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32685      }
32686      if (element.hasDateElement()) {
32687        composeDateTimeCore("date", element.getDateElement(), false);
32688        composeDateTimeExtras("date", element.getDateElement(), false);
32689      }
32690      if (element.hasPublisherElement()) {
32691        composeStringCore("publisher", element.getPublisherElement(), false);
32692        composeStringExtras("publisher", element.getPublisherElement(), false);
32693      }
32694      if (element.hasContact()) {
32695        openArray("contact");
32696        for (SearchParameter.SearchParameterContactComponent e : element.getContact()) 
32697          composeSearchParameterSearchParameterContactComponent(null, e);
32698        closeArray();
32699      };
32700      if (element.hasUseContext()) {
32701        openArray("useContext");
32702        for (CodeableConcept e : element.getUseContext()) 
32703          composeCodeableConcept(null, e);
32704        closeArray();
32705      };
32706      if (element.hasRequirementsElement()) {
32707        composeStringCore("requirements", element.getRequirementsElement(), false);
32708        composeStringExtras("requirements", element.getRequirementsElement(), false);
32709      }
32710      if (element.hasCodeElement()) {
32711        composeCodeCore("code", element.getCodeElement(), false);
32712        composeCodeExtras("code", element.getCodeElement(), false);
32713      }
32714      if (element.hasBaseElement()) {
32715        composeCodeCore("base", element.getBaseElement(), false);
32716        composeCodeExtras("base", element.getBaseElement(), false);
32717      }
32718      if (element.hasTypeElement()) {
32719        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32720        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32721      }
32722      if (element.hasDescriptionElement()) {
32723        composeStringCore("description", element.getDescriptionElement(), false);
32724        composeStringExtras("description", element.getDescriptionElement(), false);
32725      }
32726      if (element.hasExpressionElement()) {
32727        composeStringCore("expression", element.getExpressionElement(), false);
32728        composeStringExtras("expression", element.getExpressionElement(), false);
32729      }
32730      if (element.hasXpathElement()) {
32731        composeStringCore("xpath", element.getXpathElement(), false);
32732        composeStringExtras("xpath", element.getXpathElement(), false);
32733      }
32734      if (element.hasXpathUsageElement()) {
32735        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
32736        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
32737      }
32738      if (element.hasTarget()) {
32739        openArray("target");
32740        for (CodeType e : element.getTarget()) 
32741          composeCodeCore(null, e, true);
32742        closeArray();
32743        if (anyHasExtras(element.getTarget())) {
32744          openArray("_target");
32745          for (CodeType e : element.getTarget()) 
32746            composeCodeExtras(null, e, true);
32747          closeArray();
32748        }
32749      };
32750  }
32751
32752  protected void composeSearchParameterSearchParameterContactComponent(String name, SearchParameter.SearchParameterContactComponent element) throws IOException {
32753    if (element != null) {
32754      open(name);
32755      composeSearchParameterSearchParameterContactComponentInner(element);
32756      close();
32757    }
32758  }
32759
32760  protected void composeSearchParameterSearchParameterContactComponentInner(SearchParameter.SearchParameterContactComponent element) throws IOException {
32761      composeBackbone(element);
32762      if (element.hasNameElement()) {
32763        composeStringCore("name", element.getNameElement(), false);
32764        composeStringExtras("name", element.getNameElement(), false);
32765      }
32766      if (element.hasTelecom()) {
32767        openArray("telecom");
32768        for (ContactPoint e : element.getTelecom()) 
32769          composeContactPoint(null, e);
32770        closeArray();
32771      };
32772  }
32773
32774  protected void composeSequence(String name, Sequence element) throws IOException {
32775    if (element != null) {
32776      prop("resourceType", name);
32777      composeSequenceInner(element);
32778    }
32779  }
32780
32781  protected void composeSequenceInner(Sequence element) throws IOException {
32782      composeDomainResourceElements(element);
32783      if (element.hasTypeElement()) {
32784        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
32785        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
32786      }
32787      if (element.hasPatient()) {
32788        composeReference("patient", element.getPatient());
32789      }
32790      if (element.hasSpecimen()) {
32791        composeReference("specimen", element.getSpecimen());
32792      }
32793      if (element.hasDevice()) {
32794        composeReference("device", element.getDevice());
32795      }
32796      if (element.hasQuantity()) {
32797        composeQuantity("quantity", element.getQuantity());
32798      }
32799      if (element.hasSpecies()) {
32800        composeCodeableConcept("species", element.getSpecies());
32801      }
32802      if (element.hasReferenceSeq()) {
32803        openArray("referenceSeq");
32804        for (Sequence.SequenceReferenceSeqComponent e : element.getReferenceSeq()) 
32805          composeSequenceSequenceReferenceSeqComponent(null, e);
32806        closeArray();
32807      };
32808      if (element.hasVariation()) {
32809        composeSequenceSequenceVariationComponent("variation", element.getVariation());
32810      }
32811      if (element.hasQuality()) {
32812        openArray("quality");
32813        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
32814          composeSequenceSequenceQualityComponent(null, e);
32815        closeArray();
32816      };
32817      if (element.hasAllelicState()) {
32818        composeCodeableConcept("allelicState", element.getAllelicState());
32819      }
32820      if (element.hasAllelicFrequencyElement()) {
32821        composeDecimalCore("allelicFrequency", element.getAllelicFrequencyElement(), false);
32822        composeDecimalExtras("allelicFrequency", element.getAllelicFrequencyElement(), false);
32823      }
32824      if (element.hasCopyNumberEvent()) {
32825        composeCodeableConcept("copyNumberEvent", element.getCopyNumberEvent());
32826      }
32827      if (element.hasReadCoverageElement()) {
32828        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
32829        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
32830      }
32831      if (element.hasRepository()) {
32832        openArray("repository");
32833        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
32834          composeSequenceSequenceRepositoryComponent(null, e);
32835        closeArray();
32836      };
32837      if (element.hasPointer()) {
32838        openArray("pointer");
32839        for (Reference e : element.getPointer()) 
32840          composeReference(null, e);
32841        closeArray();
32842      };
32843      if (element.hasObservedSeqElement()) {
32844        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
32845        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
32846      }
32847      if (element.hasObservation()) {
32848        composeReference("observation", element.getObservation());
32849      }
32850      if (element.hasStructureVariation()) {
32851        composeSequenceSequenceStructureVariationComponent("structureVariation", element.getStructureVariation());
32852      }
32853  }
32854
32855  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
32856    if (element != null) {
32857      open(name);
32858      composeSequenceSequenceReferenceSeqComponentInner(element);
32859      close();
32860    }
32861  }
32862
32863  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
32864      composeBackbone(element);
32865      if (element.hasChromosome()) {
32866        composeCodeableConcept("chromosome", element.getChromosome());
32867      }
32868      if (element.hasGenomeBuildElement()) {
32869        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
32870        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
32871      }
32872      if (element.hasReferenceSeqId()) {
32873        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
32874      }
32875      if (element.hasReferenceSeqPointer()) {
32876        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
32877      }
32878      if (element.hasReferenceSeqStringElement()) {
32879        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
32880        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
32881      }
32882      if (element.hasWindowStartElement()) {
32883        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
32884        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
32885      }
32886      if (element.hasWindowEndElement()) {
32887        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
32888        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
32889      }
32890  }
32891
32892  protected void composeSequenceSequenceVariationComponent(String name, Sequence.SequenceVariationComponent element) throws IOException {
32893    if (element != null) {
32894      open(name);
32895      composeSequenceSequenceVariationComponentInner(element);
32896      close();
32897    }
32898  }
32899
32900  protected void composeSequenceSequenceVariationComponentInner(Sequence.SequenceVariationComponent element) throws IOException {
32901      composeBackbone(element);
32902      if (element.hasStartElement()) {
32903        composeIntegerCore("start", element.getStartElement(), false);
32904        composeIntegerExtras("start", element.getStartElement(), false);
32905      }
32906      if (element.hasEndElement()) {
32907        composeIntegerCore("end", element.getEndElement(), false);
32908        composeIntegerExtras("end", element.getEndElement(), false);
32909      }
32910      if (element.hasObservedAlleleElement()) {
32911        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
32912        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
32913      }
32914      if (element.hasReferenceAlleleElement()) {
32915        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
32916        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
32917      }
32918      if (element.hasCigarElement()) {
32919        composeStringCore("cigar", element.getCigarElement(), false);
32920        composeStringExtras("cigar", element.getCigarElement(), false);
32921      }
32922  }
32923
32924  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
32925    if (element != null) {
32926      open(name);
32927      composeSequenceSequenceQualityComponentInner(element);
32928      close();
32929    }
32930  }
32931
32932  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
32933      composeBackbone(element);
32934      if (element.hasStartElement()) {
32935        composeIntegerCore("start", element.getStartElement(), false);
32936        composeIntegerExtras("start", element.getStartElement(), false);
32937      }
32938      if (element.hasEndElement()) {
32939        composeIntegerCore("end", element.getEndElement(), false);
32940        composeIntegerExtras("end", element.getEndElement(), false);
32941      }
32942      if (element.hasScore()) {
32943        composeQuantity("score", element.getScore());
32944      }
32945      if (element.hasMethodElement()) {
32946        composeStringCore("method", element.getMethodElement(), false);
32947        composeStringExtras("method", element.getMethodElement(), false);
32948      }
32949  }
32950
32951  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
32952    if (element != null) {
32953      open(name);
32954      composeSequenceSequenceRepositoryComponentInner(element);
32955      close();
32956    }
32957  }
32958
32959  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
32960      composeBackbone(element);
32961      if (element.hasUrlElement()) {
32962        composeUriCore("url", element.getUrlElement(), false);
32963        composeUriExtras("url", element.getUrlElement(), false);
32964      }
32965      if (element.hasNameElement()) {
32966        composeStringCore("name", element.getNameElement(), false);
32967        composeStringExtras("name", element.getNameElement(), false);
32968      }
32969      if (element.hasVariantIdElement()) {
32970        composeStringCore("variantId", element.getVariantIdElement(), false);
32971        composeStringExtras("variantId", element.getVariantIdElement(), false);
32972      }
32973      if (element.hasReadIdElement()) {
32974        composeStringCore("readId", element.getReadIdElement(), false);
32975        composeStringExtras("readId", element.getReadIdElement(), false);
32976      }
32977  }
32978
32979  protected void composeSequenceSequenceStructureVariationComponent(String name, Sequence.SequenceStructureVariationComponent element) throws IOException {
32980    if (element != null) {
32981      open(name);
32982      composeSequenceSequenceStructureVariationComponentInner(element);
32983      close();
32984    }
32985  }
32986
32987  protected void composeSequenceSequenceStructureVariationComponentInner(Sequence.SequenceStructureVariationComponent element) throws IOException {
32988      composeBackbone(element);
32989      if (element.hasPrecisionOfBoundariesElement()) {
32990        composeStringCore("precisionOfBoundaries", element.getPrecisionOfBoundariesElement(), false);
32991        composeStringExtras("precisionOfBoundaries", element.getPrecisionOfBoundariesElement(), false);
32992      }
32993      if (element.hasReportedaCGHRatioElement()) {
32994        composeDecimalCore("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
32995        composeDecimalExtras("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
32996      }
32997      if (element.hasLengthElement()) {
32998        composeIntegerCore("length", element.getLengthElement(), false);
32999        composeIntegerExtras("length", element.getLengthElement(), false);
33000      }
33001      if (element.hasOuter()) {
33002        composeSequenceSequenceStructureVariationOuterComponent("outer", element.getOuter());
33003      }
33004      if (element.hasInner()) {
33005        composeSequenceSequenceStructureVariationInnerComponent("inner", element.getInner());
33006      }
33007  }
33008
33009  protected void composeSequenceSequenceStructureVariationOuterComponent(String name, Sequence.SequenceStructureVariationOuterComponent element) throws IOException {
33010    if (element != null) {
33011      open(name);
33012      composeSequenceSequenceStructureVariationOuterComponentInner(element);
33013      close();
33014    }
33015  }
33016
33017  protected void composeSequenceSequenceStructureVariationOuterComponentInner(Sequence.SequenceStructureVariationOuterComponent element) throws IOException {
33018      composeBackbone(element);
33019      if (element.hasStartElement()) {
33020        composeIntegerCore("start", element.getStartElement(), false);
33021        composeIntegerExtras("start", element.getStartElement(), false);
33022      }
33023      if (element.hasEndElement()) {
33024        composeIntegerCore("end", element.getEndElement(), false);
33025        composeIntegerExtras("end", element.getEndElement(), false);
33026      }
33027  }
33028
33029  protected void composeSequenceSequenceStructureVariationInnerComponent(String name, Sequence.SequenceStructureVariationInnerComponent element) throws IOException {
33030    if (element != null) {
33031      open(name);
33032      composeSequenceSequenceStructureVariationInnerComponentInner(element);
33033      close();
33034    }
33035  }
33036
33037  protected void composeSequenceSequenceStructureVariationInnerComponentInner(Sequence.SequenceStructureVariationInnerComponent element) throws IOException {
33038      composeBackbone(element);
33039      if (element.hasStartElement()) {
33040        composeIntegerCore("start", element.getStartElement(), false);
33041        composeIntegerExtras("start", element.getStartElement(), false);
33042      }
33043      if (element.hasEndElement()) {
33044        composeIntegerCore("end", element.getEndElement(), false);
33045        composeIntegerExtras("end", element.getEndElement(), false);
33046      }
33047  }
33048
33049  protected void composeSlot(String name, Slot element) throws IOException {
33050    if (element != null) {
33051      prop("resourceType", name);
33052      composeSlotInner(element);
33053    }
33054  }
33055
33056  protected void composeSlotInner(Slot element) throws IOException {
33057      composeDomainResourceElements(element);
33058      if (element.hasIdentifier()) {
33059        openArray("identifier");
33060        for (Identifier e : element.getIdentifier()) 
33061          composeIdentifier(null, e);
33062        closeArray();
33063      };
33064      if (element.hasServiceCategory()) {
33065        composeCodeableConcept("serviceCategory", element.getServiceCategory());
33066      }
33067      if (element.hasServiceType()) {
33068        openArray("serviceType");
33069        for (CodeableConcept e : element.getServiceType()) 
33070          composeCodeableConcept(null, e);
33071        closeArray();
33072      };
33073      if (element.hasSpecialty()) {
33074        openArray("specialty");
33075        for (CodeableConcept e : element.getSpecialty()) 
33076          composeCodeableConcept(null, e);
33077        closeArray();
33078      };
33079      if (element.hasAppointmentType()) {
33080        composeCodeableConcept("appointmentType", element.getAppointmentType());
33081      }
33082      if (element.hasSchedule()) {
33083        composeReference("schedule", element.getSchedule());
33084      }
33085      if (element.hasStatusElement()) {
33086        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
33087        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
33088      }
33089      if (element.hasStartElement()) {
33090        composeInstantCore("start", element.getStartElement(), false);
33091        composeInstantExtras("start", element.getStartElement(), false);
33092      }
33093      if (element.hasEndElement()) {
33094        composeInstantCore("end", element.getEndElement(), false);
33095        composeInstantExtras("end", element.getEndElement(), false);
33096      }
33097      if (element.hasOverbookedElement()) {
33098        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
33099        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
33100      }
33101      if (element.hasCommentElement()) {
33102        composeStringCore("comment", element.getCommentElement(), false);
33103        composeStringExtras("comment", element.getCommentElement(), false);
33104      }
33105  }
33106
33107  protected void composeSpecimen(String name, Specimen element) throws IOException {
33108    if (element != null) {
33109      prop("resourceType", name);
33110      composeSpecimenInner(element);
33111    }
33112  }
33113
33114  protected void composeSpecimenInner(Specimen element) throws IOException {
33115      composeDomainResourceElements(element);
33116      if (element.hasIdentifier()) {
33117        openArray("identifier");
33118        for (Identifier e : element.getIdentifier()) 
33119          composeIdentifier(null, e);
33120        closeArray();
33121      };
33122      if (element.hasAccessionIdentifier()) {
33123        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
33124      }
33125      if (element.hasStatusElement()) {
33126        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
33127        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
33128      }
33129      if (element.hasType()) {
33130        composeCodeableConcept("type", element.getType());
33131      }
33132      if (element.hasSubject()) {
33133        composeReference("subject", element.getSubject());
33134      }
33135      if (element.hasReceivedTimeElement()) {
33136        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
33137        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
33138      }
33139      if (element.hasParent()) {
33140        openArray("parent");
33141        for (Reference e : element.getParent()) 
33142          composeReference(null, e);
33143        closeArray();
33144      };
33145      if (element.hasCollection()) {
33146        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
33147      }
33148      if (element.hasTreatment()) {
33149        openArray("treatment");
33150        for (Specimen.SpecimenTreatmentComponent e : element.getTreatment()) 
33151          composeSpecimenSpecimenTreatmentComponent(null, e);
33152        closeArray();
33153      };
33154      if (element.hasContainer()) {
33155        openArray("container");
33156        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
33157          composeSpecimenSpecimenContainerComponent(null, e);
33158        closeArray();
33159      };
33160  }
33161
33162  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
33163    if (element != null) {
33164      open(name);
33165      composeSpecimenSpecimenCollectionComponentInner(element);
33166      close();
33167    }
33168  }
33169
33170  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
33171      composeBackbone(element);
33172      if (element.hasCollector()) {
33173        composeReference("collector", element.getCollector());
33174      }
33175      if (element.hasCommentElement()) {
33176        composeStringCore("comment", element.getCommentElement(), false);
33177        composeStringExtras("comment", element.getCommentElement(), false);
33178      }
33179      if (element.hasCollected()) {
33180        composeType("collected", element.getCollected());
33181      }
33182      if (element.hasQuantity()) {
33183        composeSimpleQuantity("quantity", element.getQuantity());
33184      }
33185      if (element.hasMethod()) {
33186        composeCodeableConcept("method", element.getMethod());
33187      }
33188      if (element.hasBodySite()) {
33189        composeCodeableConcept("bodySite", element.getBodySite());
33190      }
33191  }
33192
33193  protected void composeSpecimenSpecimenTreatmentComponent(String name, Specimen.SpecimenTreatmentComponent element) throws IOException {
33194    if (element != null) {
33195      open(name);
33196      composeSpecimenSpecimenTreatmentComponentInner(element);
33197      close();
33198    }
33199  }
33200
33201  protected void composeSpecimenSpecimenTreatmentComponentInner(Specimen.SpecimenTreatmentComponent element) throws IOException {
33202      composeBackbone(element);
33203      if (element.hasDescriptionElement()) {
33204        composeStringCore("description", element.getDescriptionElement(), false);
33205        composeStringExtras("description", element.getDescriptionElement(), false);
33206      }
33207      if (element.hasProcedure()) {
33208        composeCodeableConcept("procedure", element.getProcedure());
33209      }
33210      if (element.hasAdditive()) {
33211        openArray("additive");
33212        for (Reference e : element.getAdditive()) 
33213          composeReference(null, e);
33214        closeArray();
33215      };
33216  }
33217
33218  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
33219    if (element != null) {
33220      open(name);
33221      composeSpecimenSpecimenContainerComponentInner(element);
33222      close();
33223    }
33224  }
33225
33226  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
33227      composeBackbone(element);
33228      if (element.hasIdentifier()) {
33229        openArray("identifier");
33230        for (Identifier e : element.getIdentifier()) 
33231          composeIdentifier(null, e);
33232        closeArray();
33233      };
33234      if (element.hasDescriptionElement()) {
33235        composeStringCore("description", element.getDescriptionElement(), false);
33236        composeStringExtras("description", element.getDescriptionElement(), false);
33237      }
33238      if (element.hasType()) {
33239        composeCodeableConcept("type", element.getType());
33240      }
33241      if (element.hasCapacity()) {
33242        composeSimpleQuantity("capacity", element.getCapacity());
33243      }
33244      if (element.hasSpecimenQuantity()) {
33245        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
33246      }
33247      if (element.hasAdditive()) {
33248        composeType("additive", element.getAdditive());
33249      }
33250  }
33251
33252  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
33253    if (element != null) {
33254      prop("resourceType", name);
33255      composeStructureDefinitionInner(element);
33256    }
33257  }
33258
33259  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
33260      composeDomainResourceElements(element);
33261      if (element.hasUrlElement()) {
33262        composeUriCore("url", element.getUrlElement(), false);
33263        composeUriExtras("url", element.getUrlElement(), false);
33264      }
33265      if (element.hasIdentifier()) {
33266        openArray("identifier");
33267        for (Identifier e : element.getIdentifier()) 
33268          composeIdentifier(null, e);
33269        closeArray();
33270      };
33271      if (element.hasVersionElement()) {
33272        composeStringCore("version", element.getVersionElement(), false);
33273        composeStringExtras("version", element.getVersionElement(), false);
33274      }
33275      if (element.hasNameElement()) {
33276        composeStringCore("name", element.getNameElement(), false);
33277        composeStringExtras("name", element.getNameElement(), false);
33278      }
33279      if (element.hasDisplayElement()) {
33280        composeStringCore("display", element.getDisplayElement(), false);
33281        composeStringExtras("display", element.getDisplayElement(), false);
33282      }
33283      if (element.hasStatusElement()) {
33284        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
33285        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
33286      }
33287      if (element.hasExperimentalElement()) {
33288        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33289        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33290      }
33291      if (element.hasPublisherElement()) {
33292        composeStringCore("publisher", element.getPublisherElement(), false);
33293        composeStringExtras("publisher", element.getPublisherElement(), false);
33294      }
33295      if (element.hasContact()) {
33296        openArray("contact");
33297        for (StructureDefinition.StructureDefinitionContactComponent e : element.getContact()) 
33298          composeStructureDefinitionStructureDefinitionContactComponent(null, e);
33299        closeArray();
33300      };
33301      if (element.hasDateElement()) {
33302        composeDateTimeCore("date", element.getDateElement(), false);
33303        composeDateTimeExtras("date", element.getDateElement(), false);
33304      }
33305      if (element.hasDescriptionElement()) {
33306        composeStringCore("description", element.getDescriptionElement(), false);
33307        composeStringExtras("description", element.getDescriptionElement(), false);
33308      }
33309      if (element.hasUseContext()) {
33310        openArray("useContext");
33311        for (CodeableConcept e : element.getUseContext()) 
33312          composeCodeableConcept(null, e);
33313        closeArray();
33314      };
33315      if (element.hasRequirementsElement()) {
33316        composeStringCore("requirements", element.getRequirementsElement(), false);
33317        composeStringExtras("requirements", element.getRequirementsElement(), false);
33318      }
33319      if (element.hasCopyrightElement()) {
33320        composeStringCore("copyright", element.getCopyrightElement(), false);
33321        composeStringExtras("copyright", element.getCopyrightElement(), false);
33322      }
33323      if (element.hasCode()) {
33324        openArray("code");
33325        for (Coding e : element.getCode()) 
33326          composeCoding(null, e);
33327        closeArray();
33328      };
33329      if (element.hasFhirVersionElement()) {
33330        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
33331        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
33332      }
33333      if (element.hasMapping()) {
33334        openArray("mapping");
33335        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
33336          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
33337        closeArray();
33338      };
33339      if (element.hasKindElement()) {
33340        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
33341        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
33342      }
33343      if (element.hasAbstractElement()) {
33344        composeBooleanCore("abstract", element.getAbstractElement(), false);
33345        composeBooleanExtras("abstract", element.getAbstractElement(), false);
33346      }
33347      if (element.hasContextTypeElement()) {
33348        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
33349        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
33350      }
33351      if (element.hasContext()) {
33352        openArray("context");
33353        for (StringType e : element.getContext()) 
33354          composeStringCore(null, e, true);
33355        closeArray();
33356        if (anyHasExtras(element.getContext())) {
33357          openArray("_context");
33358          for (StringType e : element.getContext()) 
33359            composeStringExtras(null, e, true);
33360          closeArray();
33361        }
33362      };
33363      if (element.hasBaseTypeElement()) {
33364        composeCodeCore("baseType", element.getBaseTypeElement(), false);
33365        composeCodeExtras("baseType", element.getBaseTypeElement(), false);
33366      }
33367      if (element.hasBaseDefinitionElement()) {
33368        composeUriCore("baseDefinition", element.getBaseDefinitionElement(), false);
33369        composeUriExtras("baseDefinition", element.getBaseDefinitionElement(), false);
33370      }
33371      if (element.hasDerivationElement()) {
33372        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
33373        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
33374      }
33375      if (element.hasSnapshot()) {
33376        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
33377      }
33378      if (element.hasDifferential()) {
33379        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
33380      }
33381  }
33382
33383  protected void composeStructureDefinitionStructureDefinitionContactComponent(String name, StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
33384    if (element != null) {
33385      open(name);
33386      composeStructureDefinitionStructureDefinitionContactComponentInner(element);
33387      close();
33388    }
33389  }
33390
33391  protected void composeStructureDefinitionStructureDefinitionContactComponentInner(StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
33392      composeBackbone(element);
33393      if (element.hasNameElement()) {
33394        composeStringCore("name", element.getNameElement(), false);
33395        composeStringExtras("name", element.getNameElement(), false);
33396      }
33397      if (element.hasTelecom()) {
33398        openArray("telecom");
33399        for (ContactPoint e : element.getTelecom()) 
33400          composeContactPoint(null, e);
33401        closeArray();
33402      };
33403  }
33404
33405  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
33406    if (element != null) {
33407      open(name);
33408      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
33409      close();
33410    }
33411  }
33412
33413  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
33414      composeBackbone(element);
33415      if (element.hasIdentityElement()) {
33416        composeIdCore("identity", element.getIdentityElement(), false);
33417        composeIdExtras("identity", element.getIdentityElement(), false);
33418      }
33419      if (element.hasUriElement()) {
33420        composeUriCore("uri", element.getUriElement(), false);
33421        composeUriExtras("uri", element.getUriElement(), false);
33422      }
33423      if (element.hasNameElement()) {
33424        composeStringCore("name", element.getNameElement(), false);
33425        composeStringExtras("name", element.getNameElement(), false);
33426      }
33427      if (element.hasCommentsElement()) {
33428        composeStringCore("comments", element.getCommentsElement(), false);
33429        composeStringExtras("comments", element.getCommentsElement(), false);
33430      }
33431  }
33432
33433  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
33434    if (element != null) {
33435      open(name);
33436      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
33437      close();
33438    }
33439  }
33440
33441  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
33442      composeBackbone(element);
33443      if (element.hasElement()) {
33444        openArray("element");
33445        for (ElementDefinition e : element.getElement()) 
33446          composeElementDefinition(null, e);
33447        closeArray();
33448      };
33449  }
33450
33451  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
33452    if (element != null) {
33453      open(name);
33454      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
33455      close();
33456    }
33457  }
33458
33459  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
33460      composeBackbone(element);
33461      if (element.hasElement()) {
33462        openArray("element");
33463        for (ElementDefinition e : element.getElement()) 
33464          composeElementDefinition(null, e);
33465        closeArray();
33466      };
33467  }
33468
33469  protected void composeStructureMap(String name, StructureMap element) throws IOException {
33470    if (element != null) {
33471      prop("resourceType", name);
33472      composeStructureMapInner(element);
33473    }
33474  }
33475
33476  protected void composeStructureMapInner(StructureMap element) throws IOException {
33477      composeDomainResourceElements(element);
33478      if (element.hasUrlElement()) {
33479        composeUriCore("url", element.getUrlElement(), false);
33480        composeUriExtras("url", element.getUrlElement(), false);
33481      }
33482      if (element.hasIdentifier()) {
33483        openArray("identifier");
33484        for (Identifier e : element.getIdentifier()) 
33485          composeIdentifier(null, e);
33486        closeArray();
33487      };
33488      if (element.hasVersionElement()) {
33489        composeStringCore("version", element.getVersionElement(), false);
33490        composeStringExtras("version", element.getVersionElement(), false);
33491      }
33492      if (element.hasNameElement()) {
33493        composeStringCore("name", element.getNameElement(), false);
33494        composeStringExtras("name", element.getNameElement(), false);
33495      }
33496      if (element.hasStatusElement()) {
33497        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
33498        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
33499      }
33500      if (element.hasExperimentalElement()) {
33501        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33502        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33503      }
33504      if (element.hasPublisherElement()) {
33505        composeStringCore("publisher", element.getPublisherElement(), false);
33506        composeStringExtras("publisher", element.getPublisherElement(), false);
33507      }
33508      if (element.hasContact()) {
33509        openArray("contact");
33510        for (StructureMap.StructureMapContactComponent e : element.getContact()) 
33511          composeStructureMapStructureMapContactComponent(null, e);
33512        closeArray();
33513      };
33514      if (element.hasDateElement()) {
33515        composeDateTimeCore("date", element.getDateElement(), false);
33516        composeDateTimeExtras("date", element.getDateElement(), false);
33517      }
33518      if (element.hasDescriptionElement()) {
33519        composeStringCore("description", element.getDescriptionElement(), false);
33520        composeStringExtras("description", element.getDescriptionElement(), false);
33521      }
33522      if (element.hasUseContext()) {
33523        openArray("useContext");
33524        for (CodeableConcept e : element.getUseContext()) 
33525          composeCodeableConcept(null, e);
33526        closeArray();
33527      };
33528      if (element.hasRequirementsElement()) {
33529        composeStringCore("requirements", element.getRequirementsElement(), false);
33530        composeStringExtras("requirements", element.getRequirementsElement(), false);
33531      }
33532      if (element.hasCopyrightElement()) {
33533        composeStringCore("copyright", element.getCopyrightElement(), false);
33534        composeStringExtras("copyright", element.getCopyrightElement(), false);
33535      }
33536      if (element.hasStructure()) {
33537        openArray("structure");
33538        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
33539          composeStructureMapStructureMapStructureComponent(null, e);
33540        closeArray();
33541      };
33542      if (element.hasImport()) {
33543        openArray("import");
33544        for (UriType e : element.getImport()) 
33545          composeUriCore(null, e, true);
33546        closeArray();
33547        if (anyHasExtras(element.getImport())) {
33548          openArray("_import");
33549          for (UriType e : element.getImport()) 
33550            composeUriExtras(null, e, true);
33551          closeArray();
33552        }
33553      };
33554      if (element.hasGroup()) {
33555        openArray("group");
33556        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
33557          composeStructureMapStructureMapGroupComponent(null, e);
33558        closeArray();
33559      };
33560  }
33561
33562  protected void composeStructureMapStructureMapContactComponent(String name, StructureMap.StructureMapContactComponent element) throws IOException {
33563    if (element != null) {
33564      open(name);
33565      composeStructureMapStructureMapContactComponentInner(element);
33566      close();
33567    }
33568  }
33569
33570  protected void composeStructureMapStructureMapContactComponentInner(StructureMap.StructureMapContactComponent element) throws IOException {
33571      composeBackbone(element);
33572      if (element.hasNameElement()) {
33573        composeStringCore("name", element.getNameElement(), false);
33574        composeStringExtras("name", element.getNameElement(), false);
33575      }
33576      if (element.hasTelecom()) {
33577        openArray("telecom");
33578        for (ContactPoint e : element.getTelecom()) 
33579          composeContactPoint(null, e);
33580        closeArray();
33581      };
33582  }
33583
33584  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
33585    if (element != null) {
33586      open(name);
33587      composeStructureMapStructureMapStructureComponentInner(element);
33588      close();
33589    }
33590  }
33591
33592  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
33593      composeBackbone(element);
33594      if (element.hasUrlElement()) {
33595        composeUriCore("url", element.getUrlElement(), false);
33596        composeUriExtras("url", element.getUrlElement(), false);
33597      }
33598      if (element.hasModeElement()) {
33599        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
33600        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
33601      }
33602      if (element.hasDocumentationElement()) {
33603        composeStringCore("documentation", element.getDocumentationElement(), false);
33604        composeStringExtras("documentation", element.getDocumentationElement(), false);
33605      }
33606  }
33607
33608  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
33609    if (element != null) {
33610      open(name);
33611      composeStructureMapStructureMapGroupComponentInner(element);
33612      close();
33613    }
33614  }
33615
33616  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
33617      composeBackbone(element);
33618      if (element.hasNameElement()) {
33619        composeIdCore("name", element.getNameElement(), false);
33620        composeIdExtras("name", element.getNameElement(), false);
33621      }
33622      if (element.hasExtendsElement()) {
33623        composeIdCore("extends", element.getExtendsElement(), false);
33624        composeIdExtras("extends", element.getExtendsElement(), false);
33625      }
33626      if (element.hasDocumentationElement()) {
33627        composeStringCore("documentation", element.getDocumentationElement(), false);
33628        composeStringExtras("documentation", element.getDocumentationElement(), false);
33629      }
33630      if (element.hasInput()) {
33631        openArray("input");
33632        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
33633          composeStructureMapStructureMapGroupInputComponent(null, e);
33634        closeArray();
33635      };
33636      if (element.hasRule()) {
33637        openArray("rule");
33638        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
33639          composeStructureMapStructureMapGroupRuleComponent(null, e);
33640        closeArray();
33641      };
33642  }
33643
33644  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
33645    if (element != null) {
33646      open(name);
33647      composeStructureMapStructureMapGroupInputComponentInner(element);
33648      close();
33649    }
33650  }
33651
33652  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
33653      composeBackbone(element);
33654      if (element.hasNameElement()) {
33655        composeIdCore("name", element.getNameElement(), false);
33656        composeIdExtras("name", element.getNameElement(), false);
33657      }
33658      if (element.hasTypeElement()) {
33659        composeStringCore("type", element.getTypeElement(), false);
33660        composeStringExtras("type", element.getTypeElement(), false);
33661      }
33662      if (element.hasModeElement()) {
33663        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
33664        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
33665      }
33666      if (element.hasDocumentationElement()) {
33667        composeStringCore("documentation", element.getDocumentationElement(), false);
33668        composeStringExtras("documentation", element.getDocumentationElement(), false);
33669      }
33670  }
33671
33672  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
33673    if (element != null) {
33674      open(name);
33675      composeStructureMapStructureMapGroupRuleComponentInner(element);
33676      close();
33677    }
33678  }
33679
33680  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
33681      composeBackbone(element);
33682      if (element.hasNameElement()) {
33683        composeIdCore("name", element.getNameElement(), false);
33684        composeIdExtras("name", element.getNameElement(), false);
33685      }
33686      if (element.hasSource()) {
33687        openArray("source");
33688        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
33689          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
33690        closeArray();
33691      };
33692      if (element.hasTarget()) {
33693        openArray("target");
33694        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
33695          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
33696        closeArray();
33697      };
33698      if (element.hasRule()) {
33699        openArray("rule");
33700        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
33701          composeStructureMapStructureMapGroupRuleComponent(null, e);
33702        closeArray();
33703      };
33704      if (element.hasDependent()) {
33705        openArray("dependent");
33706        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
33707          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
33708        closeArray();
33709      };
33710      if (element.hasDocumentationElement()) {
33711        composeStringCore("documentation", element.getDocumentationElement(), false);
33712        composeStringExtras("documentation", element.getDocumentationElement(), false);
33713      }
33714  }
33715
33716  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
33717    if (element != null) {
33718      open(name);
33719      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
33720      close();
33721    }
33722  }
33723
33724  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
33725      composeBackbone(element);
33726      if (element.hasRequiredElement()) {
33727        composeBooleanCore("required", element.getRequiredElement(), false);
33728        composeBooleanExtras("required", element.getRequiredElement(), false);
33729      }
33730      if (element.hasContextElement()) {
33731        composeIdCore("context", element.getContextElement(), false);
33732        composeIdExtras("context", element.getContextElement(), false);
33733      }
33734      if (element.hasContextTypeElement()) {
33735        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
33736        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
33737      }
33738      if (element.hasElementElement()) {
33739        composeStringCore("element", element.getElementElement(), false);
33740        composeStringExtras("element", element.getElementElement(), false);
33741      }
33742      if (element.hasListModeElement()) {
33743        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapListModeEnumFactory(), false);
33744        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapListModeEnumFactory(), false);
33745      }
33746      if (element.hasVariableElement()) {
33747        composeIdCore("variable", element.getVariableElement(), false);
33748        composeIdExtras("variable", element.getVariableElement(), false);
33749      }
33750      if (element.hasConditionElement()) {
33751        composeStringCore("condition", element.getConditionElement(), false);
33752        composeStringExtras("condition", element.getConditionElement(), false);
33753      }
33754      if (element.hasCheckElement()) {
33755        composeStringCore("check", element.getCheckElement(), false);
33756        composeStringExtras("check", element.getCheckElement(), false);
33757      }
33758  }
33759
33760  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
33761    if (element != null) {
33762      open(name);
33763      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
33764      close();
33765    }
33766  }
33767
33768  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
33769      composeBackbone(element);
33770      if (element.hasContextElement()) {
33771        composeIdCore("context", element.getContextElement(), false);
33772        composeIdExtras("context", element.getContextElement(), false);
33773      }
33774      if (element.hasContextTypeElement()) {
33775        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
33776        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
33777      }
33778      if (element.hasElementElement()) {
33779        composeStringCore("element", element.getElementElement(), false);
33780        composeStringExtras("element", element.getElementElement(), false);
33781      }
33782      if (element.hasVariableElement()) {
33783        composeIdCore("variable", element.getVariableElement(), false);
33784        composeIdExtras("variable", element.getVariableElement(), false);
33785      }
33786      if (element.hasListMode()) {
33787        openArray("listMode");
33788        for (Enumeration<StructureMap.StructureMapListMode> e : element.getListMode()) 
33789          composeEnumerationCore(null, e, new StructureMap.StructureMapListModeEnumFactory(), true);
33790        closeArray();
33791        if (anyHasExtras(element.getListMode())) {
33792          openArray("_listMode");
33793          for (Enumeration<StructureMap.StructureMapListMode> e : element.getListMode()) 
33794            composeEnumerationExtras(null, e, new StructureMap.StructureMapListModeEnumFactory(), true);
33795          closeArray();
33796        }
33797      };
33798      if (element.hasListRuleIdElement()) {
33799        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
33800        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
33801      }
33802      if (element.hasTransformElement()) {
33803        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
33804        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
33805      }
33806      if (element.hasParameter()) {
33807        openArray("parameter");
33808        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
33809          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
33810        closeArray();
33811      };
33812  }
33813
33814  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
33815    if (element != null) {
33816      open(name);
33817      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
33818      close();
33819    }
33820  }
33821
33822  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
33823      composeBackbone(element);
33824      if (element.hasValue()) {
33825        composeType("value", element.getValue());
33826      }
33827  }
33828
33829  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
33830    if (element != null) {
33831      open(name);
33832      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
33833      close();
33834    }
33835  }
33836
33837  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
33838      composeBackbone(element);
33839      if (element.hasNameElement()) {
33840        composeIdCore("name", element.getNameElement(), false);
33841        composeIdExtras("name", element.getNameElement(), false);
33842      }
33843      if (element.hasVariable()) {
33844        openArray("variable");
33845        for (StringType e : element.getVariable()) 
33846          composeStringCore(null, e, true);
33847        closeArray();
33848        if (anyHasExtras(element.getVariable())) {
33849          openArray("_variable");
33850          for (StringType e : element.getVariable()) 
33851            composeStringExtras(null, e, true);
33852          closeArray();
33853        }
33854      };
33855  }
33856
33857  protected void composeSubscription(String name, Subscription element) throws IOException {
33858    if (element != null) {
33859      prop("resourceType", name);
33860      composeSubscriptionInner(element);
33861    }
33862  }
33863
33864  protected void composeSubscriptionInner(Subscription element) throws IOException {
33865      composeDomainResourceElements(element);
33866      if (element.hasCriteriaElement()) {
33867        composeStringCore("criteria", element.getCriteriaElement(), false);
33868        composeStringExtras("criteria", element.getCriteriaElement(), false);
33869      }
33870      if (element.hasContact()) {
33871        openArray("contact");
33872        for (ContactPoint e : element.getContact()) 
33873          composeContactPoint(null, e);
33874        closeArray();
33875      };
33876      if (element.hasReasonElement()) {
33877        composeStringCore("reason", element.getReasonElement(), false);
33878        composeStringExtras("reason", element.getReasonElement(), false);
33879      }
33880      if (element.hasStatusElement()) {
33881        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
33882        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
33883      }
33884      if (element.hasErrorElement()) {
33885        composeStringCore("error", element.getErrorElement(), false);
33886        composeStringExtras("error", element.getErrorElement(), false);
33887      }
33888      if (element.hasChannel()) {
33889        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
33890      }
33891      if (element.hasEndElement()) {
33892        composeInstantCore("end", element.getEndElement(), false);
33893        composeInstantExtras("end", element.getEndElement(), false);
33894      }
33895      if (element.hasTag()) {
33896        openArray("tag");
33897        for (Coding e : element.getTag()) 
33898          composeCoding(null, e);
33899        closeArray();
33900      };
33901  }
33902
33903  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
33904    if (element != null) {
33905      open(name);
33906      composeSubscriptionSubscriptionChannelComponentInner(element);
33907      close();
33908    }
33909  }
33910
33911  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
33912      composeBackbone(element);
33913      if (element.hasTypeElement()) {
33914        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
33915        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
33916      }
33917      if (element.hasEndpointElement()) {
33918        composeUriCore("endpoint", element.getEndpointElement(), false);
33919        composeUriExtras("endpoint", element.getEndpointElement(), false);
33920      }
33921      if (element.hasPayloadElement()) {
33922        composeStringCore("payload", element.getPayloadElement(), false);
33923        composeStringExtras("payload", element.getPayloadElement(), false);
33924      }
33925      if (element.hasHeaderElement()) {
33926        composeStringCore("header", element.getHeaderElement(), false);
33927        composeStringExtras("header", element.getHeaderElement(), false);
33928      }
33929  }
33930
33931  protected void composeSubstance(String name, Substance element) throws IOException {
33932    if (element != null) {
33933      prop("resourceType", name);
33934      composeSubstanceInner(element);
33935    }
33936  }
33937
33938  protected void composeSubstanceInner(Substance element) throws IOException {
33939      composeDomainResourceElements(element);
33940      if (element.hasIdentifier()) {
33941        openArray("identifier");
33942        for (Identifier e : element.getIdentifier()) 
33943          composeIdentifier(null, e);
33944        closeArray();
33945      };
33946      if (element.hasCategory()) {
33947        openArray("category");
33948        for (CodeableConcept e : element.getCategory()) 
33949          composeCodeableConcept(null, e);
33950        closeArray();
33951      };
33952      if (element.hasCode()) {
33953        composeCodeableConcept("code", element.getCode());
33954      }
33955      if (element.hasDescriptionElement()) {
33956        composeStringCore("description", element.getDescriptionElement(), false);
33957        composeStringExtras("description", element.getDescriptionElement(), false);
33958      }
33959      if (element.hasInstance()) {
33960        openArray("instance");
33961        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
33962          composeSubstanceSubstanceInstanceComponent(null, e);
33963        closeArray();
33964      };
33965      if (element.hasIngredient()) {
33966        openArray("ingredient");
33967        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
33968          composeSubstanceSubstanceIngredientComponent(null, e);
33969        closeArray();
33970      };
33971  }
33972
33973  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
33974    if (element != null) {
33975      open(name);
33976      composeSubstanceSubstanceInstanceComponentInner(element);
33977      close();
33978    }
33979  }
33980
33981  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
33982      composeBackbone(element);
33983      if (element.hasIdentifier()) {
33984        composeIdentifier("identifier", element.getIdentifier());
33985      }
33986      if (element.hasExpiryElement()) {
33987        composeDateTimeCore("expiry", element.getExpiryElement(), false);
33988        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
33989      }
33990      if (element.hasQuantity()) {
33991        composeSimpleQuantity("quantity", element.getQuantity());
33992      }
33993  }
33994
33995  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
33996    if (element != null) {
33997      open(name);
33998      composeSubstanceSubstanceIngredientComponentInner(element);
33999      close();
34000    }
34001  }
34002
34003  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
34004      composeBackbone(element);
34005      if (element.hasQuantity()) {
34006        composeRatio("quantity", element.getQuantity());
34007      }
34008      if (element.hasSubstance()) {
34009        composeReference("substance", element.getSubstance());
34010      }
34011  }
34012
34013  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
34014    if (element != null) {
34015      prop("resourceType", name);
34016      composeSupplyDeliveryInner(element);
34017    }
34018  }
34019
34020  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
34021      composeDomainResourceElements(element);
34022      if (element.hasIdentifier()) {
34023        composeIdentifier("identifier", element.getIdentifier());
34024      }
34025      if (element.hasStatusElement()) {
34026        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
34027        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
34028      }
34029      if (element.hasPatient()) {
34030        composeReference("patient", element.getPatient());
34031      }
34032      if (element.hasType()) {
34033        composeCodeableConcept("type", element.getType());
34034      }
34035      if (element.hasQuantity()) {
34036        composeSimpleQuantity("quantity", element.getQuantity());
34037      }
34038      if (element.hasSuppliedItem()) {
34039        composeReference("suppliedItem", element.getSuppliedItem());
34040      }
34041      if (element.hasSupplier()) {
34042        composeReference("supplier", element.getSupplier());
34043      }
34044      if (element.hasWhenPrepared()) {
34045        composePeriod("whenPrepared", element.getWhenPrepared());
34046      }
34047      if (element.hasTimeElement()) {
34048        composeDateTimeCore("time", element.getTimeElement(), false);
34049        composeDateTimeExtras("time", element.getTimeElement(), false);
34050      }
34051      if (element.hasDestination()) {
34052        composeReference("destination", element.getDestination());
34053      }
34054      if (element.hasReceiver()) {
34055        openArray("receiver");
34056        for (Reference e : element.getReceiver()) 
34057          composeReference(null, e);
34058        closeArray();
34059      };
34060  }
34061
34062  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
34063    if (element != null) {
34064      prop("resourceType", name);
34065      composeSupplyRequestInner(element);
34066    }
34067  }
34068
34069  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
34070      composeDomainResourceElements(element);
34071      if (element.hasPatient()) {
34072        composeReference("patient", element.getPatient());
34073      }
34074      if (element.hasSource()) {
34075        composeReference("source", element.getSource());
34076      }
34077      if (element.hasDateElement()) {
34078        composeDateTimeCore("date", element.getDateElement(), false);
34079        composeDateTimeExtras("date", element.getDateElement(), false);
34080      }
34081      if (element.hasIdentifier()) {
34082        composeIdentifier("identifier", element.getIdentifier());
34083      }
34084      if (element.hasStatusElement()) {
34085        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
34086        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
34087      }
34088      if (element.hasKind()) {
34089        composeCodeableConcept("kind", element.getKind());
34090      }
34091      if (element.hasOrderedItem()) {
34092        composeReference("orderedItem", element.getOrderedItem());
34093      }
34094      if (element.hasSupplier()) {
34095        openArray("supplier");
34096        for (Reference e : element.getSupplier()) 
34097          composeReference(null, e);
34098        closeArray();
34099      };
34100      if (element.hasReason()) {
34101        composeType("reason", element.getReason());
34102      }
34103      if (element.hasWhen()) {
34104        composeSupplyRequestSupplyRequestWhenComponent("when", element.getWhen());
34105      }
34106  }
34107
34108  protected void composeSupplyRequestSupplyRequestWhenComponent(String name, SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
34109    if (element != null) {
34110      open(name);
34111      composeSupplyRequestSupplyRequestWhenComponentInner(element);
34112      close();
34113    }
34114  }
34115
34116  protected void composeSupplyRequestSupplyRequestWhenComponentInner(SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
34117      composeBackbone(element);
34118      if (element.hasCode()) {
34119        composeCodeableConcept("code", element.getCode());
34120      }
34121      if (element.hasSchedule()) {
34122        composeTiming("schedule", element.getSchedule());
34123      }
34124  }
34125
34126  protected void composeTask(String name, Task element) throws IOException {
34127    if (element != null) {
34128      prop("resourceType", name);
34129      composeTaskInner(element);
34130    }
34131  }
34132
34133  protected void composeTaskInner(Task element) throws IOException {
34134      composeDomainResourceElements(element);
34135      if (element.hasIdentifier()) {
34136        composeIdentifier("identifier", element.getIdentifier());
34137      }
34138      if (element.hasType()) {
34139        composeCodeableConcept("type", element.getType());
34140      }
34141      if (element.hasDescriptionElement()) {
34142        composeStringCore("description", element.getDescriptionElement(), false);
34143        composeStringExtras("description", element.getDescriptionElement(), false);
34144      }
34145      if (element.hasPerformerType()) {
34146        openArray("performerType");
34147        for (Coding e : element.getPerformerType()) 
34148          composeCoding(null, e);
34149        closeArray();
34150      };
34151      if (element.hasPriorityElement()) {
34152        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
34153        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
34154      }
34155      if (element.hasStatusElement()) {
34156        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
34157        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
34158      }
34159      if (element.hasFailureReason()) {
34160        composeCodeableConcept("failureReason", element.getFailureReason());
34161      }
34162      if (element.hasSubject()) {
34163        composeReference("subject", element.getSubject());
34164      }
34165      if (element.hasFor()) {
34166        composeReference("for", element.getFor());
34167      }
34168      if (element.hasDefinitionElement()) {
34169        composeUriCore("definition", element.getDefinitionElement(), false);
34170        composeUriExtras("definition", element.getDefinitionElement(), false);
34171      }
34172      if (element.hasCreatedElement()) {
34173        composeDateTimeCore("created", element.getCreatedElement(), false);
34174        composeDateTimeExtras("created", element.getCreatedElement(), false);
34175      }
34176      if (element.hasLastModifiedElement()) {
34177        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
34178        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
34179      }
34180      if (element.hasCreator()) {
34181        composeReference("creator", element.getCreator());
34182      }
34183      if (element.hasOwner()) {
34184        composeReference("owner", element.getOwner());
34185      }
34186      if (element.hasParent()) {
34187        composeReference("parent", element.getParent());
34188      }
34189      if (element.hasInput()) {
34190        openArray("input");
34191        for (Task.ParameterComponent e : element.getInput()) 
34192          composeTaskParameterComponent(null, e);
34193        closeArray();
34194      };
34195      if (element.hasOutput()) {
34196        openArray("output");
34197        for (Task.TaskOutputComponent e : element.getOutput()) 
34198          composeTaskTaskOutputComponent(null, e);
34199        closeArray();
34200      };
34201  }
34202
34203  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
34204    if (element != null) {
34205      open(name);
34206      composeTaskParameterComponentInner(element);
34207      close();
34208    }
34209  }
34210
34211  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
34212      composeBackbone(element);
34213      if (element.hasNameElement()) {
34214        composeStringCore("name", element.getNameElement(), false);
34215        composeStringExtras("name", element.getNameElement(), false);
34216      }
34217      if (element.hasValue()) {
34218        composeType("value", element.getValue());
34219      }
34220  }
34221
34222  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
34223    if (element != null) {
34224      open(name);
34225      composeTaskTaskOutputComponentInner(element);
34226      close();
34227    }
34228  }
34229
34230  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
34231      composeBackbone(element);
34232      if (element.hasNameElement()) {
34233        composeStringCore("name", element.getNameElement(), false);
34234        composeStringExtras("name", element.getNameElement(), false);
34235      }
34236      if (element.hasValue()) {
34237        composeType("value", element.getValue());
34238      }
34239  }
34240
34241  protected void composeTestScript(String name, TestScript element) throws IOException {
34242    if (element != null) {
34243      prop("resourceType", name);
34244      composeTestScriptInner(element);
34245    }
34246  }
34247
34248  protected void composeTestScriptInner(TestScript element) throws IOException {
34249      composeDomainResourceElements(element);
34250      if (element.hasUrlElement()) {
34251        composeUriCore("url", element.getUrlElement(), false);
34252        composeUriExtras("url", element.getUrlElement(), false);
34253      }
34254      if (element.hasVersionElement()) {
34255        composeStringCore("version", element.getVersionElement(), false);
34256        composeStringExtras("version", element.getVersionElement(), false);
34257      }
34258      if (element.hasNameElement()) {
34259        composeStringCore("name", element.getNameElement(), false);
34260        composeStringExtras("name", element.getNameElement(), false);
34261      }
34262      if (element.hasStatusElement()) {
34263        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
34264        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
34265      }
34266      if (element.hasIdentifier()) {
34267        composeIdentifier("identifier", element.getIdentifier());
34268      }
34269      if (element.hasExperimentalElement()) {
34270        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34271        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34272      }
34273      if (element.hasPublisherElement()) {
34274        composeStringCore("publisher", element.getPublisherElement(), false);
34275        composeStringExtras("publisher", element.getPublisherElement(), false);
34276      }
34277      if (element.hasContact()) {
34278        openArray("contact");
34279        for (TestScript.TestScriptContactComponent e : element.getContact()) 
34280          composeTestScriptTestScriptContactComponent(null, e);
34281        closeArray();
34282      };
34283      if (element.hasDateElement()) {
34284        composeDateTimeCore("date", element.getDateElement(), false);
34285        composeDateTimeExtras("date", element.getDateElement(), false);
34286      }
34287      if (element.hasDescriptionElement()) {
34288        composeStringCore("description", element.getDescriptionElement(), false);
34289        composeStringExtras("description", element.getDescriptionElement(), false);
34290      }
34291      if (element.hasUseContext()) {
34292        openArray("useContext");
34293        for (CodeableConcept e : element.getUseContext()) 
34294          composeCodeableConcept(null, e);
34295        closeArray();
34296      };
34297      if (element.hasRequirementsElement()) {
34298        composeStringCore("requirements", element.getRequirementsElement(), false);
34299        composeStringExtras("requirements", element.getRequirementsElement(), false);
34300      }
34301      if (element.hasCopyrightElement()) {
34302        composeStringCore("copyright", element.getCopyrightElement(), false);
34303        composeStringExtras("copyright", element.getCopyrightElement(), false);
34304      }
34305      if (element.hasOrigin()) {
34306        openArray("origin");
34307        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
34308          composeTestScriptTestScriptOriginComponent(null, e);
34309        closeArray();
34310      };
34311      if (element.hasDestination()) {
34312        openArray("destination");
34313        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
34314          composeTestScriptTestScriptDestinationComponent(null, e);
34315        closeArray();
34316      };
34317      if (element.hasMetadata()) {
34318        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
34319      }
34320      if (element.hasFixture()) {
34321        openArray("fixture");
34322        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
34323          composeTestScriptTestScriptFixtureComponent(null, e);
34324        closeArray();
34325      };
34326      if (element.hasProfile()) {
34327        openArray("profile");
34328        for (Reference e : element.getProfile()) 
34329          composeReference(null, e);
34330        closeArray();
34331      };
34332      if (element.hasVariable()) {
34333        openArray("variable");
34334        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
34335          composeTestScriptTestScriptVariableComponent(null, e);
34336        closeArray();
34337      };
34338      if (element.hasRule()) {
34339        openArray("rule");
34340        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
34341          composeTestScriptTestScriptRuleComponent(null, e);
34342        closeArray();
34343      };
34344      if (element.hasRuleset()) {
34345        openArray("ruleset");
34346        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
34347          composeTestScriptTestScriptRulesetComponent(null, e);
34348        closeArray();
34349      };
34350      if (element.hasSetup()) {
34351        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
34352      }
34353      if (element.hasTest()) {
34354        openArray("test");
34355        for (TestScript.TestScriptTestComponent e : element.getTest()) 
34356          composeTestScriptTestScriptTestComponent(null, e);
34357        closeArray();
34358      };
34359      if (element.hasTeardown()) {
34360        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
34361      }
34362  }
34363
34364  protected void composeTestScriptTestScriptContactComponent(String name, TestScript.TestScriptContactComponent element) throws IOException {
34365    if (element != null) {
34366      open(name);
34367      composeTestScriptTestScriptContactComponentInner(element);
34368      close();
34369    }
34370  }
34371
34372  protected void composeTestScriptTestScriptContactComponentInner(TestScript.TestScriptContactComponent element) throws IOException {
34373      composeBackbone(element);
34374      if (element.hasNameElement()) {
34375        composeStringCore("name", element.getNameElement(), false);
34376        composeStringExtras("name", element.getNameElement(), false);
34377      }
34378      if (element.hasTelecom()) {
34379        openArray("telecom");
34380        for (ContactPoint e : element.getTelecom()) 
34381          composeContactPoint(null, e);
34382        closeArray();
34383      };
34384  }
34385
34386  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
34387    if (element != null) {
34388      open(name);
34389      composeTestScriptTestScriptOriginComponentInner(element);
34390      close();
34391    }
34392  }
34393
34394  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
34395      composeBackbone(element);
34396      if (element.hasIndexElement()) {
34397        composeIntegerCore("index", element.getIndexElement(), false);
34398        composeIntegerExtras("index", element.getIndexElement(), false);
34399      }
34400      if (element.hasProfile()) {
34401        composeCoding("profile", element.getProfile());
34402      }
34403  }
34404
34405  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
34406    if (element != null) {
34407      open(name);
34408      composeTestScriptTestScriptDestinationComponentInner(element);
34409      close();
34410    }
34411  }
34412
34413  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
34414      composeBackbone(element);
34415      if (element.hasIndexElement()) {
34416        composeIntegerCore("index", element.getIndexElement(), false);
34417        composeIntegerExtras("index", element.getIndexElement(), false);
34418      }
34419      if (element.hasProfile()) {
34420        composeCoding("profile", element.getProfile());
34421      }
34422  }
34423
34424  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
34425    if (element != null) {
34426      open(name);
34427      composeTestScriptTestScriptMetadataComponentInner(element);
34428      close();
34429    }
34430  }
34431
34432  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
34433      composeBackbone(element);
34434      if (element.hasLink()) {
34435        openArray("link");
34436        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
34437          composeTestScriptTestScriptMetadataLinkComponent(null, e);
34438        closeArray();
34439      };
34440      if (element.hasCapability()) {
34441        openArray("capability");
34442        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
34443          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
34444        closeArray();
34445      };
34446  }
34447
34448  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
34449    if (element != null) {
34450      open(name);
34451      composeTestScriptTestScriptMetadataLinkComponentInner(element);
34452      close();
34453    }
34454  }
34455
34456  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
34457      composeBackbone(element);
34458      if (element.hasUrlElement()) {
34459        composeUriCore("url", element.getUrlElement(), false);
34460        composeUriExtras("url", element.getUrlElement(), false);
34461      }
34462      if (element.hasDescriptionElement()) {
34463        composeStringCore("description", element.getDescriptionElement(), false);
34464        composeStringExtras("description", element.getDescriptionElement(), false);
34465      }
34466  }
34467
34468  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
34469    if (element != null) {
34470      open(name);
34471      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
34472      close();
34473    }
34474  }
34475
34476  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
34477      composeBackbone(element);
34478      if (element.hasRequiredElement()) {
34479        composeBooleanCore("required", element.getRequiredElement(), false);
34480        composeBooleanExtras("required", element.getRequiredElement(), false);
34481      }
34482      if (element.hasValidatedElement()) {
34483        composeBooleanCore("validated", element.getValidatedElement(), false);
34484        composeBooleanExtras("validated", element.getValidatedElement(), false);
34485      }
34486      if (element.hasDescriptionElement()) {
34487        composeStringCore("description", element.getDescriptionElement(), false);
34488        composeStringExtras("description", element.getDescriptionElement(), false);
34489      }
34490      if (element.hasOrigin()) {
34491        openArray("origin");
34492        for (IntegerType e : element.getOrigin()) 
34493          composeIntegerCore(null, e, true);
34494        closeArray();
34495        if (anyHasExtras(element.getOrigin())) {
34496          openArray("_origin");
34497          for (IntegerType e : element.getOrigin()) 
34498            composeIntegerExtras(null, e, true);
34499          closeArray();
34500        }
34501      };
34502      if (element.hasDestinationElement()) {
34503        composeIntegerCore("destination", element.getDestinationElement(), false);
34504        composeIntegerExtras("destination", element.getDestinationElement(), false);
34505      }
34506      if (element.hasLink()) {
34507        openArray("link");
34508        for (UriType e : element.getLink()) 
34509          composeUriCore(null, e, true);
34510        closeArray();
34511        if (anyHasExtras(element.getLink())) {
34512          openArray("_link");
34513          for (UriType e : element.getLink()) 
34514            composeUriExtras(null, e, true);
34515          closeArray();
34516        }
34517      };
34518      if (element.hasConformance()) {
34519        composeReference("conformance", element.getConformance());
34520      }
34521  }
34522
34523  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
34524    if (element != null) {
34525      open(name);
34526      composeTestScriptTestScriptFixtureComponentInner(element);
34527      close();
34528    }
34529  }
34530
34531  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
34532      composeBackbone(element);
34533      if (element.hasAutocreateElement()) {
34534        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
34535        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
34536      }
34537      if (element.hasAutodeleteElement()) {
34538        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
34539        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
34540      }
34541      if (element.hasResource()) {
34542        composeReference("resource", element.getResource());
34543      }
34544  }
34545
34546  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
34547    if (element != null) {
34548      open(name);
34549      composeTestScriptTestScriptVariableComponentInner(element);
34550      close();
34551    }
34552  }
34553
34554  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
34555      composeBackbone(element);
34556      if (element.hasNameElement()) {
34557        composeStringCore("name", element.getNameElement(), false);
34558        composeStringExtras("name", element.getNameElement(), false);
34559      }
34560      if (element.hasDefaultValueElement()) {
34561        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
34562        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
34563      }
34564      if (element.hasHeaderFieldElement()) {
34565        composeStringCore("headerField", element.getHeaderFieldElement(), false);
34566        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
34567      }
34568      if (element.hasPathElement()) {
34569        composeStringCore("path", element.getPathElement(), false);
34570        composeStringExtras("path", element.getPathElement(), false);
34571      }
34572      if (element.hasSourceIdElement()) {
34573        composeIdCore("sourceId", element.getSourceIdElement(), false);
34574        composeIdExtras("sourceId", element.getSourceIdElement(), false);
34575      }
34576  }
34577
34578  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
34579    if (element != null) {
34580      open(name);
34581      composeTestScriptTestScriptRuleComponentInner(element);
34582      close();
34583    }
34584  }
34585
34586  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
34587      composeBackbone(element);
34588      if (element.hasResource()) {
34589        composeReference("resource", element.getResource());
34590      }
34591      if (element.hasParam()) {
34592        openArray("param");
34593        for (TestScript.TestScriptRuleParamComponent e : element.getParam()) 
34594          composeTestScriptTestScriptRuleParamComponent(null, e);
34595        closeArray();
34596      };
34597  }
34598
34599  protected void composeTestScriptTestScriptRuleParamComponent(String name, TestScript.TestScriptRuleParamComponent element) throws IOException {
34600    if (element != null) {
34601      open(name);
34602      composeTestScriptTestScriptRuleParamComponentInner(element);
34603      close();
34604    }
34605  }
34606
34607  protected void composeTestScriptTestScriptRuleParamComponentInner(TestScript.TestScriptRuleParamComponent element) throws IOException {
34608      composeBackbone(element);
34609      if (element.hasNameElement()) {
34610        composeStringCore("name", element.getNameElement(), false);
34611        composeStringExtras("name", element.getNameElement(), false);
34612      }
34613      if (element.hasValueElement()) {
34614        composeStringCore("value", element.getValueElement(), false);
34615        composeStringExtras("value", element.getValueElement(), false);
34616      }
34617  }
34618
34619  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
34620    if (element != null) {
34621      open(name);
34622      composeTestScriptTestScriptRulesetComponentInner(element);
34623      close();
34624    }
34625  }
34626
34627  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
34628      composeBackbone(element);
34629      if (element.hasResource()) {
34630        composeReference("resource", element.getResource());
34631      }
34632      if (element.hasRule()) {
34633        openArray("rule");
34634        for (TestScript.TestScriptRulesetRuleComponent e : element.getRule()) 
34635          composeTestScriptTestScriptRulesetRuleComponent(null, e);
34636        closeArray();
34637      };
34638  }
34639
34640  protected void composeTestScriptTestScriptRulesetRuleComponent(String name, TestScript.TestScriptRulesetRuleComponent element) throws IOException {
34641    if (element != null) {
34642      open(name);
34643      composeTestScriptTestScriptRulesetRuleComponentInner(element);
34644      close();
34645    }
34646  }
34647
34648  protected void composeTestScriptTestScriptRulesetRuleComponentInner(TestScript.TestScriptRulesetRuleComponent element) throws IOException {
34649      composeBackbone(element);
34650      if (element.hasRuleIdElement()) {
34651        composeIdCore("ruleId", element.getRuleIdElement(), false);
34652        composeIdExtras("ruleId", element.getRuleIdElement(), false);
34653      }
34654      if (element.hasParam()) {
34655        openArray("param");
34656        for (TestScript.TestScriptRulesetRuleParamComponent e : element.getParam()) 
34657          composeTestScriptTestScriptRulesetRuleParamComponent(null, e);
34658        closeArray();
34659      };
34660  }
34661
34662  protected void composeTestScriptTestScriptRulesetRuleParamComponent(String name, TestScript.TestScriptRulesetRuleParamComponent element) throws IOException {
34663    if (element != null) {
34664      open(name);
34665      composeTestScriptTestScriptRulesetRuleParamComponentInner(element);
34666      close();
34667    }
34668  }
34669
34670  protected void composeTestScriptTestScriptRulesetRuleParamComponentInner(TestScript.TestScriptRulesetRuleParamComponent element) throws IOException {
34671      composeBackbone(element);
34672      if (element.hasNameElement()) {
34673        composeStringCore("name", element.getNameElement(), false);
34674        composeStringExtras("name", element.getNameElement(), false);
34675      }
34676      if (element.hasValueElement()) {
34677        composeStringCore("value", element.getValueElement(), false);
34678        composeStringExtras("value", element.getValueElement(), false);
34679      }
34680  }
34681
34682  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
34683    if (element != null) {
34684      open(name);
34685      composeTestScriptTestScriptSetupComponentInner(element);
34686      close();
34687    }
34688  }
34689
34690  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
34691      composeBackbone(element);
34692      if (element.hasMetadata()) {
34693        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
34694      }
34695      if (element.hasAction()) {
34696        openArray("action");
34697        for (TestScript.SetupActionComponent e : element.getAction()) 
34698          composeTestScriptSetupActionComponent(null, e);
34699        closeArray();
34700      };
34701  }
34702
34703  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
34704    if (element != null) {
34705      open(name);
34706      composeTestScriptSetupActionComponentInner(element);
34707      close();
34708    }
34709  }
34710
34711  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
34712      composeBackbone(element);
34713      if (element.hasOperation()) {
34714        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
34715      }
34716      if (element.hasAssert()) {
34717        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
34718      }
34719  }
34720
34721  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
34722    if (element != null) {
34723      open(name);
34724      composeTestScriptSetupActionOperationComponentInner(element);
34725      close();
34726    }
34727  }
34728
34729  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
34730      composeBackbone(element);
34731      if (element.hasType()) {
34732        composeCoding("type", element.getType());
34733      }
34734      if (element.hasResourceElement()) {
34735        composeCodeCore("resource", element.getResourceElement(), false);
34736        composeCodeExtras("resource", element.getResourceElement(), false);
34737      }
34738      if (element.hasLabelElement()) {
34739        composeStringCore("label", element.getLabelElement(), false);
34740        composeStringExtras("label", element.getLabelElement(), false);
34741      }
34742      if (element.hasDescriptionElement()) {
34743        composeStringCore("description", element.getDescriptionElement(), false);
34744        composeStringExtras("description", element.getDescriptionElement(), false);
34745      }
34746      if (element.hasAcceptElement()) {
34747        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
34748        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
34749      }
34750      if (element.hasContentTypeElement()) {
34751        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
34752        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
34753      }
34754      if (element.hasDestinationElement()) {
34755        composeIntegerCore("destination", element.getDestinationElement(), false);
34756        composeIntegerExtras("destination", element.getDestinationElement(), false);
34757      }
34758      if (element.hasEncodeRequestUrlElement()) {
34759        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
34760        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
34761      }
34762      if (element.hasOriginElement()) {
34763        composeIntegerCore("origin", element.getOriginElement(), false);
34764        composeIntegerExtras("origin", element.getOriginElement(), false);
34765      }
34766      if (element.hasParamsElement()) {
34767        composeStringCore("params", element.getParamsElement(), false);
34768        composeStringExtras("params", element.getParamsElement(), false);
34769      }
34770      if (element.hasRequestHeader()) {
34771        openArray("requestHeader");
34772        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
34773          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
34774        closeArray();
34775      };
34776      if (element.hasResponseIdElement()) {
34777        composeIdCore("responseId", element.getResponseIdElement(), false);
34778        composeIdExtras("responseId", element.getResponseIdElement(), false);
34779      }
34780      if (element.hasSourceIdElement()) {
34781        composeIdCore("sourceId", element.getSourceIdElement(), false);
34782        composeIdExtras("sourceId", element.getSourceIdElement(), false);
34783      }
34784      if (element.hasTargetIdElement()) {
34785        composeIdCore("targetId", element.getTargetIdElement(), false);
34786        composeIdExtras("targetId", element.getTargetIdElement(), false);
34787      }
34788      if (element.hasUrlElement()) {
34789        composeStringCore("url", element.getUrlElement(), false);
34790        composeStringExtras("url", element.getUrlElement(), false);
34791      }
34792  }
34793
34794  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
34795    if (element != null) {
34796      open(name);
34797      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
34798      close();
34799    }
34800  }
34801
34802  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
34803      composeBackbone(element);
34804      if (element.hasFieldElement()) {
34805        composeStringCore("field", element.getFieldElement(), false);
34806        composeStringExtras("field", element.getFieldElement(), false);
34807      }
34808      if (element.hasValueElement()) {
34809        composeStringCore("value", element.getValueElement(), false);
34810        composeStringExtras("value", element.getValueElement(), false);
34811      }
34812  }
34813
34814  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
34815    if (element != null) {
34816      open(name);
34817      composeTestScriptSetupActionAssertComponentInner(element);
34818      close();
34819    }
34820  }
34821
34822  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
34823      composeBackbone(element);
34824      if (element.hasLabelElement()) {
34825        composeStringCore("label", element.getLabelElement(), false);
34826        composeStringExtras("label", element.getLabelElement(), false);
34827      }
34828      if (element.hasDescriptionElement()) {
34829        composeStringCore("description", element.getDescriptionElement(), false);
34830        composeStringExtras("description", element.getDescriptionElement(), false);
34831      }
34832      if (element.hasDirectionElement()) {
34833        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
34834        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
34835      }
34836      if (element.hasCompareToSourceIdElement()) {
34837        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
34838        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
34839      }
34840      if (element.hasCompareToSourcePathElement()) {
34841        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
34842        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
34843      }
34844      if (element.hasContentTypeElement()) {
34845        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
34846        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
34847      }
34848      if (element.hasHeaderFieldElement()) {
34849        composeStringCore("headerField", element.getHeaderFieldElement(), false);
34850        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
34851      }
34852      if (element.hasMinimumIdElement()) {
34853        composeStringCore("minimumId", element.getMinimumIdElement(), false);
34854        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
34855      }
34856      if (element.hasNavigationLinksElement()) {
34857        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
34858        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
34859      }
34860      if (element.hasOperatorElement()) {
34861        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
34862        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
34863      }
34864      if (element.hasPathElement()) {
34865        composeStringCore("path", element.getPathElement(), false);
34866        composeStringExtras("path", element.getPathElement(), false);
34867      }
34868      if (element.hasResourceElement()) {
34869        composeCodeCore("resource", element.getResourceElement(), false);
34870        composeCodeExtras("resource", element.getResourceElement(), false);
34871      }
34872      if (element.hasResponseElement()) {
34873        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
34874        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
34875      }
34876      if (element.hasResponseCodeElement()) {
34877        composeStringCore("responseCode", element.getResponseCodeElement(), false);
34878        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
34879      }
34880      if (element.hasRule()) {
34881        composeTestScriptSetupActionAssertRuleComponent("rule", element.getRule());
34882      }
34883      if (element.hasRuleset()) {
34884        composeTestScriptSetupActionAssertRulesetComponent("ruleset", element.getRuleset());
34885      }
34886      if (element.hasSourceIdElement()) {
34887        composeIdCore("sourceId", element.getSourceIdElement(), false);
34888        composeIdExtras("sourceId", element.getSourceIdElement(), false);
34889      }
34890      if (element.hasValidateProfileIdElement()) {
34891        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
34892        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
34893      }
34894      if (element.hasValueElement()) {
34895        composeStringCore("value", element.getValueElement(), false);
34896        composeStringExtras("value", element.getValueElement(), false);
34897      }
34898      if (element.hasWarningOnlyElement()) {
34899        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
34900        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
34901      }
34902  }
34903
34904  protected void composeTestScriptSetupActionAssertRuleComponent(String name, TestScript.SetupActionAssertRuleComponent element) throws IOException {
34905    if (element != null) {
34906      open(name);
34907      composeTestScriptSetupActionAssertRuleComponentInner(element);
34908      close();
34909    }
34910  }
34911
34912  protected void composeTestScriptSetupActionAssertRuleComponentInner(TestScript.SetupActionAssertRuleComponent element) throws IOException {
34913      composeBackbone(element);
34914      if (element.hasRuleIdElement()) {
34915        composeIdCore("ruleId", element.getRuleIdElement(), false);
34916        composeIdExtras("ruleId", element.getRuleIdElement(), false);
34917      }
34918      if (element.hasParam()) {
34919        openArray("param");
34920        for (TestScript.SetupActionAssertRuleParamComponent e : element.getParam()) 
34921          composeTestScriptSetupActionAssertRuleParamComponent(null, e);
34922        closeArray();
34923      };
34924  }
34925
34926  protected void composeTestScriptSetupActionAssertRuleParamComponent(String name, TestScript.SetupActionAssertRuleParamComponent element) throws IOException {
34927    if (element != null) {
34928      open(name);
34929      composeTestScriptSetupActionAssertRuleParamComponentInner(element);
34930      close();
34931    }
34932  }
34933
34934  protected void composeTestScriptSetupActionAssertRuleParamComponentInner(TestScript.SetupActionAssertRuleParamComponent element) throws IOException {
34935      composeBackbone(element);
34936      if (element.hasNameElement()) {
34937        composeStringCore("name", element.getNameElement(), false);
34938        composeStringExtras("name", element.getNameElement(), false);
34939      }
34940      if (element.hasValueElement()) {
34941        composeStringCore("value", element.getValueElement(), false);
34942        composeStringExtras("value", element.getValueElement(), false);
34943      }
34944  }
34945
34946  protected void composeTestScriptSetupActionAssertRulesetComponent(String name, TestScript.SetupActionAssertRulesetComponent element) throws IOException {
34947    if (element != null) {
34948      open(name);
34949      composeTestScriptSetupActionAssertRulesetComponentInner(element);
34950      close();
34951    }
34952  }
34953
34954  protected void composeTestScriptSetupActionAssertRulesetComponentInner(TestScript.SetupActionAssertRulesetComponent element) throws IOException {
34955      composeBackbone(element);
34956      if (element.hasRulesetIdElement()) {
34957        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
34958        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
34959      }
34960      if (element.hasRule()) {
34961        openArray("rule");
34962        for (TestScript.SetupActionAssertRulesetRuleComponent e : element.getRule()) 
34963          composeTestScriptSetupActionAssertRulesetRuleComponent(null, e);
34964        closeArray();
34965      };
34966  }
34967
34968  protected void composeTestScriptSetupActionAssertRulesetRuleComponent(String name, TestScript.SetupActionAssertRulesetRuleComponent element) throws IOException {
34969    if (element != null) {
34970      open(name);
34971      composeTestScriptSetupActionAssertRulesetRuleComponentInner(element);
34972      close();
34973    }
34974  }
34975
34976  protected void composeTestScriptSetupActionAssertRulesetRuleComponentInner(TestScript.SetupActionAssertRulesetRuleComponent element) throws IOException {
34977      composeBackbone(element);
34978      if (element.hasRuleIdElement()) {
34979        composeIdCore("ruleId", element.getRuleIdElement(), false);
34980        composeIdExtras("ruleId", element.getRuleIdElement(), false);
34981      }
34982      if (element.hasParam()) {
34983        openArray("param");
34984        for (TestScript.SetupActionAssertRulesetRuleParamComponent e : element.getParam()) 
34985          composeTestScriptSetupActionAssertRulesetRuleParamComponent(null, e);
34986        closeArray();
34987      };
34988  }
34989
34990  protected void composeTestScriptSetupActionAssertRulesetRuleParamComponent(String name, TestScript.SetupActionAssertRulesetRuleParamComponent element) throws IOException {
34991    if (element != null) {
34992      open(name);
34993      composeTestScriptSetupActionAssertRulesetRuleParamComponentInner(element);
34994      close();
34995    }
34996  }
34997
34998  protected void composeTestScriptSetupActionAssertRulesetRuleParamComponentInner(TestScript.SetupActionAssertRulesetRuleParamComponent element) throws IOException {
34999      composeBackbone(element);
35000      if (element.hasNameElement()) {
35001        composeStringCore("name", element.getNameElement(), false);
35002        composeStringExtras("name", element.getNameElement(), false);
35003      }
35004      if (element.hasValueElement()) {
35005        composeStringCore("value", element.getValueElement(), false);
35006        composeStringExtras("value", element.getValueElement(), false);
35007      }
35008  }
35009
35010  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
35011    if (element != null) {
35012      open(name);
35013      composeTestScriptTestScriptTestComponentInner(element);
35014      close();
35015    }
35016  }
35017
35018  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
35019      composeBackbone(element);
35020      if (element.hasNameElement()) {
35021        composeStringCore("name", element.getNameElement(), false);
35022        composeStringExtras("name", element.getNameElement(), false);
35023      }
35024      if (element.hasDescriptionElement()) {
35025        composeStringCore("description", element.getDescriptionElement(), false);
35026        composeStringExtras("description", element.getDescriptionElement(), false);
35027      }
35028      if (element.hasMetadata()) {
35029        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
35030      }
35031      if (element.hasAction()) {
35032        openArray("action");
35033        for (TestScript.TestActionComponent e : element.getAction()) 
35034          composeTestScriptTestActionComponent(null, e);
35035        closeArray();
35036      };
35037  }
35038
35039  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
35040    if (element != null) {
35041      open(name);
35042      composeTestScriptTestActionComponentInner(element);
35043      close();
35044    }
35045  }
35046
35047  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
35048      composeBackbone(element);
35049      if (element.hasOperation()) {
35050        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
35051      }
35052      if (element.hasAssert()) {
35053        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
35054      }
35055  }
35056
35057  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
35058    if (element != null) {
35059      open(name);
35060      composeTestScriptTestScriptTeardownComponentInner(element);
35061      close();
35062    }
35063  }
35064
35065  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
35066      composeBackbone(element);
35067      if (element.hasAction()) {
35068        openArray("action");
35069        for (TestScript.TeardownActionComponent e : element.getAction()) 
35070          composeTestScriptTeardownActionComponent(null, e);
35071        closeArray();
35072      };
35073  }
35074
35075  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
35076    if (element != null) {
35077      open(name);
35078      composeTestScriptTeardownActionComponentInner(element);
35079      close();
35080    }
35081  }
35082
35083  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
35084      composeBackbone(element);
35085      if (element.hasOperation()) {
35086        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
35087      }
35088  }
35089
35090  protected void composeValueSet(String name, ValueSet element) throws IOException {
35091    if (element != null) {
35092      prop("resourceType", name);
35093      composeValueSetInner(element);
35094    }
35095  }
35096
35097  protected void composeValueSetInner(ValueSet element) throws IOException {
35098      composeDomainResourceElements(element);
35099      if (element.hasUrlElement()) {
35100        composeUriCore("url", element.getUrlElement(), false);
35101        composeUriExtras("url", element.getUrlElement(), false);
35102      }
35103      if (element.hasIdentifier()) {
35104        composeIdentifier("identifier", element.getIdentifier());
35105      }
35106      if (element.hasVersionElement()) {
35107        composeStringCore("version", element.getVersionElement(), false);
35108        composeStringExtras("version", element.getVersionElement(), false);
35109      }
35110      if (element.hasNameElement()) {
35111        composeStringCore("name", element.getNameElement(), false);
35112        composeStringExtras("name", element.getNameElement(), false);
35113      }
35114      if (element.hasStatusElement()) {
35115        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
35116        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
35117      }
35118      if (element.hasExperimentalElement()) {
35119        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35120        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35121      }
35122      if (element.hasPublisherElement()) {
35123        composeStringCore("publisher", element.getPublisherElement(), false);
35124        composeStringExtras("publisher", element.getPublisherElement(), false);
35125      }
35126      if (element.hasContact()) {
35127        openArray("contact");
35128        for (ValueSet.ValueSetContactComponent e : element.getContact()) 
35129          composeValueSetValueSetContactComponent(null, e);
35130        closeArray();
35131      };
35132      if (element.hasDateElement()) {
35133        composeDateTimeCore("date", element.getDateElement(), false);
35134        composeDateTimeExtras("date", element.getDateElement(), false);
35135      }
35136      if (element.hasLockedDateElement()) {
35137        composeDateCore("lockedDate", element.getLockedDateElement(), false);
35138        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
35139      }
35140      if (element.hasDescriptionElement()) {
35141        composeStringCore("description", element.getDescriptionElement(), false);
35142        composeStringExtras("description", element.getDescriptionElement(), false);
35143      }
35144      if (element.hasUseContext()) {
35145        openArray("useContext");
35146        for (CodeableConcept e : element.getUseContext()) 
35147          composeCodeableConcept(null, e);
35148        closeArray();
35149      };
35150      if (element.hasImmutableElement()) {
35151        composeBooleanCore("immutable", element.getImmutableElement(), false);
35152        composeBooleanExtras("immutable", element.getImmutableElement(), false);
35153      }
35154      if (element.hasRequirementsElement()) {
35155        composeStringCore("requirements", element.getRequirementsElement(), false);
35156        composeStringExtras("requirements", element.getRequirementsElement(), false);
35157      }
35158      if (element.hasCopyrightElement()) {
35159        composeStringCore("copyright", element.getCopyrightElement(), false);
35160        composeStringExtras("copyright", element.getCopyrightElement(), false);
35161      }
35162      if (element.hasExtensibleElement()) {
35163        composeBooleanCore("extensible", element.getExtensibleElement(), false);
35164        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
35165      }
35166      if (element.hasCompose()) {
35167        composeValueSetValueSetComposeComponent("compose", element.getCompose());
35168      }
35169      if (element.hasExpansion()) {
35170        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
35171      }
35172  }
35173
35174  protected void composeValueSetValueSetContactComponent(String name, ValueSet.ValueSetContactComponent element) throws IOException {
35175    if (element != null) {
35176      open(name);
35177      composeValueSetValueSetContactComponentInner(element);
35178      close();
35179    }
35180  }
35181
35182  protected void composeValueSetValueSetContactComponentInner(ValueSet.ValueSetContactComponent element) throws IOException {
35183      composeBackbone(element);
35184      if (element.hasNameElement()) {
35185        composeStringCore("name", element.getNameElement(), false);
35186        composeStringExtras("name", element.getNameElement(), false);
35187      }
35188      if (element.hasTelecom()) {
35189        openArray("telecom");
35190        for (ContactPoint e : element.getTelecom()) 
35191          composeContactPoint(null, e);
35192        closeArray();
35193      };
35194  }
35195
35196  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
35197    if (element != null) {
35198      open(name);
35199      composeValueSetValueSetComposeComponentInner(element);
35200      close();
35201    }
35202  }
35203
35204  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
35205      composeBackbone(element);
35206      if (element.hasImport()) {
35207        openArray("import");
35208        for (UriType e : element.getImport()) 
35209          composeUriCore(null, e, true);
35210        closeArray();
35211        if (anyHasExtras(element.getImport())) {
35212          openArray("_import");
35213          for (UriType e : element.getImport()) 
35214            composeUriExtras(null, e, true);
35215          closeArray();
35216        }
35217      };
35218      if (element.hasInclude()) {
35219        openArray("include");
35220        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
35221          composeValueSetConceptSetComponent(null, e);
35222        closeArray();
35223      };
35224      if (element.hasExclude()) {
35225        openArray("exclude");
35226        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
35227          composeValueSetConceptSetComponent(null, e);
35228        closeArray();
35229      };
35230  }
35231
35232  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
35233    if (element != null) {
35234      open(name);
35235      composeValueSetConceptSetComponentInner(element);
35236      close();
35237    }
35238  }
35239
35240  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
35241      composeBackbone(element);
35242      if (element.hasSystemElement()) {
35243        composeUriCore("system", element.getSystemElement(), false);
35244        composeUriExtras("system", element.getSystemElement(), false);
35245      }
35246      if (element.hasVersionElement()) {
35247        composeStringCore("version", element.getVersionElement(), false);
35248        composeStringExtras("version", element.getVersionElement(), false);
35249      }
35250      if (element.hasConcept()) {
35251        openArray("concept");
35252        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
35253          composeValueSetConceptReferenceComponent(null, e);
35254        closeArray();
35255      };
35256      if (element.hasFilter()) {
35257        openArray("filter");
35258        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
35259          composeValueSetConceptSetFilterComponent(null, e);
35260        closeArray();
35261      };
35262  }
35263
35264  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
35265    if (element != null) {
35266      open(name);
35267      composeValueSetConceptReferenceComponentInner(element);
35268      close();
35269    }
35270  }
35271
35272  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
35273      composeBackbone(element);
35274      if (element.hasCodeElement()) {
35275        composeCodeCore("code", element.getCodeElement(), false);
35276        composeCodeExtras("code", element.getCodeElement(), false);
35277      }
35278      if (element.hasDisplayElement()) {
35279        composeStringCore("display", element.getDisplayElement(), false);
35280        composeStringExtras("display", element.getDisplayElement(), false);
35281      }
35282      if (element.hasDesignation()) {
35283        openArray("designation");
35284        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
35285          composeValueSetConceptReferenceDesignationComponent(null, e);
35286        closeArray();
35287      };
35288  }
35289
35290  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
35291    if (element != null) {
35292      open(name);
35293      composeValueSetConceptReferenceDesignationComponentInner(element);
35294      close();
35295    }
35296  }
35297
35298  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
35299      composeBackbone(element);
35300      if (element.hasLanguageElement()) {
35301        composeCodeCore("language", element.getLanguageElement(), false);
35302        composeCodeExtras("language", element.getLanguageElement(), false);
35303      }
35304      if (element.hasUse()) {
35305        composeCoding("use", element.getUse());
35306      }
35307      if (element.hasValueElement()) {
35308        composeStringCore("value", element.getValueElement(), false);
35309        composeStringExtras("value", element.getValueElement(), false);
35310      }
35311  }
35312
35313  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
35314    if (element != null) {
35315      open(name);
35316      composeValueSetConceptSetFilterComponentInner(element);
35317      close();
35318    }
35319  }
35320
35321  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
35322      composeBackbone(element);
35323      if (element.hasPropertyElement()) {
35324        composeCodeCore("property", element.getPropertyElement(), false);
35325        composeCodeExtras("property", element.getPropertyElement(), false);
35326      }
35327      if (element.hasOpElement()) {
35328        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
35329        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
35330      }
35331      if (element.hasValueElement()) {
35332        composeCodeCore("value", element.getValueElement(), false);
35333        composeCodeExtras("value", element.getValueElement(), false);
35334      }
35335  }
35336
35337  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
35338    if (element != null) {
35339      open(name);
35340      composeValueSetValueSetExpansionComponentInner(element);
35341      close();
35342    }
35343  }
35344
35345  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
35346      composeBackbone(element);
35347      if (element.hasIdentifierElement()) {
35348        composeUriCore("identifier", element.getIdentifierElement(), false);
35349        composeUriExtras("identifier", element.getIdentifierElement(), false);
35350      }
35351      if (element.hasTimestampElement()) {
35352        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
35353        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
35354      }
35355      if (element.hasTotalElement()) {
35356        composeIntegerCore("total", element.getTotalElement(), false);
35357        composeIntegerExtras("total", element.getTotalElement(), false);
35358      }
35359      if (element.hasOffsetElement()) {
35360        composeIntegerCore("offset", element.getOffsetElement(), false);
35361        composeIntegerExtras("offset", element.getOffsetElement(), false);
35362      }
35363      if (element.hasParameter()) {
35364        openArray("parameter");
35365        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
35366          composeValueSetValueSetExpansionParameterComponent(null, e);
35367        closeArray();
35368      };
35369      if (element.hasContains()) {
35370        openArray("contains");
35371        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
35372          composeValueSetValueSetExpansionContainsComponent(null, e);
35373        closeArray();
35374      };
35375  }
35376
35377  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
35378    if (element != null) {
35379      open(name);
35380      composeValueSetValueSetExpansionParameterComponentInner(element);
35381      close();
35382    }
35383  }
35384
35385  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
35386      composeBackbone(element);
35387      if (element.hasNameElement()) {
35388        composeStringCore("name", element.getNameElement(), false);
35389        composeStringExtras("name", element.getNameElement(), false);
35390      }
35391      if (element.hasValue()) {
35392        composeType("value", element.getValue());
35393      }
35394  }
35395
35396  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
35397    if (element != null) {
35398      open(name);
35399      composeValueSetValueSetExpansionContainsComponentInner(element);
35400      close();
35401    }
35402  }
35403
35404  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
35405      composeBackbone(element);
35406      if (element.hasSystemElement()) {
35407        composeUriCore("system", element.getSystemElement(), false);
35408        composeUriExtras("system", element.getSystemElement(), false);
35409      }
35410      if (element.hasAbstractElement()) {
35411        composeBooleanCore("abstract", element.getAbstractElement(), false);
35412        composeBooleanExtras("abstract", element.getAbstractElement(), false);
35413      }
35414      if (element.hasVersionElement()) {
35415        composeStringCore("version", element.getVersionElement(), false);
35416        composeStringExtras("version", element.getVersionElement(), false);
35417      }
35418      if (element.hasCodeElement()) {
35419        composeCodeCore("code", element.getCodeElement(), false);
35420        composeCodeExtras("code", element.getCodeElement(), false);
35421      }
35422      if (element.hasDisplayElement()) {
35423        composeStringCore("display", element.getDisplayElement(), false);
35424        composeStringExtras("display", element.getDisplayElement(), false);
35425      }
35426      if (element.hasContains()) {
35427        openArray("contains");
35428        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
35429          composeValueSetValueSetExpansionContainsComponent(null, e);
35430        closeArray();
35431      };
35432  }
35433
35434  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
35435    if (element != null) {
35436      prop("resourceType", name);
35437      composeVisionPrescriptionInner(element);
35438    }
35439  }
35440
35441  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
35442      composeDomainResourceElements(element);
35443      if (element.hasIdentifier()) {
35444        openArray("identifier");
35445        for (Identifier e : element.getIdentifier()) 
35446          composeIdentifier(null, e);
35447        closeArray();
35448      };
35449      if (element.hasDateWrittenElement()) {
35450        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
35451        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
35452      }
35453      if (element.hasPatient()) {
35454        composeReference("patient", element.getPatient());
35455      }
35456      if (element.hasPrescriber()) {
35457        composeReference("prescriber", element.getPrescriber());
35458      }
35459      if (element.hasEncounter()) {
35460        composeReference("encounter", element.getEncounter());
35461      }
35462      if (element.hasReason()) {
35463        composeType("reason", element.getReason());
35464      }
35465      if (element.hasDispense()) {
35466        openArray("dispense");
35467        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
35468          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
35469        closeArray();
35470      };
35471  }
35472
35473  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
35474    if (element != null) {
35475      open(name);
35476      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
35477      close();
35478    }
35479  }
35480
35481  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
35482      composeBackbone(element);
35483      if (element.hasProduct()) {
35484        composeCoding("product", element.getProduct());
35485      }
35486      if (element.hasEyeElement()) {
35487        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
35488        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
35489      }
35490      if (element.hasSphereElement()) {
35491        composeDecimalCore("sphere", element.getSphereElement(), false);
35492        composeDecimalExtras("sphere", element.getSphereElement(), false);
35493      }
35494      if (element.hasCylinderElement()) {
35495        composeDecimalCore("cylinder", element.getCylinderElement(), false);
35496        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
35497      }
35498      if (element.hasAxisElement()) {
35499        composeIntegerCore("axis", element.getAxisElement(), false);
35500        composeIntegerExtras("axis", element.getAxisElement(), false);
35501      }
35502      if (element.hasPrismElement()) {
35503        composeDecimalCore("prism", element.getPrismElement(), false);
35504        composeDecimalExtras("prism", element.getPrismElement(), false);
35505      }
35506      if (element.hasBaseElement()) {
35507        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
35508        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
35509      }
35510      if (element.hasAddElement()) {
35511        composeDecimalCore("add", element.getAddElement(), false);
35512        composeDecimalExtras("add", element.getAddElement(), false);
35513      }
35514      if (element.hasPowerElement()) {
35515        composeDecimalCore("power", element.getPowerElement(), false);
35516        composeDecimalExtras("power", element.getPowerElement(), false);
35517      }
35518      if (element.hasBackCurveElement()) {
35519        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
35520        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
35521      }
35522      if (element.hasDiameterElement()) {
35523        composeDecimalCore("diameter", element.getDiameterElement(), false);
35524        composeDecimalExtras("diameter", element.getDiameterElement(), false);
35525      }
35526      if (element.hasDuration()) {
35527        composeSimpleQuantity("duration", element.getDuration());
35528      }
35529      if (element.hasColorElement()) {
35530        composeStringCore("color", element.getColorElement(), false);
35531        composeStringExtras("color", element.getColorElement(), false);
35532      }
35533      if (element.hasBrandElement()) {
35534        composeStringCore("brand", element.getBrandElement(), false);
35535        composeStringExtras("brand", element.getBrandElement(), false);
35536      }
35537      if (element.hasNotesElement()) {
35538        composeStringCore("notes", element.getNotesElement(), false);
35539        composeStringExtras("notes", element.getNotesElement(), false);
35540      }
35541  }
35542
35543  @Override
35544  protected void composeResource(Resource resource) throws IOException {
35545    if (resource instanceof Parameters)
35546      composeParameters("Parameters", (Parameters)resource);
35547    else if (resource instanceof Account)
35548      composeAccount("Account", (Account)resource);
35549    else if (resource instanceof AllergyIntolerance)
35550      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
35551    else if (resource instanceof Appointment)
35552      composeAppointment("Appointment", (Appointment)resource);
35553    else if (resource instanceof AppointmentResponse)
35554      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
35555    else if (resource instanceof AuditEvent)
35556      composeAuditEvent("AuditEvent", (AuditEvent)resource);
35557    else if (resource instanceof Basic)
35558      composeBasic("Basic", (Basic)resource);
35559    else if (resource instanceof Binary)
35560      composeBinary("Binary", (Binary)resource);
35561    else if (resource instanceof BodySite)
35562      composeBodySite("BodySite", (BodySite)resource);
35563    else if (resource instanceof Bundle)
35564      composeBundle("Bundle", (Bundle)resource);
35565    else if (resource instanceof CarePlan)
35566      composeCarePlan("CarePlan", (CarePlan)resource);
35567    else if (resource instanceof CareTeam)
35568      composeCareTeam("CareTeam", (CareTeam)resource);
35569    else if (resource instanceof Claim)
35570      composeClaim("Claim", (Claim)resource);
35571    else if (resource instanceof ClaimResponse)
35572      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
35573    else if (resource instanceof ClinicalImpression)
35574      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
35575    else if (resource instanceof CodeSystem)
35576      composeCodeSystem("CodeSystem", (CodeSystem)resource);
35577    else if (resource instanceof Communication)
35578      composeCommunication("Communication", (Communication)resource);
35579    else if (resource instanceof CommunicationRequest)
35580      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
35581    else if (resource instanceof CompartmentDefinition)
35582      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
35583    else if (resource instanceof Composition)
35584      composeComposition("Composition", (Composition)resource);
35585    else if (resource instanceof ConceptMap)
35586      composeConceptMap("ConceptMap", (ConceptMap)resource);
35587    else if (resource instanceof Condition)
35588      composeCondition("Condition", (Condition)resource);
35589    else if (resource instanceof Conformance)
35590      composeConformance("Conformance", (Conformance)resource);
35591    else if (resource instanceof Contract)
35592      composeContract("Contract", (Contract)resource);
35593    else if (resource instanceof Coverage)
35594      composeCoverage("Coverage", (Coverage)resource);
35595    else if (resource instanceof DataElement)
35596      composeDataElement("DataElement", (DataElement)resource);
35597    else if (resource instanceof DecisionSupportRule)
35598      composeDecisionSupportRule("DecisionSupportRule", (DecisionSupportRule)resource);
35599    else if (resource instanceof DecisionSupportServiceModule)
35600      composeDecisionSupportServiceModule("DecisionSupportServiceModule", (DecisionSupportServiceModule)resource);
35601    else if (resource instanceof DetectedIssue)
35602      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
35603    else if (resource instanceof Device)
35604      composeDevice("Device", (Device)resource);
35605    else if (resource instanceof DeviceComponent)
35606      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
35607    else if (resource instanceof DeviceMetric)
35608      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
35609    else if (resource instanceof DeviceUseRequest)
35610      composeDeviceUseRequest("DeviceUseRequest", (DeviceUseRequest)resource);
35611    else if (resource instanceof DeviceUseStatement)
35612      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
35613    else if (resource instanceof DiagnosticOrder)
35614      composeDiagnosticOrder("DiagnosticOrder", (DiagnosticOrder)resource);
35615    else if (resource instanceof DiagnosticReport)
35616      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
35617    else if (resource instanceof DocumentManifest)
35618      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
35619    else if (resource instanceof DocumentReference)
35620      composeDocumentReference("DocumentReference", (DocumentReference)resource);
35621    else if (resource instanceof EligibilityRequest)
35622      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
35623    else if (resource instanceof EligibilityResponse)
35624      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
35625    else if (resource instanceof Encounter)
35626      composeEncounter("Encounter", (Encounter)resource);
35627    else if (resource instanceof EnrollmentRequest)
35628      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
35629    else if (resource instanceof EnrollmentResponse)
35630      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
35631    else if (resource instanceof EpisodeOfCare)
35632      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
35633    else if (resource instanceof ExpansionProfile)
35634      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
35635    else if (resource instanceof ExplanationOfBenefit)
35636      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
35637    else if (resource instanceof FamilyMemberHistory)
35638      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
35639    else if (resource instanceof Flag)
35640      composeFlag("Flag", (Flag)resource);
35641    else if (resource instanceof Goal)
35642      composeGoal("Goal", (Goal)resource);
35643    else if (resource instanceof Group)
35644      composeGroup("Group", (Group)resource);
35645    else if (resource instanceof GuidanceResponse)
35646      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
35647    else if (resource instanceof HealthcareService)
35648      composeHealthcareService("HealthcareService", (HealthcareService)resource);
35649    else if (resource instanceof ImagingExcerpt)
35650      composeImagingExcerpt("ImagingExcerpt", (ImagingExcerpt)resource);
35651    else if (resource instanceof ImagingObjectSelection)
35652      composeImagingObjectSelection("ImagingObjectSelection", (ImagingObjectSelection)resource);
35653    else if (resource instanceof ImagingStudy)
35654      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
35655    else if (resource instanceof Immunization)
35656      composeImmunization("Immunization", (Immunization)resource);
35657    else if (resource instanceof ImmunizationRecommendation)
35658      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
35659    else if (resource instanceof ImplementationGuide)
35660      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
35661    else if (resource instanceof Library)
35662      composeLibrary("Library", (Library)resource);
35663    else if (resource instanceof Linkage)
35664      composeLinkage("Linkage", (Linkage)resource);
35665    else if (resource instanceof ListResource)
35666      composeListResource("List", (ListResource)resource);
35667    else if (resource instanceof Location)
35668      composeLocation("Location", (Location)resource);
35669    else if (resource instanceof Measure)
35670      composeMeasure("Measure", (Measure)resource);
35671    else if (resource instanceof MeasureReport)
35672      composeMeasureReport("MeasureReport", (MeasureReport)resource);
35673    else if (resource instanceof Media)
35674      composeMedia("Media", (Media)resource);
35675    else if (resource instanceof Medication)
35676      composeMedication("Medication", (Medication)resource);
35677    else if (resource instanceof MedicationAdministration)
35678      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
35679    else if (resource instanceof MedicationDispense)
35680      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
35681    else if (resource instanceof MedicationOrder)
35682      composeMedicationOrder("MedicationOrder", (MedicationOrder)resource);
35683    else if (resource instanceof MedicationStatement)
35684      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
35685    else if (resource instanceof MessageHeader)
35686      composeMessageHeader("MessageHeader", (MessageHeader)resource);
35687    else if (resource instanceof ModuleDefinition)
35688      composeModuleDefinition("ModuleDefinition", (ModuleDefinition)resource);
35689    else if (resource instanceof NamingSystem)
35690      composeNamingSystem("NamingSystem", (NamingSystem)resource);
35691    else if (resource instanceof NutritionOrder)
35692      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
35693    else if (resource instanceof Observation)
35694      composeObservation("Observation", (Observation)resource);
35695    else if (resource instanceof OperationDefinition)
35696      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
35697    else if (resource instanceof OperationOutcome)
35698      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
35699    else if (resource instanceof Order)
35700      composeOrder("Order", (Order)resource);
35701    else if (resource instanceof OrderResponse)
35702      composeOrderResponse("OrderResponse", (OrderResponse)resource);
35703    else if (resource instanceof OrderSet)
35704      composeOrderSet("OrderSet", (OrderSet)resource);
35705    else if (resource instanceof Organization)
35706      composeOrganization("Organization", (Organization)resource);
35707    else if (resource instanceof Patient)
35708      composePatient("Patient", (Patient)resource);
35709    else if (resource instanceof PaymentNotice)
35710      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
35711    else if (resource instanceof PaymentReconciliation)
35712      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
35713    else if (resource instanceof Person)
35714      composePerson("Person", (Person)resource);
35715    else if (resource instanceof Practitioner)
35716      composePractitioner("Practitioner", (Practitioner)resource);
35717    else if (resource instanceof PractitionerRole)
35718      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
35719    else if (resource instanceof Procedure)
35720      composeProcedure("Procedure", (Procedure)resource);
35721    else if (resource instanceof ProcedureRequest)
35722      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
35723    else if (resource instanceof ProcessRequest)
35724      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
35725    else if (resource instanceof ProcessResponse)
35726      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
35727    else if (resource instanceof Protocol)
35728      composeProtocol("Protocol", (Protocol)resource);
35729    else if (resource instanceof Provenance)
35730      composeProvenance("Provenance", (Provenance)resource);
35731    else if (resource instanceof Questionnaire)
35732      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
35733    else if (resource instanceof QuestionnaireResponse)
35734      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
35735    else if (resource instanceof ReferralRequest)
35736      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
35737    else if (resource instanceof RelatedPerson)
35738      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
35739    else if (resource instanceof RiskAssessment)
35740      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
35741    else if (resource instanceof Schedule)
35742      composeSchedule("Schedule", (Schedule)resource);
35743    else if (resource instanceof SearchParameter)
35744      composeSearchParameter("SearchParameter", (SearchParameter)resource);
35745    else if (resource instanceof Sequence)
35746      composeSequence("Sequence", (Sequence)resource);
35747    else if (resource instanceof Slot)
35748      composeSlot("Slot", (Slot)resource);
35749    else if (resource instanceof Specimen)
35750      composeSpecimen("Specimen", (Specimen)resource);
35751    else if (resource instanceof StructureDefinition)
35752      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
35753    else if (resource instanceof StructureMap)
35754      composeStructureMap("StructureMap", (StructureMap)resource);
35755    else if (resource instanceof Subscription)
35756      composeSubscription("Subscription", (Subscription)resource);
35757    else if (resource instanceof Substance)
35758      composeSubstance("Substance", (Substance)resource);
35759    else if (resource instanceof SupplyDelivery)
35760      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
35761    else if (resource instanceof SupplyRequest)
35762      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
35763    else if (resource instanceof Task)
35764      composeTask("Task", (Task)resource);
35765    else if (resource instanceof TestScript)
35766      composeTestScript("TestScript", (TestScript)resource);
35767    else if (resource instanceof ValueSet)
35768      composeValueSet("ValueSet", (ValueSet)resource);
35769    else if (resource instanceof VisionPrescription)
35770      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
35771    else if (resource instanceof Binary)
35772      composeBinary("Binary", (Binary)resource);
35773    else
35774      throw new Error("Unhandled resource type "+resource.getClass().getName());
35775  }
35776
35777  protected void composeNamedReference(String name, Resource resource) throws IOException {
35778    if (resource instanceof Parameters)
35779      composeParameters(name, (Parameters)resource);
35780    else if (resource instanceof Account)
35781      composeAccount(name, (Account)resource);
35782    else if (resource instanceof AllergyIntolerance)
35783      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
35784    else if (resource instanceof Appointment)
35785      composeAppointment(name, (Appointment)resource);
35786    else if (resource instanceof AppointmentResponse)
35787      composeAppointmentResponse(name, (AppointmentResponse)resource);
35788    else if (resource instanceof AuditEvent)
35789      composeAuditEvent(name, (AuditEvent)resource);
35790    else if (resource instanceof Basic)
35791      composeBasic(name, (Basic)resource);
35792    else if (resource instanceof Binary)
35793      composeBinary(name, (Binary)resource);
35794    else if (resource instanceof BodySite)
35795      composeBodySite(name, (BodySite)resource);
35796    else if (resource instanceof Bundle)
35797      composeBundle(name, (Bundle)resource);
35798    else if (resource instanceof CarePlan)
35799      composeCarePlan(name, (CarePlan)resource);
35800    else if (resource instanceof CareTeam)
35801      composeCareTeam(name, (CareTeam)resource);
35802    else if (resource instanceof Claim)
35803      composeClaim(name, (Claim)resource);
35804    else if (resource instanceof ClaimResponse)
35805      composeClaimResponse(name, (ClaimResponse)resource);
35806    else if (resource instanceof ClinicalImpression)
35807      composeClinicalImpression(name, (ClinicalImpression)resource);
35808    else if (resource instanceof CodeSystem)
35809      composeCodeSystem(name, (CodeSystem)resource);
35810    else if (resource instanceof Communication)
35811      composeCommunication(name, (Communication)resource);
35812    else if (resource instanceof CommunicationRequest)
35813      composeCommunicationRequest(name, (CommunicationRequest)resource);
35814    else if (resource instanceof CompartmentDefinition)
35815      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
35816    else if (resource instanceof Composition)
35817      composeComposition(name, (Composition)resource);
35818    else if (resource instanceof ConceptMap)
35819      composeConceptMap(name, (ConceptMap)resource);
35820    else if (resource instanceof Condition)
35821      composeCondition(name, (Condition)resource);
35822    else if (resource instanceof Conformance)
35823      composeConformance(name, (Conformance)resource);
35824    else if (resource instanceof Contract)
35825      composeContract(name, (Contract)resource);
35826    else if (resource instanceof Coverage)
35827      composeCoverage(name, (Coverage)resource);
35828    else if (resource instanceof DataElement)
35829      composeDataElement(name, (DataElement)resource);
35830    else if (resource instanceof DecisionSupportRule)
35831      composeDecisionSupportRule(name, (DecisionSupportRule)resource);
35832    else if (resource instanceof DecisionSupportServiceModule)
35833      composeDecisionSupportServiceModule(name, (DecisionSupportServiceModule)resource);
35834    else if (resource instanceof DetectedIssue)
35835      composeDetectedIssue(name, (DetectedIssue)resource);
35836    else if (resource instanceof Device)
35837      composeDevice(name, (Device)resource);
35838    else if (resource instanceof DeviceComponent)
35839      composeDeviceComponent(name, (DeviceComponent)resource);
35840    else if (resource instanceof DeviceMetric)
35841      composeDeviceMetric(name, (DeviceMetric)resource);
35842    else if (resource instanceof DeviceUseRequest)
35843      composeDeviceUseRequest(name, (DeviceUseRequest)resource);
35844    else if (resource instanceof DeviceUseStatement)
35845      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
35846    else if (resource instanceof DiagnosticOrder)
35847      composeDiagnosticOrder(name, (DiagnosticOrder)resource);
35848    else if (resource instanceof DiagnosticReport)
35849      composeDiagnosticReport(name, (DiagnosticReport)resource);
35850    else if (resource instanceof DocumentManifest)
35851      composeDocumentManifest(name, (DocumentManifest)resource);
35852    else if (resource instanceof DocumentReference)
35853      composeDocumentReference(name, (DocumentReference)resource);
35854    else if (resource instanceof EligibilityRequest)
35855      composeEligibilityRequest(name, (EligibilityRequest)resource);
35856    else if (resource instanceof EligibilityResponse)
35857      composeEligibilityResponse(name, (EligibilityResponse)resource);
35858    else if (resource instanceof Encounter)
35859      composeEncounter(name, (Encounter)resource);
35860    else if (resource instanceof EnrollmentRequest)
35861      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
35862    else if (resource instanceof EnrollmentResponse)
35863      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
35864    else if (resource instanceof EpisodeOfCare)
35865      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
35866    else if (resource instanceof ExpansionProfile)
35867      composeExpansionProfile(name, (ExpansionProfile)resource);
35868    else if (resource instanceof ExplanationOfBenefit)
35869      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
35870    else if (resource instanceof FamilyMemberHistory)
35871      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
35872    else if (resource instanceof Flag)
35873      composeFlag(name, (Flag)resource);
35874    else if (resource instanceof Goal)
35875      composeGoal(name, (Goal)resource);
35876    else if (resource instanceof Group)
35877      composeGroup(name, (Group)resource);
35878    else if (resource instanceof GuidanceResponse)
35879      composeGuidanceResponse(name, (GuidanceResponse)resource);
35880    else if (resource instanceof HealthcareService)
35881      composeHealthcareService(name, (HealthcareService)resource);
35882    else if (resource instanceof ImagingExcerpt)
35883      composeImagingExcerpt(name, (ImagingExcerpt)resource);
35884    else if (resource instanceof ImagingObjectSelection)
35885      composeImagingObjectSelection(name, (ImagingObjectSelection)resource);
35886    else if (resource instanceof ImagingStudy)
35887      composeImagingStudy(name, (ImagingStudy)resource);
35888    else if (resource instanceof Immunization)
35889      composeImmunization(name, (Immunization)resource);
35890    else if (resource instanceof ImmunizationRecommendation)
35891      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
35892    else if (resource instanceof ImplementationGuide)
35893      composeImplementationGuide(name, (ImplementationGuide)resource);
35894    else if (resource instanceof Library)
35895      composeLibrary(name, (Library)resource);
35896    else if (resource instanceof Linkage)
35897      composeLinkage(name, (Linkage)resource);
35898    else if (resource instanceof ListResource)
35899      composeListResource(name, (ListResource)resource);
35900    else if (resource instanceof Location)
35901      composeLocation(name, (Location)resource);
35902    else if (resource instanceof Measure)
35903      composeMeasure(name, (Measure)resource);
35904    else if (resource instanceof MeasureReport)
35905      composeMeasureReport(name, (MeasureReport)resource);
35906    else if (resource instanceof Media)
35907      composeMedia(name, (Media)resource);
35908    else if (resource instanceof Medication)
35909      composeMedication(name, (Medication)resource);
35910    else if (resource instanceof MedicationAdministration)
35911      composeMedicationAdministration(name, (MedicationAdministration)resource);
35912    else if (resource instanceof MedicationDispense)
35913      composeMedicationDispense(name, (MedicationDispense)resource);
35914    else if (resource instanceof MedicationOrder)
35915      composeMedicationOrder(name, (MedicationOrder)resource);
35916    else if (resource instanceof MedicationStatement)
35917      composeMedicationStatement(name, (MedicationStatement)resource);
35918    else if (resource instanceof MessageHeader)
35919      composeMessageHeader(name, (MessageHeader)resource);
35920    else if (resource instanceof ModuleDefinition)
35921      composeModuleDefinition(name, (ModuleDefinition)resource);
35922    else if (resource instanceof NamingSystem)
35923      composeNamingSystem(name, (NamingSystem)resource);
35924    else if (resource instanceof NutritionOrder)
35925      composeNutritionOrder(name, (NutritionOrder)resource);
35926    else if (resource instanceof Observation)
35927      composeObservation(name, (Observation)resource);
35928    else if (resource instanceof OperationDefinition)
35929      composeOperationDefinition(name, (OperationDefinition)resource);
35930    else if (resource instanceof OperationOutcome)
35931      composeOperationOutcome(name, (OperationOutcome)resource);
35932    else if (resource instanceof Order)
35933      composeOrder(name, (Order)resource);
35934    else if (resource instanceof OrderResponse)
35935      composeOrderResponse(name, (OrderResponse)resource);
35936    else if (resource instanceof OrderSet)
35937      composeOrderSet(name, (OrderSet)resource);
35938    else if (resource instanceof Organization)
35939      composeOrganization(name, (Organization)resource);
35940    else if (resource instanceof Patient)
35941      composePatient(name, (Patient)resource);
35942    else if (resource instanceof PaymentNotice)
35943      composePaymentNotice(name, (PaymentNotice)resource);
35944    else if (resource instanceof PaymentReconciliation)
35945      composePaymentReconciliation(name, (PaymentReconciliation)resource);
35946    else if (resource instanceof Person)
35947      composePerson(name, (Person)resource);
35948    else if (resource instanceof Practitioner)
35949      composePractitioner(name, (Practitioner)resource);
35950    else if (resource instanceof PractitionerRole)
35951      composePractitionerRole(name, (PractitionerRole)resource);
35952    else if (resource instanceof Procedure)
35953      composeProcedure(name, (Procedure)resource);
35954    else if (resource instanceof ProcedureRequest)
35955      composeProcedureRequest(name, (ProcedureRequest)resource);
35956    else if (resource instanceof ProcessRequest)
35957      composeProcessRequest(name, (ProcessRequest)resource);
35958    else if (resource instanceof ProcessResponse)
35959      composeProcessResponse(name, (ProcessResponse)resource);
35960    else if (resource instanceof Protocol)
35961      composeProtocol(name, (Protocol)resource);
35962    else if (resource instanceof Provenance)
35963      composeProvenance(name, (Provenance)resource);
35964    else if (resource instanceof Questionnaire)
35965      composeQuestionnaire(name, (Questionnaire)resource);
35966    else if (resource instanceof QuestionnaireResponse)
35967      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
35968    else if (resource instanceof ReferralRequest)
35969      composeReferralRequest(name, (ReferralRequest)resource);
35970    else if (resource instanceof RelatedPerson)
35971      composeRelatedPerson(name, (RelatedPerson)resource);
35972    else if (resource instanceof RiskAssessment)
35973      composeRiskAssessment(name, (RiskAssessment)resource);
35974    else if (resource instanceof Schedule)
35975      composeSchedule(name, (Schedule)resource);
35976    else if (resource instanceof SearchParameter)
35977      composeSearchParameter(name, (SearchParameter)resource);
35978    else if (resource instanceof Sequence)
35979      composeSequence(name, (Sequence)resource);
35980    else if (resource instanceof Slot)
35981      composeSlot(name, (Slot)resource);
35982    else if (resource instanceof Specimen)
35983      composeSpecimen(name, (Specimen)resource);
35984    else if (resource instanceof StructureDefinition)
35985      composeStructureDefinition(name, (StructureDefinition)resource);
35986    else if (resource instanceof StructureMap)
35987      composeStructureMap(name, (StructureMap)resource);
35988    else if (resource instanceof Subscription)
35989      composeSubscription(name, (Subscription)resource);
35990    else if (resource instanceof Substance)
35991      composeSubstance(name, (Substance)resource);
35992    else if (resource instanceof SupplyDelivery)
35993      composeSupplyDelivery(name, (SupplyDelivery)resource);
35994    else if (resource instanceof SupplyRequest)
35995      composeSupplyRequest(name, (SupplyRequest)resource);
35996    else if (resource instanceof Task)
35997      composeTask(name, (Task)resource);
35998    else if (resource instanceof TestScript)
35999      composeTestScript(name, (TestScript)resource);
36000    else if (resource instanceof ValueSet)
36001      composeValueSet(name, (ValueSet)resource);
36002    else if (resource instanceof VisionPrescription)
36003      composeVisionPrescription(name, (VisionPrescription)resource);
36004    else if (resource instanceof Binary)
36005      composeBinary(name, (Binary)resource);
36006    else
36007      throw new Error("Unhandled resource type "+resource.getClass().getName());
36008  }
36009
36010  protected void composeType(String prefix, Type type) throws IOException {
36011    if (type == null)
36012      ;
36013    else if (type instanceof Age)
36014       composeAge(prefix+"Age", (Age) type);
36015    else if (type instanceof Count)
36016       composeCount(prefix+"Count", (Count) type);
36017    else if (type instanceof Money)
36018       composeMoney(prefix+"Money", (Money) type);
36019    else if (type instanceof Distance)
36020       composeDistance(prefix+"Distance", (Distance) type);
36021    else if (type instanceof Duration)
36022       composeDuration(prefix+"Duration", (Duration) type);
36023    else if (type instanceof SimpleQuantity)
36024       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
36025    else if (type instanceof Period)
36026       composePeriod(prefix+"Period", (Period) type);
36027    else if (type instanceof Coding)
36028       composeCoding(prefix+"Coding", (Coding) type);
36029    else if (type instanceof Range)
36030       composeRange(prefix+"Range", (Range) type);
36031    else if (type instanceof Quantity)
36032       composeQuantity(prefix+"Quantity", (Quantity) type);
36033    else if (type instanceof Attachment)
36034       composeAttachment(prefix+"Attachment", (Attachment) type);
36035    else if (type instanceof Ratio)
36036       composeRatio(prefix+"Ratio", (Ratio) type);
36037    else if (type instanceof Annotation)
36038       composeAnnotation(prefix+"Annotation", (Annotation) type);
36039    else if (type instanceof SampledData)
36040       composeSampledData(prefix+"SampledData", (SampledData) type);
36041    else if (type instanceof Reference)
36042       composeReference(prefix+"Reference", (Reference) type);
36043    else if (type instanceof CodeableConcept)
36044       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
36045    else if (type instanceof Identifier)
36046       composeIdentifier(prefix+"Identifier", (Identifier) type);
36047    else if (type instanceof Signature)
36048       composeSignature(prefix+"Signature", (Signature) type);
36049    else if (type instanceof TriggerDefinition)
36050       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
36051    else if (type instanceof ElementDefinition)
36052       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
36053    else if (type instanceof Timing)
36054       composeTiming(prefix+"Timing", (Timing) type);
36055    else if (type instanceof ModuleMetadata)
36056       composeModuleMetadata(prefix+"ModuleMetadata", (ModuleMetadata) type);
36057    else if (type instanceof ActionDefinition)
36058       composeActionDefinition(prefix+"ActionDefinition", (ActionDefinition) type);
36059    else if (type instanceof Address)
36060       composeAddress(prefix+"Address", (Address) type);
36061    else if (type instanceof HumanName)
36062       composeHumanName(prefix+"HumanName", (HumanName) type);
36063    else if (type instanceof DataRequirement)
36064       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
36065    else if (type instanceof Meta)
36066       composeMeta(prefix+"Meta", (Meta) type);
36067    else if (type instanceof ParameterDefinition)
36068       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
36069    else if (type instanceof ContactPoint)
36070       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
36071    else if (type instanceof MarkdownType) {
36072      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
36073      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
36074    }
36075    else if (type instanceof UnsignedIntType) {
36076      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
36077      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
36078    }
36079    else if (type instanceof CodeType) {
36080      composeCodeCore(prefix+"Code", (CodeType) type, false);
36081      composeCodeExtras(prefix+"Code", (CodeType) type, false);
36082    }
36083    else if (type instanceof IdType) {
36084      composeIdCore(prefix+"Id", (IdType) type, false);
36085      composeIdExtras(prefix+"Id", (IdType) type, false);
36086    }
36087    else if (type instanceof OidType) {
36088      composeOidCore(prefix+"Oid", (OidType) type, false);
36089      composeOidExtras(prefix+"Oid", (OidType) type, false);
36090    }
36091    else if (type instanceof PositiveIntType) {
36092      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
36093      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
36094    }
36095    else if (type instanceof UuidType) {
36096      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
36097      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
36098    }
36099    else if (type instanceof IntegerType) {
36100      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
36101      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
36102    }
36103    else if (type instanceof DateTimeType) {
36104      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
36105      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
36106    }
36107    else if (type instanceof DateType) {
36108      composeDateCore(prefix+"Date", (DateType) type, false);
36109      composeDateExtras(prefix+"Date", (DateType) type, false);
36110    }
36111    else if (type instanceof DecimalType) {
36112      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
36113      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
36114    }
36115    else if (type instanceof UriType) {
36116      composeUriCore(prefix+"Uri", (UriType) type, false);
36117      composeUriExtras(prefix+"Uri", (UriType) type, false);
36118    }
36119    else if (type instanceof Base64BinaryType) {
36120      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
36121      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
36122    }
36123    else if (type instanceof TimeType) {
36124      composeTimeCore(prefix+"Time", (TimeType) type, false);
36125      composeTimeExtras(prefix+"Time", (TimeType) type, false);
36126    }
36127    else if (type instanceof StringType) {
36128      composeStringCore(prefix+"String", (StringType) type, false);
36129      composeStringExtras(prefix+"String", (StringType) type, false);
36130    }
36131    else if (type instanceof BooleanType) {
36132      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
36133      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
36134    }
36135    else if (type instanceof InstantType) {
36136      composeInstantCore(prefix+"Instant", (InstantType) type, false);
36137      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
36138    }
36139    else
36140      throw new Error("Unhandled type");
36141  }
36142
36143  protected void composeTypeInner(Type type) throws IOException {
36144    if (type == null)
36145      ;
36146    else if (type instanceof Period)
36147       composePeriodInner((Period) type);
36148    else if (type instanceof Coding)
36149       composeCodingInner((Coding) type);
36150    else if (type instanceof Range)
36151       composeRangeInner((Range) type);
36152    else if (type instanceof Quantity)
36153       composeQuantityInner((Quantity) type);
36154    else if (type instanceof Attachment)
36155       composeAttachmentInner((Attachment) type);
36156    else if (type instanceof Ratio)
36157       composeRatioInner((Ratio) type);
36158    else if (type instanceof Annotation)
36159       composeAnnotationInner((Annotation) type);
36160    else if (type instanceof SampledData)
36161       composeSampledDataInner((SampledData) type);
36162    else if (type instanceof Reference)
36163       composeReferenceInner((Reference) type);
36164    else if (type instanceof CodeableConcept)
36165       composeCodeableConceptInner((CodeableConcept) type);
36166    else if (type instanceof Identifier)
36167       composeIdentifierInner((Identifier) type);
36168    else if (type instanceof Signature)
36169       composeSignatureInner((Signature) type);
36170    else if (type instanceof Age)
36171       composeAgeInner((Age) type);
36172    else if (type instanceof Count)
36173       composeCountInner((Count) type);
36174    else if (type instanceof Money)
36175       composeMoneyInner((Money) type);
36176    else if (type instanceof Distance)
36177       composeDistanceInner((Distance) type);
36178    else if (type instanceof Duration)
36179       composeDurationInner((Duration) type);
36180    else if (type instanceof SimpleQuantity)
36181       composeSimpleQuantityInner((SimpleQuantity) type);
36182    else if (type instanceof TriggerDefinition)
36183       composeTriggerDefinitionInner((TriggerDefinition) type);
36184    else if (type instanceof ElementDefinition)
36185       composeElementDefinitionInner((ElementDefinition) type);
36186    else if (type instanceof Timing)
36187       composeTimingInner((Timing) type);
36188    else if (type instanceof ModuleMetadata)
36189       composeModuleMetadataInner((ModuleMetadata) type);
36190    else if (type instanceof ActionDefinition)
36191       composeActionDefinitionInner((ActionDefinition) type);
36192    else if (type instanceof Address)
36193       composeAddressInner((Address) type);
36194    else if (type instanceof HumanName)
36195       composeHumanNameInner((HumanName) type);
36196    else if (type instanceof DataRequirement)
36197       composeDataRequirementInner((DataRequirement) type);
36198    else if (type instanceof Meta)
36199       composeMetaInner((Meta) type);
36200    else if (type instanceof ParameterDefinition)
36201       composeParameterDefinitionInner((ParameterDefinition) type);
36202    else if (type instanceof ContactPoint)
36203       composeContactPointInner((ContactPoint) type);
36204    else
36205      throw new Error("Unhandled type");
36206  }
36207
36208}