001package org.hl7.fhir.dstu2.formats;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024import java.io.IOException;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054
055// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
056import org.hl7.fhir.dstu2.model.*;
057import org.hl7.fhir.exceptions.FHIRFormatError;
058import org.hl7.fhir.utilities.Utilities;
059
060import com.google.gson.JsonArray;
061import com.google.gson.JsonObject;
062
063public class JsonParser extends JsonParserBase {
064
065  public JsonParser() {
066    super();
067  }
068
069  public JsonParser(boolean allowUnknownContent) {
070    super();
071    setAllowUnknownContent(allowUnknownContent);
072  }
073
074
075  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
076    super.parseElementProperties(json, element);
077    if (json.has("extension")) {
078      JsonArray array = json.getAsJsonArray("extension");
079      for (int i = 0; i < array.size(); i++) {
080        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
081      }
082    };
083  }
084
085  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
086    parseElementProperties(json, element);
087    if (json.has("modifierExtension")) {
088      JsonArray array = json.getAsJsonArray("modifierExtension");
089      for (int i = 0; i < array.size(); i++) {
090        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
091      }
092    }
093  }
094
095  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
096    parseElementProperties(json, element);
097  }
098
099  @SuppressWarnings("unchecked")
100  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
101    Enumeration<E> res = new Enumeration<E>(e);
102    if (s != null)
103      res.setValue((E) e.fromCode(s));
104    return res;
105  }
106
107  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
108    DateType res = new DateType(v);
109    return res;
110  }
111
112  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
113    DateTimeType res = new DateTimeType(v);
114    return res;
115  }
116
117  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
118    CodeType res = new CodeType(v);
119    return res;
120  }
121
122  protected StringType parseString(String v) throws IOException, FHIRFormatError {
123    StringType res = new StringType(v);
124    return res;
125  }
126
127  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
128    IntegerType res = new IntegerType(v);
129    return res;
130  }
131
132  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
133    OidType res = new OidType(v);
134    return res;
135  }
136
137  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
138    UriType res = new UriType(v);
139    return res;
140  }
141
142  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
143    UuidType res = new UuidType(v);
144    return res;
145  }
146
147  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
148    InstantType res = new InstantType(v);
149    return res;
150  }
151
152  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
153    BooleanType res = new BooleanType(v);
154    return res;
155  }
156
157  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
158    Base64BinaryType res = new Base64BinaryType(v);
159    return res;
160  }
161
162  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
163    UnsignedIntType res = new UnsignedIntType(v);
164    return res;
165  }
166
167  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
168    MarkdownType res = new MarkdownType(v);
169    return res;
170  }
171
172  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
173    TimeType res = new TimeType(v);
174    return res;
175  }
176
177  protected IdType parseId(String v) throws IOException, FHIRFormatError {
178    IdType res = new IdType(v);
179    return res;
180  }
181
182  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
183    PositiveIntType res = new PositiveIntType(v);
184    return res;
185  }
186
187  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
188    DecimalType res = new DecimalType(v);
189    return res;
190  }
191
192  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
193    Extension res = new Extension();
194    parseElementProperties(json, res);
195    if (json.has("url"))
196      res.setUrlElement(parseUri(json.get("url").getAsString()));
197    if (json.has("_url"))
198      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
199    Type value = parseType("value", json);
200    if (value != null)
201      res.setValue(value);
202    return res;
203  }
204
205  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
206    Narrative res = new Narrative();
207    parseElementProperties(json, res);
208    if (json.has("status"))
209      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
210    if (json.has("_status"))
211      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
212    if (json.has("div"))
213      res.setDiv(parseXhtml(json.get("div").getAsString()));
214    return res;
215  }
216
217  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
218    Identifier res = new Identifier();
219    parseTypeProperties(json, res);
220    if (json.has("use"))
221      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
222    if (json.has("_use"))
223      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
224    if (json.has("type"))
225      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
226    if (json.has("system"))
227      res.setSystemElement(parseUri(json.get("system").getAsString()));
228    if (json.has("_system"))
229      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
230    if (json.has("value"))
231      res.setValueElement(parseString(json.get("value").getAsString()));
232    if (json.has("_value"))
233      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
234    if (json.has("period"))
235      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
236    if (json.has("assigner"))
237      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
238    return res;
239  }
240
241  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
242    Coding res = new Coding();
243    parseTypeProperties(json, res);
244    if (json.has("system"))
245      res.setSystemElement(parseUri(json.get("system").getAsString()));
246    if (json.has("_system"))
247      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
248    if (json.has("version"))
249      res.setVersionElement(parseString(json.get("version").getAsString()));
250    if (json.has("_version"))
251      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
252    if (json.has("code"))
253      res.setCodeElement(parseCode(json.get("code").getAsString()));
254    if (json.has("_code"))
255      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
256    if (json.has("display"))
257      res.setDisplayElement(parseString(json.get("display").getAsString()));
258    if (json.has("_display"))
259      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
260    if (json.has("userSelected"))
261      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
262    if (json.has("_userSelected"))
263      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
264    return res;
265  }
266
267  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
268    Reference res = new Reference();
269    parseTypeProperties(json, res);
270    if (json.has("reference"))
271      res.setReferenceElement(parseString(json.get("reference").getAsString()));
272    if (json.has("_reference"))
273      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
274    if (json.has("display"))
275      res.setDisplayElement(parseString(json.get("display").getAsString()));
276    if (json.has("_display"))
277      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
278    return res;
279  }
280
281  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
282    Signature res = new Signature();
283    parseTypeProperties(json, res);
284    if (json.has("type")) {
285      JsonArray array = json.getAsJsonArray("type");
286      for (int i = 0; i < array.size(); i++) {
287        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
288      }
289    };
290    if (json.has("when"))
291      res.setWhenElement(parseInstant(json.get("when").getAsString()));
292    if (json.has("_when"))
293      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
294    Type who = parseType("who", json);
295    if (who != null)
296      res.setWho(who);
297    if (json.has("contentType"))
298      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
299    if (json.has("_contentType"))
300      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
301    if (json.has("blob"))
302      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
303    if (json.has("_blob"))
304      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
305    return res;
306  }
307
308  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
309    SampledData res = new SampledData();
310    parseTypeProperties(json, res);
311    if (json.has("origin"))
312      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
313    if (json.has("period"))
314      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
315    if (json.has("_period"))
316      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
317    if (json.has("factor"))
318      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
319    if (json.has("_factor"))
320      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
321    if (json.has("lowerLimit"))
322      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
323    if (json.has("_lowerLimit"))
324      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
325    if (json.has("upperLimit"))
326      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
327    if (json.has("_upperLimit"))
328      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
329    if (json.has("dimensions"))
330      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
331    if (json.has("_dimensions"))
332      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
333    if (json.has("data"))
334      res.setDataElement(parseString(json.get("data").getAsString()));
335    if (json.has("_data"))
336      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
337    return res;
338  }
339
340  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
341    Quantity res = new Quantity();
342    parseTypeProperties(json, res);
343    if (json.has("value"))
344      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
345    if (json.has("_value"))
346      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
347    if (json.has("comparator"))
348      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
349    if (json.has("_comparator"))
350      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
351    if (json.has("unit"))
352      res.setUnitElement(parseString(json.get("unit").getAsString()));
353    if (json.has("_unit"))
354      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
355    if (json.has("system"))
356      res.setSystemElement(parseUri(json.get("system").getAsString()));
357    if (json.has("_system"))
358      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
359    if (json.has("code"))
360      res.setCodeElement(parseCode(json.get("code").getAsString()));
361    if (json.has("_code"))
362      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
363    return res;
364  }
365
366  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
367    Period res = new Period();
368    parseTypeProperties(json, res);
369    if (json.has("start"))
370      res.setStartElement(parseDateTime(json.get("start").getAsString()));
371    if (json.has("_start"))
372      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
373    if (json.has("end"))
374      res.setEndElement(parseDateTime(json.get("end").getAsString()));
375    if (json.has("_end"))
376      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
377    return res;
378  }
379
380  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
381    Attachment res = new Attachment();
382    parseTypeProperties(json, res);
383    if (json.has("contentType"))
384      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
385    if (json.has("_contentType"))
386      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
387    if (json.has("language"))
388      res.setLanguageElement(parseCode(json.get("language").getAsString()));
389    if (json.has("_language"))
390      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
391    if (json.has("data"))
392      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
393    if (json.has("_data"))
394      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
395    if (json.has("url"))
396      res.setUrlElement(parseUri(json.get("url").getAsString()));
397    if (json.has("_url"))
398      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
399    if (json.has("size"))
400      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
401    if (json.has("_size"))
402      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
403    if (json.has("hash"))
404      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
405    if (json.has("_hash"))
406      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
407    if (json.has("title"))
408      res.setTitleElement(parseString(json.get("title").getAsString()));
409    if (json.has("_title"))
410      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
411    if (json.has("creation"))
412      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
413    if (json.has("_creation"))
414      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
415    return res;
416  }
417
418  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
419    Ratio res = new Ratio();
420    parseTypeProperties(json, res);
421    if (json.has("numerator"))
422      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
423    if (json.has("denominator"))
424      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
425    return res;
426  }
427
428  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
429    Range res = new Range();
430    parseTypeProperties(json, res);
431    if (json.has("low"))
432      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
433    if (json.has("high"))
434      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
435    return res;
436  }
437
438  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
439    Annotation res = new Annotation();
440    parseTypeProperties(json, res);
441    Type author = parseType("author", json);
442    if (author != null)
443      res.setAuthor(author);
444    if (json.has("time"))
445      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
446    if (json.has("_time"))
447      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
448    if (json.has("text"))
449      res.setTextElement(parseString(json.get("text").getAsString()));
450    if (json.has("_text"))
451      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
452    return res;
453  }
454
455  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
456    CodeableConcept res = new CodeableConcept();
457    parseTypeProperties(json, res);
458    if (json.has("coding")) {
459      JsonArray array = json.getAsJsonArray("coding");
460      for (int i = 0; i < array.size(); i++) {
461        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
462      }
463    };
464    if (json.has("text"))
465      res.setTextElement(parseString(json.get("text").getAsString()));
466    if (json.has("_text"))
467      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
468    return res;
469  }
470
471  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
472    Money res = new Money();
473    parseElementProperties(json, res);
474    if (json.has("value"))
475      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
476    if (json.has("_value"))
477      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
478    if (json.has("comparator"))
479      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
480    if (json.has("_comparator"))
481      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
482    if (json.has("unit"))
483      res.setUnitElement(parseString(json.get("unit").getAsString()));
484    if (json.has("_unit"))
485      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
486    if (json.has("system"))
487      res.setSystemElement(parseUri(json.get("system").getAsString()));
488    if (json.has("_system"))
489      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
490    if (json.has("code"))
491      res.setCodeElement(parseCode(json.get("code").getAsString()));
492    if (json.has("_code"))
493      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
494    return res;
495  }
496
497  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
498    SimpleQuantity res = new SimpleQuantity();
499    parseElementProperties(json, res);
500    if (json.has("value"))
501      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
502    if (json.has("_value"))
503      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
504    if (json.has("comparator"))
505      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
506    if (json.has("_comparator"))
507      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
508    if (json.has("unit"))
509      res.setUnitElement(parseString(json.get("unit").getAsString()));
510    if (json.has("_unit"))
511      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
512    if (json.has("system"))
513      res.setSystemElement(parseUri(json.get("system").getAsString()));
514    if (json.has("_system"))
515      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
516    if (json.has("code"))
517      res.setCodeElement(parseCode(json.get("code").getAsString()));
518    if (json.has("_code"))
519      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
520    return res;
521  }
522
523  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
524    Duration res = new Duration();
525    parseElementProperties(json, res);
526    if (json.has("value"))
527      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
528    if (json.has("_value"))
529      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
530    if (json.has("comparator"))
531      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
532    if (json.has("_comparator"))
533      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
534    if (json.has("unit"))
535      res.setUnitElement(parseString(json.get("unit").getAsString()));
536    if (json.has("_unit"))
537      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
538    if (json.has("system"))
539      res.setSystemElement(parseUri(json.get("system").getAsString()));
540    if (json.has("_system"))
541      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
542    if (json.has("code"))
543      res.setCodeElement(parseCode(json.get("code").getAsString()));
544    if (json.has("_code"))
545      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
546    return res;
547  }
548
549  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
550    Count res = new Count();
551    parseElementProperties(json, res);
552    if (json.has("value"))
553      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
554    if (json.has("_value"))
555      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
556    if (json.has("comparator"))
557      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
558    if (json.has("_comparator"))
559      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
560    if (json.has("unit"))
561      res.setUnitElement(parseString(json.get("unit").getAsString()));
562    if (json.has("_unit"))
563      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
564    if (json.has("system"))
565      res.setSystemElement(parseUri(json.get("system").getAsString()));
566    if (json.has("_system"))
567      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
568    if (json.has("code"))
569      res.setCodeElement(parseCode(json.get("code").getAsString()));
570    if (json.has("_code"))
571      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
572    return res;
573  }
574
575  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
576    Distance res = new Distance();
577    parseElementProperties(json, res);
578    if (json.has("value"))
579      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
580    if (json.has("_value"))
581      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
582    if (json.has("comparator"))
583      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
584    if (json.has("_comparator"))
585      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
586    if (json.has("unit"))
587      res.setUnitElement(parseString(json.get("unit").getAsString()));
588    if (json.has("_unit"))
589      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
590    if (json.has("system"))
591      res.setSystemElement(parseUri(json.get("system").getAsString()));
592    if (json.has("_system"))
593      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
594    if (json.has("code"))
595      res.setCodeElement(parseCode(json.get("code").getAsString()));
596    if (json.has("_code"))
597      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
598    return res;
599  }
600
601  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
602    Age res = new Age();
603    parseElementProperties(json, res);
604    if (json.has("value"))
605      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
606    if (json.has("_value"))
607      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
608    if (json.has("comparator"))
609      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
610    if (json.has("_comparator"))
611      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
612    if (json.has("unit"))
613      res.setUnitElement(parseString(json.get("unit").getAsString()));
614    if (json.has("_unit"))
615      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
616    if (json.has("system"))
617      res.setSystemElement(parseUri(json.get("system").getAsString()));
618    if (json.has("_system"))
619      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
620    if (json.has("code"))
621      res.setCodeElement(parseCode(json.get("code").getAsString()));
622    if (json.has("_code"))
623      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
624    return res;
625  }
626
627  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
628    HumanName res = new HumanName();
629    parseElementProperties(json, res);
630    if (json.has("use"))
631      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
632    if (json.has("_use"))
633      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
634    if (json.has("text"))
635      res.setTextElement(parseString(json.get("text").getAsString()));
636    if (json.has("_text"))
637      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
638    if (json.has("family")) {
639      JsonArray array = json.getAsJsonArray("family");
640      for (int i = 0; i < array.size(); i++) {
641        res.getFamily().add(parseString(array.get(i).getAsString()));
642      }
643    };
644    if (json.has("_family")) {
645      JsonArray array = json.getAsJsonArray("_family");
646      for (int i = 0; i < array.size(); i++) {
647        if (i == res.getFamily().size())
648          res.getFamily().add(parseString(null));
649        if (array.get(i) instanceof JsonObject) 
650          parseElementProperties(array.get(i).getAsJsonObject(), res.getFamily().get(i));
651      }
652    };
653    if (json.has("given")) {
654      JsonArray array = json.getAsJsonArray("given");
655      for (int i = 0; i < array.size(); i++) {
656        res.getGiven().add(parseString(array.get(i).getAsString()));
657      }
658    };
659    if (json.has("_given")) {
660      JsonArray array = json.getAsJsonArray("_given");
661      for (int i = 0; i < array.size(); i++) {
662        if (i == res.getGiven().size())
663          res.getGiven().add(parseString(null));
664        if (array.get(i) instanceof JsonObject) 
665          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
666      }
667    };
668    if (json.has("prefix")) {
669      JsonArray array = json.getAsJsonArray("prefix");
670      for (int i = 0; i < array.size(); i++) {
671        res.getPrefix().add(parseString(array.get(i).getAsString()));
672      }
673    };
674    if (json.has("_prefix")) {
675      JsonArray array = json.getAsJsonArray("_prefix");
676      for (int i = 0; i < array.size(); i++) {
677        if (i == res.getPrefix().size())
678          res.getPrefix().add(parseString(null));
679        if (array.get(i) instanceof JsonObject) 
680          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
681      }
682    };
683    if (json.has("suffix")) {
684      JsonArray array = json.getAsJsonArray("suffix");
685      for (int i = 0; i < array.size(); i++) {
686        res.getSuffix().add(parseString(array.get(i).getAsString()));
687      }
688    };
689    if (json.has("_suffix")) {
690      JsonArray array = json.getAsJsonArray("_suffix");
691      for (int i = 0; i < array.size(); i++) {
692        if (i == res.getSuffix().size())
693          res.getSuffix().add(parseString(null));
694        if (array.get(i) instanceof JsonObject) 
695          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
696      }
697    };
698    if (json.has("period"))
699      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
700    return res;
701  }
702
703  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
704    ContactPoint res = new ContactPoint();
705    parseElementProperties(json, res);
706    if (json.has("system"))
707      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
708    if (json.has("_system"))
709      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
710    if (json.has("value"))
711      res.setValueElement(parseString(json.get("value").getAsString()));
712    if (json.has("_value"))
713      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
714    if (json.has("use"))
715      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
716    if (json.has("_use"))
717      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
718    if (json.has("rank"))
719      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
720    if (json.has("_rank"))
721      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
722    if (json.has("period"))
723      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
724    return res;
725  }
726
727  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
728    Meta res = new Meta();
729    parseElementProperties(json, res);
730    if (json.has("versionId"))
731      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
732    if (json.has("_versionId"))
733      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
734    if (json.has("lastUpdated"))
735      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
736    if (json.has("_lastUpdated"))
737      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
738    if (json.has("profile")) {
739      JsonArray array = json.getAsJsonArray("profile");
740      for (int i = 0; i < array.size(); i++) {
741        res.getProfile().add(parseUri(array.get(i).getAsString()));
742      }
743    };
744    if (json.has("_profile")) {
745      JsonArray array = json.getAsJsonArray("_profile");
746      for (int i = 0; i < array.size(); i++) {
747        if (i == res.getProfile().size())
748          res.getProfile().add(parseUri(null));
749        if (array.get(i) instanceof JsonObject) 
750          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
751      }
752    };
753    if (json.has("security")) {
754      JsonArray array = json.getAsJsonArray("security");
755      for (int i = 0; i < array.size(); i++) {
756        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
757      }
758    };
759    if (json.has("tag")) {
760      JsonArray array = json.getAsJsonArray("tag");
761      for (int i = 0; i < array.size(); i++) {
762        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
763      }
764    };
765    return res;
766  }
767
768  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
769    Address res = new Address();
770    parseElementProperties(json, res);
771    if (json.has("use"))
772      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
773    if (json.has("_use"))
774      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
775    if (json.has("type"))
776      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
777    if (json.has("_type"))
778      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
779    if (json.has("text"))
780      res.setTextElement(parseString(json.get("text").getAsString()));
781    if (json.has("_text"))
782      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
783    if (json.has("line")) {
784      JsonArray array = json.getAsJsonArray("line");
785      for (int i = 0; i < array.size(); i++) {
786        res.getLine().add(parseString(array.get(i).getAsString()));
787      }
788    };
789    if (json.has("_line")) {
790      JsonArray array = json.getAsJsonArray("_line");
791      for (int i = 0; i < array.size(); i++) {
792        if (i == res.getLine().size())
793          res.getLine().add(parseString(null));
794        if (array.get(i) instanceof JsonObject) 
795          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
796      }
797    };
798    if (json.has("city"))
799      res.setCityElement(parseString(json.get("city").getAsString()));
800    if (json.has("_city"))
801      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
802    if (json.has("district"))
803      res.setDistrictElement(parseString(json.get("district").getAsString()));
804    if (json.has("_district"))
805      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
806    if (json.has("state"))
807      res.setStateElement(parseString(json.get("state").getAsString()));
808    if (json.has("_state"))
809      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
810    if (json.has("postalCode"))
811      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
812    if (json.has("_postalCode"))
813      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
814    if (json.has("country"))
815      res.setCountryElement(parseString(json.get("country").getAsString()));
816    if (json.has("_country"))
817      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
818    if (json.has("period"))
819      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
820    return res;
821  }
822
823  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
824    Timing res = new Timing();
825    parseElementProperties(json, res);
826    if (json.has("event")) {
827      JsonArray array = json.getAsJsonArray("event");
828      for (int i = 0; i < array.size(); i++) {
829        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
830      }
831    };
832    if (json.has("_event")) {
833      JsonArray array = json.getAsJsonArray("_event");
834      for (int i = 0; i < array.size(); i++) {
835        if (i == res.getEvent().size())
836          res.getEvent().add(parseDateTime(null));
837        if (array.get(i) instanceof JsonObject) 
838          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
839      }
840    };
841    if (json.has("repeat"))
842      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
843    if (json.has("code"))
844      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
845    return res;
846  }
847
848  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
849    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
850    parseElementProperties(json, res);
851    Type bounds = parseType("bounds", json);
852    if (bounds != null)
853      res.setBounds(bounds);
854    if (json.has("count"))
855      res.setCountElement(parseInteger(json.get("count").getAsLong()));
856    if (json.has("_count"))
857      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
858    if (json.has("duration"))
859      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
860    if (json.has("_duration"))
861      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
862    if (json.has("durationMax"))
863      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
864    if (json.has("_durationMax"))
865      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
866    if (json.has("durationUnits"))
867      res.setDurationUnitsElement(parseEnumeration(json.get("durationUnits").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
868    if (json.has("_durationUnits"))
869      parseElementProperties(json.getAsJsonObject("_durationUnits"), res.getDurationUnitsElement());
870    if (json.has("frequency"))
871      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
872    if (json.has("_frequency"))
873      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
874    if (json.has("frequencyMax"))
875      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
876    if (json.has("_frequencyMax"))
877      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
878    if (json.has("period"))
879      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
880    if (json.has("_period"))
881      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
882    if (json.has("periodMax"))
883      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
884    if (json.has("_periodMax"))
885      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
886    if (json.has("periodUnits"))
887      res.setPeriodUnitsElement(parseEnumeration(json.get("periodUnits").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
888    if (json.has("_periodUnits"))
889      parseElementProperties(json.getAsJsonObject("_periodUnits"), res.getPeriodUnitsElement());
890    if (json.has("when"))
891      res.setWhenElement(parseEnumeration(json.get("when").getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
892    if (json.has("_when"))
893      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
894    return res;
895  }
896
897  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
898    ElementDefinition res = new ElementDefinition();
899    parseElementProperties(json, res);
900    if (json.has("path"))
901      res.setPathElement(parseString(json.get("path").getAsString()));
902    if (json.has("_path"))
903      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
904    if (json.has("representation")) {
905      JsonArray array = json.getAsJsonArray("representation");
906      for (int i = 0; i < array.size(); i++) {
907        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
908      }
909    };
910    if (json.has("_representation")) {
911      JsonArray array = json.getAsJsonArray("_representation");
912      for (int i = 0; i < array.size(); i++) {
913        if (i == res.getRepresentation().size())
914          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
915        if (array.get(i) instanceof JsonObject) 
916          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
917      }
918    };
919    if (json.has("name"))
920      res.setNameElement(parseString(json.get("name").getAsString()));
921    if (json.has("_name"))
922      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
923    if (json.has("label"))
924      res.setLabelElement(parseString(json.get("label").getAsString()));
925    if (json.has("_label"))
926      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
927    if (json.has("code")) {
928      JsonArray array = json.getAsJsonArray("code");
929      for (int i = 0; i < array.size(); i++) {
930        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
931      }
932    };
933    if (json.has("slicing"))
934      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
935    if (json.has("short"))
936      res.setShortElement(parseString(json.get("short").getAsString()));
937    if (json.has("_short"))
938      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
939    if (json.has("definition"))
940      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
941    if (json.has("_definition"))
942      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
943    if (json.has("comments"))
944      res.setCommentsElement(parseMarkdown(json.get("comments").getAsString()));
945    if (json.has("_comments"))
946      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
947    if (json.has("requirements"))
948      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
949    if (json.has("_requirements"))
950      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
951    if (json.has("alias")) {
952      JsonArray array = json.getAsJsonArray("alias");
953      for (int i = 0; i < array.size(); i++) {
954        res.getAlias().add(parseString(array.get(i).getAsString()));
955      }
956    };
957    if (json.has("_alias")) {
958      JsonArray array = json.getAsJsonArray("_alias");
959      for (int i = 0; i < array.size(); i++) {
960        if (i == res.getAlias().size())
961          res.getAlias().add(parseString(null));
962        if (array.get(i) instanceof JsonObject) 
963          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
964      }
965    };
966    if (json.has("min"))
967      res.setMinElement(parseInteger(json.get("min").getAsLong()));
968    if (json.has("_min"))
969      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
970    if (json.has("max"))
971      res.setMaxElement(parseString(json.get("max").getAsString()));
972    if (json.has("_max"))
973      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
974    if (json.has("base"))
975      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
976    if (json.has("type")) {
977      JsonArray array = json.getAsJsonArray("type");
978      for (int i = 0; i < array.size(); i++) {
979        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
980      }
981    };
982    if (json.has("nameReference"))
983      res.setNameReferenceElement(parseString(json.get("nameReference").getAsString()));
984    if (json.has("_nameReference"))
985      parseElementProperties(json.getAsJsonObject("_nameReference"), res.getNameReferenceElement());
986    Type defaultValue = parseType("defaultValue", json);
987    if (defaultValue != null)
988      res.setDefaultValue(defaultValue);
989    if (json.has("meaningWhenMissing"))
990      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
991    if (json.has("_meaningWhenMissing"))
992      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
993    Type fixed = parseType("fixed", json);
994    if (fixed != null)
995      res.setFixed(fixed);
996    Type pattern = parseType("pattern", json);
997    if (pattern != null)
998      res.setPattern(pattern);
999    Type example = parseType("example", json);
1000    if (example != null)
1001      res.setExample(example);
1002    Type minValue = parseType("minValue", json);
1003    if (minValue != null)
1004      res.setMinValue(minValue);
1005    Type maxValue = parseType("maxValue", json);
1006    if (maxValue != null)
1007      res.setMaxValue(maxValue);
1008    if (json.has("maxLength"))
1009      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1010    if (json.has("_maxLength"))
1011      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1012    if (json.has("condition")) {
1013      JsonArray array = json.getAsJsonArray("condition");
1014      for (int i = 0; i < array.size(); i++) {
1015        res.getCondition().add(parseId(array.get(i).getAsString()));
1016      }
1017    };
1018    if (json.has("_condition")) {
1019      JsonArray array = json.getAsJsonArray("_condition");
1020      for (int i = 0; i < array.size(); i++) {
1021        if (i == res.getCondition().size())
1022          res.getCondition().add(parseId(null));
1023        if (array.get(i) instanceof JsonObject) 
1024          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1025      }
1026    };
1027    if (json.has("constraint")) {
1028      JsonArray array = json.getAsJsonArray("constraint");
1029      for (int i = 0; i < array.size(); i++) {
1030        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1031      }
1032    };
1033    if (json.has("mustSupport"))
1034      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1035    if (json.has("_mustSupport"))
1036      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1037    if (json.has("isModifier"))
1038      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1039    if (json.has("_isModifier"))
1040      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1041    if (json.has("isSummary"))
1042      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1043    if (json.has("_isSummary"))
1044      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1045    if (json.has("binding"))
1046      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1047    if (json.has("mapping")) {
1048      JsonArray array = json.getAsJsonArray("mapping");
1049      for (int i = 0; i < array.size(); i++) {
1050        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1051      }
1052    };
1053    return res;
1054  }
1055
1056  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1057    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1058    parseElementProperties(json, res);
1059    if (json.has("discriminator")) {
1060      JsonArray array = json.getAsJsonArray("discriminator");
1061      for (int i = 0; i < array.size(); i++) {
1062        res.getDiscriminator().add(parseString(array.get(i).getAsString()));
1063      }
1064    };
1065    if (json.has("_discriminator")) {
1066      JsonArray array = json.getAsJsonArray("_discriminator");
1067      for (int i = 0; i < array.size(); i++) {
1068        if (i == res.getDiscriminator().size())
1069          res.getDiscriminator().add(parseString(null));
1070        if (array.get(i) instanceof JsonObject) 
1071          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiscriminator().get(i));
1072      }
1073    };
1074    if (json.has("description"))
1075      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1076    if (json.has("_description"))
1077      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1078    if (json.has("ordered"))
1079      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1080    if (json.has("_ordered"))
1081      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1082    if (json.has("rules"))
1083      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1084    if (json.has("_rules"))
1085      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1086    return res;
1087  }
1088
1089  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1090    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1091    parseElementProperties(json, res);
1092    if (json.has("path"))
1093      res.setPathElement(parseString(json.get("path").getAsString()));
1094    if (json.has("_path"))
1095      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1096    if (json.has("min"))
1097      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1098    if (json.has("_min"))
1099      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1100    if (json.has("max"))
1101      res.setMaxElement(parseString(json.get("max").getAsString()));
1102    if (json.has("_max"))
1103      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1104    return res;
1105  }
1106
1107  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1108    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1109    parseElementProperties(json, res);
1110    if (json.has("code"))
1111      res.setCodeElement(parseCode(json.get("code").getAsString()));
1112    if (json.has("_code"))
1113      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1114    if (json.has("profile")) {
1115      JsonArray array = json.getAsJsonArray("profile");
1116      for (int i = 0; i < array.size(); i++) {
1117        res.getProfile().add(parseUri(array.get(i).getAsString()));
1118      }
1119    };
1120    if (json.has("_profile")) {
1121      JsonArray array = json.getAsJsonArray("_profile");
1122      for (int i = 0; i < array.size(); i++) {
1123        if (i == res.getProfile().size())
1124          res.getProfile().add(parseUri(null));
1125        if (array.get(i) instanceof JsonObject) 
1126          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1127      }
1128    };
1129    if (json.has("aggregation")) {
1130      JsonArray array = json.getAsJsonArray("aggregation");
1131      for (int i = 0; i < array.size(); i++) {
1132        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1133      }
1134    };
1135    if (json.has("_aggregation")) {
1136      JsonArray array = json.getAsJsonArray("_aggregation");
1137      for (int i = 0; i < array.size(); i++) {
1138        if (i == res.getAggregation().size())
1139          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1140        if (array.get(i) instanceof JsonObject) 
1141          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1142      }
1143    };
1144    return res;
1145  }
1146
1147  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1148    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1149    parseElementProperties(json, res);
1150    if (json.has("key"))
1151      res.setKeyElement(parseId(json.get("key").getAsString()));
1152    if (json.has("_key"))
1153      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1154    if (json.has("requirements"))
1155      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1156    if (json.has("_requirements"))
1157      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1158    if (json.has("severity"))
1159      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1160    if (json.has("_severity"))
1161      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1162    if (json.has("human"))
1163      res.setHumanElement(parseString(json.get("human").getAsString()));
1164    if (json.has("_human"))
1165      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1166    if (json.has("xpath"))
1167      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1168    if (json.has("_xpath"))
1169      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1170    return res;
1171  }
1172
1173  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1174    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1175    parseElementProperties(json, res);
1176    if (json.has("strength"))
1177      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1178    if (json.has("_strength"))
1179      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1180    if (json.has("description"))
1181      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1182    if (json.has("_description"))
1183      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1184    Type valueSet = parseType("valueSet", json);
1185    if (valueSet != null)
1186      res.setValueSet(valueSet);
1187    return res;
1188  }
1189
1190  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1191    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1192    parseElementProperties(json, res);
1193    if (json.has("identity"))
1194      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1195    if (json.has("_identity"))
1196      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1197    if (json.has("language"))
1198      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1199    if (json.has("_language"))
1200      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1201    if (json.has("map"))
1202      res.setMapElement(parseString(json.get("map").getAsString()));
1203    if (json.has("_map"))
1204      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1205    return res;
1206  }
1207
1208  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1209    parseResourceProperties(json, res);
1210    if (json.has("text"))
1211      res.setText(parseNarrative(json.getAsJsonObject("text")));
1212    if (json.has("contained")) {
1213      JsonArray array = json.getAsJsonArray("contained");
1214      for (int i = 0; i < array.size(); i++) {
1215        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1216      }
1217    };
1218    if (json.has("extension")) {
1219      JsonArray array = json.getAsJsonArray("extension");
1220      for (int i = 0; i < array.size(); i++) {
1221        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1222      }
1223    };
1224    if (json.has("modifierExtension")) {
1225      JsonArray array = json.getAsJsonArray("modifierExtension");
1226      for (int i = 0; i < array.size(); i++) {
1227        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1228      }
1229    };
1230  }
1231
1232  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1233    Parameters res = new Parameters();
1234    parseResourceProperties(json, res);
1235    if (json.has("parameter")) {
1236      JsonArray array = json.getAsJsonArray("parameter");
1237      for (int i = 0; i < array.size(); i++) {
1238        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1239      }
1240    };
1241    return res;
1242  }
1243
1244  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1245    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1246    parseBackboneProperties(json, res);
1247    if (json.has("name"))
1248      res.setNameElement(parseString(json.get("name").getAsString()));
1249    if (json.has("_name"))
1250      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1251    Type value = parseType("value", json);
1252    if (value != null)
1253      res.setValue(value);
1254    if (json.has("resource"))
1255      res.setResource(parseResource(json.getAsJsonObject("resource")));
1256    if (json.has("part")) {
1257      JsonArray array = json.getAsJsonArray("part");
1258      for (int i = 0; i < array.size(); i++) {
1259        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1260      }
1261    };
1262    return res;
1263  }
1264
1265  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1266    if (json.has("id"))
1267      res.setIdElement(parseId(json.get("id").getAsString()));
1268    if (json.has("_id"))
1269      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1270    if (json.has("meta"))
1271      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1272    if (json.has("implicitRules"))
1273      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1274    if (json.has("_implicitRules"))
1275      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1276    if (json.has("language"))
1277      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1278    if (json.has("_language"))
1279      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1280  }
1281
1282  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1283    Account res = new Account();
1284    parseDomainResourceProperties(json, res);
1285    if (json.has("identifier")) {
1286      JsonArray array = json.getAsJsonArray("identifier");
1287      for (int i = 0; i < array.size(); i++) {
1288        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1289      }
1290    };
1291    if (json.has("name"))
1292      res.setNameElement(parseString(json.get("name").getAsString()));
1293    if (json.has("_name"))
1294      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1295    if (json.has("type"))
1296      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1297    if (json.has("status"))
1298      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1299    if (json.has("_status"))
1300      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1301    if (json.has("activePeriod"))
1302      res.setActivePeriod(parsePeriod(json.getAsJsonObject("activePeriod")));
1303    if (json.has("currency"))
1304      res.setCurrency(parseCoding(json.getAsJsonObject("currency")));
1305    if (json.has("balance"))
1306      res.setBalance(parseMoney(json.getAsJsonObject("balance")));
1307    if (json.has("coveragePeriod"))
1308      res.setCoveragePeriod(parsePeriod(json.getAsJsonObject("coveragePeriod")));
1309    if (json.has("subject"))
1310      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1311    if (json.has("owner"))
1312      res.setOwner(parseReference(json.getAsJsonObject("owner")));
1313    if (json.has("description"))
1314      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1315    if (json.has("_description"))
1316      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1317    return res;
1318  }
1319
1320  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
1321    AllergyIntolerance res = new AllergyIntolerance();
1322    parseDomainResourceProperties(json, res);
1323    if (json.has("identifier")) {
1324      JsonArray array = json.getAsJsonArray("identifier");
1325      for (int i = 0; i < array.size(); i++) {
1326        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1327      }
1328    };
1329    if (json.has("onset"))
1330      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1331    if (json.has("_onset"))
1332      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1333    if (json.has("recordedDate"))
1334      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
1335    if (json.has("_recordedDate"))
1336      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
1337    if (json.has("recorder"))
1338      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
1339    if (json.has("patient"))
1340      res.setPatient(parseReference(json.getAsJsonObject("patient")));
1341    if (json.has("reporter"))
1342      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
1343    if (json.has("substance"))
1344      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1345    if (json.has("status"))
1346      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AllergyIntolerance.AllergyIntoleranceStatus.NULL, new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory()));
1347    if (json.has("_status"))
1348      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1349    if (json.has("criticality"))
1350      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
1351    if (json.has("_criticality"))
1352      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
1353    if (json.has("type"))
1354      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
1355    if (json.has("_type"))
1356      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1357    if (json.has("category"))
1358      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
1359    if (json.has("_category"))
1360      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
1361    if (json.has("lastOccurence"))
1362      res.setLastOccurenceElement(parseDateTime(json.get("lastOccurence").getAsString()));
1363    if (json.has("_lastOccurence"))
1364      parseElementProperties(json.getAsJsonObject("_lastOccurence"), res.getLastOccurenceElement());
1365    if (json.has("note"))
1366      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
1367    if (json.has("reaction")) {
1368      JsonArray array = json.getAsJsonArray("reaction");
1369      for (int i = 0; i < array.size(); i++) {
1370        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
1371      }
1372    };
1373    return res;
1374  }
1375
1376  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
1377    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
1378    parseBackboneProperties(json, res);
1379    if (json.has("substance"))
1380      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
1381    if (json.has("certainty"))
1382      res.setCertaintyElement(parseEnumeration(json.get("certainty").getAsString(), AllergyIntolerance.AllergyIntoleranceCertainty.NULL, new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory()));
1383    if (json.has("_certainty"))
1384      parseElementProperties(json.getAsJsonObject("_certainty"), res.getCertaintyElement());
1385    if (json.has("manifestation")) {
1386      JsonArray array = json.getAsJsonArray("manifestation");
1387      for (int i = 0; i < array.size(); i++) {
1388        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1389      }
1390    };
1391    if (json.has("description"))
1392      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1393    if (json.has("_description"))
1394      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1395    if (json.has("onset"))
1396      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
1397    if (json.has("_onset"))
1398      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
1399    if (json.has("severity"))
1400      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
1401    if (json.has("_severity"))
1402      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1403    if (json.has("exposureRoute"))
1404      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
1405    if (json.has("note"))
1406      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
1407    return res;
1408  }
1409
1410  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
1411    Appointment res = new Appointment();
1412    parseDomainResourceProperties(json, res);
1413    if (json.has("identifier")) {
1414      JsonArray array = json.getAsJsonArray("identifier");
1415      for (int i = 0; i < array.size(); i++) {
1416        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1417      }
1418    };
1419    if (json.has("status"))
1420      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
1421    if (json.has("_status"))
1422      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1423    if (json.has("type"))
1424      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1425    if (json.has("reason"))
1426      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
1427    if (json.has("priority"))
1428      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
1429    if (json.has("_priority"))
1430      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
1431    if (json.has("description"))
1432      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1433    if (json.has("_description"))
1434      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1435    if (json.has("start"))
1436      res.setStartElement(parseInstant(json.get("start").getAsString()));
1437    if (json.has("_start"))
1438      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1439    if (json.has("end"))
1440      res.setEndElement(parseInstant(json.get("end").getAsString()));
1441    if (json.has("_end"))
1442      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1443    if (json.has("minutesDuration"))
1444      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
1445    if (json.has("_minutesDuration"))
1446      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
1447    if (json.has("slot")) {
1448      JsonArray array = json.getAsJsonArray("slot");
1449      for (int i = 0; i < array.size(); i++) {
1450        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
1451      }
1452    };
1453    if (json.has("comment"))
1454      res.setCommentElement(parseString(json.get("comment").getAsString()));
1455    if (json.has("_comment"))
1456      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1457    if (json.has("participant")) {
1458      JsonArray array = json.getAsJsonArray("participant");
1459      for (int i = 0; i < array.size(); i++) {
1460        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
1461      }
1462    };
1463    return res;
1464  }
1465
1466  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
1467    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
1468    parseBackboneProperties(json, res);
1469    if (json.has("type")) {
1470      JsonArray array = json.getAsJsonArray("type");
1471      for (int i = 0; i < array.size(); i++) {
1472        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1473      }
1474    };
1475    if (json.has("actor"))
1476      res.setActor(parseReference(json.getAsJsonObject("actor")));
1477    if (json.has("required"))
1478      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
1479    if (json.has("_required"))
1480      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
1481    if (json.has("status"))
1482      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
1483    if (json.has("_status"))
1484      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1485    return res;
1486  }
1487
1488  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
1489    AppointmentResponse res = new AppointmentResponse();
1490    parseDomainResourceProperties(json, res);
1491    if (json.has("identifier")) {
1492      JsonArray array = json.getAsJsonArray("identifier");
1493      for (int i = 0; i < array.size(); i++) {
1494        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1495      }
1496    };
1497    if (json.has("appointment"))
1498      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
1499    if (json.has("start"))
1500      res.setStartElement(parseInstant(json.get("start").getAsString()));
1501    if (json.has("_start"))
1502      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1503    if (json.has("end"))
1504      res.setEndElement(parseInstant(json.get("end").getAsString()));
1505    if (json.has("_end"))
1506      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1507    if (json.has("participantType")) {
1508      JsonArray array = json.getAsJsonArray("participantType");
1509      for (int i = 0; i < array.size(); i++) {
1510        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1511      }
1512    };
1513    if (json.has("actor"))
1514      res.setActor(parseReference(json.getAsJsonObject("actor")));
1515    if (json.has("participantStatus"))
1516      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
1517    if (json.has("_participantStatus"))
1518      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
1519    if (json.has("comment"))
1520      res.setCommentElement(parseString(json.get("comment").getAsString()));
1521    if (json.has("_comment"))
1522      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1523    return res;
1524  }
1525
1526  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
1527    AuditEvent res = new AuditEvent();
1528    parseDomainResourceProperties(json, res);
1529    if (json.has("event"))
1530      res.setEvent(parseAuditEventAuditEventEventComponent(json.getAsJsonObject("event"), res));
1531    if (json.has("participant")) {
1532      JsonArray array = json.getAsJsonArray("participant");
1533      for (int i = 0; i < array.size(); i++) {
1534        res.getParticipant().add(parseAuditEventAuditEventParticipantComponent(array.get(i).getAsJsonObject(), res));
1535      }
1536    };
1537    if (json.has("source"))
1538      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
1539    if (json.has("object")) {
1540      JsonArray array = json.getAsJsonArray("object");
1541      for (int i = 0; i < array.size(); i++) {
1542        res.getObject().add(parseAuditEventAuditEventObjectComponent(array.get(i).getAsJsonObject(), res));
1543      }
1544    };
1545    return res;
1546  }
1547
1548  protected AuditEvent.AuditEventEventComponent parseAuditEventAuditEventEventComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1549    AuditEvent.AuditEventEventComponent res = new AuditEvent.AuditEventEventComponent();
1550    parseBackboneProperties(json, res);
1551    if (json.has("type"))
1552      res.setType(parseCoding(json.getAsJsonObject("type")));
1553    if (json.has("subtype")) {
1554      JsonArray array = json.getAsJsonArray("subtype");
1555      for (int i = 0; i < array.size(); i++) {
1556        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
1557      }
1558    };
1559    if (json.has("action"))
1560      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
1561    if (json.has("_action"))
1562      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
1563    if (json.has("dateTime"))
1564      res.setDateTimeElement(parseInstant(json.get("dateTime").getAsString()));
1565    if (json.has("_dateTime"))
1566      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
1567    if (json.has("outcome"))
1568      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
1569    if (json.has("_outcome"))
1570      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
1571    if (json.has("outcomeDesc"))
1572      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
1573    if (json.has("_outcomeDesc"))
1574      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
1575    if (json.has("purposeOfEvent")) {
1576      JsonArray array = json.getAsJsonArray("purposeOfEvent");
1577      for (int i = 0; i < array.size(); i++) {
1578        res.getPurposeOfEvent().add(parseCoding(array.get(i).getAsJsonObject()));
1579      }
1580    };
1581    return res;
1582  }
1583
1584  protected AuditEvent.AuditEventParticipantComponent parseAuditEventAuditEventParticipantComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1585    AuditEvent.AuditEventParticipantComponent res = new AuditEvent.AuditEventParticipantComponent();
1586    parseBackboneProperties(json, res);
1587    if (json.has("role")) {
1588      JsonArray array = json.getAsJsonArray("role");
1589      for (int i = 0; i < array.size(); i++) {
1590        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1591      }
1592    };
1593    if (json.has("reference"))
1594      res.setReference(parseReference(json.getAsJsonObject("reference")));
1595    if (json.has("userId"))
1596      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
1597    if (json.has("altId"))
1598      res.setAltIdElement(parseString(json.get("altId").getAsString()));
1599    if (json.has("_altId"))
1600      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
1601    if (json.has("name"))
1602      res.setNameElement(parseString(json.get("name").getAsString()));
1603    if (json.has("_name"))
1604      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1605    if (json.has("requestor"))
1606      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
1607    if (json.has("_requestor"))
1608      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
1609    if (json.has("location"))
1610      res.setLocation(parseReference(json.getAsJsonObject("location")));
1611    if (json.has("policy")) {
1612      JsonArray array = json.getAsJsonArray("policy");
1613      for (int i = 0; i < array.size(); i++) {
1614        res.getPolicy().add(parseUri(array.get(i).getAsString()));
1615      }
1616    };
1617    if (json.has("_policy")) {
1618      JsonArray array = json.getAsJsonArray("_policy");
1619      for (int i = 0; i < array.size(); i++) {
1620        if (i == res.getPolicy().size())
1621          res.getPolicy().add(parseUri(null));
1622        if (array.get(i) instanceof JsonObject) 
1623          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
1624      }
1625    };
1626    if (json.has("media"))
1627      res.setMedia(parseCoding(json.getAsJsonObject("media")));
1628    if (json.has("network"))
1629      res.setNetwork(parseAuditEventAuditEventParticipantNetworkComponent(json.getAsJsonObject("network"), owner));
1630    if (json.has("purposeOfUse")) {
1631      JsonArray array = json.getAsJsonArray("purposeOfUse");
1632      for (int i = 0; i < array.size(); i++) {
1633        res.getPurposeOfUse().add(parseCoding(array.get(i).getAsJsonObject()));
1634      }
1635    };
1636    return res;
1637  }
1638
1639  protected AuditEvent.AuditEventParticipantNetworkComponent parseAuditEventAuditEventParticipantNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1640    AuditEvent.AuditEventParticipantNetworkComponent res = new AuditEvent.AuditEventParticipantNetworkComponent();
1641    parseBackboneProperties(json, res);
1642    if (json.has("address"))
1643      res.setAddressElement(parseString(json.get("address").getAsString()));
1644    if (json.has("_address"))
1645      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
1646    if (json.has("type"))
1647      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventParticipantNetworkType.NULL, new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory()));
1648    if (json.has("_type"))
1649      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1650    return res;
1651  }
1652
1653  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1654    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
1655    parseBackboneProperties(json, res);
1656    if (json.has("site"))
1657      res.setSiteElement(parseString(json.get("site").getAsString()));
1658    if (json.has("_site"))
1659      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
1660    if (json.has("identifier"))
1661      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1662    if (json.has("type")) {
1663      JsonArray array = json.getAsJsonArray("type");
1664      for (int i = 0; i < array.size(); i++) {
1665        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1666      }
1667    };
1668    return res;
1669  }
1670
1671  protected AuditEvent.AuditEventObjectComponent parseAuditEventAuditEventObjectComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1672    AuditEvent.AuditEventObjectComponent res = new AuditEvent.AuditEventObjectComponent();
1673    parseBackboneProperties(json, res);
1674    if (json.has("identifier"))
1675      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1676    if (json.has("reference"))
1677      res.setReference(parseReference(json.getAsJsonObject("reference")));
1678    if (json.has("type"))
1679      res.setType(parseCoding(json.getAsJsonObject("type")));
1680    if (json.has("role"))
1681      res.setRole(parseCoding(json.getAsJsonObject("role")));
1682    if (json.has("lifecycle"))
1683      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
1684    if (json.has("securityLabel")) {
1685      JsonArray array = json.getAsJsonArray("securityLabel");
1686      for (int i = 0; i < array.size(); i++) {
1687        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
1688      }
1689    };
1690    if (json.has("name"))
1691      res.setNameElement(parseString(json.get("name").getAsString()));
1692    if (json.has("_name"))
1693      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1694    if (json.has("description"))
1695      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1696    if (json.has("_description"))
1697      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1698    if (json.has("query"))
1699      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
1700    if (json.has("_query"))
1701      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
1702    if (json.has("detail")) {
1703      JsonArray array = json.getAsJsonArray("detail");
1704      for (int i = 0; i < array.size(); i++) {
1705        res.getDetail().add(parseAuditEventAuditEventObjectDetailComponent(array.get(i).getAsJsonObject(), owner));
1706      }
1707    };
1708    return res;
1709  }
1710
1711  protected AuditEvent.AuditEventObjectDetailComponent parseAuditEventAuditEventObjectDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
1712    AuditEvent.AuditEventObjectDetailComponent res = new AuditEvent.AuditEventObjectDetailComponent();
1713    parseBackboneProperties(json, res);
1714    if (json.has("type"))
1715      res.setTypeElement(parseString(json.get("type").getAsString()));
1716    if (json.has("_type"))
1717      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1718    if (json.has("value"))
1719      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
1720    if (json.has("_value"))
1721      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1722    return res;
1723  }
1724
1725  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
1726    Basic res = new Basic();
1727    parseDomainResourceProperties(json, res);
1728    if (json.has("identifier")) {
1729      JsonArray array = json.getAsJsonArray("identifier");
1730      for (int i = 0; i < array.size(); i++) {
1731        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1732      }
1733    };
1734    if (json.has("code"))
1735      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1736    if (json.has("subject"))
1737      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1738    if (json.has("author"))
1739      res.setAuthor(parseReference(json.getAsJsonObject("author")));
1740    if (json.has("created"))
1741      res.setCreatedElement(parseDate(json.get("created").getAsString()));
1742    if (json.has("_created"))
1743      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
1744    return res;
1745  }
1746
1747  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
1748    Binary res = new Binary();
1749    parseResourceProperties(json, res);
1750    if (json.has("contentType"))
1751      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
1752    if (json.has("_contentType"))
1753      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
1754    if (json.has("content"))
1755      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
1756    if (json.has("_content"))
1757      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
1758    return res;
1759  }
1760
1761  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
1762    BodySite res = new BodySite();
1763    parseDomainResourceProperties(json, res);
1764    if (json.has("patient"))
1765      res.setPatient(parseReference(json.getAsJsonObject("patient")));
1766    if (json.has("identifier")) {
1767      JsonArray array = json.getAsJsonArray("identifier");
1768      for (int i = 0; i < array.size(); i++) {
1769        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1770      }
1771    };
1772    if (json.has("code"))
1773      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1774    if (json.has("modifier")) {
1775      JsonArray array = json.getAsJsonArray("modifier");
1776      for (int i = 0; i < array.size(); i++) {
1777        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1778      }
1779    };
1780    if (json.has("description"))
1781      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1782    if (json.has("_description"))
1783      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1784    if (json.has("image")) {
1785      JsonArray array = json.getAsJsonArray("image");
1786      for (int i = 0; i < array.size(); i++) {
1787        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1788      }
1789    };
1790    return res;
1791  }
1792
1793  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
1794    Bundle res = new Bundle();
1795    parseResourceProperties(json, res);
1796    if (json.has("type"))
1797      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
1798    if (json.has("_type"))
1799      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1800    if (json.has("total"))
1801      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
1802    if (json.has("_total"))
1803      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
1804    if (json.has("link")) {
1805      JsonArray array = json.getAsJsonArray("link");
1806      for (int i = 0; i < array.size(); i++) {
1807        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
1808      }
1809    };
1810    if (json.has("entry")) {
1811      JsonArray array = json.getAsJsonArray("entry");
1812      for (int i = 0; i < array.size(); i++) {
1813        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
1814      }
1815    };
1816    if (json.has("signature"))
1817      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
1818    return res;
1819  }
1820
1821  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1822    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
1823    parseBackboneProperties(json, res);
1824    if (json.has("relation"))
1825      res.setRelationElement(parseString(json.get("relation").getAsString()));
1826    if (json.has("_relation"))
1827      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
1828    if (json.has("url"))
1829      res.setUrlElement(parseUri(json.get("url").getAsString()));
1830    if (json.has("_url"))
1831      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1832    return res;
1833  }
1834
1835  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1836    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
1837    parseBackboneProperties(json, res);
1838    if (json.has("link")) {
1839      JsonArray array = json.getAsJsonArray("link");
1840      for (int i = 0; i < array.size(); i++) {
1841        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
1842      }
1843    };
1844    if (json.has("fullUrl"))
1845      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
1846    if (json.has("_fullUrl"))
1847      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
1848    if (json.has("resource"))
1849      res.setResource(parseResource(json.getAsJsonObject("resource")));
1850    if (json.has("search"))
1851      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
1852    if (json.has("request"))
1853      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
1854    if (json.has("response"))
1855      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
1856    return res;
1857  }
1858
1859  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1860    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
1861    parseBackboneProperties(json, res);
1862    if (json.has("mode"))
1863      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
1864    if (json.has("_mode"))
1865      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
1866    if (json.has("score"))
1867      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
1868    if (json.has("_score"))
1869      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
1870    return res;
1871  }
1872
1873  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1874    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
1875    parseBackboneProperties(json, res);
1876    if (json.has("method"))
1877      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
1878    if (json.has("_method"))
1879      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
1880    if (json.has("url"))
1881      res.setUrlElement(parseUri(json.get("url").getAsString()));
1882    if (json.has("_url"))
1883      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1884    if (json.has("ifNoneMatch"))
1885      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
1886    if (json.has("_ifNoneMatch"))
1887      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
1888    if (json.has("ifModifiedSince"))
1889      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
1890    if (json.has("_ifModifiedSince"))
1891      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
1892    if (json.has("ifMatch"))
1893      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
1894    if (json.has("_ifMatch"))
1895      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
1896    if (json.has("ifNoneExist"))
1897      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
1898    if (json.has("_ifNoneExist"))
1899      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
1900    return res;
1901  }
1902
1903  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
1904    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
1905    parseBackboneProperties(json, res);
1906    if (json.has("status"))
1907      res.setStatusElement(parseString(json.get("status").getAsString()));
1908    if (json.has("_status"))
1909      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1910    if (json.has("location"))
1911      res.setLocationElement(parseUri(json.get("location").getAsString()));
1912    if (json.has("_location"))
1913      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
1914    if (json.has("etag"))
1915      res.setEtagElement(parseString(json.get("etag").getAsString()));
1916    if (json.has("_etag"))
1917      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
1918    if (json.has("lastModified"))
1919      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
1920    if (json.has("_lastModified"))
1921      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
1922    return res;
1923  }
1924
1925  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
1926    CarePlan res = new CarePlan();
1927    parseDomainResourceProperties(json, res);
1928    if (json.has("identifier")) {
1929      JsonArray array = json.getAsJsonArray("identifier");
1930      for (int i = 0; i < array.size(); i++) {
1931        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1932      }
1933    };
1934    if (json.has("subject"))
1935      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1936    if (json.has("status"))
1937      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
1938    if (json.has("_status"))
1939      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1940    if (json.has("context"))
1941      res.setContext(parseReference(json.getAsJsonObject("context")));
1942    if (json.has("period"))
1943      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1944    if (json.has("author")) {
1945      JsonArray array = json.getAsJsonArray("author");
1946      for (int i = 0; i < array.size(); i++) {
1947        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
1948      }
1949    };
1950    if (json.has("modified"))
1951      res.setModifiedElement(parseDateTime(json.get("modified").getAsString()));
1952    if (json.has("_modified"))
1953      parseElementProperties(json.getAsJsonObject("_modified"), res.getModifiedElement());
1954    if (json.has("category")) {
1955      JsonArray array = json.getAsJsonArray("category");
1956      for (int i = 0; i < array.size(); i++) {
1957        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1958      }
1959    };
1960    if (json.has("description"))
1961      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1962    if (json.has("_description"))
1963      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1964    if (json.has("addresses")) {
1965      JsonArray array = json.getAsJsonArray("addresses");
1966      for (int i = 0; i < array.size(); i++) {
1967        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
1968      }
1969    };
1970    if (json.has("support")) {
1971      JsonArray array = json.getAsJsonArray("support");
1972      for (int i = 0; i < array.size(); i++) {
1973        res.getSupport().add(parseReference(array.get(i).getAsJsonObject()));
1974      }
1975    };
1976    if (json.has("relatedPlan")) {
1977      JsonArray array = json.getAsJsonArray("relatedPlan");
1978      for (int i = 0; i < array.size(); i++) {
1979        res.getRelatedPlan().add(parseCarePlanCarePlanRelatedPlanComponent(array.get(i).getAsJsonObject(), res));
1980      }
1981    };
1982    if (json.has("participant")) {
1983      JsonArray array = json.getAsJsonArray("participant");
1984      for (int i = 0; i < array.size(); i++) {
1985        res.getParticipant().add(parseCarePlanCarePlanParticipantComponent(array.get(i).getAsJsonObject(), res));
1986      }
1987    };
1988    if (json.has("goal")) {
1989      JsonArray array = json.getAsJsonArray("goal");
1990      for (int i = 0; i < array.size(); i++) {
1991        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
1992      }
1993    };
1994    if (json.has("activity")) {
1995      JsonArray array = json.getAsJsonArray("activity");
1996      for (int i = 0; i < array.size(); i++) {
1997        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
1998      }
1999    };
2000    if (json.has("note"))
2001      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
2002    return res;
2003  }
2004
2005  protected CarePlan.CarePlanRelatedPlanComponent parseCarePlanCarePlanRelatedPlanComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2006    CarePlan.CarePlanRelatedPlanComponent res = new CarePlan.CarePlanRelatedPlanComponent();
2007    parseBackboneProperties(json, res);
2008    if (json.has("code"))
2009      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CarePlan.CarePlanRelationship.NULL, new CarePlan.CarePlanRelationshipEnumFactory()));
2010    if (json.has("_code"))
2011      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
2012    if (json.has("plan"))
2013      res.setPlan(parseReference(json.getAsJsonObject("plan")));
2014    return res;
2015  }
2016
2017  protected CarePlan.CarePlanParticipantComponent parseCarePlanCarePlanParticipantComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2018    CarePlan.CarePlanParticipantComponent res = new CarePlan.CarePlanParticipantComponent();
2019    parseBackboneProperties(json, res);
2020    if (json.has("role"))
2021      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2022    if (json.has("member"))
2023      res.setMember(parseReference(json.getAsJsonObject("member")));
2024    return res;
2025  }
2026
2027  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2028    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
2029    parseBackboneProperties(json, res);
2030    if (json.has("actionResulting")) {
2031      JsonArray array = json.getAsJsonArray("actionResulting");
2032      for (int i = 0; i < array.size(); i++) {
2033        res.getActionResulting().add(parseReference(array.get(i).getAsJsonObject()));
2034      }
2035    };
2036    if (json.has("progress")) {
2037      JsonArray array = json.getAsJsonArray("progress");
2038      for (int i = 0; i < array.size(); i++) {
2039        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
2040      }
2041    };
2042    if (json.has("reference"))
2043      res.setReference(parseReference(json.getAsJsonObject("reference")));
2044    if (json.has("detail"))
2045      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
2046    return res;
2047  }
2048
2049  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
2050    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
2051    parseBackboneProperties(json, res);
2052    if (json.has("category"))
2053      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
2054    if (json.has("code"))
2055      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2056    if (json.has("reasonCode")) {
2057      JsonArray array = json.getAsJsonArray("reasonCode");
2058      for (int i = 0; i < array.size(); i++) {
2059        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2060      }
2061    };
2062    if (json.has("reasonReference")) {
2063      JsonArray array = json.getAsJsonArray("reasonReference");
2064      for (int i = 0; i < array.size(); i++) {
2065        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2066      }
2067    };
2068    if (json.has("goal")) {
2069      JsonArray array = json.getAsJsonArray("goal");
2070      for (int i = 0; i < array.size(); i++) {
2071        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
2072      }
2073    };
2074    if (json.has("status"))
2075      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
2076    if (json.has("_status"))
2077      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2078    if (json.has("statusReason"))
2079      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
2080    if (json.has("prohibited"))
2081      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
2082    if (json.has("_prohibited"))
2083      parseElementProperties(json.getAsJsonObject("_prohibited"), res.getProhibitedElement());
2084    Type scheduled = parseType("scheduled", json);
2085    if (scheduled != null)
2086      res.setScheduled(scheduled);
2087    if (json.has("location"))
2088      res.setLocation(parseReference(json.getAsJsonObject("location")));
2089    if (json.has("performer")) {
2090      JsonArray array = json.getAsJsonArray("performer");
2091      for (int i = 0; i < array.size(); i++) {
2092        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
2093      }
2094    };
2095    Type product = parseType("product", json);
2096    if (product != null)
2097      res.setProduct(product);
2098    if (json.has("dailyAmount"))
2099      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
2100    if (json.has("quantity"))
2101      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2102    if (json.has("description"))
2103      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2104    if (json.has("_description"))
2105      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2106    return res;
2107  }
2108
2109  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
2110    Claim res = new Claim();
2111    parseDomainResourceProperties(json, res);
2112    if (json.has("type"))
2113      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Claim.ClaimType.NULL, new Claim.ClaimTypeEnumFactory()));
2114    if (json.has("_type"))
2115      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2116    if (json.has("identifier")) {
2117      JsonArray array = json.getAsJsonArray("identifier");
2118      for (int i = 0; i < array.size(); i++) {
2119        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2120      }
2121    };
2122    if (json.has("ruleset"))
2123      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
2124    if (json.has("originalRuleset"))
2125      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2126    if (json.has("created"))
2127      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2128    if (json.has("_created"))
2129      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2130    if (json.has("target"))
2131      res.setTarget(parseReference(json.getAsJsonObject("target")));
2132    if (json.has("provider"))
2133      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2134    if (json.has("organization"))
2135      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2136    if (json.has("use"))
2137      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
2138    if (json.has("_use"))
2139      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
2140    if (json.has("priority"))
2141      res.setPriority(parseCoding(json.getAsJsonObject("priority")));
2142    if (json.has("fundsReserve"))
2143      res.setFundsReserve(parseCoding(json.getAsJsonObject("fundsReserve")));
2144    if (json.has("enterer"))
2145      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
2146    if (json.has("facility"))
2147      res.setFacility(parseReference(json.getAsJsonObject("facility")));
2148    if (json.has("prescription"))
2149      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
2150    if (json.has("originalPrescription"))
2151      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
2152    if (json.has("payee"))
2153      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
2154    if (json.has("referral"))
2155      res.setReferral(parseReference(json.getAsJsonObject("referral")));
2156    if (json.has("diagnosis")) {
2157      JsonArray array = json.getAsJsonArray("diagnosis");
2158      for (int i = 0; i < array.size(); i++) {
2159        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
2160      }
2161    };
2162    if (json.has("condition")) {
2163      JsonArray array = json.getAsJsonArray("condition");
2164      for (int i = 0; i < array.size(); i++) {
2165        res.getCondition().add(parseCoding(array.get(i).getAsJsonObject()));
2166      }
2167    };
2168    if (json.has("patient"))
2169      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2170    if (json.has("coverage")) {
2171      JsonArray array = json.getAsJsonArray("coverage");
2172      for (int i = 0; i < array.size(); i++) {
2173        res.getCoverage().add(parseClaimCoverageComponent(array.get(i).getAsJsonObject(), res));
2174      }
2175    };
2176    if (json.has("exception")) {
2177      JsonArray array = json.getAsJsonArray("exception");
2178      for (int i = 0; i < array.size(); i++) {
2179        res.getException().add(parseCoding(array.get(i).getAsJsonObject()));
2180      }
2181    };
2182    if (json.has("school"))
2183      res.setSchoolElement(parseString(json.get("school").getAsString()));
2184    if (json.has("_school"))
2185      parseElementProperties(json.getAsJsonObject("_school"), res.getSchoolElement());
2186    if (json.has("accident"))
2187      res.setAccidentElement(parseDate(json.get("accident").getAsString()));
2188    if (json.has("_accident"))
2189      parseElementProperties(json.getAsJsonObject("_accident"), res.getAccidentElement());
2190    if (json.has("accidentType"))
2191      res.setAccidentType(parseCoding(json.getAsJsonObject("accidentType")));
2192    if (json.has("interventionException")) {
2193      JsonArray array = json.getAsJsonArray("interventionException");
2194      for (int i = 0; i < array.size(); i++) {
2195        res.getInterventionException().add(parseCoding(array.get(i).getAsJsonObject()));
2196      }
2197    };
2198    if (json.has("item")) {
2199      JsonArray array = json.getAsJsonArray("item");
2200      for (int i = 0; i < array.size(); i++) {
2201        res.getItem().add(parseClaimItemsComponent(array.get(i).getAsJsonObject(), res));
2202      }
2203    };
2204    if (json.has("additionalMaterials")) {
2205      JsonArray array = json.getAsJsonArray("additionalMaterials");
2206      for (int i = 0; i < array.size(); i++) {
2207        res.getAdditionalMaterials().add(parseCoding(array.get(i).getAsJsonObject()));
2208      }
2209    };
2210    if (json.has("missingTeeth")) {
2211      JsonArray array = json.getAsJsonArray("missingTeeth");
2212      for (int i = 0; i < array.size(); i++) {
2213        res.getMissingTeeth().add(parseClaimMissingTeethComponent(array.get(i).getAsJsonObject(), res));
2214      }
2215    };
2216    return res;
2217  }
2218
2219  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2220    Claim.PayeeComponent res = new Claim.PayeeComponent();
2221    parseBackboneProperties(json, res);
2222    if (json.has("type"))
2223      res.setType(parseCoding(json.getAsJsonObject("type")));
2224    if (json.has("provider"))
2225      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2226    if (json.has("organization"))
2227      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2228    if (json.has("person"))
2229      res.setPerson(parseReference(json.getAsJsonObject("person")));
2230    return res;
2231  }
2232
2233  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2234    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
2235    parseBackboneProperties(json, res);
2236    if (json.has("sequence"))
2237      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2238    if (json.has("_sequence"))
2239      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2240    if (json.has("diagnosis"))
2241      res.setDiagnosis(parseCoding(json.getAsJsonObject("diagnosis")));
2242    return res;
2243  }
2244
2245  protected Claim.CoverageComponent parseClaimCoverageComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2246    Claim.CoverageComponent res = new Claim.CoverageComponent();
2247    parseBackboneProperties(json, res);
2248    if (json.has("sequence"))
2249      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2250    if (json.has("_sequence"))
2251      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2252    if (json.has("focal"))
2253      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
2254    if (json.has("_focal"))
2255      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
2256    if (json.has("coverage"))
2257      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2258    if (json.has("businessArrangement"))
2259      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
2260    if (json.has("_businessArrangement"))
2261      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
2262    if (json.has("relationship"))
2263      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
2264    if (json.has("preAuthRef")) {
2265      JsonArray array = json.getAsJsonArray("preAuthRef");
2266      for (int i = 0; i < array.size(); i++) {
2267        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
2268      }
2269    };
2270    if (json.has("_preAuthRef")) {
2271      JsonArray array = json.getAsJsonArray("_preAuthRef");
2272      for (int i = 0; i < array.size(); i++) {
2273        if (i == res.getPreAuthRef().size())
2274          res.getPreAuthRef().add(parseString(null));
2275        if (array.get(i) instanceof JsonObject) 
2276          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
2277      }
2278    };
2279    if (json.has("claimResponse"))
2280      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
2281    if (json.has("originalRuleset"))
2282      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2283    return res;
2284  }
2285
2286  protected Claim.ItemsComponent parseClaimItemsComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2287    Claim.ItemsComponent res = new Claim.ItemsComponent();
2288    parseBackboneProperties(json, res);
2289    if (json.has("sequence"))
2290      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2291    if (json.has("_sequence"))
2292      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2293    if (json.has("type"))
2294      res.setType(parseCoding(json.getAsJsonObject("type")));
2295    if (json.has("provider"))
2296      res.setProvider(parseReference(json.getAsJsonObject("provider")));
2297    if (json.has("diagnosisLinkId")) {
2298      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
2299      for (int i = 0; i < array.size(); i++) {
2300        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2301      }
2302    };
2303    if (json.has("_diagnosisLinkId")) {
2304      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
2305      for (int i = 0; i < array.size(); i++) {
2306        if (i == res.getDiagnosisLinkId().size())
2307          res.getDiagnosisLinkId().add(parsePositiveInt(null));
2308        if (array.get(i) instanceof JsonObject) 
2309          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
2310      }
2311    };
2312    if (json.has("service"))
2313      res.setService(parseCoding(json.getAsJsonObject("service")));
2314    if (json.has("serviceDate"))
2315      res.setServiceDateElement(parseDate(json.get("serviceDate").getAsString()));
2316    if (json.has("_serviceDate"))
2317      parseElementProperties(json.getAsJsonObject("_serviceDate"), res.getServiceDateElement());
2318    if (json.has("quantity"))
2319      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2320    if (json.has("unitPrice"))
2321      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2322    if (json.has("factor"))
2323      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2324    if (json.has("_factor"))
2325      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2326    if (json.has("points"))
2327      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2328    if (json.has("_points"))
2329      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2330    if (json.has("net"))
2331      res.setNet(parseMoney(json.getAsJsonObject("net")));
2332    if (json.has("udi"))
2333      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2334    if (json.has("bodySite"))
2335      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
2336    if (json.has("subSite")) {
2337      JsonArray array = json.getAsJsonArray("subSite");
2338      for (int i = 0; i < array.size(); i++) {
2339        res.getSubSite().add(parseCoding(array.get(i).getAsJsonObject()));
2340      }
2341    };
2342    if (json.has("modifier")) {
2343      JsonArray array = json.getAsJsonArray("modifier");
2344      for (int i = 0; i < array.size(); i++) {
2345        res.getModifier().add(parseCoding(array.get(i).getAsJsonObject()));
2346      }
2347    };
2348    if (json.has("detail")) {
2349      JsonArray array = json.getAsJsonArray("detail");
2350      for (int i = 0; i < array.size(); i++) {
2351        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
2352      }
2353    };
2354    if (json.has("prosthesis"))
2355      res.setProsthesis(parseClaimProsthesisComponent(json.getAsJsonObject("prosthesis"), owner));
2356    return res;
2357  }
2358
2359  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2360    Claim.DetailComponent res = new Claim.DetailComponent();
2361    parseBackboneProperties(json, res);
2362    if (json.has("sequence"))
2363      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2364    if (json.has("_sequence"))
2365      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2366    if (json.has("type"))
2367      res.setType(parseCoding(json.getAsJsonObject("type")));
2368    if (json.has("service"))
2369      res.setService(parseCoding(json.getAsJsonObject("service")));
2370    if (json.has("quantity"))
2371      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2372    if (json.has("unitPrice"))
2373      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2374    if (json.has("factor"))
2375      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2376    if (json.has("_factor"))
2377      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2378    if (json.has("points"))
2379      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2380    if (json.has("_points"))
2381      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2382    if (json.has("net"))
2383      res.setNet(parseMoney(json.getAsJsonObject("net")));
2384    if (json.has("udi"))
2385      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2386    if (json.has("subDetail")) {
2387      JsonArray array = json.getAsJsonArray("subDetail");
2388      for (int i = 0; i < array.size(); i++) {
2389        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
2390      }
2391    };
2392    return res;
2393  }
2394
2395  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2396    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
2397    parseBackboneProperties(json, res);
2398    if (json.has("sequence"))
2399      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2400    if (json.has("_sequence"))
2401      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2402    if (json.has("type"))
2403      res.setType(parseCoding(json.getAsJsonObject("type")));
2404    if (json.has("service"))
2405      res.setService(parseCoding(json.getAsJsonObject("service")));
2406    if (json.has("quantity"))
2407      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2408    if (json.has("unitPrice"))
2409      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
2410    if (json.has("factor"))
2411      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
2412    if (json.has("_factor"))
2413      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
2414    if (json.has("points"))
2415      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
2416    if (json.has("_points"))
2417      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
2418    if (json.has("net"))
2419      res.setNet(parseMoney(json.getAsJsonObject("net")));
2420    if (json.has("udi"))
2421      res.setUdi(parseCoding(json.getAsJsonObject("udi")));
2422    return res;
2423  }
2424
2425  protected Claim.ProsthesisComponent parseClaimProsthesisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2426    Claim.ProsthesisComponent res = new Claim.ProsthesisComponent();
2427    parseBackboneProperties(json, res);
2428    if (json.has("initial"))
2429      res.setInitialElement(parseBoolean(json.get("initial").getAsBoolean()));
2430    if (json.has("_initial"))
2431      parseElementProperties(json.getAsJsonObject("_initial"), res.getInitialElement());
2432    if (json.has("priorDate"))
2433      res.setPriorDateElement(parseDate(json.get("priorDate").getAsString()));
2434    if (json.has("_priorDate"))
2435      parseElementProperties(json.getAsJsonObject("_priorDate"), res.getPriorDateElement());
2436    if (json.has("priorMaterial"))
2437      res.setPriorMaterial(parseCoding(json.getAsJsonObject("priorMaterial")));
2438    return res;
2439  }
2440
2441  protected Claim.MissingTeethComponent parseClaimMissingTeethComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
2442    Claim.MissingTeethComponent res = new Claim.MissingTeethComponent();
2443    parseBackboneProperties(json, res);
2444    if (json.has("tooth"))
2445      res.setTooth(parseCoding(json.getAsJsonObject("tooth")));
2446    if (json.has("reason"))
2447      res.setReason(parseCoding(json.getAsJsonObject("reason")));
2448    if (json.has("extractionDate"))
2449      res.setExtractionDateElement(parseDate(json.get("extractionDate").getAsString()));
2450    if (json.has("_extractionDate"))
2451      parseElementProperties(json.getAsJsonObject("_extractionDate"), res.getExtractionDateElement());
2452    return res;
2453  }
2454
2455  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
2456    ClaimResponse res = new ClaimResponse();
2457    parseDomainResourceProperties(json, res);
2458    if (json.has("identifier")) {
2459      JsonArray array = json.getAsJsonArray("identifier");
2460      for (int i = 0; i < array.size(); i++) {
2461        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2462      }
2463    };
2464    if (json.has("request"))
2465      res.setRequest(parseReference(json.getAsJsonObject("request")));
2466    if (json.has("ruleset"))
2467      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
2468    if (json.has("originalRuleset"))
2469      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2470    if (json.has("created"))
2471      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2472    if (json.has("_created"))
2473      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2474    if (json.has("organization"))
2475      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
2476    if (json.has("requestProvider"))
2477      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
2478    if (json.has("requestOrganization"))
2479      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
2480    if (json.has("outcome"))
2481      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
2482    if (json.has("_outcome"))
2483      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2484    if (json.has("disposition"))
2485      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
2486    if (json.has("_disposition"))
2487      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
2488    if (json.has("payeeType"))
2489      res.setPayeeType(parseCoding(json.getAsJsonObject("payeeType")));
2490    if (json.has("item")) {
2491      JsonArray array = json.getAsJsonArray("item");
2492      for (int i = 0; i < array.size(); i++) {
2493        res.getItem().add(parseClaimResponseItemsComponent(array.get(i).getAsJsonObject(), res));
2494      }
2495    };
2496    if (json.has("addItem")) {
2497      JsonArray array = json.getAsJsonArray("addItem");
2498      for (int i = 0; i < array.size(); i++) {
2499        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
2500      }
2501    };
2502    if (json.has("error")) {
2503      JsonArray array = json.getAsJsonArray("error");
2504      for (int i = 0; i < array.size(); i++) {
2505        res.getError().add(parseClaimResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
2506      }
2507    };
2508    if (json.has("totalCost"))
2509      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
2510    if (json.has("unallocDeductable"))
2511      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
2512    if (json.has("totalBenefit"))
2513      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
2514    if (json.has("paymentAdjustment"))
2515      res.setPaymentAdjustment(parseMoney(json.getAsJsonObject("paymentAdjustment")));
2516    if (json.has("paymentAdjustmentReason"))
2517      res.setPaymentAdjustmentReason(parseCoding(json.getAsJsonObject("paymentAdjustmentReason")));
2518    if (json.has("paymentDate"))
2519      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
2520    if (json.has("_paymentDate"))
2521      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
2522    if (json.has("paymentAmount"))
2523      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
2524    if (json.has("paymentRef"))
2525      res.setPaymentRef(parseIdentifier(json.getAsJsonObject("paymentRef")));
2526    if (json.has("reserved"))
2527      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
2528    if (json.has("form"))
2529      res.setForm(parseCoding(json.getAsJsonObject("form")));
2530    if (json.has("note")) {
2531      JsonArray array = json.getAsJsonArray("note");
2532      for (int i = 0; i < array.size(); i++) {
2533        res.getNote().add(parseClaimResponseNotesComponent(array.get(i).getAsJsonObject(), res));
2534      }
2535    };
2536    if (json.has("coverage")) {
2537      JsonArray array = json.getAsJsonArray("coverage");
2538      for (int i = 0; i < array.size(); i++) {
2539        res.getCoverage().add(parseClaimResponseCoverageComponent(array.get(i).getAsJsonObject(), res));
2540      }
2541    };
2542    return res;
2543  }
2544
2545  protected ClaimResponse.ItemsComponent parseClaimResponseItemsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2546    ClaimResponse.ItemsComponent res = new ClaimResponse.ItemsComponent();
2547    parseBackboneProperties(json, res);
2548    if (json.has("sequenceLinkId"))
2549      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2550    if (json.has("_sequenceLinkId"))
2551      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2552    if (json.has("noteNumber")) {
2553      JsonArray array = json.getAsJsonArray("noteNumber");
2554      for (int i = 0; i < array.size(); i++) {
2555        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
2556      }
2557    };
2558    if (json.has("_noteNumber")) {
2559      JsonArray array = json.getAsJsonArray("_noteNumber");
2560      for (int i = 0; i < array.size(); i++) {
2561        if (i == res.getNoteNumber().size())
2562          res.getNoteNumber().add(parsePositiveInt(null));
2563        if (array.get(i) instanceof JsonObject) 
2564          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
2565      }
2566    };
2567    if (json.has("adjudication")) {
2568      JsonArray array = json.getAsJsonArray("adjudication");
2569      for (int i = 0; i < array.size(); i++) {
2570        res.getAdjudication().add(parseClaimResponseItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2571      }
2572    };
2573    if (json.has("detail")) {
2574      JsonArray array = json.getAsJsonArray("detail");
2575      for (int i = 0; i < array.size(); i++) {
2576        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
2577      }
2578    };
2579    return res;
2580  }
2581
2582  protected ClaimResponse.ItemAdjudicationComponent parseClaimResponseItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2583    ClaimResponse.ItemAdjudicationComponent res = new ClaimResponse.ItemAdjudicationComponent();
2584    parseBackboneProperties(json, res);
2585    if (json.has("code"))
2586      res.setCode(parseCoding(json.getAsJsonObject("code")));
2587    if (json.has("amount"))
2588      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2589    if (json.has("value"))
2590      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2591    if (json.has("_value"))
2592      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2593    return res;
2594  }
2595
2596  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2597    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
2598    parseBackboneProperties(json, res);
2599    if (json.has("sequenceLinkId"))
2600      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2601    if (json.has("_sequenceLinkId"))
2602      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2603    if (json.has("adjudication")) {
2604      JsonArray array = json.getAsJsonArray("adjudication");
2605      for (int i = 0; i < array.size(); i++) {
2606        res.getAdjudication().add(parseClaimResponseDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2607      }
2608    };
2609    if (json.has("subDetail")) {
2610      JsonArray array = json.getAsJsonArray("subDetail");
2611      for (int i = 0; i < array.size(); i++) {
2612        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
2613      }
2614    };
2615    return res;
2616  }
2617
2618  protected ClaimResponse.DetailAdjudicationComponent parseClaimResponseDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2619    ClaimResponse.DetailAdjudicationComponent res = new ClaimResponse.DetailAdjudicationComponent();
2620    parseBackboneProperties(json, res);
2621    if (json.has("code"))
2622      res.setCode(parseCoding(json.getAsJsonObject("code")));
2623    if (json.has("amount"))
2624      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2625    if (json.has("value"))
2626      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2627    if (json.has("_value"))
2628      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2629    return res;
2630  }
2631
2632  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2633    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
2634    parseBackboneProperties(json, res);
2635    if (json.has("sequenceLinkId"))
2636      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2637    if (json.has("_sequenceLinkId"))
2638      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2639    if (json.has("adjudication")) {
2640      JsonArray array = json.getAsJsonArray("adjudication");
2641      for (int i = 0; i < array.size(); i++) {
2642        res.getAdjudication().add(parseClaimResponseSubdetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2643      }
2644    };
2645    return res;
2646  }
2647
2648  protected ClaimResponse.SubdetailAdjudicationComponent parseClaimResponseSubdetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2649    ClaimResponse.SubdetailAdjudicationComponent res = new ClaimResponse.SubdetailAdjudicationComponent();
2650    parseBackboneProperties(json, res);
2651    if (json.has("code"))
2652      res.setCode(parseCoding(json.getAsJsonObject("code")));
2653    if (json.has("amount"))
2654      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2655    if (json.has("value"))
2656      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2657    if (json.has("_value"))
2658      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2659    return res;
2660  }
2661
2662  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2663    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
2664    parseBackboneProperties(json, res);
2665    if (json.has("sequenceLinkId")) {
2666      JsonArray array = json.getAsJsonArray("sequenceLinkId");
2667      for (int i = 0; i < array.size(); i++) {
2668        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2669      }
2670    };
2671    if (json.has("_sequenceLinkId")) {
2672      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
2673      for (int i = 0; i < array.size(); i++) {
2674        if (i == res.getSequenceLinkId().size())
2675          res.getSequenceLinkId().add(parsePositiveInt(null));
2676        if (array.get(i) instanceof JsonObject) 
2677          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
2678      }
2679    };
2680    if (json.has("service"))
2681      res.setService(parseCoding(json.getAsJsonObject("service")));
2682    if (json.has("fee"))
2683      res.setFee(parseMoney(json.getAsJsonObject("fee")));
2684    if (json.has("noteNumberLinkId")) {
2685      JsonArray array = json.getAsJsonArray("noteNumberLinkId");
2686      for (int i = 0; i < array.size(); i++) {
2687        res.getNoteNumberLinkId().add(parsePositiveInt(array.get(i).getAsString()));
2688      }
2689    };
2690    if (json.has("_noteNumberLinkId")) {
2691      JsonArray array = json.getAsJsonArray("_noteNumberLinkId");
2692      for (int i = 0; i < array.size(); i++) {
2693        if (i == res.getNoteNumberLinkId().size())
2694          res.getNoteNumberLinkId().add(parsePositiveInt(null));
2695        if (array.get(i) instanceof JsonObject) 
2696          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumberLinkId().get(i));
2697      }
2698    };
2699    if (json.has("adjudication")) {
2700      JsonArray array = json.getAsJsonArray("adjudication");
2701      for (int i = 0; i < array.size(); i++) {
2702        res.getAdjudication().add(parseClaimResponseAddedItemAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2703      }
2704    };
2705    if (json.has("detail")) {
2706      JsonArray array = json.getAsJsonArray("detail");
2707      for (int i = 0; i < array.size(); i++) {
2708        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
2709      }
2710    };
2711    return res;
2712  }
2713
2714  protected ClaimResponse.AddedItemAdjudicationComponent parseClaimResponseAddedItemAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2715    ClaimResponse.AddedItemAdjudicationComponent res = new ClaimResponse.AddedItemAdjudicationComponent();
2716    parseBackboneProperties(json, res);
2717    if (json.has("code"))
2718      res.setCode(parseCoding(json.getAsJsonObject("code")));
2719    if (json.has("amount"))
2720      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2721    if (json.has("value"))
2722      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2723    if (json.has("_value"))
2724      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2725    return res;
2726  }
2727
2728  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2729    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
2730    parseBackboneProperties(json, res);
2731    if (json.has("service"))
2732      res.setService(parseCoding(json.getAsJsonObject("service")));
2733    if (json.has("fee"))
2734      res.setFee(parseMoney(json.getAsJsonObject("fee")));
2735    if (json.has("adjudication")) {
2736      JsonArray array = json.getAsJsonArray("adjudication");
2737      for (int i = 0; i < array.size(); i++) {
2738        res.getAdjudication().add(parseClaimResponseAddedItemDetailAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
2739      }
2740    };
2741    return res;
2742  }
2743
2744  protected ClaimResponse.AddedItemDetailAdjudicationComponent parseClaimResponseAddedItemDetailAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2745    ClaimResponse.AddedItemDetailAdjudicationComponent res = new ClaimResponse.AddedItemDetailAdjudicationComponent();
2746    parseBackboneProperties(json, res);
2747    if (json.has("code"))
2748      res.setCode(parseCoding(json.getAsJsonObject("code")));
2749    if (json.has("amount"))
2750      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
2751    if (json.has("value"))
2752      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
2753    if (json.has("_value"))
2754      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2755    return res;
2756  }
2757
2758  protected ClaimResponse.ErrorsComponent parseClaimResponseErrorsComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2759    ClaimResponse.ErrorsComponent res = new ClaimResponse.ErrorsComponent();
2760    parseBackboneProperties(json, res);
2761    if (json.has("sequenceLinkId"))
2762      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
2763    if (json.has("_sequenceLinkId"))
2764      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
2765    if (json.has("detailSequenceLinkId"))
2766      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
2767    if (json.has("_detailSequenceLinkId"))
2768      parseElementProperties(json.getAsJsonObject("_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
2769    if (json.has("subdetailSequenceLinkId"))
2770      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
2771    if (json.has("_subdetailSequenceLinkId"))
2772      parseElementProperties(json.getAsJsonObject("_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
2773    if (json.has("code"))
2774      res.setCode(parseCoding(json.getAsJsonObject("code")));
2775    return res;
2776  }
2777
2778  protected ClaimResponse.NotesComponent parseClaimResponseNotesComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2779    ClaimResponse.NotesComponent res = new ClaimResponse.NotesComponent();
2780    parseBackboneProperties(json, res);
2781    if (json.has("number"))
2782      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
2783    if (json.has("_number"))
2784      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
2785    if (json.has("type"))
2786      res.setType(parseCoding(json.getAsJsonObject("type")));
2787    if (json.has("text"))
2788      res.setTextElement(parseString(json.get("text").getAsString()));
2789    if (json.has("_text"))
2790      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
2791    return res;
2792  }
2793
2794  protected ClaimResponse.CoverageComponent parseClaimResponseCoverageComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
2795    ClaimResponse.CoverageComponent res = new ClaimResponse.CoverageComponent();
2796    parseBackboneProperties(json, res);
2797    if (json.has("sequence"))
2798      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2799    if (json.has("_sequence"))
2800      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
2801    if (json.has("focal"))
2802      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
2803    if (json.has("_focal"))
2804      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
2805    if (json.has("coverage"))
2806      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2807    if (json.has("businessArrangement"))
2808      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
2809    if (json.has("_businessArrangement"))
2810      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
2811    if (json.has("relationship"))
2812      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
2813    if (json.has("preAuthRef")) {
2814      JsonArray array = json.getAsJsonArray("preAuthRef");
2815      for (int i = 0; i < array.size(); i++) {
2816        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
2817      }
2818    };
2819    if (json.has("_preAuthRef")) {
2820      JsonArray array = json.getAsJsonArray("_preAuthRef");
2821      for (int i = 0; i < array.size(); i++) {
2822        if (i == res.getPreAuthRef().size())
2823          res.getPreAuthRef().add(parseString(null));
2824        if (array.get(i) instanceof JsonObject) 
2825          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
2826      }
2827    };
2828    if (json.has("claimResponse"))
2829      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
2830    if (json.has("originalRuleset"))
2831      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
2832    return res;
2833  }
2834
2835  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
2836    ClinicalImpression res = new ClinicalImpression();
2837    parseDomainResourceProperties(json, res);
2838    if (json.has("patient"))
2839      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2840    if (json.has("assessor"))
2841      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
2842    if (json.has("status"))
2843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
2844    if (json.has("_status"))
2845      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2846    if (json.has("date"))
2847      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2848    if (json.has("_date"))
2849      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2850    if (json.has("description"))
2851      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2852    if (json.has("_description"))
2853      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2854    if (json.has("previous"))
2855      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
2856    if (json.has("problem")) {
2857      JsonArray array = json.getAsJsonArray("problem");
2858      for (int i = 0; i < array.size(); i++) {
2859        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
2860      }
2861    };
2862    Type trigger = parseType("trigger", json);
2863    if (trigger != null)
2864      res.setTrigger(trigger);
2865    if (json.has("investigations")) {
2866      JsonArray array = json.getAsJsonArray("investigations");
2867      for (int i = 0; i < array.size(); i++) {
2868        res.getInvestigations().add(parseClinicalImpressionClinicalImpressionInvestigationsComponent(array.get(i).getAsJsonObject(), res));
2869      }
2870    };
2871    if (json.has("protocol"))
2872      res.setProtocolElement(parseUri(json.get("protocol").getAsString()));
2873    if (json.has("_protocol"))
2874      parseElementProperties(json.getAsJsonObject("_protocol"), res.getProtocolElement());
2875    if (json.has("summary"))
2876      res.setSummaryElement(parseString(json.get("summary").getAsString()));
2877    if (json.has("_summary"))
2878      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
2879    if (json.has("finding")) {
2880      JsonArray array = json.getAsJsonArray("finding");
2881      for (int i = 0; i < array.size(); i++) {
2882        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
2883      }
2884    };
2885    if (json.has("resolved")) {
2886      JsonArray array = json.getAsJsonArray("resolved");
2887      for (int i = 0; i < array.size(); i++) {
2888        res.getResolved().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2889      }
2890    };
2891    if (json.has("ruledOut")) {
2892      JsonArray array = json.getAsJsonArray("ruledOut");
2893      for (int i = 0; i < array.size(); i++) {
2894        res.getRuledOut().add(parseClinicalImpressionClinicalImpressionRuledOutComponent(array.get(i).getAsJsonObject(), res));
2895      }
2896    };
2897    if (json.has("prognosis"))
2898      res.setPrognosisElement(parseString(json.get("prognosis").getAsString()));
2899    if (json.has("_prognosis"))
2900      parseElementProperties(json.getAsJsonObject("_prognosis"), res.getPrognosisElement());
2901    if (json.has("plan")) {
2902      JsonArray array = json.getAsJsonArray("plan");
2903      for (int i = 0; i < array.size(); i++) {
2904        res.getPlan().add(parseReference(array.get(i).getAsJsonObject()));
2905      }
2906    };
2907    if (json.has("action")) {
2908      JsonArray array = json.getAsJsonArray("action");
2909      for (int i = 0; i < array.size(); i++) {
2910        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
2911      }
2912    };
2913    return res;
2914  }
2915
2916  protected ClinicalImpression.ClinicalImpressionInvestigationsComponent parseClinicalImpressionClinicalImpressionInvestigationsComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2917    ClinicalImpression.ClinicalImpressionInvestigationsComponent res = new ClinicalImpression.ClinicalImpressionInvestigationsComponent();
2918    parseBackboneProperties(json, res);
2919    if (json.has("code"))
2920      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2921    if (json.has("item")) {
2922      JsonArray array = json.getAsJsonArray("item");
2923      for (int i = 0; i < array.size(); i++) {
2924        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
2925      }
2926    };
2927    return res;
2928  }
2929
2930  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2931    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
2932    parseBackboneProperties(json, res);
2933    if (json.has("item"))
2934      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
2935    if (json.has("cause"))
2936      res.setCauseElement(parseString(json.get("cause").getAsString()));
2937    if (json.has("_cause"))
2938      parseElementProperties(json.getAsJsonObject("_cause"), res.getCauseElement());
2939    return res;
2940  }
2941
2942  protected ClinicalImpression.ClinicalImpressionRuledOutComponent parseClinicalImpressionClinicalImpressionRuledOutComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
2943    ClinicalImpression.ClinicalImpressionRuledOutComponent res = new ClinicalImpression.ClinicalImpressionRuledOutComponent();
2944    parseBackboneProperties(json, res);
2945    if (json.has("item"))
2946      res.setItem(parseCodeableConcept(json.getAsJsonObject("item")));
2947    if (json.has("reason"))
2948      res.setReasonElement(parseString(json.get("reason").getAsString()));
2949    if (json.has("_reason"))
2950      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
2951    return res;
2952  }
2953
2954  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
2955    Communication res = new Communication();
2956    parseDomainResourceProperties(json, res);
2957    if (json.has("identifier")) {
2958      JsonArray array = json.getAsJsonArray("identifier");
2959      for (int i = 0; i < array.size(); i++) {
2960        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2961      }
2962    };
2963    if (json.has("category"))
2964      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
2965    if (json.has("sender"))
2966      res.setSender(parseReference(json.getAsJsonObject("sender")));
2967    if (json.has("recipient")) {
2968      JsonArray array = json.getAsJsonArray("recipient");
2969      for (int i = 0; i < array.size(); i++) {
2970        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
2971      }
2972    };
2973    if (json.has("payload")) {
2974      JsonArray array = json.getAsJsonArray("payload");
2975      for (int i = 0; i < array.size(); i++) {
2976        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
2977      }
2978    };
2979    if (json.has("medium")) {
2980      JsonArray array = json.getAsJsonArray("medium");
2981      for (int i = 0; i < array.size(); i++) {
2982        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2983      }
2984    };
2985    if (json.has("status"))
2986      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
2987    if (json.has("_status"))
2988      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2989    if (json.has("encounter"))
2990      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2991    if (json.has("sent"))
2992      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
2993    if (json.has("_sent"))
2994      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
2995    if (json.has("received"))
2996      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
2997    if (json.has("_received"))
2998      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
2999    if (json.has("reason")) {
3000      JsonArray array = json.getAsJsonArray("reason");
3001      for (int i = 0; i < array.size(); i++) {
3002        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3003      }
3004    };
3005    if (json.has("subject"))
3006      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3007    if (json.has("requestDetail"))
3008      res.setRequestDetail(parseReference(json.getAsJsonObject("requestDetail")));
3009    return res;
3010  }
3011
3012  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
3013    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
3014    parseBackboneProperties(json, res);
3015    Type content = parseType("content", json);
3016    if (content != null)
3017      res.setContent(content);
3018    return res;
3019  }
3020
3021  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
3022    CommunicationRequest res = new CommunicationRequest();
3023    parseDomainResourceProperties(json, res);
3024    if (json.has("identifier")) {
3025      JsonArray array = json.getAsJsonArray("identifier");
3026      for (int i = 0; i < array.size(); i++) {
3027        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3028      }
3029    };
3030    if (json.has("category"))
3031      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3032    if (json.has("sender"))
3033      res.setSender(parseReference(json.getAsJsonObject("sender")));
3034    if (json.has("recipient")) {
3035      JsonArray array = json.getAsJsonArray("recipient");
3036      for (int i = 0; i < array.size(); i++) {
3037        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
3038      }
3039    };
3040    if (json.has("payload")) {
3041      JsonArray array = json.getAsJsonArray("payload");
3042      for (int i = 0; i < array.size(); i++) {
3043        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
3044      }
3045    };
3046    if (json.has("medium")) {
3047      JsonArray array = json.getAsJsonArray("medium");
3048      for (int i = 0; i < array.size(); i++) {
3049        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3050      }
3051    };
3052    if (json.has("requester"))
3053      res.setRequester(parseReference(json.getAsJsonObject("requester")));
3054    if (json.has("status"))
3055      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
3056    if (json.has("_status"))
3057      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3058    if (json.has("encounter"))
3059      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3060    Type scheduled = parseType("scheduled", json);
3061    if (scheduled != null)
3062      res.setScheduled(scheduled);
3063    if (json.has("reason")) {
3064      JsonArray array = json.getAsJsonArray("reason");
3065      for (int i = 0; i < array.size(); i++) {
3066        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3067      }
3068    };
3069    if (json.has("requestedOn"))
3070      res.setRequestedOnElement(parseDateTime(json.get("requestedOn").getAsString()));
3071    if (json.has("_requestedOn"))
3072      parseElementProperties(json.getAsJsonObject("_requestedOn"), res.getRequestedOnElement());
3073    if (json.has("subject"))
3074      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3075    if (json.has("priority"))
3076      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
3077    return res;
3078  }
3079
3080  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
3081    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
3082    parseBackboneProperties(json, res);
3083    Type content = parseType("content", json);
3084    if (content != null)
3085      res.setContent(content);
3086    return res;
3087  }
3088
3089  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
3090    Composition res = new Composition();
3091    parseDomainResourceProperties(json, res);
3092    if (json.has("identifier"))
3093      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3094    if (json.has("date"))
3095      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3096    if (json.has("_date"))
3097      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3098    if (json.has("type"))
3099      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3100    if (json.has("class"))
3101      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
3102    if (json.has("title"))
3103      res.setTitleElement(parseString(json.get("title").getAsString()));
3104    if (json.has("_title"))
3105      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3106    if (json.has("status"))
3107      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
3108    if (json.has("_status"))
3109      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3110    if (json.has("confidentiality"))
3111      res.setConfidentialityElement(parseCode(json.get("confidentiality").getAsString()));
3112    if (json.has("_confidentiality"))
3113      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
3114    if (json.has("subject"))
3115      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3116    if (json.has("author")) {
3117      JsonArray array = json.getAsJsonArray("author");
3118      for (int i = 0; i < array.size(); i++) {
3119        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3120      }
3121    };
3122    if (json.has("attester")) {
3123      JsonArray array = json.getAsJsonArray("attester");
3124      for (int i = 0; i < array.size(); i++) {
3125        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
3126      }
3127    };
3128    if (json.has("custodian"))
3129      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3130    if (json.has("event")) {
3131      JsonArray array = json.getAsJsonArray("event");
3132      for (int i = 0; i < array.size(); i++) {
3133        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
3134      }
3135    };
3136    if (json.has("encounter"))
3137      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3138    if (json.has("section")) {
3139      JsonArray array = json.getAsJsonArray("section");
3140      for (int i = 0; i < array.size(); i++) {
3141        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
3142      }
3143    };
3144    return res;
3145  }
3146
3147  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3148    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
3149    parseBackboneProperties(json, res);
3150    if (json.has("mode")) {
3151      JsonArray array = json.getAsJsonArray("mode");
3152      for (int i = 0; i < array.size(); i++) {
3153        res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
3154      }
3155    };
3156    if (json.has("_mode")) {
3157      JsonArray array = json.getAsJsonArray("_mode");
3158      for (int i = 0; i < array.size(); i++) {
3159        if (i == res.getMode().size())
3160          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
3161        if (array.get(i) instanceof JsonObject) 
3162          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
3163      }
3164    };
3165    if (json.has("time"))
3166      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
3167    if (json.has("_time"))
3168      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
3169    if (json.has("party"))
3170      res.setParty(parseReference(json.getAsJsonObject("party")));
3171    return res;
3172  }
3173
3174  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3175    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
3176    parseBackboneProperties(json, res);
3177    if (json.has("code")) {
3178      JsonArray array = json.getAsJsonArray("code");
3179      for (int i = 0; i < array.size(); i++) {
3180        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3181      }
3182    };
3183    if (json.has("period"))
3184      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3185    if (json.has("detail")) {
3186      JsonArray array = json.getAsJsonArray("detail");
3187      for (int i = 0; i < array.size(); i++) {
3188        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
3189      }
3190    };
3191    return res;
3192  }
3193
3194  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
3195    Composition.SectionComponent res = new Composition.SectionComponent();
3196    parseBackboneProperties(json, res);
3197    if (json.has("title"))
3198      res.setTitleElement(parseString(json.get("title").getAsString()));
3199    if (json.has("_title"))
3200      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3201    if (json.has("code"))
3202      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3203    if (json.has("text"))
3204      res.setText(parseNarrative(json.getAsJsonObject("text")));
3205    if (json.has("mode"))
3206      res.setModeElement(parseCode(json.get("mode").getAsString()));
3207    if (json.has("_mode"))
3208      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3209    if (json.has("orderedBy"))
3210      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
3211    if (json.has("entry")) {
3212      JsonArray array = json.getAsJsonArray("entry");
3213      for (int i = 0; i < array.size(); i++) {
3214        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
3215      }
3216    };
3217    if (json.has("emptyReason"))
3218      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
3219    if (json.has("section")) {
3220      JsonArray array = json.getAsJsonArray("section");
3221      for (int i = 0; i < array.size(); i++) {
3222        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
3223      }
3224    };
3225    return res;
3226  }
3227
3228  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
3229    ConceptMap res = new ConceptMap();
3230    parseDomainResourceProperties(json, res);
3231    if (json.has("url"))
3232      res.setUrlElement(parseUri(json.get("url").getAsString()));
3233    if (json.has("_url"))
3234      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3235    if (json.has("identifier"))
3236      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3237    if (json.has("version"))
3238      res.setVersionElement(parseString(json.get("version").getAsString()));
3239    if (json.has("_version"))
3240      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3241    if (json.has("name"))
3242      res.setNameElement(parseString(json.get("name").getAsString()));
3243    if (json.has("_name"))
3244      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3245    if (json.has("status"))
3246      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3247    if (json.has("_status"))
3248      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3249    if (json.has("experimental"))
3250      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3251    if (json.has("_experimental"))
3252      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3253    if (json.has("publisher"))
3254      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3255    if (json.has("_publisher"))
3256      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3257    if (json.has("contact")) {
3258      JsonArray array = json.getAsJsonArray("contact");
3259      for (int i = 0; i < array.size(); i++) {
3260        res.getContact().add(parseConceptMapConceptMapContactComponent(array.get(i).getAsJsonObject(), res));
3261      }
3262    };
3263    if (json.has("date"))
3264      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3265    if (json.has("_date"))
3266      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3267    if (json.has("description"))
3268      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3269    if (json.has("_description"))
3270      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3271    if (json.has("useContext")) {
3272      JsonArray array = json.getAsJsonArray("useContext");
3273      for (int i = 0; i < array.size(); i++) {
3274        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3275      }
3276    };
3277    if (json.has("requirements"))
3278      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
3279    if (json.has("_requirements"))
3280      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
3281    if (json.has("copyright"))
3282      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
3283    if (json.has("_copyright"))
3284      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3285    Type source = parseType("source", json);
3286    if (source != null)
3287      res.setSource(source);
3288    Type target = parseType("target", json);
3289    if (target != null)
3290      res.setTarget(target);
3291    if (json.has("element")) {
3292      JsonArray array = json.getAsJsonArray("element");
3293      for (int i = 0; i < array.size(); i++) {
3294        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), res));
3295      }
3296    };
3297    return res;
3298  }
3299
3300  protected ConceptMap.ConceptMapContactComponent parseConceptMapConceptMapContactComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3301    ConceptMap.ConceptMapContactComponent res = new ConceptMap.ConceptMapContactComponent();
3302    parseBackboneProperties(json, res);
3303    if (json.has("name"))
3304      res.setNameElement(parseString(json.get("name").getAsString()));
3305    if (json.has("_name"))
3306      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3307    if (json.has("telecom")) {
3308      JsonArray array = json.getAsJsonArray("telecom");
3309      for (int i = 0; i < array.size(); i++) {
3310        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
3311      }
3312    };
3313    return res;
3314  }
3315
3316  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3317    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
3318    parseBackboneProperties(json, res);
3319    if (json.has("codeSystem"))
3320      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3321    if (json.has("_codeSystem"))
3322      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3323    if (json.has("code"))
3324      res.setCodeElement(parseCode(json.get("code").getAsString()));
3325    if (json.has("_code"))
3326      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3327    if (json.has("target")) {
3328      JsonArray array = json.getAsJsonArray("target");
3329      for (int i = 0; i < array.size(); i++) {
3330        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
3331      }
3332    };
3333    return res;
3334  }
3335
3336  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3337    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
3338    parseBackboneProperties(json, res);
3339    if (json.has("codeSystem"))
3340      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3341    if (json.has("_codeSystem"))
3342      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3343    if (json.has("code"))
3344      res.setCodeElement(parseCode(json.get("code").getAsString()));
3345    if (json.has("_code"))
3346      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3347    if (json.has("equivalence"))
3348      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
3349    if (json.has("_equivalence"))
3350      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
3351    if (json.has("comments"))
3352      res.setCommentsElement(parseString(json.get("comments").getAsString()));
3353    if (json.has("_comments"))
3354      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
3355    if (json.has("dependsOn")) {
3356      JsonArray array = json.getAsJsonArray("dependsOn");
3357      for (int i = 0; i < array.size(); i++) {
3358        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
3359      }
3360    };
3361    if (json.has("product")) {
3362      JsonArray array = json.getAsJsonArray("product");
3363      for (int i = 0; i < array.size(); i++) {
3364        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
3365      }
3366    };
3367    return res;
3368  }
3369
3370  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
3371    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
3372    parseBackboneProperties(json, res);
3373    if (json.has("element"))
3374      res.setElementElement(parseUri(json.get("element").getAsString()));
3375    if (json.has("_element"))
3376      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
3377    if (json.has("codeSystem"))
3378      res.setCodeSystemElement(parseUri(json.get("codeSystem").getAsString()));
3379    if (json.has("_codeSystem"))
3380      parseElementProperties(json.getAsJsonObject("_codeSystem"), res.getCodeSystemElement());
3381    if (json.has("code"))
3382      res.setCodeElement(parseString(json.get("code").getAsString()));
3383    if (json.has("_code"))
3384      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3385    return res;
3386  }
3387
3388  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
3389    Condition res = new Condition();
3390    parseDomainResourceProperties(json, res);
3391    if (json.has("identifier")) {
3392      JsonArray array = json.getAsJsonArray("identifier");
3393      for (int i = 0; i < array.size(); i++) {
3394        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3395      }
3396    };
3397    if (json.has("patient"))
3398      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3399    if (json.has("encounter"))
3400      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3401    if (json.has("asserter"))
3402      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
3403    if (json.has("dateRecorded"))
3404      res.setDateRecordedElement(parseDate(json.get("dateRecorded").getAsString()));
3405    if (json.has("_dateRecorded"))
3406      parseElementProperties(json.getAsJsonObject("_dateRecorded"), res.getDateRecordedElement());
3407    if (json.has("code"))
3408      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3409    if (json.has("category"))
3410      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3411    if (json.has("clinicalStatus"))
3412      res.setClinicalStatusElement(parseCode(json.get("clinicalStatus").getAsString()));
3413    if (json.has("_clinicalStatus"))
3414      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
3415    if (json.has("verificationStatus"))
3416      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
3417    if (json.has("_verificationStatus"))
3418      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
3419    if (json.has("severity"))
3420      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
3421    Type onset = parseType("onset", json);
3422    if (onset != null)
3423      res.setOnset(onset);
3424    Type abatement = parseType("abatement", json);
3425    if (abatement != null)
3426      res.setAbatement(abatement);
3427    if (json.has("stage"))
3428      res.setStage(parseConditionConditionStageComponent(json.getAsJsonObject("stage"), res));
3429    if (json.has("evidence")) {
3430      JsonArray array = json.getAsJsonArray("evidence");
3431      for (int i = 0; i < array.size(); i++) {
3432        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
3433      }
3434    };
3435    if (json.has("bodySite")) {
3436      JsonArray array = json.getAsJsonArray("bodySite");
3437      for (int i = 0; i < array.size(); i++) {
3438        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3439      }
3440    };
3441    if (json.has("notes"))
3442      res.setNotesElement(parseString(json.get("notes").getAsString()));
3443    if (json.has("_notes"))
3444      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
3445    return res;
3446  }
3447
3448  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
3449    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
3450    parseBackboneProperties(json, res);
3451    if (json.has("summary"))
3452      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
3453    if (json.has("assessment")) {
3454      JsonArray array = json.getAsJsonArray("assessment");
3455      for (int i = 0; i < array.size(); i++) {
3456        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
3457      }
3458    };
3459    return res;
3460  }
3461
3462  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
3463    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
3464    parseBackboneProperties(json, res);
3465    if (json.has("code"))
3466      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3467    if (json.has("detail")) {
3468      JsonArray array = json.getAsJsonArray("detail");
3469      for (int i = 0; i < array.size(); i++) {
3470        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
3471      }
3472    };
3473    return res;
3474  }
3475
3476  protected Conformance parseConformance(JsonObject json) throws IOException, FHIRFormatError {
3477    Conformance res = new Conformance();
3478    parseDomainResourceProperties(json, res);
3479    if (json.has("url"))
3480      res.setUrlElement(parseUri(json.get("url").getAsString()));
3481    if (json.has("_url"))
3482      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3483    if (json.has("version"))
3484      res.setVersionElement(parseString(json.get("version").getAsString()));
3485    if (json.has("_version"))
3486      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3487    if (json.has("name"))
3488      res.setNameElement(parseString(json.get("name").getAsString()));
3489    if (json.has("_name"))
3490      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3491    if (json.has("status"))
3492      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
3493    if (json.has("_status"))
3494      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3495    if (json.has("experimental"))
3496      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3497    if (json.has("_experimental"))
3498      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3499    if (json.has("publisher"))
3500      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3501    if (json.has("_publisher"))
3502      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3503    if (json.has("contact")) {
3504      JsonArray array = json.getAsJsonArray("contact");
3505      for (int i = 0; i < array.size(); i++) {
3506        res.getContact().add(parseConformanceConformanceContactComponent(array.get(i).getAsJsonObject(), res));
3507      }
3508    };
3509    if (json.has("date"))
3510      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3511    if (json.has("_date"))
3512      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3513    if (json.has("description"))
3514      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3515    if (json.has("_description"))
3516      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3517    if (json.has("requirements"))
3518      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
3519    if (json.has("_requirements"))
3520      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
3521    if (json.has("copyright"))
3522      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
3523    if (json.has("_copyright"))
3524      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3525    if (json.has("kind"))
3526      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Conformance.ConformanceStatementKind.NULL, new Conformance.ConformanceStatementKindEnumFactory()));
3527    if (json.has("_kind"))
3528      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3529    if (json.has("software"))
3530      res.setSoftware(parseConformanceConformanceSoftwareComponent(json.getAsJsonObject("software"), res));
3531    if (json.has("implementation"))
3532      res.setImplementation(parseConformanceConformanceImplementationComponent(json.getAsJsonObject("implementation"), res));
3533    if (json.has("fhirVersion"))
3534      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3535    if (json.has("_fhirVersion"))
3536      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3537    if (json.has("acceptUnknown"))
3538      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), Conformance.UnknownContentCode.NULL, new Conformance.UnknownContentCodeEnumFactory()));
3539    if (json.has("_acceptUnknown"))
3540      parseElementProperties(json.getAsJsonObject("_acceptUnknown"), res.getAcceptUnknownElement());
3541    if (json.has("format")) {
3542      JsonArray array = json.getAsJsonArray("format");
3543      for (int i = 0; i < array.size(); i++) {
3544        res.getFormat().add(parseCode(array.get(i).getAsString()));
3545      }
3546    };
3547    if (json.has("_format")) {
3548      JsonArray array = json.getAsJsonArray("_format");
3549      for (int i = 0; i < array.size(); i++) {
3550        if (i == res.getFormat().size())
3551          res.getFormat().add(parseCode(null));
3552        if (array.get(i) instanceof JsonObject) 
3553          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3554      }
3555    };
3556    if (json.has("profile")) {
3557      JsonArray array = json.getAsJsonArray("profile");
3558      for (int i = 0; i < array.size(); i++) {
3559        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
3560      }
3561    };
3562    if (json.has("rest")) {
3563      JsonArray array = json.getAsJsonArray("rest");
3564      for (int i = 0; i < array.size(); i++) {
3565        res.getRest().add(parseConformanceConformanceRestComponent(array.get(i).getAsJsonObject(), res));
3566      }
3567    };
3568    if (json.has("messaging")) {
3569      JsonArray array = json.getAsJsonArray("messaging");
3570      for (int i = 0; i < array.size(); i++) {
3571        res.getMessaging().add(parseConformanceConformanceMessagingComponent(array.get(i).getAsJsonObject(), res));
3572      }
3573    };
3574    if (json.has("document")) {
3575      JsonArray array = json.getAsJsonArray("document");
3576      for (int i = 0; i < array.size(); i++) {
3577        res.getDocument().add(parseConformanceConformanceDocumentComponent(array.get(i).getAsJsonObject(), res));
3578      }
3579    };
3580    return res;
3581  }
3582
3583  protected Conformance.ConformanceContactComponent parseConformanceConformanceContactComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3584    Conformance.ConformanceContactComponent res = new Conformance.ConformanceContactComponent();
3585    parseBackboneProperties(json, res);
3586    if (json.has("name"))
3587      res.setNameElement(parseString(json.get("name").getAsString()));
3588    if (json.has("_name"))
3589      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3590    if (json.has("telecom")) {
3591      JsonArray array = json.getAsJsonArray("telecom");
3592      for (int i = 0; i < array.size(); i++) {
3593        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
3594      }
3595    };
3596    return res;
3597  }
3598
3599  protected Conformance.ConformanceSoftwareComponent parseConformanceConformanceSoftwareComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3600    Conformance.ConformanceSoftwareComponent res = new Conformance.ConformanceSoftwareComponent();
3601    parseBackboneProperties(json, res);
3602    if (json.has("name"))
3603      res.setNameElement(parseString(json.get("name").getAsString()));
3604    if (json.has("_name"))
3605      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3606    if (json.has("version"))
3607      res.setVersionElement(parseString(json.get("version").getAsString()));
3608    if (json.has("_version"))
3609      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3610    if (json.has("releaseDate"))
3611      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3612    if (json.has("_releaseDate"))
3613      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3614    return res;
3615  }
3616
3617  protected Conformance.ConformanceImplementationComponent parseConformanceConformanceImplementationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3618    Conformance.ConformanceImplementationComponent res = new Conformance.ConformanceImplementationComponent();
3619    parseBackboneProperties(json, res);
3620    if (json.has("description"))
3621      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3622    if (json.has("_description"))
3623      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3624    if (json.has("url"))
3625      res.setUrlElement(parseUri(json.get("url").getAsString()));
3626    if (json.has("_url"))
3627      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3628    return res;
3629  }
3630
3631  protected Conformance.ConformanceRestComponent parseConformanceConformanceRestComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3632    Conformance.ConformanceRestComponent res = new Conformance.ConformanceRestComponent();
3633    parseBackboneProperties(json, res);
3634    if (json.has("mode"))
3635      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.RestfulConformanceMode.NULL, new Conformance.RestfulConformanceModeEnumFactory()));
3636    if (json.has("_mode"))
3637      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3638    if (json.has("documentation"))
3639      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3640    if (json.has("_documentation"))
3641      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3642    if (json.has("security"))
3643      res.setSecurity(parseConformanceConformanceRestSecurityComponent(json.getAsJsonObject("security"), owner));
3644    if (json.has("resource")) {
3645      JsonArray array = json.getAsJsonArray("resource");
3646      for (int i = 0; i < array.size(); i++) {
3647        res.getResource().add(parseConformanceConformanceRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3648      }
3649    };
3650    if (json.has("interaction")) {
3651      JsonArray array = json.getAsJsonArray("interaction");
3652      for (int i = 0; i < array.size(); i++) {
3653        res.getInteraction().add(parseConformanceSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3654      }
3655    };
3656    if (json.has("transactionMode"))
3657      res.setTransactionModeElement(parseEnumeration(json.get("transactionMode").getAsString(), Conformance.TransactionMode.NULL, new Conformance.TransactionModeEnumFactory()));
3658    if (json.has("_transactionMode"))
3659      parseElementProperties(json.getAsJsonObject("_transactionMode"), res.getTransactionModeElement());
3660    if (json.has("searchParam")) {
3661      JsonArray array = json.getAsJsonArray("searchParam");
3662      for (int i = 0; i < array.size(); i++) {
3663        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3664      }
3665    };
3666    if (json.has("operation")) {
3667      JsonArray array = json.getAsJsonArray("operation");
3668      for (int i = 0; i < array.size(); i++) {
3669        res.getOperation().add(parseConformanceConformanceRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3670      }
3671    };
3672    if (json.has("compartment")) {
3673      JsonArray array = json.getAsJsonArray("compartment");
3674      for (int i = 0; i < array.size(); i++) {
3675        res.getCompartment().add(parseUri(array.get(i).getAsString()));
3676      }
3677    };
3678    if (json.has("_compartment")) {
3679      JsonArray array = json.getAsJsonArray("_compartment");
3680      for (int i = 0; i < array.size(); i++) {
3681        if (i == res.getCompartment().size())
3682          res.getCompartment().add(parseUri(null));
3683        if (array.get(i) instanceof JsonObject) 
3684          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3685      }
3686    };
3687    return res;
3688  }
3689
3690  protected Conformance.ConformanceRestSecurityComponent parseConformanceConformanceRestSecurityComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3691    Conformance.ConformanceRestSecurityComponent res = new Conformance.ConformanceRestSecurityComponent();
3692    parseBackboneProperties(json, res);
3693    if (json.has("cors"))
3694      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3695    if (json.has("_cors"))
3696      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3697    if (json.has("service")) {
3698      JsonArray array = json.getAsJsonArray("service");
3699      for (int i = 0; i < array.size(); i++) {
3700        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3701      }
3702    };
3703    if (json.has("description"))
3704      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3705    if (json.has("_description"))
3706      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3707    if (json.has("certificate")) {
3708      JsonArray array = json.getAsJsonArray("certificate");
3709      for (int i = 0; i < array.size(); i++) {
3710        res.getCertificate().add(parseConformanceConformanceRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3711      }
3712    };
3713    return res;
3714  }
3715
3716  protected Conformance.ConformanceRestSecurityCertificateComponent parseConformanceConformanceRestSecurityCertificateComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3717    Conformance.ConformanceRestSecurityCertificateComponent res = new Conformance.ConformanceRestSecurityCertificateComponent();
3718    parseBackboneProperties(json, res);
3719    if (json.has("type"))
3720      res.setTypeElement(parseCode(json.get("type").getAsString()));
3721    if (json.has("_type"))
3722      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3723    if (json.has("blob"))
3724      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3725    if (json.has("_blob"))
3726      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
3727    return res;
3728  }
3729
3730  protected Conformance.ConformanceRestResourceComponent parseConformanceConformanceRestResourceComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3731    Conformance.ConformanceRestResourceComponent res = new Conformance.ConformanceRestResourceComponent();
3732    parseBackboneProperties(json, res);
3733    if (json.has("type"))
3734      res.setTypeElement(parseCode(json.get("type").getAsString()));
3735    if (json.has("_type"))
3736      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3737    if (json.has("profile"))
3738      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3739    if (json.has("interaction")) {
3740      JsonArray array = json.getAsJsonArray("interaction");
3741      for (int i = 0; i < array.size(); i++) {
3742        res.getInteraction().add(parseConformanceResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3743      }
3744    };
3745    if (json.has("versioning"))
3746      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), Conformance.ResourceVersionPolicy.NULL, new Conformance.ResourceVersionPolicyEnumFactory()));
3747    if (json.has("_versioning"))
3748      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3749    if (json.has("readHistory"))
3750      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3751    if (json.has("_readHistory"))
3752      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3753    if (json.has("updateCreate"))
3754      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3755    if (json.has("_updateCreate"))
3756      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3757    if (json.has("conditionalCreate"))
3758      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3759    if (json.has("_conditionalCreate"))
3760      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3761    if (json.has("conditionalUpdate"))
3762      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3763    if (json.has("_conditionalUpdate"))
3764      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3765    if (json.has("conditionalDelete"))
3766      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), Conformance.ConditionalDeleteStatus.NULL, new Conformance.ConditionalDeleteStatusEnumFactory()));
3767    if (json.has("_conditionalDelete"))
3768      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3769    if (json.has("searchInclude")) {
3770      JsonArray array = json.getAsJsonArray("searchInclude");
3771      for (int i = 0; i < array.size(); i++) {
3772        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3773      }
3774    };
3775    if (json.has("_searchInclude")) {
3776      JsonArray array = json.getAsJsonArray("_searchInclude");
3777      for (int i = 0; i < array.size(); i++) {
3778        if (i == res.getSearchInclude().size())
3779          res.getSearchInclude().add(parseString(null));
3780        if (array.get(i) instanceof JsonObject) 
3781          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3782      }
3783    };
3784    if (json.has("searchRevInclude")) {
3785      JsonArray array = json.getAsJsonArray("searchRevInclude");
3786      for (int i = 0; i < array.size(); i++) {
3787        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3788      }
3789    };
3790    if (json.has("_searchRevInclude")) {
3791      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3792      for (int i = 0; i < array.size(); i++) {
3793        if (i == res.getSearchRevInclude().size())
3794          res.getSearchRevInclude().add(parseString(null));
3795        if (array.get(i) instanceof JsonObject) 
3796          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3797      }
3798    };
3799    if (json.has("searchParam")) {
3800      JsonArray array = json.getAsJsonArray("searchParam");
3801      for (int i = 0; i < array.size(); i++) {
3802        res.getSearchParam().add(parseConformanceConformanceRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3803      }
3804    };
3805    return res;
3806  }
3807
3808  protected Conformance.ResourceInteractionComponent parseConformanceResourceInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3809    Conformance.ResourceInteractionComponent res = new Conformance.ResourceInteractionComponent();
3810    parseBackboneProperties(json, res);
3811    if (json.has("code"))
3812      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.TypeRestfulInteraction.NULL, new Conformance.TypeRestfulInteractionEnumFactory()));
3813    if (json.has("_code"))
3814      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3815    if (json.has("documentation"))
3816      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3817    if (json.has("_documentation"))
3818      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3819    return res;
3820  }
3821
3822  protected Conformance.ConformanceRestResourceSearchParamComponent parseConformanceConformanceRestResourceSearchParamComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3823    Conformance.ConformanceRestResourceSearchParamComponent res = new Conformance.ConformanceRestResourceSearchParamComponent();
3824    parseBackboneProperties(json, res);
3825    if (json.has("name"))
3826      res.setNameElement(parseString(json.get("name").getAsString()));
3827    if (json.has("_name"))
3828      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3829    if (json.has("definition"))
3830      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3831    if (json.has("_definition"))
3832      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3833    if (json.has("type"))
3834      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3835    if (json.has("_type"))
3836      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3837    if (json.has("documentation"))
3838      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3839    if (json.has("_documentation"))
3840      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3841    if (json.has("target")) {
3842      JsonArray array = json.getAsJsonArray("target");
3843      for (int i = 0; i < array.size(); i++) {
3844        res.getTarget().add(parseCode(array.get(i).getAsString()));
3845      }
3846    };
3847    if (json.has("_target")) {
3848      JsonArray array = json.getAsJsonArray("_target");
3849      for (int i = 0; i < array.size(); i++) {
3850        if (i == res.getTarget().size())
3851          res.getTarget().add(parseCode(null));
3852        if (array.get(i) instanceof JsonObject) 
3853          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
3854      }
3855    };
3856    if (json.has("modifier")) {
3857      JsonArray array = json.getAsJsonArray("modifier");
3858      for (int i = 0; i < array.size(); i++) {
3859        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
3860      }
3861    };
3862    if (json.has("_modifier")) {
3863      JsonArray array = json.getAsJsonArray("_modifier");
3864      for (int i = 0; i < array.size(); i++) {
3865        if (i == res.getModifier().size())
3866          res.getModifier().add(parseEnumeration(null, Conformance.SearchModifierCode.NULL, new Conformance.SearchModifierCodeEnumFactory()));
3867        if (array.get(i) instanceof JsonObject) 
3868          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
3869      }
3870    };
3871    if (json.has("chain")) {
3872      JsonArray array = json.getAsJsonArray("chain");
3873      for (int i = 0; i < array.size(); i++) {
3874        res.getChain().add(parseString(array.get(i).getAsString()));
3875      }
3876    };
3877    if (json.has("_chain")) {
3878      JsonArray array = json.getAsJsonArray("_chain");
3879      for (int i = 0; i < array.size(); i++) {
3880        if (i == res.getChain().size())
3881          res.getChain().add(parseString(null));
3882        if (array.get(i) instanceof JsonObject) 
3883          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
3884      }
3885    };
3886    return res;
3887  }
3888
3889  protected Conformance.SystemInteractionComponent parseConformanceSystemInteractionComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3890    Conformance.SystemInteractionComponent res = new Conformance.SystemInteractionComponent();
3891    parseBackboneProperties(json, res);
3892    if (json.has("code"))
3893      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Conformance.SystemRestfulInteraction.NULL, new Conformance.SystemRestfulInteractionEnumFactory()));
3894    if (json.has("_code"))
3895      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3896    if (json.has("documentation"))
3897      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3898    if (json.has("_documentation"))
3899      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3900    return res;
3901  }
3902
3903  protected Conformance.ConformanceRestOperationComponent parseConformanceConformanceRestOperationComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3904    Conformance.ConformanceRestOperationComponent res = new Conformance.ConformanceRestOperationComponent();
3905    parseBackboneProperties(json, res);
3906    if (json.has("name"))
3907      res.setNameElement(parseString(json.get("name").getAsString()));
3908    if (json.has("_name"))
3909      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3910    if (json.has("definition"))
3911      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3912    return res;
3913  }
3914
3915  protected Conformance.ConformanceMessagingComponent parseConformanceConformanceMessagingComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3916    Conformance.ConformanceMessagingComponent res = new Conformance.ConformanceMessagingComponent();
3917    parseBackboneProperties(json, res);
3918    if (json.has("endpoint")) {
3919      JsonArray array = json.getAsJsonArray("endpoint");
3920      for (int i = 0; i < array.size(); i++) {
3921        res.getEndpoint().add(parseConformanceConformanceMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3922      }
3923    };
3924    if (json.has("reliableCache"))
3925      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3926    if (json.has("_reliableCache"))
3927      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3928    if (json.has("documentation"))
3929      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3930    if (json.has("_documentation"))
3931      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3932    if (json.has("event")) {
3933      JsonArray array = json.getAsJsonArray("event");
3934      for (int i = 0; i < array.size(); i++) {
3935        res.getEvent().add(parseConformanceConformanceMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3936      }
3937    };
3938    return res;
3939  }
3940
3941  protected Conformance.ConformanceMessagingEndpointComponent parseConformanceConformanceMessagingEndpointComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3942    Conformance.ConformanceMessagingEndpointComponent res = new Conformance.ConformanceMessagingEndpointComponent();
3943    parseBackboneProperties(json, res);
3944    if (json.has("protocol"))
3945      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3946    if (json.has("address"))
3947      res.setAddressElement(parseUri(json.get("address").getAsString()));
3948    if (json.has("_address"))
3949      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3950    return res;
3951  }
3952
3953  protected Conformance.ConformanceMessagingEventComponent parseConformanceConformanceMessagingEventComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3954    Conformance.ConformanceMessagingEventComponent res = new Conformance.ConformanceMessagingEventComponent();
3955    parseBackboneProperties(json, res);
3956    if (json.has("code"))
3957      res.setCode(parseCoding(json.getAsJsonObject("code")));
3958    if (json.has("category"))
3959      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), Conformance.MessageSignificanceCategory.NULL, new Conformance.MessageSignificanceCategoryEnumFactory()));
3960    if (json.has("_category"))
3961      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
3962    if (json.has("mode"))
3963      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.ConformanceEventMode.NULL, new Conformance.ConformanceEventModeEnumFactory()));
3964    if (json.has("_mode"))
3965      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3966    if (json.has("focus"))
3967      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3968    if (json.has("_focus"))
3969      parseElementProperties(json.getAsJsonObject("_focus"), res.getFocusElement());
3970    if (json.has("request"))
3971      res.setRequest(parseReference(json.getAsJsonObject("request")));
3972    if (json.has("response"))
3973      res.setResponse(parseReference(json.getAsJsonObject("response")));
3974    if (json.has("documentation"))
3975      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3976    if (json.has("_documentation"))
3977      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3978    return res;
3979  }
3980
3981  protected Conformance.ConformanceDocumentComponent parseConformanceConformanceDocumentComponent(JsonObject json, Conformance owner) throws IOException, FHIRFormatError {
3982    Conformance.ConformanceDocumentComponent res = new Conformance.ConformanceDocumentComponent();
3983    parseBackboneProperties(json, res);
3984    if (json.has("mode"))
3985      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Conformance.DocumentMode.NULL, new Conformance.DocumentModeEnumFactory()));
3986    if (json.has("_mode"))
3987      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3988    if (json.has("documentation"))
3989      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3990    if (json.has("_documentation"))
3991      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3992    if (json.has("profile"))
3993      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3994    return res;
3995  }
3996
3997  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
3998    Contract res = new Contract();
3999    parseDomainResourceProperties(json, res);
4000    if (json.has("identifier"))
4001      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4002    if (json.has("issued"))
4003      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
4004    if (json.has("_issued"))
4005      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
4006    if (json.has("applies"))
4007      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
4008    if (json.has("subject")) {
4009      JsonArray array = json.getAsJsonArray("subject");
4010      for (int i = 0; i < array.size(); i++) {
4011        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
4012      }
4013    };
4014    if (json.has("authority")) {
4015      JsonArray array = json.getAsJsonArray("authority");
4016      for (int i = 0; i < array.size(); i++) {
4017        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
4018      }
4019    };
4020    if (json.has("domain")) {
4021      JsonArray array = json.getAsJsonArray("domain");
4022      for (int i = 0; i < array.size(); i++) {
4023        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
4024      }
4025    };
4026    if (json.has("type"))
4027      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4028    if (json.has("subType")) {
4029      JsonArray array = json.getAsJsonArray("subType");
4030      for (int i = 0; i < array.size(); i++) {
4031        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4032      }
4033    };
4034    if (json.has("action")) {
4035      JsonArray array = json.getAsJsonArray("action");
4036      for (int i = 0; i < array.size(); i++) {
4037        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4038      }
4039    };
4040    if (json.has("actionReason")) {
4041      JsonArray array = json.getAsJsonArray("actionReason");
4042      for (int i = 0; i < array.size(); i++) {
4043        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4044      }
4045    };
4046    if (json.has("actor")) {
4047      JsonArray array = json.getAsJsonArray("actor");
4048      for (int i = 0; i < array.size(); i++) {
4049        res.getActor().add(parseContractActorComponent(array.get(i).getAsJsonObject(), res));
4050      }
4051    };
4052    if (json.has("valuedItem")) {
4053      JsonArray array = json.getAsJsonArray("valuedItem");
4054      for (int i = 0; i < array.size(); i++) {
4055        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
4056      }
4057    };
4058    if (json.has("signer")) {
4059      JsonArray array = json.getAsJsonArray("signer");
4060      for (int i = 0; i < array.size(); i++) {
4061        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
4062      }
4063    };
4064    if (json.has("term")) {
4065      JsonArray array = json.getAsJsonArray("term");
4066      for (int i = 0; i < array.size(); i++) {
4067        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
4068      }
4069    };
4070    Type binding = parseType("binding", json);
4071    if (binding != null)
4072      res.setBinding(binding);
4073    if (json.has("friendly")) {
4074      JsonArray array = json.getAsJsonArray("friendly");
4075      for (int i = 0; i < array.size(); i++) {
4076        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
4077      }
4078    };
4079    if (json.has("legal")) {
4080      JsonArray array = json.getAsJsonArray("legal");
4081      for (int i = 0; i < array.size(); i++) {
4082        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
4083      }
4084    };
4085    if (json.has("rule")) {
4086      JsonArray array = json.getAsJsonArray("rule");
4087      for (int i = 0; i < array.size(); i++) {
4088        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
4089      }
4090    };
4091    return res;
4092  }
4093
4094  protected Contract.ActorComponent parseContractActorComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4095    Contract.ActorComponent res = new Contract.ActorComponent();
4096    parseBackboneProperties(json, res);
4097    if (json.has("entity"))
4098      res.setEntity(parseReference(json.getAsJsonObject("entity")));
4099    if (json.has("role")) {
4100      JsonArray array = json.getAsJsonArray("role");
4101      for (int i = 0; i < array.size(); i++) {
4102        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4103      }
4104    };
4105    return res;
4106  }
4107
4108  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4109    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
4110    parseBackboneProperties(json, res);
4111    Type entity = parseType("entity", json);
4112    if (entity != null)
4113      res.setEntity(entity);
4114    if (json.has("identifier"))
4115      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4116    if (json.has("effectiveTime"))
4117      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
4118    if (json.has("_effectiveTime"))
4119      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
4120    if (json.has("quantity"))
4121      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4122    if (json.has("unitPrice"))
4123      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4124    if (json.has("factor"))
4125      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4126    if (json.has("_factor"))
4127      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4128    if (json.has("points"))
4129      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
4130    if (json.has("_points"))
4131      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
4132    if (json.has("net"))
4133      res.setNet(parseMoney(json.getAsJsonObject("net")));
4134    return res;
4135  }
4136
4137  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4138    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
4139    parseBackboneProperties(json, res);
4140    if (json.has("type"))
4141      res.setType(parseCoding(json.getAsJsonObject("type")));
4142    if (json.has("party"))
4143      res.setParty(parseReference(json.getAsJsonObject("party")));
4144    if (json.has("signature"))
4145      res.setSignatureElement(parseString(json.get("signature").getAsString()));
4146    if (json.has("_signature"))
4147      parseElementProperties(json.getAsJsonObject("_signature"), res.getSignatureElement());
4148    return res;
4149  }
4150
4151  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4152    Contract.TermComponent res = new Contract.TermComponent();
4153    parseBackboneProperties(json, res);
4154    if (json.has("identifier"))
4155      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4156    if (json.has("issued"))
4157      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
4158    if (json.has("_issued"))
4159      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
4160    if (json.has("applies"))
4161      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
4162    if (json.has("type"))
4163      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4164    if (json.has("subType"))
4165      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
4166    if (json.has("subject"))
4167      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4168    if (json.has("action")) {
4169      JsonArray array = json.getAsJsonArray("action");
4170      for (int i = 0; i < array.size(); i++) {
4171        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4172      }
4173    };
4174    if (json.has("actionReason")) {
4175      JsonArray array = json.getAsJsonArray("actionReason");
4176      for (int i = 0; i < array.size(); i++) {
4177        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4178      }
4179    };
4180    if (json.has("actor")) {
4181      JsonArray array = json.getAsJsonArray("actor");
4182      for (int i = 0; i < array.size(); i++) {
4183        res.getActor().add(parseContractTermActorComponent(array.get(i).getAsJsonObject(), owner));
4184      }
4185    };
4186    if (json.has("text"))
4187      res.setTextElement(parseString(json.get("text").getAsString()));
4188    if (json.has("_text"))
4189      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
4190    if (json.has("valuedItem")) {
4191      JsonArray array = json.getAsJsonArray("valuedItem");
4192      for (int i = 0; i < array.size(); i++) {
4193        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
4194      }
4195    };
4196    if (json.has("group")) {
4197      JsonArray array = json.getAsJsonArray("group");
4198      for (int i = 0; i < array.size(); i++) {
4199        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
4200      }
4201    };
4202    return res;
4203  }
4204
4205  protected Contract.TermActorComponent parseContractTermActorComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4206    Contract.TermActorComponent res = new Contract.TermActorComponent();
4207    parseBackboneProperties(json, res);
4208    if (json.has("entity"))
4209      res.setEntity(parseReference(json.getAsJsonObject("entity")));
4210    if (json.has("role")) {
4211      JsonArray array = json.getAsJsonArray("role");
4212      for (int i = 0; i < array.size(); i++) {
4213        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4214      }
4215    };
4216    return res;
4217  }
4218
4219  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4220    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
4221    parseBackboneProperties(json, res);
4222    Type entity = parseType("entity", json);
4223    if (entity != null)
4224      res.setEntity(entity);
4225    if (json.has("identifier"))
4226      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4227    if (json.has("effectiveTime"))
4228      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
4229    if (json.has("_effectiveTime"))
4230      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
4231    if (json.has("quantity"))
4232      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4233    if (json.has("unitPrice"))
4234      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4235    if (json.has("factor"))
4236      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4237    if (json.has("_factor"))
4238      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4239    if (json.has("points"))
4240      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
4241    if (json.has("_points"))
4242      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
4243    if (json.has("net"))
4244      res.setNet(parseMoney(json.getAsJsonObject("net")));
4245    return res;
4246  }
4247
4248  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4249    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
4250    parseBackboneProperties(json, res);
4251    Type content = parseType("content", json);
4252    if (content != null)
4253      res.setContent(content);
4254    return res;
4255  }
4256
4257  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4258    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
4259    parseBackboneProperties(json, res);
4260    Type content = parseType("content", json);
4261    if (content != null)
4262      res.setContent(content);
4263    return res;
4264  }
4265
4266  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
4267    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
4268    parseBackboneProperties(json, res);
4269    Type content = parseType("content", json);
4270    if (content != null)
4271      res.setContent(content);
4272    return res;
4273  }
4274
4275  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
4276    Coverage res = new Coverage();
4277    parseDomainResourceProperties(json, res);
4278    if (json.has("issuer"))
4279      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
4280    if (json.has("bin"))
4281      res.setBin(parseIdentifier(json.getAsJsonObject("bin")));
4282    if (json.has("period"))
4283      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4284    if (json.has("type"))
4285      res.setType(parseCoding(json.getAsJsonObject("type")));
4286    if (json.has("subscriberId"))
4287      res.setSubscriberId(parseIdentifier(json.getAsJsonObject("subscriberId")));
4288    if (json.has("identifier")) {
4289      JsonArray array = json.getAsJsonArray("identifier");
4290      for (int i = 0; i < array.size(); i++) {
4291        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4292      }
4293    };
4294    if (json.has("group"))
4295      res.setGroupElement(parseString(json.get("group").getAsString()));
4296    if (json.has("_group"))
4297      parseElementProperties(json.getAsJsonObject("_group"), res.getGroupElement());
4298    if (json.has("plan"))
4299      res.setPlanElement(parseString(json.get("plan").getAsString()));
4300    if (json.has("_plan"))
4301      parseElementProperties(json.getAsJsonObject("_plan"), res.getPlanElement());
4302    if (json.has("subPlan"))
4303      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
4304    if (json.has("_subPlan"))
4305      parseElementProperties(json.getAsJsonObject("_subPlan"), res.getSubPlanElement());
4306    if (json.has("dependent"))
4307      res.setDependentElement(parsePositiveInt(json.get("dependent").getAsString()));
4308    if (json.has("_dependent"))
4309      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
4310    if (json.has("sequence"))
4311      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4312    if (json.has("_sequence"))
4313      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4314    if (json.has("subscriber"))
4315      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
4316    if (json.has("network"))
4317      res.setNetwork(parseIdentifier(json.getAsJsonObject("network")));
4318    if (json.has("contract")) {
4319      JsonArray array = json.getAsJsonArray("contract");
4320      for (int i = 0; i < array.size(); i++) {
4321        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
4322      }
4323    };
4324    return res;
4325  }
4326
4327  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
4328    DataElement res = new DataElement();
4329    parseDomainResourceProperties(json, res);
4330    if (json.has("url"))
4331      res.setUrlElement(parseUri(json.get("url").getAsString()));
4332    if (json.has("_url"))
4333      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4334    if (json.has("identifier")) {
4335      JsonArray array = json.getAsJsonArray("identifier");
4336      for (int i = 0; i < array.size(); i++) {
4337        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4338      }
4339    };
4340    if (json.has("version"))
4341      res.setVersionElement(parseString(json.get("version").getAsString()));
4342    if (json.has("_version"))
4343      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4344    if (json.has("name"))
4345      res.setNameElement(parseString(json.get("name").getAsString()));
4346    if (json.has("_name"))
4347      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4348    if (json.has("status"))
4349      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
4350    if (json.has("_status"))
4351      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4352    if (json.has("experimental"))
4353      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4354    if (json.has("_experimental"))
4355      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4356    if (json.has("publisher"))
4357      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4358    if (json.has("_publisher"))
4359      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4360    if (json.has("contact")) {
4361      JsonArray array = json.getAsJsonArray("contact");
4362      for (int i = 0; i < array.size(); i++) {
4363        res.getContact().add(parseDataElementDataElementContactComponent(array.get(i).getAsJsonObject(), res));
4364      }
4365    };
4366    if (json.has("date"))
4367      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4368    if (json.has("_date"))
4369      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4370    if (json.has("useContext")) {
4371      JsonArray array = json.getAsJsonArray("useContext");
4372      for (int i = 0; i < array.size(); i++) {
4373        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4374      }
4375    };
4376    if (json.has("copyright"))
4377      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
4378    if (json.has("_copyright"))
4379      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4380    if (json.has("stringency"))
4381      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
4382    if (json.has("_stringency"))
4383      parseElementProperties(json.getAsJsonObject("_stringency"), res.getStringencyElement());
4384    if (json.has("mapping")) {
4385      JsonArray array = json.getAsJsonArray("mapping");
4386      for (int i = 0; i < array.size(); i++) {
4387        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
4388      }
4389    };
4390    if (json.has("element")) {
4391      JsonArray array = json.getAsJsonArray("element");
4392      for (int i = 0; i < array.size(); i++) {
4393        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
4394      }
4395    };
4396    return res;
4397  }
4398
4399  protected DataElement.DataElementContactComponent parseDataElementDataElementContactComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
4400    DataElement.DataElementContactComponent res = new DataElement.DataElementContactComponent();
4401    parseBackboneProperties(json, res);
4402    if (json.has("name"))
4403      res.setNameElement(parseString(json.get("name").getAsString()));
4404    if (json.has("_name"))
4405      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4406    if (json.has("telecom")) {
4407      JsonArray array = json.getAsJsonArray("telecom");
4408      for (int i = 0; i < array.size(); i++) {
4409        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4410      }
4411    };
4412    return res;
4413  }
4414
4415  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
4416    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
4417    parseBackboneProperties(json, res);
4418    if (json.has("identity"))
4419      res.setIdentityElement(parseId(json.get("identity").getAsString()));
4420    if (json.has("_identity"))
4421      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
4422    if (json.has("uri"))
4423      res.setUriElement(parseUri(json.get("uri").getAsString()));
4424    if (json.has("_uri"))
4425      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
4426    if (json.has("name"))
4427      res.setNameElement(parseString(json.get("name").getAsString()));
4428    if (json.has("_name"))
4429      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4430    if (json.has("comments"))
4431      res.setCommentsElement(parseString(json.get("comments").getAsString()));
4432    if (json.has("_comments"))
4433      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
4434    return res;
4435  }
4436
4437  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
4438    DetectedIssue res = new DetectedIssue();
4439    parseDomainResourceProperties(json, res);
4440    if (json.has("patient"))
4441      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4442    if (json.has("category"))
4443      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4444    if (json.has("severity"))
4445      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
4446    if (json.has("_severity"))
4447      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
4448    if (json.has("implicated")) {
4449      JsonArray array = json.getAsJsonArray("implicated");
4450      for (int i = 0; i < array.size(); i++) {
4451        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
4452      }
4453    };
4454    if (json.has("detail"))
4455      res.setDetailElement(parseString(json.get("detail").getAsString()));
4456    if (json.has("_detail"))
4457      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
4458    if (json.has("date"))
4459      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4460    if (json.has("_date"))
4461      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4462    if (json.has("author"))
4463      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4464    if (json.has("identifier"))
4465      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4466    if (json.has("reference"))
4467      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
4468    if (json.has("_reference"))
4469      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
4470    if (json.has("mitigation")) {
4471      JsonArray array = json.getAsJsonArray("mitigation");
4472      for (int i = 0; i < array.size(); i++) {
4473        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
4474      }
4475    };
4476    return res;
4477  }
4478
4479  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
4480    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
4481    parseBackboneProperties(json, res);
4482    if (json.has("action"))
4483      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
4484    if (json.has("date"))
4485      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4486    if (json.has("_date"))
4487      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4488    if (json.has("author"))
4489      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4490    return res;
4491  }
4492
4493  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
4494    Device res = new Device();
4495    parseDomainResourceProperties(json, res);
4496    if (json.has("identifier")) {
4497      JsonArray array = json.getAsJsonArray("identifier");
4498      for (int i = 0; i < array.size(); i++) {
4499        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4500      }
4501    };
4502    if (json.has("type"))
4503      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4504    if (json.has("note")) {
4505      JsonArray array = json.getAsJsonArray("note");
4506      for (int i = 0; i < array.size(); i++) {
4507        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4508      }
4509    };
4510    if (json.has("status"))
4511      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.DeviceStatus.NULL, new Device.DeviceStatusEnumFactory()));
4512    if (json.has("_status"))
4513      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4514    if (json.has("manufacturer"))
4515      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
4516    if (json.has("_manufacturer"))
4517      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
4518    if (json.has("model"))
4519      res.setModelElement(parseString(json.get("model").getAsString()));
4520    if (json.has("_model"))
4521      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
4522    if (json.has("version"))
4523      res.setVersionElement(parseString(json.get("version").getAsString()));
4524    if (json.has("_version"))
4525      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4526    if (json.has("manufactureDate"))
4527      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
4528    if (json.has("_manufactureDate"))
4529      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
4530    if (json.has("expiry"))
4531      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
4532    if (json.has("_expiry"))
4533      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
4534    if (json.has("udi"))
4535      res.setUdiElement(parseString(json.get("udi").getAsString()));
4536    if (json.has("_udi"))
4537      parseElementProperties(json.getAsJsonObject("_udi"), res.getUdiElement());
4538    if (json.has("lotNumber"))
4539      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
4540    if (json.has("_lotNumber"))
4541      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
4542    if (json.has("owner"))
4543      res.setOwner(parseReference(json.getAsJsonObject("owner")));
4544    if (json.has("location"))
4545      res.setLocation(parseReference(json.getAsJsonObject("location")));
4546    if (json.has("patient"))
4547      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4548    if (json.has("contact")) {
4549      JsonArray array = json.getAsJsonArray("contact");
4550      for (int i = 0; i < array.size(); i++) {
4551        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
4552      }
4553    };
4554    if (json.has("url"))
4555      res.setUrlElement(parseUri(json.get("url").getAsString()));
4556    if (json.has("_url"))
4557      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4558    return res;
4559  }
4560
4561  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
4562    DeviceComponent res = new DeviceComponent();
4563    parseDomainResourceProperties(json, res);
4564    if (json.has("type"))
4565      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4566    if (json.has("identifier"))
4567      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4568    if (json.has("lastSystemChange"))
4569      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
4570    if (json.has("_lastSystemChange"))
4571      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
4572    if (json.has("source"))
4573      res.setSource(parseReference(json.getAsJsonObject("source")));
4574    if (json.has("parent"))
4575      res.setParent(parseReference(json.getAsJsonObject("parent")));
4576    if (json.has("operationalStatus")) {
4577      JsonArray array = json.getAsJsonArray("operationalStatus");
4578      for (int i = 0; i < array.size(); i++) {
4579        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4580      }
4581    };
4582    if (json.has("parameterGroup"))
4583      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
4584    if (json.has("measurementPrinciple"))
4585      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
4586    if (json.has("_measurementPrinciple"))
4587      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
4588    if (json.has("productionSpecification")) {
4589      JsonArray array = json.getAsJsonArray("productionSpecification");
4590      for (int i = 0; i < array.size(); i++) {
4591        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
4592      }
4593    };
4594    if (json.has("languageCode"))
4595      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
4596    return res;
4597  }
4598
4599  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
4600    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
4601    parseBackboneProperties(json, res);
4602    if (json.has("specType"))
4603      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
4604    if (json.has("componentId"))
4605      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
4606    if (json.has("productionSpec"))
4607      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
4608    if (json.has("_productionSpec"))
4609      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
4610    return res;
4611  }
4612
4613  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
4614    DeviceMetric res = new DeviceMetric();
4615    parseDomainResourceProperties(json, res);
4616    if (json.has("type"))
4617      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4618    if (json.has("identifier"))
4619      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4620    if (json.has("unit"))
4621      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
4622    if (json.has("source"))
4623      res.setSource(parseReference(json.getAsJsonObject("source")));
4624    if (json.has("parent"))
4625      res.setParent(parseReference(json.getAsJsonObject("parent")));
4626    if (json.has("operationalStatus"))
4627      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
4628    if (json.has("_operationalStatus"))
4629      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
4630    if (json.has("color"))
4631      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
4632    if (json.has("_color"))
4633      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
4634    if (json.has("category"))
4635      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
4636    if (json.has("_category"))
4637      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
4638    if (json.has("measurementPeriod"))
4639      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
4640    if (json.has("calibration")) {
4641      JsonArray array = json.getAsJsonArray("calibration");
4642      for (int i = 0; i < array.size(); i++) {
4643        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
4644      }
4645    };
4646    return res;
4647  }
4648
4649  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
4650    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
4651    parseBackboneProperties(json, res);
4652    if (json.has("type"))
4653      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
4654    if (json.has("_type"))
4655      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4656    if (json.has("state"))
4657      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
4658    if (json.has("_state"))
4659      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
4660    if (json.has("time"))
4661      res.setTimeElement(parseInstant(json.get("time").getAsString()));
4662    if (json.has("_time"))
4663      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
4664    return res;
4665  }
4666
4667  protected DeviceUseRequest parseDeviceUseRequest(JsonObject json) throws IOException, FHIRFormatError {
4668    DeviceUseRequest res = new DeviceUseRequest();
4669    parseDomainResourceProperties(json, res);
4670    Type bodySite = parseType("bodySite", json);
4671    if (bodySite != null)
4672      res.setBodySite(bodySite);
4673    if (json.has("status"))
4674      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseRequest.DeviceUseRequestStatus.NULL, new DeviceUseRequest.DeviceUseRequestStatusEnumFactory()));
4675    if (json.has("_status"))
4676      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4677    if (json.has("device"))
4678      res.setDevice(parseReference(json.getAsJsonObject("device")));
4679    if (json.has("encounter"))
4680      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4681    if (json.has("identifier")) {
4682      JsonArray array = json.getAsJsonArray("identifier");
4683      for (int i = 0; i < array.size(); i++) {
4684        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4685      }
4686    };
4687    if (json.has("indication")) {
4688      JsonArray array = json.getAsJsonArray("indication");
4689      for (int i = 0; i < array.size(); i++) {
4690        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4691      }
4692    };
4693    if (json.has("notes")) {
4694      JsonArray array = json.getAsJsonArray("notes");
4695      for (int i = 0; i < array.size(); i++) {
4696        res.getNotes().add(parseString(array.get(i).getAsString()));
4697      }
4698    };
4699    if (json.has("_notes")) {
4700      JsonArray array = json.getAsJsonArray("_notes");
4701      for (int i = 0; i < array.size(); i++) {
4702        if (i == res.getNotes().size())
4703          res.getNotes().add(parseString(null));
4704        if (array.get(i) instanceof JsonObject) 
4705          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
4706      }
4707    };
4708    if (json.has("prnReason")) {
4709      JsonArray array = json.getAsJsonArray("prnReason");
4710      for (int i = 0; i < array.size(); i++) {
4711        res.getPrnReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4712      }
4713    };
4714    if (json.has("orderedOn"))
4715      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
4716    if (json.has("_orderedOn"))
4717      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
4718    if (json.has("recordedOn"))
4719      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
4720    if (json.has("_recordedOn"))
4721      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
4722    if (json.has("subject"))
4723      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4724    Type timing = parseType("timing", json);
4725    if (timing != null)
4726      res.setTiming(timing);
4727    if (json.has("priority"))
4728      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceUseRequest.DeviceUseRequestPriority.NULL, new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory()));
4729    if (json.has("_priority"))
4730      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
4731    return res;
4732  }
4733
4734  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
4735    DeviceUseStatement res = new DeviceUseStatement();
4736    parseDomainResourceProperties(json, res);
4737    Type bodySite = parseType("bodySite", json);
4738    if (bodySite != null)
4739      res.setBodySite(bodySite);
4740    if (json.has("whenUsed"))
4741      res.setWhenUsed(parsePeriod(json.getAsJsonObject("whenUsed")));
4742    if (json.has("device"))
4743      res.setDevice(parseReference(json.getAsJsonObject("device")));
4744    if (json.has("identifier")) {
4745      JsonArray array = json.getAsJsonArray("identifier");
4746      for (int i = 0; i < array.size(); i++) {
4747        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4748      }
4749    };
4750    if (json.has("indication")) {
4751      JsonArray array = json.getAsJsonArray("indication");
4752      for (int i = 0; i < array.size(); i++) {
4753        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4754      }
4755    };
4756    if (json.has("notes")) {
4757      JsonArray array = json.getAsJsonArray("notes");
4758      for (int i = 0; i < array.size(); i++) {
4759        res.getNotes().add(parseString(array.get(i).getAsString()));
4760      }
4761    };
4762    if (json.has("_notes")) {
4763      JsonArray array = json.getAsJsonArray("_notes");
4764      for (int i = 0; i < array.size(); i++) {
4765        if (i == res.getNotes().size())
4766          res.getNotes().add(parseString(null));
4767        if (array.get(i) instanceof JsonObject) 
4768          parseElementProperties(array.get(i).getAsJsonObject(), res.getNotes().get(i));
4769      }
4770    };
4771    if (json.has("recordedOn"))
4772      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
4773    if (json.has("_recordedOn"))
4774      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
4775    if (json.has("subject"))
4776      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4777    Type timing = parseType("timing", json);
4778    if (timing != null)
4779      res.setTiming(timing);
4780    return res;
4781  }
4782
4783  protected DiagnosticOrder parseDiagnosticOrder(JsonObject json) throws IOException, FHIRFormatError {
4784    DiagnosticOrder res = new DiagnosticOrder();
4785    parseDomainResourceProperties(json, res);
4786    if (json.has("subject"))
4787      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4788    if (json.has("orderer"))
4789      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
4790    if (json.has("identifier")) {
4791      JsonArray array = json.getAsJsonArray("identifier");
4792      for (int i = 0; i < array.size(); i++) {
4793        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4794      }
4795    };
4796    if (json.has("encounter"))
4797      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4798    if (json.has("reason")) {
4799      JsonArray array = json.getAsJsonArray("reason");
4800      for (int i = 0; i < array.size(); i++) {
4801        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4802      }
4803    };
4804    if (json.has("supportingInformation")) {
4805      JsonArray array = json.getAsJsonArray("supportingInformation");
4806      for (int i = 0; i < array.size(); i++) {
4807        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4808      }
4809    };
4810    if (json.has("specimen")) {
4811      JsonArray array = json.getAsJsonArray("specimen");
4812      for (int i = 0; i < array.size(); i++) {
4813        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4814      }
4815    };
4816    if (json.has("status"))
4817      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4818    if (json.has("_status"))
4819      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4820    if (json.has("priority"))
4821      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DiagnosticOrder.DiagnosticOrderPriority.NULL, new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory()));
4822    if (json.has("_priority"))
4823      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
4824    if (json.has("event")) {
4825      JsonArray array = json.getAsJsonArray("event");
4826      for (int i = 0; i < array.size(); i++) {
4827        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), res));
4828      }
4829    };
4830    if (json.has("item")) {
4831      JsonArray array = json.getAsJsonArray("item");
4832      for (int i = 0; i < array.size(); i++) {
4833        res.getItem().add(parseDiagnosticOrderDiagnosticOrderItemComponent(array.get(i).getAsJsonObject(), res));
4834      }
4835    };
4836    if (json.has("note")) {
4837      JsonArray array = json.getAsJsonArray("note");
4838      for (int i = 0; i < array.size(); i++) {
4839        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4840      }
4841    };
4842    return res;
4843  }
4844
4845  protected DiagnosticOrder.DiagnosticOrderEventComponent parseDiagnosticOrderDiagnosticOrderEventComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
4846    DiagnosticOrder.DiagnosticOrderEventComponent res = new DiagnosticOrder.DiagnosticOrderEventComponent();
4847    parseBackboneProperties(json, res);
4848    if (json.has("status"))
4849      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4850    if (json.has("_status"))
4851      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4852    if (json.has("description"))
4853      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
4854    if (json.has("dateTime"))
4855      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
4856    if (json.has("_dateTime"))
4857      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
4858    if (json.has("actor"))
4859      res.setActor(parseReference(json.getAsJsonObject("actor")));
4860    return res;
4861  }
4862
4863  protected DiagnosticOrder.DiagnosticOrderItemComponent parseDiagnosticOrderDiagnosticOrderItemComponent(JsonObject json, DiagnosticOrder owner) throws IOException, FHIRFormatError {
4864    DiagnosticOrder.DiagnosticOrderItemComponent res = new DiagnosticOrder.DiagnosticOrderItemComponent();
4865    parseBackboneProperties(json, res);
4866    if (json.has("code"))
4867      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4868    if (json.has("specimen")) {
4869      JsonArray array = json.getAsJsonArray("specimen");
4870      for (int i = 0; i < array.size(); i++) {
4871        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4872      }
4873    };
4874    if (json.has("bodySite"))
4875      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
4876    if (json.has("status"))
4877      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticOrder.DiagnosticOrderStatus.NULL, new DiagnosticOrder.DiagnosticOrderStatusEnumFactory()));
4878    if (json.has("_status"))
4879      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4880    if (json.has("event")) {
4881      JsonArray array = json.getAsJsonArray("event");
4882      for (int i = 0; i < array.size(); i++) {
4883        res.getEvent().add(parseDiagnosticOrderDiagnosticOrderEventComponent(array.get(i).getAsJsonObject(), owner));
4884      }
4885    };
4886    return res;
4887  }
4888
4889  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
4890    DiagnosticReport res = new DiagnosticReport();
4891    parseDomainResourceProperties(json, res);
4892    if (json.has("identifier")) {
4893      JsonArray array = json.getAsJsonArray("identifier");
4894      for (int i = 0; i < array.size(); i++) {
4895        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4896      }
4897    };
4898    if (json.has("status"))
4899      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
4900    if (json.has("_status"))
4901      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4902    if (json.has("category"))
4903      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4904    if (json.has("code"))
4905      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4906    if (json.has("subject"))
4907      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4908    if (json.has("encounter"))
4909      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4910    Type effective = parseType("effective", json);
4911    if (effective != null)
4912      res.setEffective(effective);
4913    if (json.has("issued"))
4914      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
4915    if (json.has("_issued"))
4916      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
4917    if (json.has("performer"))
4918      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
4919    if (json.has("request")) {
4920      JsonArray array = json.getAsJsonArray("request");
4921      for (int i = 0; i < array.size(); i++) {
4922        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
4923      }
4924    };
4925    if (json.has("specimen")) {
4926      JsonArray array = json.getAsJsonArray("specimen");
4927      for (int i = 0; i < array.size(); i++) {
4928        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
4929      }
4930    };
4931    if (json.has("result")) {
4932      JsonArray array = json.getAsJsonArray("result");
4933      for (int i = 0; i < array.size(); i++) {
4934        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
4935      }
4936    };
4937    if (json.has("imagingStudy")) {
4938      JsonArray array = json.getAsJsonArray("imagingStudy");
4939      for (int i = 0; i < array.size(); i++) {
4940        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
4941      }
4942    };
4943    if (json.has("image")) {
4944      JsonArray array = json.getAsJsonArray("image");
4945      for (int i = 0; i < array.size(); i++) {
4946        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
4947      }
4948    };
4949    if (json.has("conclusion"))
4950      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
4951    if (json.has("_conclusion"))
4952      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
4953    if (json.has("codedDiagnosis")) {
4954      JsonArray array = json.getAsJsonArray("codedDiagnosis");
4955      for (int i = 0; i < array.size(); i++) {
4956        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4957      }
4958    };
4959    if (json.has("presentedForm")) {
4960      JsonArray array = json.getAsJsonArray("presentedForm");
4961      for (int i = 0; i < array.size(); i++) {
4962        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
4963      }
4964    };
4965    return res;
4966  }
4967
4968  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
4969    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
4970    parseBackboneProperties(json, res);
4971    if (json.has("comment"))
4972      res.setCommentElement(parseString(json.get("comment").getAsString()));
4973    if (json.has("_comment"))
4974      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
4975    if (json.has("link"))
4976      res.setLink(parseReference(json.getAsJsonObject("link")));
4977    return res;
4978  }
4979
4980  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
4981    DocumentManifest res = new DocumentManifest();
4982    parseDomainResourceProperties(json, res);
4983    if (json.has("masterIdentifier"))
4984      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
4985    if (json.has("identifier")) {
4986      JsonArray array = json.getAsJsonArray("identifier");
4987      for (int i = 0; i < array.size(); i++) {
4988        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4989      }
4990    };
4991    if (json.has("subject"))
4992      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4993    if (json.has("recipient")) {
4994      JsonArray array = json.getAsJsonArray("recipient");
4995      for (int i = 0; i < array.size(); i++) {
4996        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
4997      }
4998    };
4999    if (json.has("type"))
5000      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5001    if (json.has("author")) {
5002      JsonArray array = json.getAsJsonArray("author");
5003      for (int i = 0; i < array.size(); i++) {
5004        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5005      }
5006    };
5007    if (json.has("created"))
5008      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5009    if (json.has("_created"))
5010      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5011    if (json.has("source"))
5012      res.setSourceElement(parseUri(json.get("source").getAsString()));
5013    if (json.has("_source"))
5014      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
5015    if (json.has("status"))
5016      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
5017    if (json.has("_status"))
5018      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5019    if (json.has("description"))
5020      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5021    if (json.has("_description"))
5022      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5023    if (json.has("content")) {
5024      JsonArray array = json.getAsJsonArray("content");
5025      for (int i = 0; i < array.size(); i++) {
5026        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
5027      }
5028    };
5029    if (json.has("related")) {
5030      JsonArray array = json.getAsJsonArray("related");
5031      for (int i = 0; i < array.size(); i++) {
5032        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
5033      }
5034    };
5035    return res;
5036  }
5037
5038  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
5039    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
5040    parseBackboneProperties(json, res);
5041    Type p = parseType("p", json);
5042    if (p != null)
5043      res.setP(p);
5044    return res;
5045  }
5046
5047  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
5048    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
5049    parseBackboneProperties(json, res);
5050    if (json.has("identifier"))
5051      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5052    if (json.has("ref"))
5053      res.setRef(parseReference(json.getAsJsonObject("ref")));
5054    return res;
5055  }
5056
5057  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
5058    DocumentReference res = new DocumentReference();
5059    parseDomainResourceProperties(json, res);
5060    if (json.has("masterIdentifier"))
5061      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
5062    if (json.has("identifier")) {
5063      JsonArray array = json.getAsJsonArray("identifier");
5064      for (int i = 0; i < array.size(); i++) {
5065        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5066      }
5067    };
5068    if (json.has("subject"))
5069      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5070    if (json.has("type"))
5071      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5072    if (json.has("class"))
5073      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
5074    if (json.has("author")) {
5075      JsonArray array = json.getAsJsonArray("author");
5076      for (int i = 0; i < array.size(); i++) {
5077        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5078      }
5079    };
5080    if (json.has("custodian"))
5081      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
5082    if (json.has("authenticator"))
5083      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
5084    if (json.has("created"))
5085      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5086    if (json.has("_created"))
5087      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5088    if (json.has("indexed"))
5089      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
5090    if (json.has("_indexed"))
5091      parseElementProperties(json.getAsJsonObject("_indexed"), res.getIndexedElement());
5092    if (json.has("status"))
5093      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
5094    if (json.has("_status"))
5095      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5096    if (json.has("docStatus"))
5097      res.setDocStatus(parseCodeableConcept(json.getAsJsonObject("docStatus")));
5098    if (json.has("relatesTo")) {
5099      JsonArray array = json.getAsJsonArray("relatesTo");
5100      for (int i = 0; i < array.size(); i++) {
5101        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
5102      }
5103    };
5104    if (json.has("description"))
5105      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5106    if (json.has("_description"))
5107      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5108    if (json.has("securityLabel")) {
5109      JsonArray array = json.getAsJsonArray("securityLabel");
5110      for (int i = 0; i < array.size(); i++) {
5111        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5112      }
5113    };
5114    if (json.has("content")) {
5115      JsonArray array = json.getAsJsonArray("content");
5116      for (int i = 0; i < array.size(); i++) {
5117        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
5118      }
5119    };
5120    if (json.has("context"))
5121      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
5122    return res;
5123  }
5124
5125  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5126    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
5127    parseBackboneProperties(json, res);
5128    if (json.has("code"))
5129      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
5130    if (json.has("_code"))
5131      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5132    if (json.has("target"))
5133      res.setTarget(parseReference(json.getAsJsonObject("target")));
5134    return res;
5135  }
5136
5137  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5138    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
5139    parseBackboneProperties(json, res);
5140    if (json.has("attachment"))
5141      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
5142    if (json.has("format")) {
5143      JsonArray array = json.getAsJsonArray("format");
5144      for (int i = 0; i < array.size(); i++) {
5145        res.getFormat().add(parseCoding(array.get(i).getAsJsonObject()));
5146      }
5147    };
5148    return res;
5149  }
5150
5151  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5152    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
5153    parseBackboneProperties(json, res);
5154    if (json.has("encounter"))
5155      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5156    if (json.has("event")) {
5157      JsonArray array = json.getAsJsonArray("event");
5158      for (int i = 0; i < array.size(); i++) {
5159        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5160      }
5161    };
5162    if (json.has("period"))
5163      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5164    if (json.has("facilityType"))
5165      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
5166    if (json.has("practiceSetting"))
5167      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
5168    if (json.has("sourcePatientInfo"))
5169      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
5170    if (json.has("related")) {
5171      JsonArray array = json.getAsJsonArray("related");
5172      for (int i = 0; i < array.size(); i++) {
5173        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
5174      }
5175    };
5176    return res;
5177  }
5178
5179  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
5180    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
5181    parseBackboneProperties(json, res);
5182    if (json.has("identifier"))
5183      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5184    if (json.has("ref"))
5185      res.setRef(parseReference(json.getAsJsonObject("ref")));
5186    return res;
5187  }
5188
5189  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
5190    EligibilityRequest res = new EligibilityRequest();
5191    parseDomainResourceProperties(json, res);
5192    if (json.has("identifier")) {
5193      JsonArray array = json.getAsJsonArray("identifier");
5194      for (int i = 0; i < array.size(); i++) {
5195        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5196      }
5197    };
5198    if (json.has("ruleset"))
5199      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5200    if (json.has("originalRuleset"))
5201      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5202    if (json.has("created"))
5203      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5204    if (json.has("_created"))
5205      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5206    if (json.has("target"))
5207      res.setTarget(parseReference(json.getAsJsonObject("target")));
5208    if (json.has("provider"))
5209      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5210    if (json.has("organization"))
5211      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5212    return res;
5213  }
5214
5215  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
5216    EligibilityResponse res = new EligibilityResponse();
5217    parseDomainResourceProperties(json, res);
5218    if (json.has("identifier")) {
5219      JsonArray array = json.getAsJsonArray("identifier");
5220      for (int i = 0; i < array.size(); i++) {
5221        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5222      }
5223    };
5224    if (json.has("request"))
5225      res.setRequest(parseReference(json.getAsJsonObject("request")));
5226    if (json.has("outcome"))
5227      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5228    if (json.has("_outcome"))
5229      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5230    if (json.has("disposition"))
5231      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5232    if (json.has("_disposition"))
5233      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5234    if (json.has("ruleset"))
5235      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5236    if (json.has("originalRuleset"))
5237      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5238    if (json.has("created"))
5239      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5240    if (json.has("_created"))
5241      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5242    if (json.has("organization"))
5243      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5244    if (json.has("requestProvider"))
5245      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5246    if (json.has("requestOrganization"))
5247      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5248    return res;
5249  }
5250
5251  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
5252    Encounter res = new Encounter();
5253    parseDomainResourceProperties(json, res);
5254    if (json.has("identifier")) {
5255      JsonArray array = json.getAsJsonArray("identifier");
5256      for (int i = 0; i < array.size(); i++) {
5257        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5258      }
5259    };
5260    if (json.has("status"))
5261      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
5262    if (json.has("_status"))
5263      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5264    if (json.has("statusHistory")) {
5265      JsonArray array = json.getAsJsonArray("statusHistory");
5266      for (int i = 0; i < array.size(); i++) {
5267        res.getStatusHistory().add(parseEncounterEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
5268      }
5269    };
5270    if (json.has("class"))
5271      res.setClass_Element(parseEnumeration(json.get("class").getAsString(), Encounter.EncounterClass.NULL, new Encounter.EncounterClassEnumFactory()));
5272    if (json.has("_class"))
5273      parseElementProperties(json.getAsJsonObject("_class"), res.getClass_Element());
5274    if (json.has("type")) {
5275      JsonArray array = json.getAsJsonArray("type");
5276      for (int i = 0; i < array.size(); i++) {
5277        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5278      }
5279    };
5280    if (json.has("priority"))
5281      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5282    if (json.has("patient"))
5283      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5284    if (json.has("episodeOfCare")) {
5285      JsonArray array = json.getAsJsonArray("episodeOfCare");
5286      for (int i = 0; i < array.size(); i++) {
5287        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
5288      }
5289    };
5290    if (json.has("incomingReferral")) {
5291      JsonArray array = json.getAsJsonArray("incomingReferral");
5292      for (int i = 0; i < array.size(); i++) {
5293        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
5294      }
5295    };
5296    if (json.has("participant")) {
5297      JsonArray array = json.getAsJsonArray("participant");
5298      for (int i = 0; i < array.size(); i++) {
5299        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
5300      }
5301    };
5302    if (json.has("appointment"))
5303      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
5304    if (json.has("period"))
5305      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5306    if (json.has("length"))
5307      res.setLength(parseDuration(json.getAsJsonObject("length")));
5308    if (json.has("reason")) {
5309      JsonArray array = json.getAsJsonArray("reason");
5310      for (int i = 0; i < array.size(); i++) {
5311        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5312      }
5313    };
5314    if (json.has("indication")) {
5315      JsonArray array = json.getAsJsonArray("indication");
5316      for (int i = 0; i < array.size(); i++) {
5317        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
5318      }
5319    };
5320    if (json.has("hospitalization"))
5321      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
5322    if (json.has("location")) {
5323      JsonArray array = json.getAsJsonArray("location");
5324      for (int i = 0; i < array.size(); i++) {
5325        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
5326      }
5327    };
5328    if (json.has("serviceProvider"))
5329      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
5330    if (json.has("partOf"))
5331      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
5332    return res;
5333  }
5334
5335  protected Encounter.EncounterStatusHistoryComponent parseEncounterEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5336    Encounter.EncounterStatusHistoryComponent res = new Encounter.EncounterStatusHistoryComponent();
5337    parseBackboneProperties(json, res);
5338    if (json.has("status"))
5339      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterState.NULL, new Encounter.EncounterStateEnumFactory()));
5340    if (json.has("_status"))
5341      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5342    if (json.has("period"))
5343      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5344    return res;
5345  }
5346
5347  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5348    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
5349    parseBackboneProperties(json, res);
5350    if (json.has("type")) {
5351      JsonArray array = json.getAsJsonArray("type");
5352      for (int i = 0; i < array.size(); i++) {
5353        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5354      }
5355    };
5356    if (json.has("period"))
5357      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5358    if (json.has("individual"))
5359      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
5360    return res;
5361  }
5362
5363  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5364    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
5365    parseBackboneProperties(json, res);
5366    if (json.has("preAdmissionIdentifier"))
5367      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
5368    if (json.has("origin"))
5369      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
5370    if (json.has("admitSource"))
5371      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
5372    if (json.has("admittingDiagnosis")) {
5373      JsonArray array = json.getAsJsonArray("admittingDiagnosis");
5374      for (int i = 0; i < array.size(); i++) {
5375        res.getAdmittingDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
5376      }
5377    };
5378    if (json.has("reAdmission"))
5379      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
5380    if (json.has("dietPreference")) {
5381      JsonArray array = json.getAsJsonArray("dietPreference");
5382      for (int i = 0; i < array.size(); i++) {
5383        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5384      }
5385    };
5386    if (json.has("specialCourtesy")) {
5387      JsonArray array = json.getAsJsonArray("specialCourtesy");
5388      for (int i = 0; i < array.size(); i++) {
5389        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5390      }
5391    };
5392    if (json.has("specialArrangement")) {
5393      JsonArray array = json.getAsJsonArray("specialArrangement");
5394      for (int i = 0; i < array.size(); i++) {
5395        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5396      }
5397    };
5398    if (json.has("destination"))
5399      res.setDestination(parseReference(json.getAsJsonObject("destination")));
5400    if (json.has("dischargeDisposition"))
5401      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
5402    if (json.has("dischargeDiagnosis")) {
5403      JsonArray array = json.getAsJsonArray("dischargeDiagnosis");
5404      for (int i = 0; i < array.size(); i++) {
5405        res.getDischargeDiagnosis().add(parseReference(array.get(i).getAsJsonObject()));
5406      }
5407    };
5408    return res;
5409  }
5410
5411  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
5412    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
5413    parseBackboneProperties(json, res);
5414    if (json.has("location"))
5415      res.setLocation(parseReference(json.getAsJsonObject("location")));
5416    if (json.has("status"))
5417      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
5418    if (json.has("_status"))
5419      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5420    if (json.has("period"))
5421      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5422    return res;
5423  }
5424
5425  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
5426    EnrollmentRequest res = new EnrollmentRequest();
5427    parseDomainResourceProperties(json, res);
5428    if (json.has("identifier")) {
5429      JsonArray array = json.getAsJsonArray("identifier");
5430      for (int i = 0; i < array.size(); i++) {
5431        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5432      }
5433    };
5434    if (json.has("ruleset"))
5435      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5436    if (json.has("originalRuleset"))
5437      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5438    if (json.has("created"))
5439      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5440    if (json.has("_created"))
5441      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5442    if (json.has("target"))
5443      res.setTarget(parseReference(json.getAsJsonObject("target")));
5444    if (json.has("provider"))
5445      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5446    if (json.has("organization"))
5447      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5448    if (json.has("subject"))
5449      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5450    if (json.has("coverage"))
5451      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5452    if (json.has("relationship"))
5453      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
5454    return res;
5455  }
5456
5457  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
5458    EnrollmentResponse res = new EnrollmentResponse();
5459    parseDomainResourceProperties(json, res);
5460    if (json.has("identifier")) {
5461      JsonArray array = json.getAsJsonArray("identifier");
5462      for (int i = 0; i < array.size(); i++) {
5463        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5464      }
5465    };
5466    if (json.has("request"))
5467      res.setRequest(parseReference(json.getAsJsonObject("request")));
5468    if (json.has("outcome"))
5469      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5470    if (json.has("_outcome"))
5471      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5472    if (json.has("disposition"))
5473      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5474    if (json.has("_disposition"))
5475      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5476    if (json.has("ruleset"))
5477      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5478    if (json.has("originalRuleset"))
5479      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5480    if (json.has("created"))
5481      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5482    if (json.has("_created"))
5483      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5484    if (json.has("organization"))
5485      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5486    if (json.has("requestProvider"))
5487      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5488    if (json.has("requestOrganization"))
5489      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5490    return res;
5491  }
5492
5493  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
5494    EpisodeOfCare res = new EpisodeOfCare();
5495    parseDomainResourceProperties(json, res);
5496    if (json.has("identifier")) {
5497      JsonArray array = json.getAsJsonArray("identifier");
5498      for (int i = 0; i < array.size(); i++) {
5499        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5500      }
5501    };
5502    if (json.has("status"))
5503      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
5504    if (json.has("_status"))
5505      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5506    if (json.has("statusHistory")) {
5507      JsonArray array = json.getAsJsonArray("statusHistory");
5508      for (int i = 0; i < array.size(); i++) {
5509        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
5510      }
5511    };
5512    if (json.has("type")) {
5513      JsonArray array = json.getAsJsonArray("type");
5514      for (int i = 0; i < array.size(); i++) {
5515        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5516      }
5517    };
5518    if (json.has("condition")) {
5519      JsonArray array = json.getAsJsonArray("condition");
5520      for (int i = 0; i < array.size(); i++) {
5521        res.getCondition().add(parseReference(array.get(i).getAsJsonObject()));
5522      }
5523    };
5524    if (json.has("patient"))
5525      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5526    if (json.has("managingOrganization"))
5527      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
5528    if (json.has("period"))
5529      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5530    if (json.has("referralRequest")) {
5531      JsonArray array = json.getAsJsonArray("referralRequest");
5532      for (int i = 0; i < array.size(); i++) {
5533        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
5534      }
5535    };
5536    if (json.has("careManager"))
5537      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
5538    if (json.has("careTeam")) {
5539      JsonArray array = json.getAsJsonArray("careTeam");
5540      for (int i = 0; i < array.size(); i++) {
5541        res.getCareTeam().add(parseEpisodeOfCareEpisodeOfCareCareTeamComponent(array.get(i).getAsJsonObject(), res));
5542      }
5543    };
5544    return res;
5545  }
5546
5547  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
5548    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
5549    parseBackboneProperties(json, res);
5550    if (json.has("status"))
5551      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
5552    if (json.has("_status"))
5553      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5554    if (json.has("period"))
5555      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5556    return res;
5557  }
5558
5559  protected EpisodeOfCare.EpisodeOfCareCareTeamComponent parseEpisodeOfCareEpisodeOfCareCareTeamComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
5560    EpisodeOfCare.EpisodeOfCareCareTeamComponent res = new EpisodeOfCare.EpisodeOfCareCareTeamComponent();
5561    parseBackboneProperties(json, res);
5562    if (json.has("role")) {
5563      JsonArray array = json.getAsJsonArray("role");
5564      for (int i = 0; i < array.size(); i++) {
5565        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5566      }
5567    };
5568    if (json.has("period"))
5569      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5570    if (json.has("member"))
5571      res.setMember(parseReference(json.getAsJsonObject("member")));
5572    return res;
5573  }
5574
5575  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
5576    ExplanationOfBenefit res = new ExplanationOfBenefit();
5577    parseDomainResourceProperties(json, res);
5578    if (json.has("identifier")) {
5579      JsonArray array = json.getAsJsonArray("identifier");
5580      for (int i = 0; i < array.size(); i++) {
5581        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5582      }
5583    };
5584    if (json.has("request"))
5585      res.setRequest(parseReference(json.getAsJsonObject("request")));
5586    if (json.has("outcome"))
5587      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
5588    if (json.has("_outcome"))
5589      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5590    if (json.has("disposition"))
5591      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5592    if (json.has("_disposition"))
5593      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5594    if (json.has("ruleset"))
5595      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
5596    if (json.has("originalRuleset"))
5597      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
5598    if (json.has("created"))
5599      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5600    if (json.has("_created"))
5601      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5602    if (json.has("organization"))
5603      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
5604    if (json.has("requestProvider"))
5605      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5606    if (json.has("requestOrganization"))
5607      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
5608    return res;
5609  }
5610
5611  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
5612    FamilyMemberHistory res = new FamilyMemberHistory();
5613    parseDomainResourceProperties(json, res);
5614    if (json.has("identifier")) {
5615      JsonArray array = json.getAsJsonArray("identifier");
5616      for (int i = 0; i < array.size(); i++) {
5617        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5618      }
5619    };
5620    if (json.has("patient"))
5621      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5622    if (json.has("date"))
5623      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5624    if (json.has("_date"))
5625      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5626    if (json.has("status"))
5627      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
5628    if (json.has("_status"))
5629      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5630    if (json.has("name"))
5631      res.setNameElement(parseString(json.get("name").getAsString()));
5632    if (json.has("_name"))
5633      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5634    if (json.has("relationship"))
5635      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
5636    if (json.has("gender"))
5637      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
5638    if (json.has("_gender"))
5639      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
5640    Type born = parseType("born", json);
5641    if (born != null)
5642      res.setBorn(born);
5643    Type age = parseType("age", json);
5644    if (age != null)
5645      res.setAge(age);
5646    Type deceased = parseType("deceased", json);
5647    if (deceased != null)
5648      res.setDeceased(deceased);
5649    if (json.has("note"))
5650      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
5651    if (json.has("condition")) {
5652      JsonArray array = json.getAsJsonArray("condition");
5653      for (int i = 0; i < array.size(); i++) {
5654        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
5655      }
5656    };
5657    return res;
5658  }
5659
5660  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
5661    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
5662    parseBackboneProperties(json, res);
5663    if (json.has("code"))
5664      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5665    if (json.has("outcome"))
5666      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
5667    Type onset = parseType("onset", json);
5668    if (onset != null)
5669      res.setOnset(onset);
5670    if (json.has("note"))
5671      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
5672    return res;
5673  }
5674
5675  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
5676    Flag res = new Flag();
5677    parseDomainResourceProperties(json, res);
5678    if (json.has("identifier")) {
5679      JsonArray array = json.getAsJsonArray("identifier");
5680      for (int i = 0; i < array.size(); i++) {
5681        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5682      }
5683    };
5684    if (json.has("category"))
5685      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5686    if (json.has("status"))
5687      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
5688    if (json.has("_status"))
5689      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5690    if (json.has("period"))
5691      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5692    if (json.has("subject"))
5693      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5694    if (json.has("encounter"))
5695      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5696    if (json.has("author"))
5697      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5698    if (json.has("code"))
5699      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5700    return res;
5701  }
5702
5703  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
5704    Goal res = new Goal();
5705    parseDomainResourceProperties(json, res);
5706    if (json.has("identifier")) {
5707      JsonArray array = json.getAsJsonArray("identifier");
5708      for (int i = 0; i < array.size(); i++) {
5709        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5710      }
5711    };
5712    if (json.has("subject"))
5713      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5714    Type start = parseType("start", json);
5715    if (start != null)
5716      res.setStart(start);
5717    Type target = parseType("target", json);
5718    if (target != null)
5719      res.setTarget(target);
5720    if (json.has("category")) {
5721      JsonArray array = json.getAsJsonArray("category");
5722      for (int i = 0; i < array.size(); i++) {
5723        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5724      }
5725    };
5726    if (json.has("description"))
5727      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5728    if (json.has("_description"))
5729      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5730    if (json.has("status"))
5731      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
5732    if (json.has("_status"))
5733      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5734    if (json.has("statusDate"))
5735      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
5736    if (json.has("_statusDate"))
5737      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
5738    if (json.has("statusReason"))
5739      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5740    if (json.has("author"))
5741      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5742    if (json.has("priority"))
5743      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5744    if (json.has("addresses")) {
5745      JsonArray array = json.getAsJsonArray("addresses");
5746      for (int i = 0; i < array.size(); i++) {
5747        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
5748      }
5749    };
5750    if (json.has("note")) {
5751      JsonArray array = json.getAsJsonArray("note");
5752      for (int i = 0; i < array.size(); i++) {
5753        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5754      }
5755    };
5756    if (json.has("outcome")) {
5757      JsonArray array = json.getAsJsonArray("outcome");
5758      for (int i = 0; i < array.size(); i++) {
5759        res.getOutcome().add(parseGoalGoalOutcomeComponent(array.get(i).getAsJsonObject(), res));
5760      }
5761    };
5762    return res;
5763  }
5764
5765  protected Goal.GoalOutcomeComponent parseGoalGoalOutcomeComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
5766    Goal.GoalOutcomeComponent res = new Goal.GoalOutcomeComponent();
5767    parseBackboneProperties(json, res);
5768    Type result = parseType("result", json);
5769    if (result != null)
5770      res.setResult(result);
5771    return res;
5772  }
5773
5774  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
5775    Group res = new Group();
5776    parseDomainResourceProperties(json, res);
5777    if (json.has("identifier")) {
5778      JsonArray array = json.getAsJsonArray("identifier");
5779      for (int i = 0; i < array.size(); i++) {
5780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5781      }
5782    };
5783    if (json.has("type"))
5784      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
5785    if (json.has("_type"))
5786      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5787    if (json.has("actual"))
5788      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5789    if (json.has("_actual"))
5790      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
5791    if (json.has("code"))
5792      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5793    if (json.has("name"))
5794      res.setNameElement(parseString(json.get("name").getAsString()));
5795    if (json.has("_name"))
5796      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5797    if (json.has("quantity"))
5798      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
5799    if (json.has("_quantity"))
5800      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
5801    if (json.has("characteristic")) {
5802      JsonArray array = json.getAsJsonArray("characteristic");
5803      for (int i = 0; i < array.size(); i++) {
5804        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
5805      }
5806    };
5807    if (json.has("member")) {
5808      JsonArray array = json.getAsJsonArray("member");
5809      for (int i = 0; i < array.size(); i++) {
5810        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
5811      }
5812    };
5813    return res;
5814  }
5815
5816  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
5817    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
5818    parseBackboneProperties(json, res);
5819    if (json.has("code"))
5820      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5821    Type value = parseType("value", json);
5822    if (value != null)
5823      res.setValue(value);
5824    if (json.has("exclude"))
5825      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
5826    if (json.has("_exclude"))
5827      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
5828    if (json.has("period"))
5829      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5830    return res;
5831  }
5832
5833  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
5834    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
5835    parseBackboneProperties(json, res);
5836    if (json.has("entity"))
5837      res.setEntity(parseReference(json.getAsJsonObject("entity")));
5838    if (json.has("period"))
5839      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5840    if (json.has("inactive"))
5841      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
5842    if (json.has("_inactive"))
5843      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
5844    return res;
5845  }
5846
5847  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
5848    HealthcareService res = new HealthcareService();
5849    parseDomainResourceProperties(json, res);
5850    if (json.has("identifier")) {
5851      JsonArray array = json.getAsJsonArray("identifier");
5852      for (int i = 0; i < array.size(); i++) {
5853        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5854      }
5855    };
5856    if (json.has("providedBy"))
5857      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
5858    if (json.has("serviceCategory"))
5859      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
5860    if (json.has("serviceType")) {
5861      JsonArray array = json.getAsJsonArray("serviceType");
5862      for (int i = 0; i < array.size(); i++) {
5863        res.getServiceType().add(parseHealthcareServiceServiceTypeComponent(array.get(i).getAsJsonObject(), res));
5864      }
5865    };
5866    if (json.has("location"))
5867      res.setLocation(parseReference(json.getAsJsonObject("location")));
5868    if (json.has("serviceName"))
5869      res.setServiceNameElement(parseString(json.get("serviceName").getAsString()));
5870    if (json.has("_serviceName"))
5871      parseElementProperties(json.getAsJsonObject("_serviceName"), res.getServiceNameElement());
5872    if (json.has("comment"))
5873      res.setCommentElement(parseString(json.get("comment").getAsString()));
5874    if (json.has("_comment"))
5875      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
5876    if (json.has("extraDetails"))
5877      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
5878    if (json.has("_extraDetails"))
5879      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
5880    if (json.has("photo"))
5881      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
5882    if (json.has("telecom")) {
5883      JsonArray array = json.getAsJsonArray("telecom");
5884      for (int i = 0; i < array.size(); i++) {
5885        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5886      }
5887    };
5888    if (json.has("coverageArea")) {
5889      JsonArray array = json.getAsJsonArray("coverageArea");
5890      for (int i = 0; i < array.size(); i++) {
5891        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
5892      }
5893    };
5894    if (json.has("serviceProvisionCode")) {
5895      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
5896      for (int i = 0; i < array.size(); i++) {
5897        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5898      }
5899    };
5900    if (json.has("eligibility"))
5901      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
5902    if (json.has("eligibilityNote"))
5903      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
5904    if (json.has("_eligibilityNote"))
5905      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
5906    if (json.has("programName")) {
5907      JsonArray array = json.getAsJsonArray("programName");
5908      for (int i = 0; i < array.size(); i++) {
5909        res.getProgramName().add(parseString(array.get(i).getAsString()));
5910      }
5911    };
5912    if (json.has("_programName")) {
5913      JsonArray array = json.getAsJsonArray("_programName");
5914      for (int i = 0; i < array.size(); i++) {
5915        if (i == res.getProgramName().size())
5916          res.getProgramName().add(parseString(null));
5917        if (array.get(i) instanceof JsonObject) 
5918          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
5919      }
5920    };
5921    if (json.has("characteristic")) {
5922      JsonArray array = json.getAsJsonArray("characteristic");
5923      for (int i = 0; i < array.size(); i++) {
5924        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5925      }
5926    };
5927    if (json.has("referralMethod")) {
5928      JsonArray array = json.getAsJsonArray("referralMethod");
5929      for (int i = 0; i < array.size(); i++) {
5930        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5931      }
5932    };
5933    if (json.has("publicKey"))
5934      res.setPublicKeyElement(parseString(json.get("publicKey").getAsString()));
5935    if (json.has("_publicKey"))
5936      parseElementProperties(json.getAsJsonObject("_publicKey"), res.getPublicKeyElement());
5937    if (json.has("appointmentRequired"))
5938      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
5939    if (json.has("_appointmentRequired"))
5940      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
5941    if (json.has("availableTime")) {
5942      JsonArray array = json.getAsJsonArray("availableTime");
5943      for (int i = 0; i < array.size(); i++) {
5944        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
5945      }
5946    };
5947    if (json.has("notAvailable")) {
5948      JsonArray array = json.getAsJsonArray("notAvailable");
5949      for (int i = 0; i < array.size(); i++) {
5950        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
5951      }
5952    };
5953    if (json.has("availabilityExceptions"))
5954      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
5955    if (json.has("_availabilityExceptions"))
5956      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
5957    return res;
5958  }
5959
5960  protected HealthcareService.ServiceTypeComponent parseHealthcareServiceServiceTypeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
5961    HealthcareService.ServiceTypeComponent res = new HealthcareService.ServiceTypeComponent();
5962    parseBackboneProperties(json, res);
5963    if (json.has("type"))
5964      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5965    if (json.has("specialty")) {
5966      JsonArray array = json.getAsJsonArray("specialty");
5967      for (int i = 0; i < array.size(); i++) {
5968        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5969      }
5970    };
5971    return res;
5972  }
5973
5974  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
5975    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
5976    parseBackboneProperties(json, res);
5977    if (json.has("daysOfWeek")) {
5978      JsonArray array = json.getAsJsonArray("daysOfWeek");
5979      for (int i = 0; i < array.size(); i++) {
5980        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
5981      }
5982    };
5983    if (json.has("_daysOfWeek")) {
5984      JsonArray array = json.getAsJsonArray("_daysOfWeek");
5985      for (int i = 0; i < array.size(); i++) {
5986        if (i == res.getDaysOfWeek().size())
5987          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
5988        if (array.get(i) instanceof JsonObject) 
5989          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
5990      }
5991    };
5992    if (json.has("allDay"))
5993      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
5994    if (json.has("_allDay"))
5995      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
5996    if (json.has("availableStartTime"))
5997      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
5998    if (json.has("_availableStartTime"))
5999      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
6000    if (json.has("availableEndTime"))
6001      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
6002    if (json.has("_availableEndTime"))
6003      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
6004    return res;
6005  }
6006
6007  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
6008    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
6009    parseBackboneProperties(json, res);
6010    if (json.has("description"))
6011      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6012    if (json.has("_description"))
6013      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6014    if (json.has("during"))
6015      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
6016    return res;
6017  }
6018
6019  protected ImagingObjectSelection parseImagingObjectSelection(JsonObject json) throws IOException, FHIRFormatError {
6020    ImagingObjectSelection res = new ImagingObjectSelection();
6021    parseDomainResourceProperties(json, res);
6022    if (json.has("uid"))
6023      res.setUidElement(parseOid(json.get("uid").getAsString()));
6024    if (json.has("_uid"))
6025      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6026    if (json.has("patient"))
6027      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6028    if (json.has("title"))
6029      res.setTitle(parseCodeableConcept(json.getAsJsonObject("title")));
6030    if (json.has("description"))
6031      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6032    if (json.has("_description"))
6033      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6034    if (json.has("author"))
6035      res.setAuthor(parseReference(json.getAsJsonObject("author")));
6036    if (json.has("authoringTime"))
6037      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
6038    if (json.has("_authoringTime"))
6039      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
6040    if (json.has("study")) {
6041      JsonArray array = json.getAsJsonArray("study");
6042      for (int i = 0; i < array.size(); i++) {
6043        res.getStudy().add(parseImagingObjectSelectionStudyComponent(array.get(i).getAsJsonObject(), res));
6044      }
6045    };
6046    return res;
6047  }
6048
6049  protected ImagingObjectSelection.StudyComponent parseImagingObjectSelectionStudyComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6050    ImagingObjectSelection.StudyComponent res = new ImagingObjectSelection.StudyComponent();
6051    parseBackboneProperties(json, res);
6052    if (json.has("uid"))
6053      res.setUidElement(parseOid(json.get("uid").getAsString()));
6054    if (json.has("_uid"))
6055      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6056    if (json.has("url"))
6057      res.setUrlElement(parseUri(json.get("url").getAsString()));
6058    if (json.has("_url"))
6059      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6060    if (json.has("imagingStudy"))
6061      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
6062    if (json.has("series")) {
6063      JsonArray array = json.getAsJsonArray("series");
6064      for (int i = 0; i < array.size(); i++) {
6065        res.getSeries().add(parseImagingObjectSelectionSeriesComponent(array.get(i).getAsJsonObject(), owner));
6066      }
6067    };
6068    return res;
6069  }
6070
6071  protected ImagingObjectSelection.SeriesComponent parseImagingObjectSelectionSeriesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6072    ImagingObjectSelection.SeriesComponent res = new ImagingObjectSelection.SeriesComponent();
6073    parseBackboneProperties(json, res);
6074    if (json.has("uid"))
6075      res.setUidElement(parseOid(json.get("uid").getAsString()));
6076    if (json.has("_uid"))
6077      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6078    if (json.has("url"))
6079      res.setUrlElement(parseUri(json.get("url").getAsString()));
6080    if (json.has("_url"))
6081      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6082    if (json.has("instance")) {
6083      JsonArray array = json.getAsJsonArray("instance");
6084      for (int i = 0; i < array.size(); i++) {
6085        res.getInstance().add(parseImagingObjectSelectionInstanceComponent(array.get(i).getAsJsonObject(), owner));
6086      }
6087    };
6088    return res;
6089  }
6090
6091  protected ImagingObjectSelection.InstanceComponent parseImagingObjectSelectionInstanceComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6092    ImagingObjectSelection.InstanceComponent res = new ImagingObjectSelection.InstanceComponent();
6093    parseBackboneProperties(json, res);
6094    if (json.has("sopClass"))
6095      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
6096    if (json.has("_sopClass"))
6097      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
6098    if (json.has("uid"))
6099      res.setUidElement(parseOid(json.get("uid").getAsString()));
6100    if (json.has("_uid"))
6101      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6102    if (json.has("url"))
6103      res.setUrlElement(parseUri(json.get("url").getAsString()));
6104    if (json.has("_url"))
6105      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6106    if (json.has("frames")) {
6107      JsonArray array = json.getAsJsonArray("frames");
6108      for (int i = 0; i < array.size(); i++) {
6109        res.getFrames().add(parseImagingObjectSelectionFramesComponent(array.get(i).getAsJsonObject(), owner));
6110      }
6111    };
6112    return res;
6113  }
6114
6115  protected ImagingObjectSelection.FramesComponent parseImagingObjectSelectionFramesComponent(JsonObject json, ImagingObjectSelection owner) throws IOException, FHIRFormatError {
6116    ImagingObjectSelection.FramesComponent res = new ImagingObjectSelection.FramesComponent();
6117    parseBackboneProperties(json, res);
6118    if (json.has("frameNumbers")) {
6119      JsonArray array = json.getAsJsonArray("frameNumbers");
6120      for (int i = 0; i < array.size(); i++) {
6121        res.getFrameNumbers().add(parseUnsignedInt(array.get(i).getAsString()));
6122      }
6123    };
6124    if (json.has("_frameNumbers")) {
6125      JsonArray array = json.getAsJsonArray("_frameNumbers");
6126      for (int i = 0; i < array.size(); i++) {
6127        if (i == res.getFrameNumbers().size())
6128          res.getFrameNumbers().add(parseUnsignedInt(null));
6129        if (array.get(i) instanceof JsonObject) 
6130          parseElementProperties(array.get(i).getAsJsonObject(), res.getFrameNumbers().get(i));
6131      }
6132    };
6133    if (json.has("url"))
6134      res.setUrlElement(parseUri(json.get("url").getAsString()));
6135    if (json.has("_url"))
6136      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6137    return res;
6138  }
6139
6140  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
6141    ImagingStudy res = new ImagingStudy();
6142    parseDomainResourceProperties(json, res);
6143    if (json.has("started"))
6144      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
6145    if (json.has("_started"))
6146      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
6147    if (json.has("patient"))
6148      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6149    if (json.has("uid"))
6150      res.setUidElement(parseOid(json.get("uid").getAsString()));
6151    if (json.has("_uid"))
6152      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6153    if (json.has("accession"))
6154      res.setAccession(parseIdentifier(json.getAsJsonObject("accession")));
6155    if (json.has("identifier")) {
6156      JsonArray array = json.getAsJsonArray("identifier");
6157      for (int i = 0; i < array.size(); i++) {
6158        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6159      }
6160    };
6161    if (json.has("order")) {
6162      JsonArray array = json.getAsJsonArray("order");
6163      for (int i = 0; i < array.size(); i++) {
6164        res.getOrder().add(parseReference(array.get(i).getAsJsonObject()));
6165      }
6166    };
6167    if (json.has("modalityList")) {
6168      JsonArray array = json.getAsJsonArray("modalityList");
6169      for (int i = 0; i < array.size(); i++) {
6170        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
6171      }
6172    };
6173    if (json.has("referrer"))
6174      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
6175    if (json.has("availability"))
6176      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
6177    if (json.has("_availability"))
6178      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
6179    if (json.has("url"))
6180      res.setUrlElement(parseUri(json.get("url").getAsString()));
6181    if (json.has("_url"))
6182      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6183    if (json.has("numberOfSeries"))
6184      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
6185    if (json.has("_numberOfSeries"))
6186      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
6187    if (json.has("numberOfInstances"))
6188      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
6189    if (json.has("_numberOfInstances"))
6190      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
6191    if (json.has("procedure")) {
6192      JsonArray array = json.getAsJsonArray("procedure");
6193      for (int i = 0; i < array.size(); i++) {
6194        res.getProcedure().add(parseReference(array.get(i).getAsJsonObject()));
6195      }
6196    };
6197    if (json.has("interpreter"))
6198      res.setInterpreter(parseReference(json.getAsJsonObject("interpreter")));
6199    if (json.has("description"))
6200      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6201    if (json.has("_description"))
6202      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6203    if (json.has("series")) {
6204      JsonArray array = json.getAsJsonArray("series");
6205      for (int i = 0; i < array.size(); i++) {
6206        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
6207      }
6208    };
6209    return res;
6210  }
6211
6212  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
6213    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
6214    parseBackboneProperties(json, res);
6215    if (json.has("number"))
6216      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
6217    if (json.has("_number"))
6218      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6219    if (json.has("modality"))
6220      res.setModality(parseCoding(json.getAsJsonObject("modality")));
6221    if (json.has("uid"))
6222      res.setUidElement(parseOid(json.get("uid").getAsString()));
6223    if (json.has("_uid"))
6224      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6225    if (json.has("description"))
6226      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6227    if (json.has("_description"))
6228      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6229    if (json.has("numberOfInstances"))
6230      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
6231    if (json.has("_numberOfInstances"))
6232      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
6233    if (json.has("availability"))
6234      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
6235    if (json.has("_availability"))
6236      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
6237    if (json.has("url"))
6238      res.setUrlElement(parseUri(json.get("url").getAsString()));
6239    if (json.has("_url"))
6240      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6241    if (json.has("bodySite"))
6242      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
6243    if (json.has("laterality"))
6244      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
6245    if (json.has("started"))
6246      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
6247    if (json.has("_started"))
6248      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
6249    if (json.has("instance")) {
6250      JsonArray array = json.getAsJsonArray("instance");
6251      for (int i = 0; i < array.size(); i++) {
6252        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
6253      }
6254    };
6255    return res;
6256  }
6257
6258  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
6259    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
6260    parseBackboneProperties(json, res);
6261    if (json.has("number"))
6262      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
6263    if (json.has("_number"))
6264      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6265    if (json.has("uid"))
6266      res.setUidElement(parseOid(json.get("uid").getAsString()));
6267    if (json.has("_uid"))
6268      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
6269    if (json.has("sopClass"))
6270      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
6271    if (json.has("_sopClass"))
6272      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
6273    if (json.has("type"))
6274      res.setTypeElement(parseString(json.get("type").getAsString()));
6275    if (json.has("_type"))
6276      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6277    if (json.has("title"))
6278      res.setTitleElement(parseString(json.get("title").getAsString()));
6279    if (json.has("_title"))
6280      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6281    if (json.has("content")) {
6282      JsonArray array = json.getAsJsonArray("content");
6283      for (int i = 0; i < array.size(); i++) {
6284        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
6285      }
6286    };
6287    return res;
6288  }
6289
6290  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
6291    Immunization res = new Immunization();
6292    parseDomainResourceProperties(json, res);
6293    if (json.has("identifier")) {
6294      JsonArray array = json.getAsJsonArray("identifier");
6295      for (int i = 0; i < array.size(); i++) {
6296        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6297      }
6298    };
6299    if (json.has("status"))
6300      res.setStatusElement(parseCode(json.get("status").getAsString()));
6301    if (json.has("_status"))
6302      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6303    if (json.has("date"))
6304      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6305    if (json.has("_date"))
6306      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6307    if (json.has("vaccineCode"))
6308      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
6309    if (json.has("patient"))
6310      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6311    if (json.has("wasNotGiven"))
6312      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
6313    if (json.has("_wasNotGiven"))
6314      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
6315    if (json.has("reported"))
6316      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
6317    if (json.has("_reported"))
6318      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
6319    if (json.has("performer"))
6320      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
6321    if (json.has("requester"))
6322      res.setRequester(parseReference(json.getAsJsonObject("requester")));
6323    if (json.has("encounter"))
6324      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6325    if (json.has("manufacturer"))
6326      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
6327    if (json.has("location"))
6328      res.setLocation(parseReference(json.getAsJsonObject("location")));
6329    if (json.has("lotNumber"))
6330      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
6331    if (json.has("_lotNumber"))
6332      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
6333    if (json.has("expirationDate"))
6334      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
6335    if (json.has("_expirationDate"))
6336      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
6337    if (json.has("site"))
6338      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
6339    if (json.has("route"))
6340      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
6341    if (json.has("doseQuantity"))
6342      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
6343    if (json.has("note")) {
6344      JsonArray array = json.getAsJsonArray("note");
6345      for (int i = 0; i < array.size(); i++) {
6346        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6347      }
6348    };
6349    if (json.has("explanation"))
6350      res.setExplanation(parseImmunizationImmunizationExplanationComponent(json.getAsJsonObject("explanation"), res));
6351    if (json.has("reaction")) {
6352      JsonArray array = json.getAsJsonArray("reaction");
6353      for (int i = 0; i < array.size(); i++) {
6354        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
6355      }
6356    };
6357    if (json.has("vaccinationProtocol")) {
6358      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
6359      for (int i = 0; i < array.size(); i++) {
6360        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
6361      }
6362    };
6363    return res;
6364  }
6365
6366  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6367    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
6368    parseBackboneProperties(json, res);
6369    if (json.has("reason")) {
6370      JsonArray array = json.getAsJsonArray("reason");
6371      for (int i = 0; i < array.size(); i++) {
6372        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6373      }
6374    };
6375    if (json.has("reasonNotGiven")) {
6376      JsonArray array = json.getAsJsonArray("reasonNotGiven");
6377      for (int i = 0; i < array.size(); i++) {
6378        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6379      }
6380    };
6381    return res;
6382  }
6383
6384  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6385    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
6386    parseBackboneProperties(json, res);
6387    if (json.has("date"))
6388      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6389    if (json.has("_date"))
6390      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6391    if (json.has("detail"))
6392      res.setDetail(parseReference(json.getAsJsonObject("detail")));
6393    if (json.has("reported"))
6394      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
6395    if (json.has("_reported"))
6396      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
6397    return res;
6398  }
6399
6400  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
6401    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
6402    parseBackboneProperties(json, res);
6403    if (json.has("doseSequence"))
6404      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
6405    if (json.has("_doseSequence"))
6406      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
6407    if (json.has("description"))
6408      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6409    if (json.has("_description"))
6410      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6411    if (json.has("authority"))
6412      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
6413    if (json.has("series"))
6414      res.setSeriesElement(parseString(json.get("series").getAsString()));
6415    if (json.has("_series"))
6416      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
6417    if (json.has("seriesDoses"))
6418      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
6419    if (json.has("_seriesDoses"))
6420      parseElementProperties(json.getAsJsonObject("_seriesDoses"), res.getSeriesDosesElement());
6421    if (json.has("targetDisease")) {
6422      JsonArray array = json.getAsJsonArray("targetDisease");
6423      for (int i = 0; i < array.size(); i++) {
6424        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6425      }
6426    };
6427    if (json.has("doseStatus"))
6428      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
6429    if (json.has("doseStatusReason"))
6430      res.setDoseStatusReason(parseCodeableConcept(json.getAsJsonObject("doseStatusReason")));
6431    return res;
6432  }
6433
6434  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
6435    ImmunizationRecommendation res = new ImmunizationRecommendation();
6436    parseDomainResourceProperties(json, res);
6437    if (json.has("identifier")) {
6438      JsonArray array = json.getAsJsonArray("identifier");
6439      for (int i = 0; i < array.size(); i++) {
6440        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6441      }
6442    };
6443    if (json.has("patient"))
6444      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6445    if (json.has("recommendation")) {
6446      JsonArray array = json.getAsJsonArray("recommendation");
6447      for (int i = 0; i < array.size(); i++) {
6448        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
6449      }
6450    };
6451    return res;
6452  }
6453
6454  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6455    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
6456    parseBackboneProperties(json, res);
6457    if (json.has("date"))
6458      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6459    if (json.has("_date"))
6460      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6461    if (json.has("vaccineCode"))
6462      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
6463    if (json.has("doseNumber"))
6464      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
6465    if (json.has("_doseNumber"))
6466      parseElementProperties(json.getAsJsonObject("_doseNumber"), res.getDoseNumberElement());
6467    if (json.has("forecastStatus"))
6468      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
6469    if (json.has("dateCriterion")) {
6470      JsonArray array = json.getAsJsonArray("dateCriterion");
6471      for (int i = 0; i < array.size(); i++) {
6472        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
6473      }
6474    };
6475    if (json.has("protocol"))
6476      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(json.getAsJsonObject("protocol"), owner));
6477    if (json.has("supportingImmunization")) {
6478      JsonArray array = json.getAsJsonArray("supportingImmunization");
6479      for (int i = 0; i < array.size(); i++) {
6480        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
6481      }
6482    };
6483    if (json.has("supportingPatientInformation")) {
6484      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
6485      for (int i = 0; i < array.size(); i++) {
6486        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
6487      }
6488    };
6489    return res;
6490  }
6491
6492  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6493    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
6494    parseBackboneProperties(json, res);
6495    if (json.has("code"))
6496      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6497    if (json.has("value"))
6498      res.setValueElement(parseDateTime(json.get("value").getAsString()));
6499    if (json.has("_value"))
6500      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6501    return res;
6502  }
6503
6504  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
6505    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
6506    parseBackboneProperties(json, res);
6507    if (json.has("doseSequence"))
6508      res.setDoseSequenceElement(parseInteger(json.get("doseSequence").getAsLong()));
6509    if (json.has("_doseSequence"))
6510      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
6511    if (json.has("description"))
6512      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6513    if (json.has("_description"))
6514      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6515    if (json.has("authority"))
6516      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
6517    if (json.has("series"))
6518      res.setSeriesElement(parseString(json.get("series").getAsString()));
6519    if (json.has("_series"))
6520      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
6521    return res;
6522  }
6523
6524  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
6525    ImplementationGuide res = new ImplementationGuide();
6526    parseDomainResourceProperties(json, res);
6527    if (json.has("url"))
6528      res.setUrlElement(parseUri(json.get("url").getAsString()));
6529    if (json.has("_url"))
6530      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6531    if (json.has("version"))
6532      res.setVersionElement(parseString(json.get("version").getAsString()));
6533    if (json.has("_version"))
6534      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6535    if (json.has("name"))
6536      res.setNameElement(parseString(json.get("name").getAsString()));
6537    if (json.has("_name"))
6538      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6539    if (json.has("status"))
6540      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
6541    if (json.has("_status"))
6542      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6543    if (json.has("experimental"))
6544      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6545    if (json.has("_experimental"))
6546      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6547    if (json.has("publisher"))
6548      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6549    if (json.has("_publisher"))
6550      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6551    if (json.has("contact")) {
6552      JsonArray array = json.getAsJsonArray("contact");
6553      for (int i = 0; i < array.size(); i++) {
6554        res.getContact().add(parseImplementationGuideImplementationGuideContactComponent(array.get(i).getAsJsonObject(), res));
6555      }
6556    };
6557    if (json.has("date"))
6558      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6559    if (json.has("_date"))
6560      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6561    if (json.has("description"))
6562      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6563    if (json.has("_description"))
6564      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6565    if (json.has("useContext")) {
6566      JsonArray array = json.getAsJsonArray("useContext");
6567      for (int i = 0; i < array.size(); i++) {
6568        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6569      }
6570    };
6571    if (json.has("copyright"))
6572      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
6573    if (json.has("_copyright"))
6574      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6575    if (json.has("fhirVersion"))
6576      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
6577    if (json.has("_fhirVersion"))
6578      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
6579    if (json.has("dependency")) {
6580      JsonArray array = json.getAsJsonArray("dependency");
6581      for (int i = 0; i < array.size(); i++) {
6582        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
6583      }
6584    };
6585    if (json.has("package")) {
6586      JsonArray array = json.getAsJsonArray("package");
6587      for (int i = 0; i < array.size(); i++) {
6588        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
6589      }
6590    };
6591    if (json.has("global")) {
6592      JsonArray array = json.getAsJsonArray("global");
6593      for (int i = 0; i < array.size(); i++) {
6594        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
6595      }
6596    };
6597    if (json.has("binary")) {
6598      JsonArray array = json.getAsJsonArray("binary");
6599      for (int i = 0; i < array.size(); i++) {
6600        res.getBinary().add(parseUri(array.get(i).getAsString()));
6601      }
6602    };
6603    if (json.has("_binary")) {
6604      JsonArray array = json.getAsJsonArray("_binary");
6605      for (int i = 0; i < array.size(); i++) {
6606        if (i == res.getBinary().size())
6607          res.getBinary().add(parseUri(null));
6608        if (array.get(i) instanceof JsonObject) 
6609          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
6610      }
6611    };
6612    if (json.has("page"))
6613      res.setPage(parseImplementationGuideImplementationGuidePageComponent(json.getAsJsonObject("page"), res));
6614    return res;
6615  }
6616
6617  protected ImplementationGuide.ImplementationGuideContactComponent parseImplementationGuideImplementationGuideContactComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6618    ImplementationGuide.ImplementationGuideContactComponent res = new ImplementationGuide.ImplementationGuideContactComponent();
6619    parseBackboneProperties(json, res);
6620    if (json.has("name"))
6621      res.setNameElement(parseString(json.get("name").getAsString()));
6622    if (json.has("_name"))
6623      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6624    if (json.has("telecom")) {
6625      JsonArray array = json.getAsJsonArray("telecom");
6626      for (int i = 0; i < array.size(); i++) {
6627        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6628      }
6629    };
6630    return res;
6631  }
6632
6633  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6634    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
6635    parseBackboneProperties(json, res);
6636    if (json.has("type"))
6637      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
6638    if (json.has("_type"))
6639      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6640    if (json.has("uri"))
6641      res.setUriElement(parseUri(json.get("uri").getAsString()));
6642    if (json.has("_uri"))
6643      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6644    return res;
6645  }
6646
6647  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6648    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
6649    parseBackboneProperties(json, res);
6650    if (json.has("name"))
6651      res.setNameElement(parseString(json.get("name").getAsString()));
6652    if (json.has("_name"))
6653      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6654    if (json.has("description"))
6655      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6656    if (json.has("_description"))
6657      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6658    if (json.has("resource")) {
6659      JsonArray array = json.getAsJsonArray("resource");
6660      for (int i = 0; i < array.size(); i++) {
6661        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
6662      }
6663    };
6664    return res;
6665  }
6666
6667  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6668    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
6669    parseBackboneProperties(json, res);
6670    if (json.has("purpose"))
6671      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ImplementationGuide.GuideResourcePurpose.NULL, new ImplementationGuide.GuideResourcePurposeEnumFactory()));
6672    if (json.has("_purpose"))
6673      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6674    if (json.has("name"))
6675      res.setNameElement(parseString(json.get("name").getAsString()));
6676    if (json.has("_name"))
6677      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6678    if (json.has("description"))
6679      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6680    if (json.has("_description"))
6681      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6682    if (json.has("acronym"))
6683      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
6684    if (json.has("_acronym"))
6685      parseElementProperties(json.getAsJsonObject("_acronym"), res.getAcronymElement());
6686    Type source = parseType("source", json);
6687    if (source != null)
6688      res.setSource(source);
6689    if (json.has("exampleFor"))
6690      res.setExampleFor(parseReference(json.getAsJsonObject("exampleFor")));
6691    return res;
6692  }
6693
6694  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6695    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
6696    parseBackboneProperties(json, res);
6697    if (json.has("type"))
6698      res.setTypeElement(parseCode(json.get("type").getAsString()));
6699    if (json.has("_type"))
6700      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6701    if (json.has("profile"))
6702      res.setProfile(parseReference(json.getAsJsonObject("profile")));
6703    return res;
6704  }
6705
6706  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
6707    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
6708    parseBackboneProperties(json, res);
6709    if (json.has("source"))
6710      res.setSourceElement(parseUri(json.get("source").getAsString()));
6711    if (json.has("_source"))
6712      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6713    if (json.has("name"))
6714      res.setNameElement(parseString(json.get("name").getAsString()));
6715    if (json.has("_name"))
6716      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6717    if (json.has("kind"))
6718      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
6719    if (json.has("_kind"))
6720      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
6721    if (json.has("type")) {
6722      JsonArray array = json.getAsJsonArray("type");
6723      for (int i = 0; i < array.size(); i++) {
6724        res.getType().add(parseCode(array.get(i).getAsString()));
6725      }
6726    };
6727    if (json.has("_type")) {
6728      JsonArray array = json.getAsJsonArray("_type");
6729      for (int i = 0; i < array.size(); i++) {
6730        if (i == res.getType().size())
6731          res.getType().add(parseCode(null));
6732        if (array.get(i) instanceof JsonObject) 
6733          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
6734      }
6735    };
6736    if (json.has("package")) {
6737      JsonArray array = json.getAsJsonArray("package");
6738      for (int i = 0; i < array.size(); i++) {
6739        res.getPackage().add(parseString(array.get(i).getAsString()));
6740      }
6741    };
6742    if (json.has("_package")) {
6743      JsonArray array = json.getAsJsonArray("_package");
6744      for (int i = 0; i < array.size(); i++) {
6745        if (i == res.getPackage().size())
6746          res.getPackage().add(parseString(null));
6747        if (array.get(i) instanceof JsonObject) 
6748          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
6749      }
6750    };
6751    if (json.has("format"))
6752      res.setFormatElement(parseCode(json.get("format").getAsString()));
6753    if (json.has("_format"))
6754      parseElementProperties(json.getAsJsonObject("_format"), res.getFormatElement());
6755    if (json.has("page")) {
6756      JsonArray array = json.getAsJsonArray("page");
6757      for (int i = 0; i < array.size(); i++) {
6758        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
6759      }
6760    };
6761    return res;
6762  }
6763
6764  protected List_ parseList_(JsonObject json) throws IOException, FHIRFormatError {
6765    List_ res = new List_();
6766    parseDomainResourceProperties(json, res);
6767    if (json.has("identifier")) {
6768      JsonArray array = json.getAsJsonArray("identifier");
6769      for (int i = 0; i < array.size(); i++) {
6770        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6771      }
6772    };
6773    if (json.has("title"))
6774      res.setTitleElement(parseString(json.get("title").getAsString()));
6775    if (json.has("_title"))
6776      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6777    if (json.has("code"))
6778      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6779    if (json.has("subject"))
6780      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6781    if (json.has("source"))
6782      res.setSource(parseReference(json.getAsJsonObject("source")));
6783    if (json.has("encounter"))
6784      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6785    if (json.has("status"))
6786      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), List_.ListStatus.NULL, new List_.ListStatusEnumFactory()));
6787    if (json.has("_status"))
6788      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6789    if (json.has("date"))
6790      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6791    if (json.has("_date"))
6792      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6793    if (json.has("orderedBy"))
6794      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6795    if (json.has("mode"))
6796      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), List_.ListMode.NULL, new List_.ListModeEnumFactory()));
6797    if (json.has("_mode"))
6798      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6799    if (json.has("note"))
6800      res.setNoteElement(parseString(json.get("note").getAsString()));
6801    if (json.has("_note"))
6802      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
6803    if (json.has("entry")) {
6804      JsonArray array = json.getAsJsonArray("entry");
6805      for (int i = 0; i < array.size(); i++) {
6806        res.getEntry().add(parseList_ListEntryComponent(array.get(i).getAsJsonObject(), res));
6807      }
6808    };
6809    if (json.has("emptyReason"))
6810      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6811    return res;
6812  }
6813
6814  protected List_.ListEntryComponent parseList_ListEntryComponent(JsonObject json, List_ owner) throws IOException, FHIRFormatError {
6815    List_.ListEntryComponent res = new List_.ListEntryComponent();
6816    parseBackboneProperties(json, res);
6817    if (json.has("flag"))
6818      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
6819    if (json.has("deleted"))
6820      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
6821    if (json.has("_deleted"))
6822      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
6823    if (json.has("date"))
6824      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6825    if (json.has("_date"))
6826      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6827    if (json.has("item"))
6828      res.setItem(parseReference(json.getAsJsonObject("item")));
6829    return res;
6830  }
6831
6832  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
6833    Location res = new Location();
6834    parseDomainResourceProperties(json, res);
6835    if (json.has("identifier")) {
6836      JsonArray array = json.getAsJsonArray("identifier");
6837      for (int i = 0; i < array.size(); i++) {
6838        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6839      }
6840    };
6841    if (json.has("status"))
6842      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
6843    if (json.has("_status"))
6844      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6845    if (json.has("name"))
6846      res.setNameElement(parseString(json.get("name").getAsString()));
6847    if (json.has("_name"))
6848      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6849    if (json.has("description"))
6850      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6851    if (json.has("_description"))
6852      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6853    if (json.has("mode"))
6854      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
6855    if (json.has("_mode"))
6856      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6857    if (json.has("type"))
6858      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6859    if (json.has("telecom")) {
6860      JsonArray array = json.getAsJsonArray("telecom");
6861      for (int i = 0; i < array.size(); i++) {
6862        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
6863      }
6864    };
6865    if (json.has("address"))
6866      res.setAddress(parseAddress(json.getAsJsonObject("address")));
6867    if (json.has("physicalType"))
6868      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
6869    if (json.has("position"))
6870      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
6871    if (json.has("managingOrganization"))
6872      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
6873    if (json.has("partOf"))
6874      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
6875    return res;
6876  }
6877
6878  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
6879    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
6880    parseBackboneProperties(json, res);
6881    if (json.has("longitude"))
6882      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
6883    if (json.has("_longitude"))
6884      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
6885    if (json.has("latitude"))
6886      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
6887    if (json.has("_latitude"))
6888      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
6889    if (json.has("altitude"))
6890      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
6891    if (json.has("_altitude"))
6892      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
6893    return res;
6894  }
6895
6896  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
6897    Media res = new Media();
6898    parseDomainResourceProperties(json, res);
6899    if (json.has("type"))
6900      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
6901    if (json.has("_type"))
6902      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6903    if (json.has("subtype"))
6904      res.setSubtype(parseCodeableConcept(json.getAsJsonObject("subtype")));
6905    if (json.has("identifier")) {
6906      JsonArray array = json.getAsJsonArray("identifier");
6907      for (int i = 0; i < array.size(); i++) {
6908        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6909      }
6910    };
6911    if (json.has("subject"))
6912      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6913    if (json.has("operator"))
6914      res.setOperator(parseReference(json.getAsJsonObject("operator")));
6915    if (json.has("view"))
6916      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
6917    if (json.has("deviceName"))
6918      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
6919    if (json.has("_deviceName"))
6920      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
6921    if (json.has("height"))
6922      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
6923    if (json.has("_height"))
6924      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
6925    if (json.has("width"))
6926      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
6927    if (json.has("_width"))
6928      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
6929    if (json.has("frames"))
6930      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
6931    if (json.has("_frames"))
6932      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
6933    if (json.has("duration"))
6934      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
6935    if (json.has("_duration"))
6936      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
6937    if (json.has("content"))
6938      res.setContent(parseAttachment(json.getAsJsonObject("content")));
6939    return res;
6940  }
6941
6942  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
6943    Medication res = new Medication();
6944    parseDomainResourceProperties(json, res);
6945    if (json.has("code"))
6946      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6947    if (json.has("isBrand"))
6948      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
6949    if (json.has("_isBrand"))
6950      parseElementProperties(json.getAsJsonObject("_isBrand"), res.getIsBrandElement());
6951    if (json.has("manufacturer"))
6952      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
6953    if (json.has("product"))
6954      res.setProduct(parseMedicationMedicationProductComponent(json.getAsJsonObject("product"), res));
6955    if (json.has("package"))
6956      res.setPackage(parseMedicationMedicationPackageComponent(json.getAsJsonObject("package"), res));
6957    return res;
6958  }
6959
6960  protected Medication.MedicationProductComponent parseMedicationMedicationProductComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6961    Medication.MedicationProductComponent res = new Medication.MedicationProductComponent();
6962    parseBackboneProperties(json, res);
6963    if (json.has("form"))
6964      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
6965    if (json.has("ingredient")) {
6966      JsonArray array = json.getAsJsonArray("ingredient");
6967      for (int i = 0; i < array.size(); i++) {
6968        res.getIngredient().add(parseMedicationMedicationProductIngredientComponent(array.get(i).getAsJsonObject(), owner));
6969      }
6970    };
6971    if (json.has("batch")) {
6972      JsonArray array = json.getAsJsonArray("batch");
6973      for (int i = 0; i < array.size(); i++) {
6974        res.getBatch().add(parseMedicationMedicationProductBatchComponent(array.get(i).getAsJsonObject(), owner));
6975      }
6976    };
6977    return res;
6978  }
6979
6980  protected Medication.MedicationProductIngredientComponent parseMedicationMedicationProductIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6981    Medication.MedicationProductIngredientComponent res = new Medication.MedicationProductIngredientComponent();
6982    parseBackboneProperties(json, res);
6983    if (json.has("item"))
6984      res.setItem(parseReference(json.getAsJsonObject("item")));
6985    if (json.has("amount"))
6986      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
6987    return res;
6988  }
6989
6990  protected Medication.MedicationProductBatchComponent parseMedicationMedicationProductBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
6991    Medication.MedicationProductBatchComponent res = new Medication.MedicationProductBatchComponent();
6992    parseBackboneProperties(json, res);
6993    if (json.has("lotNumber"))
6994      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
6995    if (json.has("_lotNumber"))
6996      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
6997    if (json.has("expirationDate"))
6998      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
6999    if (json.has("_expirationDate"))
7000      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
7001    return res;
7002  }
7003
7004  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
7005    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
7006    parseBackboneProperties(json, res);
7007    if (json.has("container"))
7008      res.setContainer(parseCodeableConcept(json.getAsJsonObject("container")));
7009    if (json.has("content")) {
7010      JsonArray array = json.getAsJsonArray("content");
7011      for (int i = 0; i < array.size(); i++) {
7012        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
7013      }
7014    };
7015    return res;
7016  }
7017
7018  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
7019    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
7020    parseBackboneProperties(json, res);
7021    if (json.has("item"))
7022      res.setItem(parseReference(json.getAsJsonObject("item")));
7023    if (json.has("amount"))
7024      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
7025    return res;
7026  }
7027
7028  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
7029    MedicationAdministration res = new MedicationAdministration();
7030    parseDomainResourceProperties(json, res);
7031    if (json.has("identifier")) {
7032      JsonArray array = json.getAsJsonArray("identifier");
7033      for (int i = 0; i < array.size(); i++) {
7034        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7035      }
7036    };
7037    if (json.has("status"))
7038      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
7039    if (json.has("_status"))
7040      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7041    if (json.has("patient"))
7042      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7043    if (json.has("practitioner"))
7044      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
7045    if (json.has("encounter"))
7046      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7047    if (json.has("prescription"))
7048      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
7049    if (json.has("wasNotGiven"))
7050      res.setWasNotGivenElement(parseBoolean(json.get("wasNotGiven").getAsBoolean()));
7051    if (json.has("_wasNotGiven"))
7052      parseElementProperties(json.getAsJsonObject("_wasNotGiven"), res.getWasNotGivenElement());
7053    if (json.has("reasonNotGiven")) {
7054      JsonArray array = json.getAsJsonArray("reasonNotGiven");
7055      for (int i = 0; i < array.size(); i++) {
7056        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7057      }
7058    };
7059    if (json.has("reasonGiven")) {
7060      JsonArray array = json.getAsJsonArray("reasonGiven");
7061      for (int i = 0; i < array.size(); i++) {
7062        res.getReasonGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7063      }
7064    };
7065    Type effectiveTime = parseType("effectiveTime", json);
7066    if (effectiveTime != null)
7067      res.setEffectiveTime(effectiveTime);
7068    Type medication = parseType("medication", json);
7069    if (medication != null)
7070      res.setMedication(medication);
7071    if (json.has("device")) {
7072      JsonArray array = json.getAsJsonArray("device");
7073      for (int i = 0; i < array.size(); i++) {
7074        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
7075      }
7076    };
7077    if (json.has("note"))
7078      res.setNoteElement(parseString(json.get("note").getAsString()));
7079    if (json.has("_note"))
7080      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7081    if (json.has("dosage"))
7082      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
7083    return res;
7084  }
7085
7086  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
7087    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
7088    parseBackboneProperties(json, res);
7089    if (json.has("text"))
7090      res.setTextElement(parseString(json.get("text").getAsString()));
7091    if (json.has("_text"))
7092      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7093    Type site = parseType("site", json);
7094    if (site != null)
7095      res.setSite(site);
7096    if (json.has("route"))
7097      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7098    if (json.has("method"))
7099      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7100    if (json.has("quantity"))
7101      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7102    Type rate = parseType("rate", json);
7103    if (rate != null)
7104      res.setRate(rate);
7105    return res;
7106  }
7107
7108  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
7109    MedicationDispense res = new MedicationDispense();
7110    parseDomainResourceProperties(json, res);
7111    if (json.has("identifier"))
7112      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7113    if (json.has("status"))
7114      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
7115    if (json.has("_status"))
7116      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7117    if (json.has("patient"))
7118      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7119    if (json.has("dispenser"))
7120      res.setDispenser(parseReference(json.getAsJsonObject("dispenser")));
7121    if (json.has("authorizingPrescription")) {
7122      JsonArray array = json.getAsJsonArray("authorizingPrescription");
7123      for (int i = 0; i < array.size(); i++) {
7124        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
7125      }
7126    };
7127    if (json.has("type"))
7128      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7129    if (json.has("quantity"))
7130      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7131    if (json.has("daysSupply"))
7132      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
7133    Type medication = parseType("medication", json);
7134    if (medication != null)
7135      res.setMedication(medication);
7136    if (json.has("whenPrepared"))
7137      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
7138    if (json.has("_whenPrepared"))
7139      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
7140    if (json.has("whenHandedOver"))
7141      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
7142    if (json.has("_whenHandedOver"))
7143      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
7144    if (json.has("destination"))
7145      res.setDestination(parseReference(json.getAsJsonObject("destination")));
7146    if (json.has("receiver")) {
7147      JsonArray array = json.getAsJsonArray("receiver");
7148      for (int i = 0; i < array.size(); i++) {
7149        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
7150      }
7151    };
7152    if (json.has("note"))
7153      res.setNoteElement(parseString(json.get("note").getAsString()));
7154    if (json.has("_note"))
7155      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7156    if (json.has("dosageInstruction")) {
7157      JsonArray array = json.getAsJsonArray("dosageInstruction");
7158      for (int i = 0; i < array.size(); i++) {
7159        res.getDosageInstruction().add(parseMedicationDispenseMedicationDispenseDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
7160      }
7161    };
7162    if (json.has("substitution"))
7163      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
7164    return res;
7165  }
7166
7167  protected MedicationDispense.MedicationDispenseDosageInstructionComponent parseMedicationDispenseMedicationDispenseDosageInstructionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
7168    MedicationDispense.MedicationDispenseDosageInstructionComponent res = new MedicationDispense.MedicationDispenseDosageInstructionComponent();
7169    parseBackboneProperties(json, res);
7170    if (json.has("text"))
7171      res.setTextElement(parseString(json.get("text").getAsString()));
7172    if (json.has("_text"))
7173      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7174    if (json.has("additionalInstructions"))
7175      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
7176    if (json.has("timing"))
7177      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7178    Type asNeeded = parseType("asNeeded", json);
7179    if (asNeeded != null)
7180      res.setAsNeeded(asNeeded);
7181    Type site = parseType("site", json);
7182    if (site != null)
7183      res.setSite(site);
7184    if (json.has("route"))
7185      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7186    if (json.has("method"))
7187      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7188    Type dose = parseType("dose", json);
7189    if (dose != null)
7190      res.setDose(dose);
7191    Type rate = parseType("rate", json);
7192    if (rate != null)
7193      res.setRate(rate);
7194    if (json.has("maxDosePerPeriod"))
7195      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7196    return res;
7197  }
7198
7199  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
7200    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
7201    parseBackboneProperties(json, res);
7202    if (json.has("type"))
7203      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7204    if (json.has("reason")) {
7205      JsonArray array = json.getAsJsonArray("reason");
7206      for (int i = 0; i < array.size(); i++) {
7207        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7208      }
7209    };
7210    if (json.has("responsibleParty")) {
7211      JsonArray array = json.getAsJsonArray("responsibleParty");
7212      for (int i = 0; i < array.size(); i++) {
7213        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
7214      }
7215    };
7216    return res;
7217  }
7218
7219  protected MedicationOrder parseMedicationOrder(JsonObject json) throws IOException, FHIRFormatError {
7220    MedicationOrder res = new MedicationOrder();
7221    parseDomainResourceProperties(json, res);
7222    if (json.has("identifier")) {
7223      JsonArray array = json.getAsJsonArray("identifier");
7224      for (int i = 0; i < array.size(); i++) {
7225        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7226      }
7227    };
7228    if (json.has("dateWritten"))
7229      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
7230    if (json.has("_dateWritten"))
7231      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
7232    if (json.has("status"))
7233      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationOrder.MedicationOrderStatus.NULL, new MedicationOrder.MedicationOrderStatusEnumFactory()));
7234    if (json.has("_status"))
7235      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7236    if (json.has("dateEnded"))
7237      res.setDateEndedElement(parseDateTime(json.get("dateEnded").getAsString()));
7238    if (json.has("_dateEnded"))
7239      parseElementProperties(json.getAsJsonObject("_dateEnded"), res.getDateEndedElement());
7240    if (json.has("reasonEnded"))
7241      res.setReasonEnded(parseCodeableConcept(json.getAsJsonObject("reasonEnded")));
7242    if (json.has("patient"))
7243      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7244    if (json.has("prescriber"))
7245      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
7246    if (json.has("encounter"))
7247      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7248    Type reason = parseType("reason", json);
7249    if (reason != null)
7250      res.setReason(reason);
7251    if (json.has("note"))
7252      res.setNoteElement(parseString(json.get("note").getAsString()));
7253    if (json.has("_note"))
7254      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7255    Type medication = parseType("medication", json);
7256    if (medication != null)
7257      res.setMedication(medication);
7258    if (json.has("dosageInstruction")) {
7259      JsonArray array = json.getAsJsonArray("dosageInstruction");
7260      for (int i = 0; i < array.size(); i++) {
7261        res.getDosageInstruction().add(parseMedicationOrderMedicationOrderDosageInstructionComponent(array.get(i).getAsJsonObject(), res));
7262      }
7263    };
7264    if (json.has("dispenseRequest"))
7265      res.setDispenseRequest(parseMedicationOrderMedicationOrderDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
7266    if (json.has("substitution"))
7267      res.setSubstitution(parseMedicationOrderMedicationOrderSubstitutionComponent(json.getAsJsonObject("substitution"), res));
7268    if (json.has("priorPrescription"))
7269      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
7270    return res;
7271  }
7272
7273  protected MedicationOrder.MedicationOrderDosageInstructionComponent parseMedicationOrderMedicationOrderDosageInstructionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7274    MedicationOrder.MedicationOrderDosageInstructionComponent res = new MedicationOrder.MedicationOrderDosageInstructionComponent();
7275    parseBackboneProperties(json, res);
7276    if (json.has("text"))
7277      res.setTextElement(parseString(json.get("text").getAsString()));
7278    if (json.has("_text"))
7279      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7280    if (json.has("additionalInstructions"))
7281      res.setAdditionalInstructions(parseCodeableConcept(json.getAsJsonObject("additionalInstructions")));
7282    if (json.has("timing"))
7283      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7284    Type asNeeded = parseType("asNeeded", json);
7285    if (asNeeded != null)
7286      res.setAsNeeded(asNeeded);
7287    Type site = parseType("site", json);
7288    if (site != null)
7289      res.setSite(site);
7290    if (json.has("route"))
7291      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7292    if (json.has("method"))
7293      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7294    Type dose = parseType("dose", json);
7295    if (dose != null)
7296      res.setDose(dose);
7297    Type rate = parseType("rate", json);
7298    if (rate != null)
7299      res.setRate(rate);
7300    if (json.has("maxDosePerPeriod"))
7301      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7302    return res;
7303  }
7304
7305  protected MedicationOrder.MedicationOrderDispenseRequestComponent parseMedicationOrderMedicationOrderDispenseRequestComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7306    MedicationOrder.MedicationOrderDispenseRequestComponent res = new MedicationOrder.MedicationOrderDispenseRequestComponent();
7307    parseBackboneProperties(json, res);
7308    Type medication = parseType("medication", json);
7309    if (medication != null)
7310      res.setMedication(medication);
7311    if (json.has("validityPeriod"))
7312      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
7313    if (json.has("numberOfRepeatsAllowed"))
7314      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
7315    if (json.has("_numberOfRepeatsAllowed"))
7316      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
7317    if (json.has("quantity"))
7318      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7319    if (json.has("expectedSupplyDuration"))
7320      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
7321    return res;
7322  }
7323
7324  protected MedicationOrder.MedicationOrderSubstitutionComponent parseMedicationOrderMedicationOrderSubstitutionComponent(JsonObject json, MedicationOrder owner) throws IOException, FHIRFormatError {
7325    MedicationOrder.MedicationOrderSubstitutionComponent res = new MedicationOrder.MedicationOrderSubstitutionComponent();
7326    parseBackboneProperties(json, res);
7327    if (json.has("type"))
7328      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7329    if (json.has("reason"))
7330      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
7331    return res;
7332  }
7333
7334  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
7335    MedicationStatement res = new MedicationStatement();
7336    parseDomainResourceProperties(json, res);
7337    if (json.has("identifier")) {
7338      JsonArray array = json.getAsJsonArray("identifier");
7339      for (int i = 0; i < array.size(); i++) {
7340        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7341      }
7342    };
7343    if (json.has("patient"))
7344      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7345    if (json.has("informationSource"))
7346      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
7347    if (json.has("dateAsserted"))
7348      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
7349    if (json.has("_dateAsserted"))
7350      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
7351    if (json.has("status"))
7352      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
7353    if (json.has("_status"))
7354      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7355    if (json.has("wasNotTaken"))
7356      res.setWasNotTakenElement(parseBoolean(json.get("wasNotTaken").getAsBoolean()));
7357    if (json.has("_wasNotTaken"))
7358      parseElementProperties(json.getAsJsonObject("_wasNotTaken"), res.getWasNotTakenElement());
7359    if (json.has("reasonNotTaken")) {
7360      JsonArray array = json.getAsJsonArray("reasonNotTaken");
7361      for (int i = 0; i < array.size(); i++) {
7362        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7363      }
7364    };
7365    Type reasonForUse = parseType("reasonForUse", json);
7366    if (reasonForUse != null)
7367      res.setReasonForUse(reasonForUse);
7368    Type effective = parseType("effective", json);
7369    if (effective != null)
7370      res.setEffective(effective);
7371    if (json.has("note"))
7372      res.setNoteElement(parseString(json.get("note").getAsString()));
7373    if (json.has("_note"))
7374      parseElementProperties(json.getAsJsonObject("_note"), res.getNoteElement());
7375    if (json.has("supportingInformation")) {
7376      JsonArray array = json.getAsJsonArray("supportingInformation");
7377      for (int i = 0; i < array.size(); i++) {
7378        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
7379      }
7380    };
7381    Type medication = parseType("medication", json);
7382    if (medication != null)
7383      res.setMedication(medication);
7384    if (json.has("dosage")) {
7385      JsonArray array = json.getAsJsonArray("dosage");
7386      for (int i = 0; i < array.size(); i++) {
7387        res.getDosage().add(parseMedicationStatementMedicationStatementDosageComponent(array.get(i).getAsJsonObject(), res));
7388      }
7389    };
7390    return res;
7391  }
7392
7393  protected MedicationStatement.MedicationStatementDosageComponent parseMedicationStatementMedicationStatementDosageComponent(JsonObject json, MedicationStatement owner) throws IOException, FHIRFormatError {
7394    MedicationStatement.MedicationStatementDosageComponent res = new MedicationStatement.MedicationStatementDosageComponent();
7395    parseBackboneProperties(json, res);
7396    if (json.has("text"))
7397      res.setTextElement(parseString(json.get("text").getAsString()));
7398    if (json.has("_text"))
7399      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7400    if (json.has("timing"))
7401      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
7402    Type asNeeded = parseType("asNeeded", json);
7403    if (asNeeded != null)
7404      res.setAsNeeded(asNeeded);
7405    Type site = parseType("site", json);
7406    if (site != null)
7407      res.setSite(site);
7408    if (json.has("route"))
7409      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
7410    if (json.has("method"))
7411      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7412    Type quantity = parseType("quantity", json);
7413    if (quantity != null)
7414      res.setQuantity(quantity);
7415    Type rate = parseType("rate", json);
7416    if (rate != null)
7417      res.setRate(rate);
7418    if (json.has("maxDosePerPeriod"))
7419      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
7420    return res;
7421  }
7422
7423  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
7424    MessageHeader res = new MessageHeader();
7425    parseDomainResourceProperties(json, res);
7426    if (json.has("timestamp"))
7427      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
7428    if (json.has("_timestamp"))
7429      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
7430    if (json.has("event"))
7431      res.setEvent(parseCoding(json.getAsJsonObject("event")));
7432    if (json.has("response"))
7433      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
7434    if (json.has("source"))
7435      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
7436    if (json.has("destination")) {
7437      JsonArray array = json.getAsJsonArray("destination");
7438      for (int i = 0; i < array.size(); i++) {
7439        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
7440      }
7441    };
7442    if (json.has("enterer"))
7443      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
7444    if (json.has("author"))
7445      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7446    if (json.has("receiver"))
7447      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
7448    if (json.has("responsible"))
7449      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
7450    if (json.has("reason"))
7451      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
7452    if (json.has("data")) {
7453      JsonArray array = json.getAsJsonArray("data");
7454      for (int i = 0; i < array.size(); i++) {
7455        res.getData().add(parseReference(array.get(i).getAsJsonObject()));
7456      }
7457    };
7458    return res;
7459  }
7460
7461  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7462    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
7463    parseBackboneProperties(json, res);
7464    if (json.has("identifier"))
7465      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
7466    if (json.has("_identifier"))
7467      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
7468    if (json.has("code"))
7469      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
7470    if (json.has("_code"))
7471      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7472    if (json.has("details"))
7473      res.setDetails(parseReference(json.getAsJsonObject("details")));
7474    return res;
7475  }
7476
7477  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7478    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
7479    parseBackboneProperties(json, res);
7480    if (json.has("name"))
7481      res.setNameElement(parseString(json.get("name").getAsString()));
7482    if (json.has("_name"))
7483      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7484    if (json.has("software"))
7485      res.setSoftwareElement(parseString(json.get("software").getAsString()));
7486    if (json.has("_software"))
7487      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
7488    if (json.has("version"))
7489      res.setVersionElement(parseString(json.get("version").getAsString()));
7490    if (json.has("_version"))
7491      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7492    if (json.has("contact"))
7493      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
7494    if (json.has("endpoint"))
7495      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
7496    if (json.has("_endpoint"))
7497      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
7498    return res;
7499  }
7500
7501  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
7502    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
7503    parseBackboneProperties(json, res);
7504    if (json.has("name"))
7505      res.setNameElement(parseString(json.get("name").getAsString()));
7506    if (json.has("_name"))
7507      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7508    if (json.has("target"))
7509      res.setTarget(parseReference(json.getAsJsonObject("target")));
7510    if (json.has("endpoint"))
7511      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
7512    if (json.has("_endpoint"))
7513      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
7514    return res;
7515  }
7516
7517  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
7518    NamingSystem res = new NamingSystem();
7519    parseDomainResourceProperties(json, res);
7520    if (json.has("name"))
7521      res.setNameElement(parseString(json.get("name").getAsString()));
7522    if (json.has("_name"))
7523      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7524    if (json.has("status"))
7525      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
7526    if (json.has("_status"))
7527      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7528    if (json.has("kind"))
7529      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
7530    if (json.has("_kind"))
7531      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
7532    if (json.has("publisher"))
7533      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7534    if (json.has("_publisher"))
7535      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7536    if (json.has("contact")) {
7537      JsonArray array = json.getAsJsonArray("contact");
7538      for (int i = 0; i < array.size(); i++) {
7539        res.getContact().add(parseNamingSystemNamingSystemContactComponent(array.get(i).getAsJsonObject(), res));
7540      }
7541    };
7542    if (json.has("responsible"))
7543      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
7544    if (json.has("_responsible"))
7545      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
7546    if (json.has("date"))
7547      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7548    if (json.has("_date"))
7549      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7550    if (json.has("type"))
7551      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7552    if (json.has("description"))
7553      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7554    if (json.has("_description"))
7555      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7556    if (json.has("useContext")) {
7557      JsonArray array = json.getAsJsonArray("useContext");
7558      for (int i = 0; i < array.size(); i++) {
7559        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7560      }
7561    };
7562    if (json.has("usage"))
7563      res.setUsageElement(parseString(json.get("usage").getAsString()));
7564    if (json.has("_usage"))
7565      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
7566    if (json.has("uniqueId")) {
7567      JsonArray array = json.getAsJsonArray("uniqueId");
7568      for (int i = 0; i < array.size(); i++) {
7569        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
7570      }
7571    };
7572    if (json.has("replacedBy"))
7573      res.setReplacedBy(parseReference(json.getAsJsonObject("replacedBy")));
7574    return res;
7575  }
7576
7577  protected NamingSystem.NamingSystemContactComponent parseNamingSystemNamingSystemContactComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
7578    NamingSystem.NamingSystemContactComponent res = new NamingSystem.NamingSystemContactComponent();
7579    parseBackboneProperties(json, res);
7580    if (json.has("name"))
7581      res.setNameElement(parseString(json.get("name").getAsString()));
7582    if (json.has("_name"))
7583      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7584    if (json.has("telecom")) {
7585      JsonArray array = json.getAsJsonArray("telecom");
7586      for (int i = 0; i < array.size(); i++) {
7587        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
7588      }
7589    };
7590    return res;
7591  }
7592
7593  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
7594    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
7595    parseBackboneProperties(json, res);
7596    if (json.has("type"))
7597      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
7598    if (json.has("_type"))
7599      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7600    if (json.has("value"))
7601      res.setValueElement(parseString(json.get("value").getAsString()));
7602    if (json.has("_value"))
7603      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7604    if (json.has("preferred"))
7605      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
7606    if (json.has("_preferred"))
7607      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
7608    if (json.has("period"))
7609      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7610    return res;
7611  }
7612
7613  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
7614    NutritionOrder res = new NutritionOrder();
7615    parseDomainResourceProperties(json, res);
7616    if (json.has("patient"))
7617      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7618    if (json.has("orderer"))
7619      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
7620    if (json.has("identifier")) {
7621      JsonArray array = json.getAsJsonArray("identifier");
7622      for (int i = 0; i < array.size(); i++) {
7623        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7624      }
7625    };
7626    if (json.has("encounter"))
7627      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7628    if (json.has("dateTime"))
7629      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7630    if (json.has("_dateTime"))
7631      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
7632    if (json.has("status"))
7633      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
7634    if (json.has("_status"))
7635      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7636    if (json.has("allergyIntolerance")) {
7637      JsonArray array = json.getAsJsonArray("allergyIntolerance");
7638      for (int i = 0; i < array.size(); i++) {
7639        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
7640      }
7641    };
7642    if (json.has("foodPreferenceModifier")) {
7643      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
7644      for (int i = 0; i < array.size(); i++) {
7645        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7646      }
7647    };
7648    if (json.has("excludeFoodModifier")) {
7649      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
7650      for (int i = 0; i < array.size(); i++) {
7651        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7652      }
7653    };
7654    if (json.has("oralDiet"))
7655      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
7656    if (json.has("supplement")) {
7657      JsonArray array = json.getAsJsonArray("supplement");
7658      for (int i = 0; i < array.size(); i++) {
7659        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
7660      }
7661    };
7662    if (json.has("enteralFormula"))
7663      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
7664    return res;
7665  }
7666
7667  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7668    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
7669    parseBackboneProperties(json, res);
7670    if (json.has("type")) {
7671      JsonArray array = json.getAsJsonArray("type");
7672      for (int i = 0; i < array.size(); i++) {
7673        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7674      }
7675    };
7676    if (json.has("schedule")) {
7677      JsonArray array = json.getAsJsonArray("schedule");
7678      for (int i = 0; i < array.size(); i++) {
7679        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
7680      }
7681    };
7682    if (json.has("nutrient")) {
7683      JsonArray array = json.getAsJsonArray("nutrient");
7684      for (int i = 0; i < array.size(); i++) {
7685        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
7686      }
7687    };
7688    if (json.has("texture")) {
7689      JsonArray array = json.getAsJsonArray("texture");
7690      for (int i = 0; i < array.size(); i++) {
7691        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
7692      }
7693    };
7694    if (json.has("fluidConsistencyType")) {
7695      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
7696      for (int i = 0; i < array.size(); i++) {
7697        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7698      }
7699    };
7700    if (json.has("instruction"))
7701      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
7702    if (json.has("_instruction"))
7703      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
7704    return res;
7705  }
7706
7707  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7708    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
7709    parseBackboneProperties(json, res);
7710    if (json.has("modifier"))
7711      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
7712    if (json.has("amount"))
7713      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
7714    return res;
7715  }
7716
7717  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7718    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
7719    parseBackboneProperties(json, res);
7720    if (json.has("modifier"))
7721      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
7722    if (json.has("foodType"))
7723      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
7724    return res;
7725  }
7726
7727  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7728    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
7729    parseBackboneProperties(json, res);
7730    if (json.has("type"))
7731      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7732    if (json.has("productName"))
7733      res.setProductNameElement(parseString(json.get("productName").getAsString()));
7734    if (json.has("_productName"))
7735      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
7736    if (json.has("schedule")) {
7737      JsonArray array = json.getAsJsonArray("schedule");
7738      for (int i = 0; i < array.size(); i++) {
7739        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
7740      }
7741    };
7742    if (json.has("quantity"))
7743      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7744    if (json.has("instruction"))
7745      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
7746    if (json.has("_instruction"))
7747      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
7748    return res;
7749  }
7750
7751  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7752    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
7753    parseBackboneProperties(json, res);
7754    if (json.has("baseFormulaType"))
7755      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
7756    if (json.has("baseFormulaProductName"))
7757      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
7758    if (json.has("_baseFormulaProductName"))
7759      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
7760    if (json.has("additiveType"))
7761      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
7762    if (json.has("additiveProductName"))
7763      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
7764    if (json.has("_additiveProductName"))
7765      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
7766    if (json.has("caloricDensity"))
7767      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
7768    if (json.has("routeofAdministration"))
7769      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
7770    if (json.has("administration")) {
7771      JsonArray array = json.getAsJsonArray("administration");
7772      for (int i = 0; i < array.size(); i++) {
7773        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
7774      }
7775    };
7776    if (json.has("maxVolumeToDeliver"))
7777      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
7778    if (json.has("administrationInstruction"))
7779      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
7780    if (json.has("_administrationInstruction"))
7781      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
7782    return res;
7783  }
7784
7785  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
7786    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
7787    parseBackboneProperties(json, res);
7788    if (json.has("schedule"))
7789      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
7790    if (json.has("quantity"))
7791      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7792    Type rate = parseType("rate", json);
7793    if (rate != null)
7794      res.setRate(rate);
7795    return res;
7796  }
7797
7798  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
7799    Observation res = new Observation();
7800    parseDomainResourceProperties(json, res);
7801    if (json.has("identifier")) {
7802      JsonArray array = json.getAsJsonArray("identifier");
7803      for (int i = 0; i < array.size(); i++) {
7804        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7805      }
7806    };
7807    if (json.has("status"))
7808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
7809    if (json.has("_status"))
7810      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7811    if (json.has("category"))
7812      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7813    if (json.has("code"))
7814      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7815    if (json.has("subject"))
7816      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7817    if (json.has("encounter"))
7818      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7819    Type effective = parseType("effective", json);
7820    if (effective != null)
7821      res.setEffective(effective);
7822    if (json.has("issued"))
7823      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7824    if (json.has("_issued"))
7825      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7826    if (json.has("performer")) {
7827      JsonArray array = json.getAsJsonArray("performer");
7828      for (int i = 0; i < array.size(); i++) {
7829        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7830      }
7831    };
7832    Type value = parseType("value", json);
7833    if (value != null)
7834      res.setValue(value);
7835    if (json.has("dataAbsentReason"))
7836      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
7837    if (json.has("interpretation"))
7838      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
7839    if (json.has("comments"))
7840      res.setCommentsElement(parseString(json.get("comments").getAsString()));
7841    if (json.has("_comments"))
7842      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
7843    if (json.has("bodySite"))
7844      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
7845    if (json.has("method"))
7846      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
7847    if (json.has("specimen"))
7848      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
7849    if (json.has("device"))
7850      res.setDevice(parseReference(json.getAsJsonObject("device")));
7851    if (json.has("referenceRange")) {
7852      JsonArray array = json.getAsJsonArray("referenceRange");
7853      for (int i = 0; i < array.size(); i++) {
7854        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
7855      }
7856    };
7857    if (json.has("related")) {
7858      JsonArray array = json.getAsJsonArray("related");
7859      for (int i = 0; i < array.size(); i++) {
7860        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
7861      }
7862    };
7863    if (json.has("component")) {
7864      JsonArray array = json.getAsJsonArray("component");
7865      for (int i = 0; i < array.size(); i++) {
7866        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
7867      }
7868    };
7869    return res;
7870  }
7871
7872  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7873    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
7874    parseBackboneProperties(json, res);
7875    if (json.has("low"))
7876      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
7877    if (json.has("high"))
7878      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
7879    if (json.has("meaning"))
7880      res.setMeaning(parseCodeableConcept(json.getAsJsonObject("meaning")));
7881    if (json.has("age"))
7882      res.setAge(parseRange(json.getAsJsonObject("age")));
7883    if (json.has("text"))
7884      res.setTextElement(parseString(json.get("text").getAsString()));
7885    if (json.has("_text"))
7886      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7887    return res;
7888  }
7889
7890  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7891    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
7892    parseBackboneProperties(json, res);
7893    if (json.has("type"))
7894      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
7895    if (json.has("_type"))
7896      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7897    if (json.has("target"))
7898      res.setTarget(parseReference(json.getAsJsonObject("target")));
7899    return res;
7900  }
7901
7902  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
7903    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
7904    parseBackboneProperties(json, res);
7905    if (json.has("code"))
7906      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7907    Type value = parseType("value", json);
7908    if (value != null)
7909      res.setValue(value);
7910    if (json.has("dataAbsentReason"))
7911      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
7912    if (json.has("referenceRange")) {
7913      JsonArray array = json.getAsJsonArray("referenceRange");
7914      for (int i = 0; i < array.size(); i++) {
7915        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
7916      }
7917    };
7918    return res;
7919  }
7920
7921  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
7922    OperationDefinition res = new OperationDefinition();
7923    parseDomainResourceProperties(json, res);
7924    if (json.has("url"))
7925      res.setUrlElement(parseUri(json.get("url").getAsString()));
7926    if (json.has("_url"))
7927      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7928    if (json.has("version"))
7929      res.setVersionElement(parseString(json.get("version").getAsString()));
7930    if (json.has("_version"))
7931      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7932    if (json.has("name"))
7933      res.setNameElement(parseString(json.get("name").getAsString()));
7934    if (json.has("_name"))
7935      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7936    if (json.has("status"))
7937      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
7938    if (json.has("_status"))
7939      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7940    if (json.has("kind"))
7941      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
7942    if (json.has("_kind"))
7943      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
7944    if (json.has("experimental"))
7945      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7946    if (json.has("_experimental"))
7947      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7948    if (json.has("publisher"))
7949      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7950    if (json.has("_publisher"))
7951      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7952    if (json.has("contact")) {
7953      JsonArray array = json.getAsJsonArray("contact");
7954      for (int i = 0; i < array.size(); i++) {
7955        res.getContact().add(parseOperationDefinitionOperationDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
7956      }
7957    };
7958    if (json.has("date"))
7959      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7960    if (json.has("_date"))
7961      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7962    if (json.has("description"))
7963      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7964    if (json.has("_description"))
7965      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7966    if (json.has("requirements"))
7967      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
7968    if (json.has("_requirements"))
7969      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
7970    if (json.has("idempotent"))
7971      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
7972    if (json.has("_idempotent"))
7973      parseElementProperties(json.getAsJsonObject("_idempotent"), res.getIdempotentElement());
7974    if (json.has("code"))
7975      res.setCodeElement(parseCode(json.get("code").getAsString()));
7976    if (json.has("_code"))
7977      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7978    if (json.has("notes"))
7979      res.setNotesElement(parseString(json.get("notes").getAsString()));
7980    if (json.has("_notes"))
7981      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
7982    if (json.has("base"))
7983      res.setBase(parseReference(json.getAsJsonObject("base")));
7984    if (json.has("system"))
7985      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
7986    if (json.has("_system"))
7987      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
7988    if (json.has("type")) {
7989      JsonArray array = json.getAsJsonArray("type");
7990      for (int i = 0; i < array.size(); i++) {
7991        res.getType().add(parseCode(array.get(i).getAsString()));
7992      }
7993    };
7994    if (json.has("_type")) {
7995      JsonArray array = json.getAsJsonArray("_type");
7996      for (int i = 0; i < array.size(); i++) {
7997        if (i == res.getType().size())
7998          res.getType().add(parseCode(null));
7999        if (array.get(i) instanceof JsonObject) 
8000          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
8001      }
8002    };
8003    if (json.has("instance"))
8004      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
8005    if (json.has("_instance"))
8006      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
8007    if (json.has("parameter")) {
8008      JsonArray array = json.getAsJsonArray("parameter");
8009      for (int i = 0; i < array.size(); i++) {
8010        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
8011      }
8012    };
8013    return res;
8014  }
8015
8016  protected OperationDefinition.OperationDefinitionContactComponent parseOperationDefinitionOperationDefinitionContactComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
8017    OperationDefinition.OperationDefinitionContactComponent res = new OperationDefinition.OperationDefinitionContactComponent();
8018    parseBackboneProperties(json, res);
8019    if (json.has("name"))
8020      res.setNameElement(parseString(json.get("name").getAsString()));
8021    if (json.has("_name"))
8022      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8023    if (json.has("telecom")) {
8024      JsonArray array = json.getAsJsonArray("telecom");
8025      for (int i = 0; i < array.size(); i++) {
8026        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8027      }
8028    };
8029    return res;
8030  }
8031
8032  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
8033    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
8034    parseBackboneProperties(json, res);
8035    if (json.has("name"))
8036      res.setNameElement(parseCode(json.get("name").getAsString()));
8037    if (json.has("_name"))
8038      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8039    if (json.has("use"))
8040      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
8041    if (json.has("_use"))
8042      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
8043    if (json.has("min"))
8044      res.setMinElement(parseInteger(json.get("min").getAsLong()));
8045    if (json.has("_min"))
8046      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
8047    if (json.has("max"))
8048      res.setMaxElement(parseString(json.get("max").getAsString()));
8049    if (json.has("_max"))
8050      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
8051    if (json.has("documentation"))
8052      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
8053    if (json.has("_documentation"))
8054      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
8055    if (json.has("type"))
8056      res.setTypeElement(parseCode(json.get("type").getAsString()));
8057    if (json.has("_type"))
8058      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8059    if (json.has("profile"))
8060      res.setProfile(parseReference(json.getAsJsonObject("profile")));
8061    if (json.has("binding"))
8062      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
8063    if (json.has("part")) {
8064      JsonArray array = json.getAsJsonArray("part");
8065      for (int i = 0; i < array.size(); i++) {
8066        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
8067      }
8068    };
8069    return res;
8070  }
8071
8072  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
8073    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
8074    parseBackboneProperties(json, res);
8075    if (json.has("strength"))
8076      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
8077    if (json.has("_strength"))
8078      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
8079    Type valueSet = parseType("valueSet", json);
8080    if (valueSet != null)
8081      res.setValueSet(valueSet);
8082    return res;
8083  }
8084
8085  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
8086    OperationOutcome res = new OperationOutcome();
8087    parseDomainResourceProperties(json, res);
8088    if (json.has("issue")) {
8089      JsonArray array = json.getAsJsonArray("issue");
8090      for (int i = 0; i < array.size(); i++) {
8091        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
8092      }
8093    };
8094    return res;
8095  }
8096
8097  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
8098    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
8099    parseBackboneProperties(json, res);
8100    if (json.has("severity"))
8101      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
8102    if (json.has("_severity"))
8103      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
8104    if (json.has("code"))
8105      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
8106    if (json.has("_code"))
8107      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8108    if (json.has("details"))
8109      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
8110    if (json.has("diagnostics"))
8111      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
8112    if (json.has("_diagnostics"))
8113      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
8114    if (json.has("location")) {
8115      JsonArray array = json.getAsJsonArray("location");
8116      for (int i = 0; i < array.size(); i++) {
8117        res.getLocation().add(parseString(array.get(i).getAsString()));
8118      }
8119    };
8120    if (json.has("_location")) {
8121      JsonArray array = json.getAsJsonArray("_location");
8122      for (int i = 0; i < array.size(); i++) {
8123        if (i == res.getLocation().size())
8124          res.getLocation().add(parseString(null));
8125        if (array.get(i) instanceof JsonObject) 
8126          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
8127      }
8128    };
8129    return res;
8130  }
8131
8132  protected Order parseOrder(JsonObject json) throws IOException, FHIRFormatError {
8133    Order res = new Order();
8134    parseDomainResourceProperties(json, res);
8135    if (json.has("identifier")) {
8136      JsonArray array = json.getAsJsonArray("identifier");
8137      for (int i = 0; i < array.size(); i++) {
8138        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8139      }
8140    };
8141    if (json.has("date"))
8142      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8143    if (json.has("_date"))
8144      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8145    if (json.has("subject"))
8146      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8147    if (json.has("source"))
8148      res.setSource(parseReference(json.getAsJsonObject("source")));
8149    if (json.has("target"))
8150      res.setTarget(parseReference(json.getAsJsonObject("target")));
8151    Type reason = parseType("reason", json);
8152    if (reason != null)
8153      res.setReason(reason);
8154    if (json.has("when"))
8155      res.setWhen(parseOrderOrderWhenComponent(json.getAsJsonObject("when"), res));
8156    if (json.has("detail")) {
8157      JsonArray array = json.getAsJsonArray("detail");
8158      for (int i = 0; i < array.size(); i++) {
8159        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8160      }
8161    };
8162    return res;
8163  }
8164
8165  protected Order.OrderWhenComponent parseOrderOrderWhenComponent(JsonObject json, Order owner) throws IOException, FHIRFormatError {
8166    Order.OrderWhenComponent res = new Order.OrderWhenComponent();
8167    parseBackboneProperties(json, res);
8168    if (json.has("code"))
8169      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8170    if (json.has("schedule"))
8171      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
8172    return res;
8173  }
8174
8175  protected OrderResponse parseOrderResponse(JsonObject json) throws IOException, FHIRFormatError {
8176    OrderResponse res = new OrderResponse();
8177    parseDomainResourceProperties(json, res);
8178    if (json.has("identifier")) {
8179      JsonArray array = json.getAsJsonArray("identifier");
8180      for (int i = 0; i < array.size(); i++) {
8181        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8182      }
8183    };
8184    if (json.has("request"))
8185      res.setRequest(parseReference(json.getAsJsonObject("request")));
8186    if (json.has("date"))
8187      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8188    if (json.has("_date"))
8189      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8190    if (json.has("who"))
8191      res.setWho(parseReference(json.getAsJsonObject("who")));
8192    if (json.has("orderStatus"))
8193      res.setOrderStatusElement(parseEnumeration(json.get("orderStatus").getAsString(), OrderResponse.OrderStatus.NULL, new OrderResponse.OrderStatusEnumFactory()));
8194    if (json.has("_orderStatus"))
8195      parseElementProperties(json.getAsJsonObject("_orderStatus"), res.getOrderStatusElement());
8196    if (json.has("description"))
8197      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8198    if (json.has("_description"))
8199      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8200    if (json.has("fulfillment")) {
8201      JsonArray array = json.getAsJsonArray("fulfillment");
8202      for (int i = 0; i < array.size(); i++) {
8203        res.getFulfillment().add(parseReference(array.get(i).getAsJsonObject()));
8204      }
8205    };
8206    return res;
8207  }
8208
8209  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
8210    Organization res = new Organization();
8211    parseDomainResourceProperties(json, res);
8212    if (json.has("identifier")) {
8213      JsonArray array = json.getAsJsonArray("identifier");
8214      for (int i = 0; i < array.size(); i++) {
8215        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8216      }
8217    };
8218    if (json.has("active"))
8219      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8220    if (json.has("_active"))
8221      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8222    if (json.has("type"))
8223      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8224    if (json.has("name"))
8225      res.setNameElement(parseString(json.get("name").getAsString()));
8226    if (json.has("_name"))
8227      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8228    if (json.has("telecom")) {
8229      JsonArray array = json.getAsJsonArray("telecom");
8230      for (int i = 0; i < array.size(); i++) {
8231        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8232      }
8233    };
8234    if (json.has("address")) {
8235      JsonArray array = json.getAsJsonArray("address");
8236      for (int i = 0; i < array.size(); i++) {
8237        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8238      }
8239    };
8240    if (json.has("partOf"))
8241      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
8242    if (json.has("contact")) {
8243      JsonArray array = json.getAsJsonArray("contact");
8244      for (int i = 0; i < array.size(); i++) {
8245        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
8246      }
8247    };
8248    return res;
8249  }
8250
8251  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
8252    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
8253    parseBackboneProperties(json, res);
8254    if (json.has("purpose"))
8255      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
8256    if (json.has("name"))
8257      res.setName(parseHumanName(json.getAsJsonObject("name")));
8258    if (json.has("telecom")) {
8259      JsonArray array = json.getAsJsonArray("telecom");
8260      for (int i = 0; i < array.size(); i++) {
8261        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8262      }
8263    };
8264    if (json.has("address"))
8265      res.setAddress(parseAddress(json.getAsJsonObject("address")));
8266    return res;
8267  }
8268
8269  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
8270    Patient res = new Patient();
8271    parseDomainResourceProperties(json, res);
8272    if (json.has("identifier")) {
8273      JsonArray array = json.getAsJsonArray("identifier");
8274      for (int i = 0; i < array.size(); i++) {
8275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8276      }
8277    };
8278    if (json.has("active"))
8279      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8280    if (json.has("_active"))
8281      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8282    if (json.has("name")) {
8283      JsonArray array = json.getAsJsonArray("name");
8284      for (int i = 0; i < array.size(); i++) {
8285        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
8286      }
8287    };
8288    if (json.has("telecom")) {
8289      JsonArray array = json.getAsJsonArray("telecom");
8290      for (int i = 0; i < array.size(); i++) {
8291        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8292      }
8293    };
8294    if (json.has("gender"))
8295      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8296    if (json.has("_gender"))
8297      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8298    if (json.has("birthDate"))
8299      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8300    if (json.has("_birthDate"))
8301      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8302    Type deceased = parseType("deceased", json);
8303    if (deceased != null)
8304      res.setDeceased(deceased);
8305    if (json.has("address")) {
8306      JsonArray array = json.getAsJsonArray("address");
8307      for (int i = 0; i < array.size(); i++) {
8308        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8309      }
8310    };
8311    if (json.has("maritalStatus"))
8312      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
8313    Type multipleBirth = parseType("multipleBirth", json);
8314    if (multipleBirth != null)
8315      res.setMultipleBirth(multipleBirth);
8316    if (json.has("photo")) {
8317      JsonArray array = json.getAsJsonArray("photo");
8318      for (int i = 0; i < array.size(); i++) {
8319        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
8320      }
8321    };
8322    if (json.has("contact")) {
8323      JsonArray array = json.getAsJsonArray("contact");
8324      for (int i = 0; i < array.size(); i++) {
8325        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
8326      }
8327    };
8328    if (json.has("animal"))
8329      res.setAnimal(parsePatientAnimalComponent(json.getAsJsonObject("animal"), res));
8330    if (json.has("communication")) {
8331      JsonArray array = json.getAsJsonArray("communication");
8332      for (int i = 0; i < array.size(); i++) {
8333        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
8334      }
8335    };
8336    if (json.has("careProvider")) {
8337      JsonArray array = json.getAsJsonArray("careProvider");
8338      for (int i = 0; i < array.size(); i++) {
8339        res.getCareProvider().add(parseReference(array.get(i).getAsJsonObject()));
8340      }
8341    };
8342    if (json.has("managingOrganization"))
8343      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8344    if (json.has("link")) {
8345      JsonArray array = json.getAsJsonArray("link");
8346      for (int i = 0; i < array.size(); i++) {
8347        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
8348      }
8349    };
8350    return res;
8351  }
8352
8353  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8354    Patient.ContactComponent res = new Patient.ContactComponent();
8355    parseBackboneProperties(json, res);
8356    if (json.has("relationship")) {
8357      JsonArray array = json.getAsJsonArray("relationship");
8358      for (int i = 0; i < array.size(); i++) {
8359        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8360      }
8361    };
8362    if (json.has("name"))
8363      res.setName(parseHumanName(json.getAsJsonObject("name")));
8364    if (json.has("telecom")) {
8365      JsonArray array = json.getAsJsonArray("telecom");
8366      for (int i = 0; i < array.size(); i++) {
8367        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8368      }
8369    };
8370    if (json.has("address"))
8371      res.setAddress(parseAddress(json.getAsJsonObject("address")));
8372    if (json.has("gender"))
8373      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8374    if (json.has("_gender"))
8375      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8376    if (json.has("organization"))
8377      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8378    if (json.has("period"))
8379      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8380    return res;
8381  }
8382
8383  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8384    Patient.AnimalComponent res = new Patient.AnimalComponent();
8385    parseBackboneProperties(json, res);
8386    if (json.has("species"))
8387      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
8388    if (json.has("breed"))
8389      res.setBreed(parseCodeableConcept(json.getAsJsonObject("breed")));
8390    if (json.has("genderStatus"))
8391      res.setGenderStatus(parseCodeableConcept(json.getAsJsonObject("genderStatus")));
8392    return res;
8393  }
8394
8395  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8396    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
8397    parseBackboneProperties(json, res);
8398    if (json.has("language"))
8399      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
8400    if (json.has("preferred"))
8401      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
8402    if (json.has("_preferred"))
8403      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
8404    return res;
8405  }
8406
8407  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
8408    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
8409    parseBackboneProperties(json, res);
8410    if (json.has("other"))
8411      res.setOther(parseReference(json.getAsJsonObject("other")));
8412    if (json.has("type"))
8413      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
8414    if (json.has("_type"))
8415      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8416    return res;
8417  }
8418
8419  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
8420    PaymentNotice res = new PaymentNotice();
8421    parseDomainResourceProperties(json, res);
8422    if (json.has("identifier")) {
8423      JsonArray array = json.getAsJsonArray("identifier");
8424      for (int i = 0; i < array.size(); i++) {
8425        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8426      }
8427    };
8428    if (json.has("ruleset"))
8429      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8430    if (json.has("originalRuleset"))
8431      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8432    if (json.has("created"))
8433      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8434    if (json.has("_created"))
8435      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8436    if (json.has("target"))
8437      res.setTarget(parseReference(json.getAsJsonObject("target")));
8438    if (json.has("provider"))
8439      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8440    if (json.has("organization"))
8441      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8442    if (json.has("request"))
8443      res.setRequest(parseReference(json.getAsJsonObject("request")));
8444    if (json.has("response"))
8445      res.setResponse(parseReference(json.getAsJsonObject("response")));
8446    if (json.has("paymentStatus"))
8447      res.setPaymentStatus(parseCoding(json.getAsJsonObject("paymentStatus")));
8448    return res;
8449  }
8450
8451  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
8452    PaymentReconciliation res = new PaymentReconciliation();
8453    parseDomainResourceProperties(json, res);
8454    if (json.has("identifier")) {
8455      JsonArray array = json.getAsJsonArray("identifier");
8456      for (int i = 0; i < array.size(); i++) {
8457        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8458      }
8459    };
8460    if (json.has("request"))
8461      res.setRequest(parseReference(json.getAsJsonObject("request")));
8462    if (json.has("outcome"))
8463      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8464    if (json.has("_outcome"))
8465      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8466    if (json.has("disposition"))
8467      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8468    if (json.has("_disposition"))
8469      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8470    if (json.has("ruleset"))
8471      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8472    if (json.has("originalRuleset"))
8473      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8474    if (json.has("created"))
8475      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8476    if (json.has("_created"))
8477      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8478    if (json.has("period"))
8479      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8480    if (json.has("organization"))
8481      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8482    if (json.has("requestProvider"))
8483      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8484    if (json.has("requestOrganization"))
8485      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
8486    if (json.has("detail")) {
8487      JsonArray array = json.getAsJsonArray("detail");
8488      for (int i = 0; i < array.size(); i++) {
8489        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
8490      }
8491    };
8492    if (json.has("form"))
8493      res.setForm(parseCoding(json.getAsJsonObject("form")));
8494    if (json.has("total"))
8495      res.setTotal(parseMoney(json.getAsJsonObject("total")));
8496    if (json.has("note")) {
8497      JsonArray array = json.getAsJsonArray("note");
8498      for (int i = 0; i < array.size(); i++) {
8499        res.getNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
8500      }
8501    };
8502    return res;
8503  }
8504
8505  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
8506    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
8507    parseBackboneProperties(json, res);
8508    if (json.has("type"))
8509      res.setType(parseCoding(json.getAsJsonObject("type")));
8510    if (json.has("request"))
8511      res.setRequest(parseReference(json.getAsJsonObject("request")));
8512    if (json.has("responce"))
8513      res.setResponce(parseReference(json.getAsJsonObject("responce")));
8514    if (json.has("submitter"))
8515      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
8516    if (json.has("payee"))
8517      res.setPayee(parseReference(json.getAsJsonObject("payee")));
8518    if (json.has("date"))
8519      res.setDateElement(parseDate(json.get("date").getAsString()));
8520    if (json.has("_date"))
8521      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8522    if (json.has("amount"))
8523      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
8524    return res;
8525  }
8526
8527  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
8528    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
8529    parseBackboneProperties(json, res);
8530    if (json.has("type"))
8531      res.setType(parseCoding(json.getAsJsonObject("type")));
8532    if (json.has("text"))
8533      res.setTextElement(parseString(json.get("text").getAsString()));
8534    if (json.has("_text"))
8535      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
8536    return res;
8537  }
8538
8539  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
8540    Person res = new Person();
8541    parseDomainResourceProperties(json, res);
8542    if (json.has("identifier")) {
8543      JsonArray array = json.getAsJsonArray("identifier");
8544      for (int i = 0; i < array.size(); i++) {
8545        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8546      }
8547    };
8548    if (json.has("name")) {
8549      JsonArray array = json.getAsJsonArray("name");
8550      for (int i = 0; i < array.size(); i++) {
8551        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
8552      }
8553    };
8554    if (json.has("telecom")) {
8555      JsonArray array = json.getAsJsonArray("telecom");
8556      for (int i = 0; i < array.size(); i++) {
8557        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8558      }
8559    };
8560    if (json.has("gender"))
8561      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8562    if (json.has("_gender"))
8563      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8564    if (json.has("birthDate"))
8565      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8566    if (json.has("_birthDate"))
8567      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8568    if (json.has("address")) {
8569      JsonArray array = json.getAsJsonArray("address");
8570      for (int i = 0; i < array.size(); i++) {
8571        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8572      }
8573    };
8574    if (json.has("photo"))
8575      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
8576    if (json.has("managingOrganization"))
8577      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8578    if (json.has("active"))
8579      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8580    if (json.has("_active"))
8581      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8582    if (json.has("link")) {
8583      JsonArray array = json.getAsJsonArray("link");
8584      for (int i = 0; i < array.size(); i++) {
8585        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
8586      }
8587    };
8588    return res;
8589  }
8590
8591  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
8592    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
8593    parseBackboneProperties(json, res);
8594    if (json.has("target"))
8595      res.setTarget(parseReference(json.getAsJsonObject("target")));
8596    if (json.has("assurance"))
8597      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
8598    if (json.has("_assurance"))
8599      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
8600    return res;
8601  }
8602
8603  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
8604    Practitioner res = new Practitioner();
8605    parseDomainResourceProperties(json, res);
8606    if (json.has("identifier")) {
8607      JsonArray array = json.getAsJsonArray("identifier");
8608      for (int i = 0; i < array.size(); i++) {
8609        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8610      }
8611    };
8612    if (json.has("active"))
8613      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
8614    if (json.has("_active"))
8615      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
8616    if (json.has("name"))
8617      res.setName(parseHumanName(json.getAsJsonObject("name")));
8618    if (json.has("telecom")) {
8619      JsonArray array = json.getAsJsonArray("telecom");
8620      for (int i = 0; i < array.size(); i++) {
8621        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
8622      }
8623    };
8624    if (json.has("address")) {
8625      JsonArray array = json.getAsJsonArray("address");
8626      for (int i = 0; i < array.size(); i++) {
8627        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
8628      }
8629    };
8630    if (json.has("gender"))
8631      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
8632    if (json.has("_gender"))
8633      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
8634    if (json.has("birthDate"))
8635      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
8636    if (json.has("_birthDate"))
8637      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
8638    if (json.has("photo")) {
8639      JsonArray array = json.getAsJsonArray("photo");
8640      for (int i = 0; i < array.size(); i++) {
8641        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
8642      }
8643    };
8644    if (json.has("practitionerRole")) {
8645      JsonArray array = json.getAsJsonArray("practitionerRole");
8646      for (int i = 0; i < array.size(); i++) {
8647        res.getPractitionerRole().add(parsePractitionerPractitionerPractitionerRoleComponent(array.get(i).getAsJsonObject(), res));
8648      }
8649    };
8650    if (json.has("qualification")) {
8651      JsonArray array = json.getAsJsonArray("qualification");
8652      for (int i = 0; i < array.size(); i++) {
8653        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
8654      }
8655    };
8656    if (json.has("communication")) {
8657      JsonArray array = json.getAsJsonArray("communication");
8658      for (int i = 0; i < array.size(); i++) {
8659        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8660      }
8661    };
8662    return res;
8663  }
8664
8665  protected Practitioner.PractitionerPractitionerRoleComponent parsePractitionerPractitionerPractitionerRoleComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
8666    Practitioner.PractitionerPractitionerRoleComponent res = new Practitioner.PractitionerPractitionerRoleComponent();
8667    parseBackboneProperties(json, res);
8668    if (json.has("managingOrganization"))
8669      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8670    if (json.has("role"))
8671      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8672    if (json.has("specialty")) {
8673      JsonArray array = json.getAsJsonArray("specialty");
8674      for (int i = 0; i < array.size(); i++) {
8675        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8676      }
8677    };
8678    if (json.has("period"))
8679      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8680    if (json.has("location")) {
8681      JsonArray array = json.getAsJsonArray("location");
8682      for (int i = 0; i < array.size(); i++) {
8683        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
8684      }
8685    };
8686    if (json.has("healthcareService")) {
8687      JsonArray array = json.getAsJsonArray("healthcareService");
8688      for (int i = 0; i < array.size(); i++) {
8689        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
8690      }
8691    };
8692    return res;
8693  }
8694
8695  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
8696    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
8697    parseBackboneProperties(json, res);
8698    if (json.has("identifier")) {
8699      JsonArray array = json.getAsJsonArray("identifier");
8700      for (int i = 0; i < array.size(); i++) {
8701        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8702      }
8703    };
8704    if (json.has("code"))
8705      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8706    if (json.has("period"))
8707      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8708    if (json.has("issuer"))
8709      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
8710    return res;
8711  }
8712
8713  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
8714    Procedure res = new Procedure();
8715    parseDomainResourceProperties(json, res);
8716    if (json.has("identifier")) {
8717      JsonArray array = json.getAsJsonArray("identifier");
8718      for (int i = 0; i < array.size(); i++) {
8719        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8720      }
8721    };
8722    if (json.has("subject"))
8723      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8724    if (json.has("status"))
8725      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
8726    if (json.has("_status"))
8727      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8728    if (json.has("category"))
8729      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8730    if (json.has("code"))
8731      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8732    if (json.has("notPerformed"))
8733      res.setNotPerformedElement(parseBoolean(json.get("notPerformed").getAsBoolean()));
8734    if (json.has("_notPerformed"))
8735      parseElementProperties(json.getAsJsonObject("_notPerformed"), res.getNotPerformedElement());
8736    if (json.has("reasonNotPerformed")) {
8737      JsonArray array = json.getAsJsonArray("reasonNotPerformed");
8738      for (int i = 0; i < array.size(); i++) {
8739        res.getReasonNotPerformed().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8740      }
8741    };
8742    if (json.has("bodySite")) {
8743      JsonArray array = json.getAsJsonArray("bodySite");
8744      for (int i = 0; i < array.size(); i++) {
8745        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8746      }
8747    };
8748    Type reason = parseType("reason", json);
8749    if (reason != null)
8750      res.setReason(reason);
8751    if (json.has("performer")) {
8752      JsonArray array = json.getAsJsonArray("performer");
8753      for (int i = 0; i < array.size(); i++) {
8754        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
8755      }
8756    };
8757    Type performed = parseType("performed", json);
8758    if (performed != null)
8759      res.setPerformed(performed);
8760    if (json.has("encounter"))
8761      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8762    if (json.has("location"))
8763      res.setLocation(parseReference(json.getAsJsonObject("location")));
8764    if (json.has("outcome"))
8765      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8766    if (json.has("report")) {
8767      JsonArray array = json.getAsJsonArray("report");
8768      for (int i = 0; i < array.size(); i++) {
8769        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
8770      }
8771    };
8772    if (json.has("complication")) {
8773      JsonArray array = json.getAsJsonArray("complication");
8774      for (int i = 0; i < array.size(); i++) {
8775        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8776      }
8777    };
8778    if (json.has("followUp")) {
8779      JsonArray array = json.getAsJsonArray("followUp");
8780      for (int i = 0; i < array.size(); i++) {
8781        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8782      }
8783    };
8784    if (json.has("request"))
8785      res.setRequest(parseReference(json.getAsJsonObject("request")));
8786    if (json.has("notes")) {
8787      JsonArray array = json.getAsJsonArray("notes");
8788      for (int i = 0; i < array.size(); i++) {
8789        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
8790      }
8791    };
8792    if (json.has("focalDevice")) {
8793      JsonArray array = json.getAsJsonArray("focalDevice");
8794      for (int i = 0; i < array.size(); i++) {
8795        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
8796      }
8797    };
8798    if (json.has("used")) {
8799      JsonArray array = json.getAsJsonArray("used");
8800      for (int i = 0; i < array.size(); i++) {
8801        res.getUsed().add(parseReference(array.get(i).getAsJsonObject()));
8802      }
8803    };
8804    return res;
8805  }
8806
8807  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
8808    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
8809    parseBackboneProperties(json, res);
8810    if (json.has("actor"))
8811      res.setActor(parseReference(json.getAsJsonObject("actor")));
8812    if (json.has("role"))
8813      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8814    return res;
8815  }
8816
8817  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
8818    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
8819    parseBackboneProperties(json, res);
8820    if (json.has("action"))
8821      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
8822    if (json.has("manipulated"))
8823      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
8824    return res;
8825  }
8826
8827  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
8828    ProcedureRequest res = new ProcedureRequest();
8829    parseDomainResourceProperties(json, res);
8830    if (json.has("identifier")) {
8831      JsonArray array = json.getAsJsonArray("identifier");
8832      for (int i = 0; i < array.size(); i++) {
8833        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8834      }
8835    };
8836    if (json.has("subject"))
8837      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8838    if (json.has("code"))
8839      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8840    if (json.has("bodySite")) {
8841      JsonArray array = json.getAsJsonArray("bodySite");
8842      for (int i = 0; i < array.size(); i++) {
8843        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8844      }
8845    };
8846    Type reason = parseType("reason", json);
8847    if (reason != null)
8848      res.setReason(reason);
8849    Type scheduled = parseType("scheduled", json);
8850    if (scheduled != null)
8851      res.setScheduled(scheduled);
8852    if (json.has("encounter"))
8853      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8854    if (json.has("performer"))
8855      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8856    if (json.has("status"))
8857      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
8858    if (json.has("_status"))
8859      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8860    if (json.has("notes")) {
8861      JsonArray array = json.getAsJsonArray("notes");
8862      for (int i = 0; i < array.size(); i++) {
8863        res.getNotes().add(parseAnnotation(array.get(i).getAsJsonObject()));
8864      }
8865    };
8866    Type asNeeded = parseType("asNeeded", json);
8867    if (asNeeded != null)
8868      res.setAsNeeded(asNeeded);
8869    if (json.has("orderedOn"))
8870      res.setOrderedOnElement(parseDateTime(json.get("orderedOn").getAsString()));
8871    if (json.has("_orderedOn"))
8872      parseElementProperties(json.getAsJsonObject("_orderedOn"), res.getOrderedOnElement());
8873    if (json.has("orderer"))
8874      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
8875    if (json.has("priority"))
8876      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
8877    if (json.has("_priority"))
8878      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
8879    return res;
8880  }
8881
8882  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
8883    ProcessRequest res = new ProcessRequest();
8884    parseDomainResourceProperties(json, res);
8885    if (json.has("action"))
8886      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
8887    if (json.has("_action"))
8888      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
8889    if (json.has("identifier")) {
8890      JsonArray array = json.getAsJsonArray("identifier");
8891      for (int i = 0; i < array.size(); i++) {
8892        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8893      }
8894    };
8895    if (json.has("ruleset"))
8896      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8897    if (json.has("originalRuleset"))
8898      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8899    if (json.has("created"))
8900      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8901    if (json.has("_created"))
8902      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8903    if (json.has("target"))
8904      res.setTarget(parseReference(json.getAsJsonObject("target")));
8905    if (json.has("provider"))
8906      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8907    if (json.has("organization"))
8908      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8909    if (json.has("request"))
8910      res.setRequest(parseReference(json.getAsJsonObject("request")));
8911    if (json.has("response"))
8912      res.setResponse(parseReference(json.getAsJsonObject("response")));
8913    if (json.has("nullify"))
8914      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
8915    if (json.has("_nullify"))
8916      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
8917    if (json.has("reference"))
8918      res.setReferenceElement(parseString(json.get("reference").getAsString()));
8919    if (json.has("_reference"))
8920      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
8921    if (json.has("item")) {
8922      JsonArray array = json.getAsJsonArray("item");
8923      for (int i = 0; i < array.size(); i++) {
8924        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
8925      }
8926    };
8927    if (json.has("include")) {
8928      JsonArray array = json.getAsJsonArray("include");
8929      for (int i = 0; i < array.size(); i++) {
8930        res.getInclude().add(parseString(array.get(i).getAsString()));
8931      }
8932    };
8933    if (json.has("_include")) {
8934      JsonArray array = json.getAsJsonArray("_include");
8935      for (int i = 0; i < array.size(); i++) {
8936        if (i == res.getInclude().size())
8937          res.getInclude().add(parseString(null));
8938        if (array.get(i) instanceof JsonObject) 
8939          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
8940      }
8941    };
8942    if (json.has("exclude")) {
8943      JsonArray array = json.getAsJsonArray("exclude");
8944      for (int i = 0; i < array.size(); i++) {
8945        res.getExclude().add(parseString(array.get(i).getAsString()));
8946      }
8947    };
8948    if (json.has("_exclude")) {
8949      JsonArray array = json.getAsJsonArray("_exclude");
8950      for (int i = 0; i < array.size(); i++) {
8951        if (i == res.getExclude().size())
8952          res.getExclude().add(parseString(null));
8953        if (array.get(i) instanceof JsonObject) 
8954          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
8955      }
8956    };
8957    if (json.has("period"))
8958      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8959    return res;
8960  }
8961
8962  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
8963    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
8964    parseBackboneProperties(json, res);
8965    if (json.has("sequenceLinkId"))
8966      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
8967    if (json.has("_sequenceLinkId"))
8968      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
8969    return res;
8970  }
8971
8972  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
8973    ProcessResponse res = new ProcessResponse();
8974    parseDomainResourceProperties(json, res);
8975    if (json.has("identifier")) {
8976      JsonArray array = json.getAsJsonArray("identifier");
8977      for (int i = 0; i < array.size(); i++) {
8978        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8979      }
8980    };
8981    if (json.has("request"))
8982      res.setRequest(parseReference(json.getAsJsonObject("request")));
8983    if (json.has("outcome"))
8984      res.setOutcome(parseCoding(json.getAsJsonObject("outcome")));
8985    if (json.has("disposition"))
8986      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8987    if (json.has("_disposition"))
8988      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8989    if (json.has("ruleset"))
8990      res.setRuleset(parseCoding(json.getAsJsonObject("ruleset")));
8991    if (json.has("originalRuleset"))
8992      res.setOriginalRuleset(parseCoding(json.getAsJsonObject("originalRuleset")));
8993    if (json.has("created"))
8994      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8995    if (json.has("_created"))
8996      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8997    if (json.has("organization"))
8998      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8999    if (json.has("requestProvider"))
9000      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
9001    if (json.has("requestOrganization"))
9002      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
9003    if (json.has("form"))
9004      res.setForm(parseCoding(json.getAsJsonObject("form")));
9005    if (json.has("notes")) {
9006      JsonArray array = json.getAsJsonArray("notes");
9007      for (int i = 0; i < array.size(); i++) {
9008        res.getNotes().add(parseProcessResponseProcessResponseNotesComponent(array.get(i).getAsJsonObject(), res));
9009      }
9010    };
9011    if (json.has("error")) {
9012      JsonArray array = json.getAsJsonArray("error");
9013      for (int i = 0; i < array.size(); i++) {
9014        res.getError().add(parseCoding(array.get(i).getAsJsonObject()));
9015      }
9016    };
9017    return res;
9018  }
9019
9020  protected ProcessResponse.ProcessResponseNotesComponent parseProcessResponseProcessResponseNotesComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
9021    ProcessResponse.ProcessResponseNotesComponent res = new ProcessResponse.ProcessResponseNotesComponent();
9022    parseBackboneProperties(json, res);
9023    if (json.has("type"))
9024      res.setType(parseCoding(json.getAsJsonObject("type")));
9025    if (json.has("text"))
9026      res.setTextElement(parseString(json.get("text").getAsString()));
9027    if (json.has("_text"))
9028      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9029    return res;
9030  }
9031
9032  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
9033    Provenance res = new Provenance();
9034    parseDomainResourceProperties(json, res);
9035    if (json.has("target")) {
9036      JsonArray array = json.getAsJsonArray("target");
9037      for (int i = 0; i < array.size(); i++) {
9038        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
9039      }
9040    };
9041    if (json.has("period"))
9042      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9043    if (json.has("recorded"))
9044      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
9045    if (json.has("_recorded"))
9046      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
9047    if (json.has("reason")) {
9048      JsonArray array = json.getAsJsonArray("reason");
9049      for (int i = 0; i < array.size(); i++) {
9050        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9051      }
9052    };
9053    if (json.has("activity"))
9054      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
9055    if (json.has("location"))
9056      res.setLocation(parseReference(json.getAsJsonObject("location")));
9057    if (json.has("policy")) {
9058      JsonArray array = json.getAsJsonArray("policy");
9059      for (int i = 0; i < array.size(); i++) {
9060        res.getPolicy().add(parseUri(array.get(i).getAsString()));
9061      }
9062    };
9063    if (json.has("_policy")) {
9064      JsonArray array = json.getAsJsonArray("_policy");
9065      for (int i = 0; i < array.size(); i++) {
9066        if (i == res.getPolicy().size())
9067          res.getPolicy().add(parseUri(null));
9068        if (array.get(i) instanceof JsonObject) 
9069          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
9070      }
9071    };
9072    if (json.has("agent")) {
9073      JsonArray array = json.getAsJsonArray("agent");
9074      for (int i = 0; i < array.size(); i++) {
9075        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
9076      }
9077    };
9078    if (json.has("entity")) {
9079      JsonArray array = json.getAsJsonArray("entity");
9080      for (int i = 0; i < array.size(); i++) {
9081        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
9082      }
9083    };
9084    if (json.has("signature")) {
9085      JsonArray array = json.getAsJsonArray("signature");
9086      for (int i = 0; i < array.size(); i++) {
9087        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9088      }
9089    };
9090    return res;
9091  }
9092
9093  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9094    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
9095    parseBackboneProperties(json, res);
9096    if (json.has("role"))
9097      res.setRole(parseCoding(json.getAsJsonObject("role")));
9098    if (json.has("actor"))
9099      res.setActor(parseReference(json.getAsJsonObject("actor")));
9100    if (json.has("userId"))
9101      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
9102    if (json.has("relatedAgent")) {
9103      JsonArray array = json.getAsJsonArray("relatedAgent");
9104      for (int i = 0; i < array.size(); i++) {
9105        res.getRelatedAgent().add(parseProvenanceProvenanceAgentRelatedAgentComponent(array.get(i).getAsJsonObject(), owner));
9106      }
9107    };
9108    return res;
9109  }
9110
9111  protected Provenance.ProvenanceAgentRelatedAgentComponent parseProvenanceProvenanceAgentRelatedAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9112    Provenance.ProvenanceAgentRelatedAgentComponent res = new Provenance.ProvenanceAgentRelatedAgentComponent();
9113    parseBackboneProperties(json, res);
9114    if (json.has("type"))
9115      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9116    if (json.has("target"))
9117      res.setTargetElement(parseUri(json.get("target").getAsString()));
9118    if (json.has("_target"))
9119      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
9120    return res;
9121  }
9122
9123  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
9124    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
9125    parseBackboneProperties(json, res);
9126    if (json.has("role"))
9127      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
9128    if (json.has("_role"))
9129      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
9130    if (json.has("type"))
9131      res.setType(parseCoding(json.getAsJsonObject("type")));
9132    if (json.has("reference"))
9133      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
9134    if (json.has("_reference"))
9135      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
9136    if (json.has("display"))
9137      res.setDisplayElement(parseString(json.get("display").getAsString()));
9138    if (json.has("_display"))
9139      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
9140    if (json.has("agent"))
9141      res.setAgent(parseProvenanceProvenanceAgentComponent(json.getAsJsonObject("agent"), owner));
9142    return res;
9143  }
9144
9145  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
9146    Questionnaire res = new Questionnaire();
9147    parseDomainResourceProperties(json, res);
9148    if (json.has("identifier")) {
9149      JsonArray array = json.getAsJsonArray("identifier");
9150      for (int i = 0; i < array.size(); i++) {
9151        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9152      }
9153    };
9154    if (json.has("version"))
9155      res.setVersionElement(parseString(json.get("version").getAsString()));
9156    if (json.has("_version"))
9157      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9158    if (json.has("status"))
9159      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Questionnaire.QuestionnaireStatus.NULL, new Questionnaire.QuestionnaireStatusEnumFactory()));
9160    if (json.has("_status"))
9161      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9162    if (json.has("date"))
9163      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9164    if (json.has("_date"))
9165      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9166    if (json.has("publisher"))
9167      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9168    if (json.has("_publisher"))
9169      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9170    if (json.has("telecom")) {
9171      JsonArray array = json.getAsJsonArray("telecom");
9172      for (int i = 0; i < array.size(); i++) {
9173        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9174      }
9175    };
9176    if (json.has("subjectType")) {
9177      JsonArray array = json.getAsJsonArray("subjectType");
9178      for (int i = 0; i < array.size(); i++) {
9179        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
9180      }
9181    };
9182    if (json.has("_subjectType")) {
9183      JsonArray array = json.getAsJsonArray("_subjectType");
9184      for (int i = 0; i < array.size(); i++) {
9185        if (i == res.getSubjectType().size())
9186          res.getSubjectType().add(parseCode(null));
9187        if (array.get(i) instanceof JsonObject) 
9188          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
9189      }
9190    };
9191    if (json.has("group"))
9192      res.setGroup(parseQuestionnaireGroupComponent(json.getAsJsonObject("group"), res));
9193    return res;
9194  }
9195
9196  protected Questionnaire.GroupComponent parseQuestionnaireGroupComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
9197    Questionnaire.GroupComponent res = new Questionnaire.GroupComponent();
9198    parseBackboneProperties(json, res);
9199    if (json.has("linkId"))
9200      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9201    if (json.has("_linkId"))
9202      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9203    if (json.has("title"))
9204      res.setTitleElement(parseString(json.get("title").getAsString()));
9205    if (json.has("_title"))
9206      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9207    if (json.has("concept")) {
9208      JsonArray array = json.getAsJsonArray("concept");
9209      for (int i = 0; i < array.size(); i++) {
9210        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
9211      }
9212    };
9213    if (json.has("text"))
9214      res.setTextElement(parseString(json.get("text").getAsString()));
9215    if (json.has("_text"))
9216      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9217    if (json.has("required"))
9218      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
9219    if (json.has("_required"))
9220      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
9221    if (json.has("repeats"))
9222      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
9223    if (json.has("_repeats"))
9224      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
9225    if (json.has("group")) {
9226      JsonArray array = json.getAsJsonArray("group");
9227      for (int i = 0; i < array.size(); i++) {
9228        res.getGroup().add(parseQuestionnaireGroupComponent(array.get(i).getAsJsonObject(), owner));
9229      }
9230    };
9231    if (json.has("question")) {
9232      JsonArray array = json.getAsJsonArray("question");
9233      for (int i = 0; i < array.size(); i++) {
9234        res.getQuestion().add(parseQuestionnaireQuestionComponent(array.get(i).getAsJsonObject(), owner));
9235      }
9236    };
9237    return res;
9238  }
9239
9240  protected Questionnaire.QuestionComponent parseQuestionnaireQuestionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
9241    Questionnaire.QuestionComponent res = new Questionnaire.QuestionComponent();
9242    parseBackboneProperties(json, res);
9243    if (json.has("linkId"))
9244      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9245    if (json.has("_linkId"))
9246      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9247    if (json.has("concept")) {
9248      JsonArray array = json.getAsJsonArray("concept");
9249      for (int i = 0; i < array.size(); i++) {
9250        res.getConcept().add(parseCoding(array.get(i).getAsJsonObject()));
9251      }
9252    };
9253    if (json.has("text"))
9254      res.setTextElement(parseString(json.get("text").getAsString()));
9255    if (json.has("_text"))
9256      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9257    if (json.has("type"))
9258      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.AnswerFormat.NULL, new Questionnaire.AnswerFormatEnumFactory()));
9259    if (json.has("_type"))
9260      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9261    if (json.has("required"))
9262      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
9263    if (json.has("_required"))
9264      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
9265    if (json.has("repeats"))
9266      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
9267    if (json.has("_repeats"))
9268      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
9269    if (json.has("options"))
9270      res.setOptions(parseReference(json.getAsJsonObject("options")));
9271    if (json.has("option")) {
9272      JsonArray array = json.getAsJsonArray("option");
9273      for (int i = 0; i < array.size(); i++) {
9274        res.getOption().add(parseCoding(array.get(i).getAsJsonObject()));
9275      }
9276    };
9277    if (json.has("group")) {
9278      JsonArray array = json.getAsJsonArray("group");
9279      for (int i = 0; i < array.size(); i++) {
9280        res.getGroup().add(parseQuestionnaireGroupComponent(array.get(i).getAsJsonObject(), owner));
9281      }
9282    };
9283    return res;
9284  }
9285
9286  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
9287    QuestionnaireResponse res = new QuestionnaireResponse();
9288    parseDomainResourceProperties(json, res);
9289    if (json.has("identifier"))
9290      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9291    if (json.has("questionnaire"))
9292      res.setQuestionnaire(parseReference(json.getAsJsonObject("questionnaire")));
9293    if (json.has("status"))
9294      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
9295    if (json.has("_status"))
9296      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9297    if (json.has("subject"))
9298      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9299    if (json.has("author"))
9300      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9301    if (json.has("authored"))
9302      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
9303    if (json.has("_authored"))
9304      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
9305    if (json.has("source"))
9306      res.setSource(parseReference(json.getAsJsonObject("source")));
9307    if (json.has("encounter"))
9308      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9309    if (json.has("group"))
9310      res.setGroup(parseQuestionnaireResponseGroupComponent(json.getAsJsonObject("group"), res));
9311    return res;
9312  }
9313
9314  protected QuestionnaireResponse.GroupComponent parseQuestionnaireResponseGroupComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9315    QuestionnaireResponse.GroupComponent res = new QuestionnaireResponse.GroupComponent();
9316    parseBackboneProperties(json, res);
9317    if (json.has("linkId"))
9318      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9319    if (json.has("_linkId"))
9320      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9321    if (json.has("title"))
9322      res.setTitleElement(parseString(json.get("title").getAsString()));
9323    if (json.has("_title"))
9324      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9325    if (json.has("text"))
9326      res.setTextElement(parseString(json.get("text").getAsString()));
9327    if (json.has("_text"))
9328      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9329    if (json.has("subject"))
9330      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9331    if (json.has("group")) {
9332      JsonArray array = json.getAsJsonArray("group");
9333      for (int i = 0; i < array.size(); i++) {
9334        res.getGroup().add(parseQuestionnaireResponseGroupComponent(array.get(i).getAsJsonObject(), owner));
9335      }
9336    };
9337    if (json.has("question")) {
9338      JsonArray array = json.getAsJsonArray("question");
9339      for (int i = 0; i < array.size(); i++) {
9340        res.getQuestion().add(parseQuestionnaireResponseQuestionComponent(array.get(i).getAsJsonObject(), owner));
9341      }
9342    };
9343    return res;
9344  }
9345
9346  protected QuestionnaireResponse.QuestionComponent parseQuestionnaireResponseQuestionComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9347    QuestionnaireResponse.QuestionComponent res = new QuestionnaireResponse.QuestionComponent();
9348    parseBackboneProperties(json, res);
9349    if (json.has("linkId"))
9350      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
9351    if (json.has("_linkId"))
9352      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
9353    if (json.has("text"))
9354      res.setTextElement(parseString(json.get("text").getAsString()));
9355    if (json.has("_text"))
9356      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9357    if (json.has("answer")) {
9358      JsonArray array = json.getAsJsonArray("answer");
9359      for (int i = 0; i < array.size(); i++) {
9360        res.getAnswer().add(parseQuestionnaireResponseQuestionAnswerComponent(array.get(i).getAsJsonObject(), owner));
9361      }
9362    };
9363    return res;
9364  }
9365
9366  protected QuestionnaireResponse.QuestionAnswerComponent parseQuestionnaireResponseQuestionAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
9367    QuestionnaireResponse.QuestionAnswerComponent res = new QuestionnaireResponse.QuestionAnswerComponent();
9368    parseBackboneProperties(json, res);
9369    Type value = parseType("value", json);
9370    if (value != null)
9371      res.setValue(value);
9372    if (json.has("group")) {
9373      JsonArray array = json.getAsJsonArray("group");
9374      for (int i = 0; i < array.size(); i++) {
9375        res.getGroup().add(parseQuestionnaireResponseGroupComponent(array.get(i).getAsJsonObject(), owner));
9376      }
9377    };
9378    return res;
9379  }
9380
9381  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
9382    ReferralRequest res = new ReferralRequest();
9383    parseDomainResourceProperties(json, res);
9384    if (json.has("status"))
9385      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralStatus.NULL, new ReferralRequest.ReferralStatusEnumFactory()));
9386    if (json.has("_status"))
9387      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9388    if (json.has("identifier")) {
9389      JsonArray array = json.getAsJsonArray("identifier");
9390      for (int i = 0; i < array.size(); i++) {
9391        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9392      }
9393    };
9394    if (json.has("date"))
9395      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9396    if (json.has("_date"))
9397      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9398    if (json.has("type"))
9399      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9400    if (json.has("specialty"))
9401      res.setSpecialty(parseCodeableConcept(json.getAsJsonObject("specialty")));
9402    if (json.has("priority"))
9403      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9404    if (json.has("patient"))
9405      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9406    if (json.has("requester"))
9407      res.setRequester(parseReference(json.getAsJsonObject("requester")));
9408    if (json.has("recipient")) {
9409      JsonArray array = json.getAsJsonArray("recipient");
9410      for (int i = 0; i < array.size(); i++) {
9411        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9412      }
9413    };
9414    if (json.has("encounter"))
9415      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9416    if (json.has("dateSent"))
9417      res.setDateSentElement(parseDateTime(json.get("dateSent").getAsString()));
9418    if (json.has("_dateSent"))
9419      parseElementProperties(json.getAsJsonObject("_dateSent"), res.getDateSentElement());
9420    if (json.has("reason"))
9421      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
9422    if (json.has("description"))
9423      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9424    if (json.has("_description"))
9425      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9426    if (json.has("serviceRequested")) {
9427      JsonArray array = json.getAsJsonArray("serviceRequested");
9428      for (int i = 0; i < array.size(); i++) {
9429        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9430      }
9431    };
9432    if (json.has("supportingInformation")) {
9433      JsonArray array = json.getAsJsonArray("supportingInformation");
9434      for (int i = 0; i < array.size(); i++) {
9435        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
9436      }
9437    };
9438    if (json.has("fulfillmentTime"))
9439      res.setFulfillmentTime(parsePeriod(json.getAsJsonObject("fulfillmentTime")));
9440    return res;
9441  }
9442
9443  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
9444    RelatedPerson res = new RelatedPerson();
9445    parseDomainResourceProperties(json, res);
9446    if (json.has("identifier")) {
9447      JsonArray array = json.getAsJsonArray("identifier");
9448      for (int i = 0; i < array.size(); i++) {
9449        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9450      }
9451    };
9452    if (json.has("patient"))
9453      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9454    if (json.has("relationship"))
9455      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9456    if (json.has("name"))
9457      res.setName(parseHumanName(json.getAsJsonObject("name")));
9458    if (json.has("telecom")) {
9459      JsonArray array = json.getAsJsonArray("telecom");
9460      for (int i = 0; i < array.size(); i++) {
9461        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9462      }
9463    };
9464    if (json.has("gender"))
9465      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
9466    if (json.has("_gender"))
9467      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
9468    if (json.has("birthDate"))
9469      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
9470    if (json.has("_birthDate"))
9471      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
9472    if (json.has("address")) {
9473      JsonArray array = json.getAsJsonArray("address");
9474      for (int i = 0; i < array.size(); i++) {
9475        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
9476      }
9477    };
9478    if (json.has("photo")) {
9479      JsonArray array = json.getAsJsonArray("photo");
9480      for (int i = 0; i < array.size(); i++) {
9481        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
9482      }
9483    };
9484    if (json.has("period"))
9485      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9486    return res;
9487  }
9488
9489  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
9490    RiskAssessment res = new RiskAssessment();
9491    parseDomainResourceProperties(json, res);
9492    if (json.has("subject"))
9493      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9494    if (json.has("date"))
9495      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9496    if (json.has("_date"))
9497      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9498    if (json.has("condition"))
9499      res.setCondition(parseReference(json.getAsJsonObject("condition")));
9500    if (json.has("encounter"))
9501      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9502    if (json.has("performer"))
9503      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9504    if (json.has("identifier"))
9505      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9506    if (json.has("method"))
9507      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
9508    if (json.has("basis")) {
9509      JsonArray array = json.getAsJsonArray("basis");
9510      for (int i = 0; i < array.size(); i++) {
9511        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
9512      }
9513    };
9514    if (json.has("prediction")) {
9515      JsonArray array = json.getAsJsonArray("prediction");
9516      for (int i = 0; i < array.size(); i++) {
9517        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
9518      }
9519    };
9520    if (json.has("mitigation"))
9521      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
9522    if (json.has("_mitigation"))
9523      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
9524    return res;
9525  }
9526
9527  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
9528    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
9529    parseBackboneProperties(json, res);
9530    if (json.has("outcome"))
9531      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
9532    Type probability = parseType("probability", json);
9533    if (probability != null)
9534      res.setProbability(probability);
9535    if (json.has("relativeRisk"))
9536      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
9537    if (json.has("_relativeRisk"))
9538      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
9539    Type when = parseType("when", json);
9540    if (when != null)
9541      res.setWhen(when);
9542    if (json.has("rationale"))
9543      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
9544    if (json.has("_rationale"))
9545      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
9546    return res;
9547  }
9548
9549  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
9550    Schedule res = new Schedule();
9551    parseDomainResourceProperties(json, res);
9552    if (json.has("identifier")) {
9553      JsonArray array = json.getAsJsonArray("identifier");
9554      for (int i = 0; i < array.size(); i++) {
9555        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9556      }
9557    };
9558    if (json.has("type")) {
9559      JsonArray array = json.getAsJsonArray("type");
9560      for (int i = 0; i < array.size(); i++) {
9561        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9562      }
9563    };
9564    if (json.has("actor"))
9565      res.setActor(parseReference(json.getAsJsonObject("actor")));
9566    if (json.has("planningHorizon"))
9567      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
9568    if (json.has("comment"))
9569      res.setCommentElement(parseString(json.get("comment").getAsString()));
9570    if (json.has("_comment"))
9571      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9572    return res;
9573  }
9574
9575  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
9576    SearchParameter res = new SearchParameter();
9577    parseDomainResourceProperties(json, res);
9578    if (json.has("url"))
9579      res.setUrlElement(parseUri(json.get("url").getAsString()));
9580    if (json.has("_url"))
9581      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9582    if (json.has("name"))
9583      res.setNameElement(parseString(json.get("name").getAsString()));
9584    if (json.has("_name"))
9585      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9586    if (json.has("status"))
9587      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
9588    if (json.has("_status"))
9589      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9590    if (json.has("experimental"))
9591      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9592    if (json.has("_experimental"))
9593      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9594    if (json.has("publisher"))
9595      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9596    if (json.has("_publisher"))
9597      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9598    if (json.has("contact")) {
9599      JsonArray array = json.getAsJsonArray("contact");
9600      for (int i = 0; i < array.size(); i++) {
9601        res.getContact().add(parseSearchParameterSearchParameterContactComponent(array.get(i).getAsJsonObject(), res));
9602      }
9603    };
9604    if (json.has("date"))
9605      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9606    if (json.has("_date"))
9607      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9608    if (json.has("requirements"))
9609      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
9610    if (json.has("_requirements"))
9611      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
9612    if (json.has("code"))
9613      res.setCodeElement(parseCode(json.get("code").getAsString()));
9614    if (json.has("_code"))
9615      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9616    if (json.has("base"))
9617      res.setBaseElement(parseCode(json.get("base").getAsString()));
9618    if (json.has("_base"))
9619      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
9620    if (json.has("type"))
9621      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
9622    if (json.has("_type"))
9623      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9624    if (json.has("description"))
9625      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9626    if (json.has("_description"))
9627      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9628    if (json.has("xpath"))
9629      res.setXpathElement(parseString(json.get("xpath").getAsString()));
9630    if (json.has("_xpath"))
9631      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
9632    if (json.has("xpathUsage"))
9633      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
9634    if (json.has("_xpathUsage"))
9635      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
9636    if (json.has("target")) {
9637      JsonArray array = json.getAsJsonArray("target");
9638      for (int i = 0; i < array.size(); i++) {
9639        res.getTarget().add(parseCode(array.get(i).getAsString()));
9640      }
9641    };
9642    if (json.has("_target")) {
9643      JsonArray array = json.getAsJsonArray("_target");
9644      for (int i = 0; i < array.size(); i++) {
9645        if (i == res.getTarget().size())
9646          res.getTarget().add(parseCode(null));
9647        if (array.get(i) instanceof JsonObject) 
9648          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
9649      }
9650    };
9651    return res;
9652  }
9653
9654  protected SearchParameter.SearchParameterContactComponent parseSearchParameterSearchParameterContactComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
9655    SearchParameter.SearchParameterContactComponent res = new SearchParameter.SearchParameterContactComponent();
9656    parseBackboneProperties(json, res);
9657    if (json.has("name"))
9658      res.setNameElement(parseString(json.get("name").getAsString()));
9659    if (json.has("_name"))
9660      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9661    if (json.has("telecom")) {
9662      JsonArray array = json.getAsJsonArray("telecom");
9663      for (int i = 0; i < array.size(); i++) {
9664        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9665      }
9666    };
9667    return res;
9668  }
9669
9670  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
9671    Slot res = new Slot();
9672    parseDomainResourceProperties(json, res);
9673    if (json.has("identifier")) {
9674      JsonArray array = json.getAsJsonArray("identifier");
9675      for (int i = 0; i < array.size(); i++) {
9676        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9677      }
9678    };
9679    if (json.has("type"))
9680      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9681    if (json.has("schedule"))
9682      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
9683    if (json.has("freeBusyType"))
9684      res.setFreeBusyTypeElement(parseEnumeration(json.get("freeBusyType").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
9685    if (json.has("_freeBusyType"))
9686      parseElementProperties(json.getAsJsonObject("_freeBusyType"), res.getFreeBusyTypeElement());
9687    if (json.has("start"))
9688      res.setStartElement(parseInstant(json.get("start").getAsString()));
9689    if (json.has("_start"))
9690      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
9691    if (json.has("end"))
9692      res.setEndElement(parseInstant(json.get("end").getAsString()));
9693    if (json.has("_end"))
9694      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
9695    if (json.has("overbooked"))
9696      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
9697    if (json.has("_overbooked"))
9698      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
9699    if (json.has("comment"))
9700      res.setCommentElement(parseString(json.get("comment").getAsString()));
9701    if (json.has("_comment"))
9702      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9703    return res;
9704  }
9705
9706  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
9707    Specimen res = new Specimen();
9708    parseDomainResourceProperties(json, res);
9709    if (json.has("identifier")) {
9710      JsonArray array = json.getAsJsonArray("identifier");
9711      for (int i = 0; i < array.size(); i++) {
9712        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9713      }
9714    };
9715    if (json.has("status"))
9716      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
9717    if (json.has("_status"))
9718      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9719    if (json.has("type"))
9720      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9721    if (json.has("parent")) {
9722      JsonArray array = json.getAsJsonArray("parent");
9723      for (int i = 0; i < array.size(); i++) {
9724        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
9725      }
9726    };
9727    if (json.has("subject"))
9728      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9729    if (json.has("accessionIdentifier"))
9730      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
9731    if (json.has("receivedTime"))
9732      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
9733    if (json.has("_receivedTime"))
9734      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
9735    if (json.has("collection"))
9736      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
9737    if (json.has("treatment")) {
9738      JsonArray array = json.getAsJsonArray("treatment");
9739      for (int i = 0; i < array.size(); i++) {
9740        res.getTreatment().add(parseSpecimenSpecimenTreatmentComponent(array.get(i).getAsJsonObject(), res));
9741      }
9742    };
9743    if (json.has("container")) {
9744      JsonArray array = json.getAsJsonArray("container");
9745      for (int i = 0; i < array.size(); i++) {
9746        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
9747      }
9748    };
9749    return res;
9750  }
9751
9752  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9753    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
9754    parseBackboneProperties(json, res);
9755    if (json.has("collector"))
9756      res.setCollector(parseReference(json.getAsJsonObject("collector")));
9757    if (json.has("comment")) {
9758      JsonArray array = json.getAsJsonArray("comment");
9759      for (int i = 0; i < array.size(); i++) {
9760        res.getComment().add(parseString(array.get(i).getAsString()));
9761      }
9762    };
9763    if (json.has("_comment")) {
9764      JsonArray array = json.getAsJsonArray("_comment");
9765      for (int i = 0; i < array.size(); i++) {
9766        if (i == res.getComment().size())
9767          res.getComment().add(parseString(null));
9768        if (array.get(i) instanceof JsonObject) 
9769          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
9770      }
9771    };
9772    Type collected = parseType("collected", json);
9773    if (collected != null)
9774      res.setCollected(collected);
9775    if (json.has("quantity"))
9776      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9777    if (json.has("method"))
9778      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
9779    if (json.has("bodySite"))
9780      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9781    return res;
9782  }
9783
9784  protected Specimen.SpecimenTreatmentComponent parseSpecimenSpecimenTreatmentComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9785    Specimen.SpecimenTreatmentComponent res = new Specimen.SpecimenTreatmentComponent();
9786    parseBackboneProperties(json, res);
9787    if (json.has("description"))
9788      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9789    if (json.has("_description"))
9790      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9791    if (json.has("procedure"))
9792      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
9793    if (json.has("additive")) {
9794      JsonArray array = json.getAsJsonArray("additive");
9795      for (int i = 0; i < array.size(); i++) {
9796        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
9797      }
9798    };
9799    return res;
9800  }
9801
9802  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
9803    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
9804    parseBackboneProperties(json, res);
9805    if (json.has("identifier")) {
9806      JsonArray array = json.getAsJsonArray("identifier");
9807      for (int i = 0; i < array.size(); i++) {
9808        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9809      }
9810    };
9811    if (json.has("description"))
9812      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9813    if (json.has("_description"))
9814      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9815    if (json.has("type"))
9816      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9817    if (json.has("capacity"))
9818      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
9819    if (json.has("specimenQuantity"))
9820      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
9821    Type additive = parseType("additive", json);
9822    if (additive != null)
9823      res.setAdditive(additive);
9824    return res;
9825  }
9826
9827  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
9828    StructureDefinition res = new StructureDefinition();
9829    parseDomainResourceProperties(json, res);
9830    if (json.has("url"))
9831      res.setUrlElement(parseUri(json.get("url").getAsString()));
9832    if (json.has("_url"))
9833      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9834    if (json.has("identifier")) {
9835      JsonArray array = json.getAsJsonArray("identifier");
9836      for (int i = 0; i < array.size(); i++) {
9837        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9838      }
9839    };
9840    if (json.has("version"))
9841      res.setVersionElement(parseString(json.get("version").getAsString()));
9842    if (json.has("_version"))
9843      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9844    if (json.has("name"))
9845      res.setNameElement(parseString(json.get("name").getAsString()));
9846    if (json.has("_name"))
9847      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9848    if (json.has("display"))
9849      res.setDisplayElement(parseString(json.get("display").getAsString()));
9850    if (json.has("_display"))
9851      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
9852    if (json.has("status"))
9853      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
9854    if (json.has("_status"))
9855      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9856    if (json.has("experimental"))
9857      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9858    if (json.has("_experimental"))
9859      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9860    if (json.has("publisher"))
9861      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9862    if (json.has("_publisher"))
9863      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9864    if (json.has("contact")) {
9865      JsonArray array = json.getAsJsonArray("contact");
9866      for (int i = 0; i < array.size(); i++) {
9867        res.getContact().add(parseStructureDefinitionStructureDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
9868      }
9869    };
9870    if (json.has("date"))
9871      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9872    if (json.has("_date"))
9873      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9874    if (json.has("description"))
9875      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9876    if (json.has("_description"))
9877      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9878    if (json.has("useContext")) {
9879      JsonArray array = json.getAsJsonArray("useContext");
9880      for (int i = 0; i < array.size(); i++) {
9881        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9882      }
9883    };
9884    if (json.has("requirements"))
9885      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
9886    if (json.has("_requirements"))
9887      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
9888    if (json.has("copyright"))
9889      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
9890    if (json.has("_copyright"))
9891      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
9892    if (json.has("code")) {
9893      JsonArray array = json.getAsJsonArray("code");
9894      for (int i = 0; i < array.size(); i++) {
9895        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
9896      }
9897    };
9898    if (json.has("fhirVersion"))
9899      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
9900    if (json.has("_fhirVersion"))
9901      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
9902    if (json.has("mapping")) {
9903      JsonArray array = json.getAsJsonArray("mapping");
9904      for (int i = 0; i < array.size(); i++) {
9905        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
9906      }
9907    };
9908    if (json.has("kind"))
9909      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
9910    if (json.has("_kind"))
9911      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
9912    if (json.has("constrainedType"))
9913      res.setConstrainedTypeElement(parseCode(json.get("constrainedType").getAsString()));
9914    if (json.has("_constrainedType"))
9915      parseElementProperties(json.getAsJsonObject("_constrainedType"), res.getConstrainedTypeElement());
9916    if (json.has("abstract"))
9917      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
9918    if (json.has("_abstract"))
9919      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
9920    if (json.has("contextType"))
9921      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
9922    if (json.has("_contextType"))
9923      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
9924    if (json.has("context")) {
9925      JsonArray array = json.getAsJsonArray("context");
9926      for (int i = 0; i < array.size(); i++) {
9927        res.getContext().add(parseString(array.get(i).getAsString()));
9928      }
9929    };
9930    if (json.has("_context")) {
9931      JsonArray array = json.getAsJsonArray("_context");
9932      for (int i = 0; i < array.size(); i++) {
9933        if (i == res.getContext().size())
9934          res.getContext().add(parseString(null));
9935        if (array.get(i) instanceof JsonObject) 
9936          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
9937      }
9938    };
9939    if (json.has("base"))
9940      res.setBaseElement(parseUri(json.get("base").getAsString()));
9941    if (json.has("_base"))
9942      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
9943    if (json.has("snapshot"))
9944      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
9945    if (json.has("differential"))
9946      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
9947    return res;
9948  }
9949
9950  protected StructureDefinition.StructureDefinitionContactComponent parseStructureDefinitionStructureDefinitionContactComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9951    StructureDefinition.StructureDefinitionContactComponent res = new StructureDefinition.StructureDefinitionContactComponent();
9952    parseBackboneProperties(json, res);
9953    if (json.has("name"))
9954      res.setNameElement(parseString(json.get("name").getAsString()));
9955    if (json.has("_name"))
9956      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9957    if (json.has("telecom")) {
9958      JsonArray array = json.getAsJsonArray("telecom");
9959      for (int i = 0; i < array.size(); i++) {
9960        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
9961      }
9962    };
9963    return res;
9964  }
9965
9966  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9967    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
9968    parseBackboneProperties(json, res);
9969    if (json.has("identity"))
9970      res.setIdentityElement(parseId(json.get("identity").getAsString()));
9971    if (json.has("_identity"))
9972      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
9973    if (json.has("uri"))
9974      res.setUriElement(parseUri(json.get("uri").getAsString()));
9975    if (json.has("_uri"))
9976      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
9977    if (json.has("name"))
9978      res.setNameElement(parseString(json.get("name").getAsString()));
9979    if (json.has("_name"))
9980      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9981    if (json.has("comments"))
9982      res.setCommentsElement(parseString(json.get("comments").getAsString()));
9983    if (json.has("_comments"))
9984      parseElementProperties(json.getAsJsonObject("_comments"), res.getCommentsElement());
9985    return res;
9986  }
9987
9988  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
9989    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
9990    parseBackboneProperties(json, res);
9991    if (json.has("element")) {
9992      JsonArray array = json.getAsJsonArray("element");
9993      for (int i = 0; i < array.size(); i++) {
9994        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
9995      }
9996    };
9997    return res;
9998  }
9999
10000  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
10001    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
10002    parseBackboneProperties(json, res);
10003    if (json.has("element")) {
10004      JsonArray array = json.getAsJsonArray("element");
10005      for (int i = 0; i < array.size(); i++) {
10006        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
10007      }
10008    };
10009    return res;
10010  }
10011
10012  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
10013    Subscription res = new Subscription();
10014    parseDomainResourceProperties(json, res);
10015    if (json.has("criteria"))
10016      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
10017    if (json.has("_criteria"))
10018      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
10019    if (json.has("contact")) {
10020      JsonArray array = json.getAsJsonArray("contact");
10021      for (int i = 0; i < array.size(); i++) {
10022        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10023      }
10024    };
10025    if (json.has("reason"))
10026      res.setReasonElement(parseString(json.get("reason").getAsString()));
10027    if (json.has("_reason"))
10028      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
10029    if (json.has("status"))
10030      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
10031    if (json.has("_status"))
10032      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10033    if (json.has("error"))
10034      res.setErrorElement(parseString(json.get("error").getAsString()));
10035    if (json.has("_error"))
10036      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
10037    if (json.has("channel"))
10038      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
10039    if (json.has("end"))
10040      res.setEndElement(parseInstant(json.get("end").getAsString()));
10041    if (json.has("_end"))
10042      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
10043    if (json.has("tag")) {
10044      JsonArray array = json.getAsJsonArray("tag");
10045      for (int i = 0; i < array.size(); i++) {
10046        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
10047      }
10048    };
10049    return res;
10050  }
10051
10052  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
10053    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
10054    parseBackboneProperties(json, res);
10055    if (json.has("type"))
10056      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
10057    if (json.has("_type"))
10058      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10059    if (json.has("endpoint"))
10060      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
10061    if (json.has("_endpoint"))
10062      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
10063    if (json.has("payload"))
10064      res.setPayloadElement(parseString(json.get("payload").getAsString()));
10065    if (json.has("_payload"))
10066      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
10067    if (json.has("header"))
10068      res.setHeaderElement(parseString(json.get("header").getAsString()));
10069    if (json.has("_header"))
10070      parseElementProperties(json.getAsJsonObject("_header"), res.getHeaderElement());
10071    return res;
10072  }
10073
10074  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
10075    Substance res = new Substance();
10076    parseDomainResourceProperties(json, res);
10077    if (json.has("identifier")) {
10078      JsonArray array = json.getAsJsonArray("identifier");
10079      for (int i = 0; i < array.size(); i++) {
10080        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10081      }
10082    };
10083    if (json.has("category")) {
10084      JsonArray array = json.getAsJsonArray("category");
10085      for (int i = 0; i < array.size(); i++) {
10086        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10087      }
10088    };
10089    if (json.has("code"))
10090      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10091    if (json.has("description"))
10092      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10093    if (json.has("_description"))
10094      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10095    if (json.has("instance")) {
10096      JsonArray array = json.getAsJsonArray("instance");
10097      for (int i = 0; i < array.size(); i++) {
10098        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
10099      }
10100    };
10101    if (json.has("ingredient")) {
10102      JsonArray array = json.getAsJsonArray("ingredient");
10103      for (int i = 0; i < array.size(); i++) {
10104        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
10105      }
10106    };
10107    return res;
10108  }
10109
10110  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
10111    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
10112    parseBackboneProperties(json, res);
10113    if (json.has("identifier"))
10114      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10115    if (json.has("expiry"))
10116      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
10117    if (json.has("_expiry"))
10118      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
10119    if (json.has("quantity"))
10120      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10121    return res;
10122  }
10123
10124  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
10125    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
10126    parseBackboneProperties(json, res);
10127    if (json.has("quantity"))
10128      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
10129    if (json.has("substance"))
10130      res.setSubstance(parseReference(json.getAsJsonObject("substance")));
10131    return res;
10132  }
10133
10134  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
10135    SupplyDelivery res = new SupplyDelivery();
10136    parseDomainResourceProperties(json, res);
10137    if (json.has("identifier"))
10138      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10139    if (json.has("status"))
10140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
10141    if (json.has("_status"))
10142      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10143    if (json.has("patient"))
10144      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10145    if (json.has("type"))
10146      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10147    if (json.has("quantity"))
10148      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10149    if (json.has("suppliedItem"))
10150      res.setSuppliedItem(parseReference(json.getAsJsonObject("suppliedItem")));
10151    if (json.has("supplier"))
10152      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
10153    if (json.has("whenPrepared"))
10154      res.setWhenPrepared(parsePeriod(json.getAsJsonObject("whenPrepared")));
10155    if (json.has("time"))
10156      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
10157    if (json.has("_time"))
10158      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
10159    if (json.has("destination"))
10160      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10161    if (json.has("receiver")) {
10162      JsonArray array = json.getAsJsonArray("receiver");
10163      for (int i = 0; i < array.size(); i++) {
10164        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
10165      }
10166    };
10167    return res;
10168  }
10169
10170  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
10171    SupplyRequest res = new SupplyRequest();
10172    parseDomainResourceProperties(json, res);
10173    if (json.has("patient"))
10174      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10175    if (json.has("source"))
10176      res.setSource(parseReference(json.getAsJsonObject("source")));
10177    if (json.has("date"))
10178      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10179    if (json.has("_date"))
10180      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10181    if (json.has("identifier"))
10182      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10183    if (json.has("status"))
10184      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
10185    if (json.has("_status"))
10186      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10187    if (json.has("kind"))
10188      res.setKind(parseCodeableConcept(json.getAsJsonObject("kind")));
10189    if (json.has("orderedItem"))
10190      res.setOrderedItem(parseReference(json.getAsJsonObject("orderedItem")));
10191    if (json.has("supplier")) {
10192      JsonArray array = json.getAsJsonArray("supplier");
10193      for (int i = 0; i < array.size(); i++) {
10194        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
10195      }
10196    };
10197    Type reason = parseType("reason", json);
10198    if (reason != null)
10199      res.setReason(reason);
10200    if (json.has("when"))
10201      res.setWhen(parseSupplyRequestSupplyRequestWhenComponent(json.getAsJsonObject("when"), res));
10202    return res;
10203  }
10204
10205  protected SupplyRequest.SupplyRequestWhenComponent parseSupplyRequestSupplyRequestWhenComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
10206    SupplyRequest.SupplyRequestWhenComponent res = new SupplyRequest.SupplyRequestWhenComponent();
10207    parseBackboneProperties(json, res);
10208    if (json.has("code"))
10209      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10210    if (json.has("schedule"))
10211      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
10212    return res;
10213  }
10214
10215  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
10216    TestScript res = new TestScript();
10217    parseDomainResourceProperties(json, res);
10218    if (json.has("url"))
10219      res.setUrlElement(parseUri(json.get("url").getAsString()));
10220    if (json.has("_url"))
10221      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10222    if (json.has("version"))
10223      res.setVersionElement(parseString(json.get("version").getAsString()));
10224    if (json.has("_version"))
10225      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10226    if (json.has("name"))
10227      res.setNameElement(parseString(json.get("name").getAsString()));
10228    if (json.has("_name"))
10229      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10230    if (json.has("status"))
10231      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
10232    if (json.has("_status"))
10233      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10234    if (json.has("identifier"))
10235      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10236    if (json.has("experimental"))
10237      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10238    if (json.has("_experimental"))
10239      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10240    if (json.has("publisher"))
10241      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10242    if (json.has("_publisher"))
10243      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10244    if (json.has("contact")) {
10245      JsonArray array = json.getAsJsonArray("contact");
10246      for (int i = 0; i < array.size(); i++) {
10247        res.getContact().add(parseTestScriptTestScriptContactComponent(array.get(i).getAsJsonObject(), res));
10248      }
10249    };
10250    if (json.has("date"))
10251      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10252    if (json.has("_date"))
10253      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10254    if (json.has("description"))
10255      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10256    if (json.has("_description"))
10257      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10258    if (json.has("useContext")) {
10259      JsonArray array = json.getAsJsonArray("useContext");
10260      for (int i = 0; i < array.size(); i++) {
10261        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10262      }
10263    };
10264    if (json.has("requirements"))
10265      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
10266    if (json.has("_requirements"))
10267      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
10268    if (json.has("copyright"))
10269      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
10270    if (json.has("_copyright"))
10271      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10272    if (json.has("metadata"))
10273      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
10274    if (json.has("multiserver"))
10275      res.setMultiserverElement(parseBoolean(json.get("multiserver").getAsBoolean()));
10276    if (json.has("_multiserver"))
10277      parseElementProperties(json.getAsJsonObject("_multiserver"), res.getMultiserverElement());
10278    if (json.has("fixture")) {
10279      JsonArray array = json.getAsJsonArray("fixture");
10280      for (int i = 0; i < array.size(); i++) {
10281        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
10282      }
10283    };
10284    if (json.has("profile")) {
10285      JsonArray array = json.getAsJsonArray("profile");
10286      for (int i = 0; i < array.size(); i++) {
10287        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
10288      }
10289    };
10290    if (json.has("variable")) {
10291      JsonArray array = json.getAsJsonArray("variable");
10292      for (int i = 0; i < array.size(); i++) {
10293        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
10294      }
10295    };
10296    if (json.has("setup"))
10297      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
10298    if (json.has("test")) {
10299      JsonArray array = json.getAsJsonArray("test");
10300      for (int i = 0; i < array.size(); i++) {
10301        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
10302      }
10303    };
10304    if (json.has("teardown"))
10305      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
10306    return res;
10307  }
10308
10309  protected TestScript.TestScriptContactComponent parseTestScriptTestScriptContactComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10310    TestScript.TestScriptContactComponent res = new TestScript.TestScriptContactComponent();
10311    parseBackboneProperties(json, res);
10312    if (json.has("name"))
10313      res.setNameElement(parseString(json.get("name").getAsString()));
10314    if (json.has("_name"))
10315      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10316    if (json.has("telecom")) {
10317      JsonArray array = json.getAsJsonArray("telecom");
10318      for (int i = 0; i < array.size(); i++) {
10319        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10320      }
10321    };
10322    return res;
10323  }
10324
10325  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10326    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
10327    parseBackboneProperties(json, res);
10328    if (json.has("link")) {
10329      JsonArray array = json.getAsJsonArray("link");
10330      for (int i = 0; i < array.size(); i++) {
10331        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
10332      }
10333    };
10334    if (json.has("capability")) {
10335      JsonArray array = json.getAsJsonArray("capability");
10336      for (int i = 0; i < array.size(); i++) {
10337        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
10338      }
10339    };
10340    return res;
10341  }
10342
10343  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10344    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
10345    parseBackboneProperties(json, res);
10346    if (json.has("url"))
10347      res.setUrlElement(parseUri(json.get("url").getAsString()));
10348    if (json.has("_url"))
10349      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10350    if (json.has("description"))
10351      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10352    if (json.has("_description"))
10353      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10354    return res;
10355  }
10356
10357  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10358    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
10359    parseBackboneProperties(json, res);
10360    if (json.has("required"))
10361      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
10362    if (json.has("_required"))
10363      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
10364    if (json.has("validated"))
10365      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
10366    if (json.has("_validated"))
10367      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
10368    if (json.has("description"))
10369      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10370    if (json.has("_description"))
10371      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10372    if (json.has("destination"))
10373      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
10374    if (json.has("_destination"))
10375      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
10376    if (json.has("link")) {
10377      JsonArray array = json.getAsJsonArray("link");
10378      for (int i = 0; i < array.size(); i++) {
10379        res.getLink().add(parseUri(array.get(i).getAsString()));
10380      }
10381    };
10382    if (json.has("_link")) {
10383      JsonArray array = json.getAsJsonArray("_link");
10384      for (int i = 0; i < array.size(); i++) {
10385        if (i == res.getLink().size())
10386          res.getLink().add(parseUri(null));
10387        if (array.get(i) instanceof JsonObject) 
10388          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
10389      }
10390    };
10391    if (json.has("conformance"))
10392      res.setConformance(parseReference(json.getAsJsonObject("conformance")));
10393    return res;
10394  }
10395
10396  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10397    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
10398    parseBackboneProperties(json, res);
10399    if (json.has("autocreate"))
10400      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
10401    if (json.has("_autocreate"))
10402      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
10403    if (json.has("autodelete"))
10404      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
10405    if (json.has("_autodelete"))
10406      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
10407    if (json.has("resource"))
10408      res.setResource(parseReference(json.getAsJsonObject("resource")));
10409    return res;
10410  }
10411
10412  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10413    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
10414    parseBackboneProperties(json, res);
10415    if (json.has("name"))
10416      res.setNameElement(parseString(json.get("name").getAsString()));
10417    if (json.has("_name"))
10418      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10419    if (json.has("headerField"))
10420      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
10421    if (json.has("_headerField"))
10422      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
10423    if (json.has("path"))
10424      res.setPathElement(parseString(json.get("path").getAsString()));
10425    if (json.has("_path"))
10426      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10427    if (json.has("sourceId"))
10428      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10429    if (json.has("_sourceId"))
10430      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10431    return res;
10432  }
10433
10434  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10435    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
10436    parseBackboneProperties(json, res);
10437    if (json.has("metadata"))
10438      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
10439    if (json.has("action")) {
10440      JsonArray array = json.getAsJsonArray("action");
10441      for (int i = 0; i < array.size(); i++) {
10442        res.getAction().add(parseTestScriptTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
10443      }
10444    };
10445    return res;
10446  }
10447
10448  protected TestScript.TestScriptSetupActionComponent parseTestScriptTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10449    TestScript.TestScriptSetupActionComponent res = new TestScript.TestScriptSetupActionComponent();
10450    parseBackboneProperties(json, res);
10451    if (json.has("operation"))
10452      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10453    if (json.has("assert"))
10454      res.setAssert(parseTestScriptTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
10455    return res;
10456  }
10457
10458  protected TestScript.TestScriptSetupActionOperationComponent parseTestScriptTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10459    TestScript.TestScriptSetupActionOperationComponent res = new TestScript.TestScriptSetupActionOperationComponent();
10460    parseBackboneProperties(json, res);
10461    if (json.has("type"))
10462      res.setType(parseCoding(json.getAsJsonObject("type")));
10463    if (json.has("resource"))
10464      res.setResourceElement(parseCode(json.get("resource").getAsString()));
10465    if (json.has("_resource"))
10466      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
10467    if (json.has("label"))
10468      res.setLabelElement(parseString(json.get("label").getAsString()));
10469    if (json.has("_label"))
10470      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
10471    if (json.has("description"))
10472      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10473    if (json.has("_description"))
10474      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10475    if (json.has("accept"))
10476      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10477    if (json.has("_accept"))
10478      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
10479    if (json.has("contentType"))
10480      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10481    if (json.has("_contentType"))
10482      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
10483    if (json.has("destination"))
10484      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
10485    if (json.has("_destination"))
10486      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
10487    if (json.has("encodeRequestUrl"))
10488      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
10489    if (json.has("_encodeRequestUrl"))
10490      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
10491    if (json.has("params"))
10492      res.setParamsElement(parseString(json.get("params").getAsString()));
10493    if (json.has("_params"))
10494      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
10495    if (json.has("requestHeader")) {
10496      JsonArray array = json.getAsJsonArray("requestHeader");
10497      for (int i = 0; i < array.size(); i++) {
10498        res.getRequestHeader().add(parseTestScriptTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
10499      }
10500    };
10501    if (json.has("responseId"))
10502      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
10503    if (json.has("_responseId"))
10504      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
10505    if (json.has("sourceId"))
10506      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10507    if (json.has("_sourceId"))
10508      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10509    if (json.has("targetId"))
10510      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
10511    if (json.has("_targetId"))
10512      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
10513    if (json.has("url"))
10514      res.setUrlElement(parseString(json.get("url").getAsString()));
10515    if (json.has("_url"))
10516      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10517    return res;
10518  }
10519
10520  protected TestScript.TestScriptSetupActionOperationRequestHeaderComponent parseTestScriptTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10521    TestScript.TestScriptSetupActionOperationRequestHeaderComponent res = new TestScript.TestScriptSetupActionOperationRequestHeaderComponent();
10522    parseBackboneProperties(json, res);
10523    if (json.has("field"))
10524      res.setFieldElement(parseString(json.get("field").getAsString()));
10525    if (json.has("_field"))
10526      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
10527    if (json.has("value"))
10528      res.setValueElement(parseString(json.get("value").getAsString()));
10529    if (json.has("_value"))
10530      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10531    return res;
10532  }
10533
10534  protected TestScript.TestScriptSetupActionAssertComponent parseTestScriptTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10535    TestScript.TestScriptSetupActionAssertComponent res = new TestScript.TestScriptSetupActionAssertComponent();
10536    parseBackboneProperties(json, res);
10537    if (json.has("label"))
10538      res.setLabelElement(parseString(json.get("label").getAsString()));
10539    if (json.has("_label"))
10540      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
10541    if (json.has("description"))
10542      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10543    if (json.has("_description"))
10544      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10545    if (json.has("direction"))
10546      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
10547    if (json.has("_direction"))
10548      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
10549    if (json.has("compareToSourceId"))
10550      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
10551    if (json.has("_compareToSourceId"))
10552      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
10553    if (json.has("compareToSourcePath"))
10554      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
10555    if (json.has("_compareToSourcePath"))
10556      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
10557    if (json.has("contentType"))
10558      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
10559    if (json.has("_contentType"))
10560      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
10561    if (json.has("headerField"))
10562      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
10563    if (json.has("_headerField"))
10564      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
10565    if (json.has("minimumId"))
10566      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
10567    if (json.has("_minimumId"))
10568      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
10569    if (json.has("navigationLinks"))
10570      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
10571    if (json.has("_navigationLinks"))
10572      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
10573    if (json.has("operator"))
10574      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
10575    if (json.has("_operator"))
10576      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
10577    if (json.has("path"))
10578      res.setPathElement(parseString(json.get("path").getAsString()));
10579    if (json.has("_path"))
10580      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10581    if (json.has("resource"))
10582      res.setResourceElement(parseCode(json.get("resource").getAsString()));
10583    if (json.has("_resource"))
10584      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
10585    if (json.has("response"))
10586      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
10587    if (json.has("_response"))
10588      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
10589    if (json.has("responseCode"))
10590      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
10591    if (json.has("_responseCode"))
10592      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
10593    if (json.has("sourceId"))
10594      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
10595    if (json.has("_sourceId"))
10596      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
10597    if (json.has("validateProfileId"))
10598      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
10599    if (json.has("_validateProfileId"))
10600      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
10601    if (json.has("value"))
10602      res.setValueElement(parseString(json.get("value").getAsString()));
10603    if (json.has("_value"))
10604      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10605    if (json.has("warningOnly"))
10606      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
10607    if (json.has("_warningOnly"))
10608      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
10609    return res;
10610  }
10611
10612  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10613    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
10614    parseBackboneProperties(json, res);
10615    if (json.has("name"))
10616      res.setNameElement(parseString(json.get("name").getAsString()));
10617    if (json.has("_name"))
10618      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10619    if (json.has("description"))
10620      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10621    if (json.has("_description"))
10622      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10623    if (json.has("metadata"))
10624      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), owner));
10625    if (json.has("action")) {
10626      JsonArray array = json.getAsJsonArray("action");
10627      for (int i = 0; i < array.size(); i++) {
10628        res.getAction().add(parseTestScriptTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
10629      }
10630    };
10631    return res;
10632  }
10633
10634  protected TestScript.TestScriptTestActionComponent parseTestScriptTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10635    TestScript.TestScriptTestActionComponent res = new TestScript.TestScriptTestActionComponent();
10636    parseBackboneProperties(json, res);
10637    if (json.has("operation"))
10638      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10639    if (json.has("assert"))
10640      res.setAssert(parseTestScriptTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
10641    return res;
10642  }
10643
10644  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10645    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
10646    parseBackboneProperties(json, res);
10647    if (json.has("action")) {
10648      JsonArray array = json.getAsJsonArray("action");
10649      for (int i = 0; i < array.size(); i++) {
10650        res.getAction().add(parseTestScriptTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
10651      }
10652    };
10653    return res;
10654  }
10655
10656  protected TestScript.TestScriptTeardownActionComponent parseTestScriptTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
10657    TestScript.TestScriptTeardownActionComponent res = new TestScript.TestScriptTeardownActionComponent();
10658    parseBackboneProperties(json, res);
10659    if (json.has("operation"))
10660      res.setOperation(parseTestScriptTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
10661    return res;
10662  }
10663
10664  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
10665    ValueSet res = new ValueSet();
10666    parseDomainResourceProperties(json, res);
10667    if (json.has("url"))
10668      res.setUrlElement(parseUri(json.get("url").getAsString()));
10669    if (json.has("_url"))
10670      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10671    if (json.has("identifier"))
10672      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10673    if (json.has("version"))
10674      res.setVersionElement(parseString(json.get("version").getAsString()));
10675    if (json.has("_version"))
10676      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10677    if (json.has("name"))
10678      res.setNameElement(parseString(json.get("name").getAsString()));
10679    if (json.has("_name"))
10680      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10681    if (json.has("status"))
10682      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ConformanceResourceStatus.NULL, new Enumerations.ConformanceResourceStatusEnumFactory()));
10683    if (json.has("_status"))
10684      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10685    if (json.has("experimental"))
10686      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10687    if (json.has("_experimental"))
10688      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10689    if (json.has("publisher"))
10690      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10691    if (json.has("_publisher"))
10692      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10693    if (json.has("contact")) {
10694      JsonArray array = json.getAsJsonArray("contact");
10695      for (int i = 0; i < array.size(); i++) {
10696        res.getContact().add(parseValueSetValueSetContactComponent(array.get(i).getAsJsonObject(), res));
10697      }
10698    };
10699    if (json.has("date"))
10700      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10701    if (json.has("_date"))
10702      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10703    if (json.has("lockedDate"))
10704      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
10705    if (json.has("_lockedDate"))
10706      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
10707    if (json.has("description"))
10708      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10709    if (json.has("_description"))
10710      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10711    if (json.has("useContext")) {
10712      JsonArray array = json.getAsJsonArray("useContext");
10713      for (int i = 0; i < array.size(); i++) {
10714        res.getUseContext().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10715      }
10716    };
10717    if (json.has("immutable"))
10718      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
10719    if (json.has("_immutable"))
10720      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
10721    if (json.has("requirements"))
10722      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
10723    if (json.has("_requirements"))
10724      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
10725    if (json.has("copyright"))
10726      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
10727    if (json.has("_copyright"))
10728      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10729    if (json.has("extensible"))
10730      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
10731    if (json.has("_extensible"))
10732      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
10733    if (json.has("codeSystem"))
10734      res.setCodeSystem(parseValueSetValueSetCodeSystemComponent(json.getAsJsonObject("codeSystem"), res));
10735    if (json.has("compose"))
10736      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
10737    if (json.has("expansion"))
10738      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
10739    return res;
10740  }
10741
10742  protected ValueSet.ValueSetContactComponent parseValueSetValueSetContactComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10743    ValueSet.ValueSetContactComponent res = new ValueSet.ValueSetContactComponent();
10744    parseBackboneProperties(json, res);
10745    if (json.has("name"))
10746      res.setNameElement(parseString(json.get("name").getAsString()));
10747    if (json.has("_name"))
10748      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10749    if (json.has("telecom")) {
10750      JsonArray array = json.getAsJsonArray("telecom");
10751      for (int i = 0; i < array.size(); i++) {
10752        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10753      }
10754    };
10755    return res;
10756  }
10757
10758  protected ValueSet.ValueSetCodeSystemComponent parseValueSetValueSetCodeSystemComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10759    ValueSet.ValueSetCodeSystemComponent res = new ValueSet.ValueSetCodeSystemComponent();
10760    parseBackboneProperties(json, res);
10761    if (json.has("system"))
10762      res.setSystemElement(parseUri(json.get("system").getAsString()));
10763    if (json.has("_system"))
10764      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10765    if (json.has("version"))
10766      res.setVersionElement(parseString(json.get("version").getAsString()));
10767    if (json.has("_version"))
10768      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10769    if (json.has("caseSensitive"))
10770      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
10771    if (json.has("_caseSensitive"))
10772      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
10773    if (json.has("concept")) {
10774      JsonArray array = json.getAsJsonArray("concept");
10775      for (int i = 0; i < array.size(); i++) {
10776        res.getConcept().add(parseValueSetConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
10777      }
10778    };
10779    return res;
10780  }
10781
10782  protected ValueSet.ConceptDefinitionComponent parseValueSetConceptDefinitionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10783    ValueSet.ConceptDefinitionComponent res = new ValueSet.ConceptDefinitionComponent();
10784    parseBackboneProperties(json, res);
10785    if (json.has("code"))
10786      res.setCodeElement(parseCode(json.get("code").getAsString()));
10787    if (json.has("_code"))
10788      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10789    if (json.has("abstract"))
10790      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
10791    if (json.has("_abstract"))
10792      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
10793    if (json.has("display"))
10794      res.setDisplayElement(parseString(json.get("display").getAsString()));
10795    if (json.has("_display"))
10796      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10797    if (json.has("definition"))
10798      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
10799    if (json.has("_definition"))
10800      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
10801    if (json.has("designation")) {
10802      JsonArray array = json.getAsJsonArray("designation");
10803      for (int i = 0; i < array.size(); i++) {
10804        res.getDesignation().add(parseValueSetConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
10805      }
10806    };
10807    if (json.has("concept")) {
10808      JsonArray array = json.getAsJsonArray("concept");
10809      for (int i = 0; i < array.size(); i++) {
10810        res.getConcept().add(parseValueSetConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
10811      }
10812    };
10813    return res;
10814  }
10815
10816  protected ValueSet.ConceptDefinitionDesignationComponent parseValueSetConceptDefinitionDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10817    ValueSet.ConceptDefinitionDesignationComponent res = new ValueSet.ConceptDefinitionDesignationComponent();
10818    parseBackboneProperties(json, res);
10819    if (json.has("language"))
10820      res.setLanguageElement(parseCode(json.get("language").getAsString()));
10821    if (json.has("_language"))
10822      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
10823    if (json.has("use"))
10824      res.setUse(parseCoding(json.getAsJsonObject("use")));
10825    if (json.has("value"))
10826      res.setValueElement(parseString(json.get("value").getAsString()));
10827    if (json.has("_value"))
10828      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10829    return res;
10830  }
10831
10832  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10833    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
10834    parseBackboneProperties(json, res);
10835    if (json.has("import")) {
10836      JsonArray array = json.getAsJsonArray("import");
10837      for (int i = 0; i < array.size(); i++) {
10838        res.getImport().add(parseUri(array.get(i).getAsString()));
10839      }
10840    };
10841    if (json.has("_import")) {
10842      JsonArray array = json.getAsJsonArray("_import");
10843      for (int i = 0; i < array.size(); i++) {
10844        if (i == res.getImport().size())
10845          res.getImport().add(parseUri(null));
10846        if (array.get(i) instanceof JsonObject) 
10847          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
10848      }
10849    };
10850    if (json.has("include")) {
10851      JsonArray array = json.getAsJsonArray("include");
10852      for (int i = 0; i < array.size(); i++) {
10853        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10854      }
10855    };
10856    if (json.has("exclude")) {
10857      JsonArray array = json.getAsJsonArray("exclude");
10858      for (int i = 0; i < array.size(); i++) {
10859        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
10860      }
10861    };
10862    return res;
10863  }
10864
10865  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10866    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
10867    parseBackboneProperties(json, res);
10868    if (json.has("system"))
10869      res.setSystemElement(parseUri(json.get("system").getAsString()));
10870    if (json.has("_system"))
10871      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10872    if (json.has("version"))
10873      res.setVersionElement(parseString(json.get("version").getAsString()));
10874    if (json.has("_version"))
10875      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10876    if (json.has("concept")) {
10877      JsonArray array = json.getAsJsonArray("concept");
10878      for (int i = 0; i < array.size(); i++) {
10879        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
10880      }
10881    };
10882    if (json.has("filter")) {
10883      JsonArray array = json.getAsJsonArray("filter");
10884      for (int i = 0; i < array.size(); i++) {
10885        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
10886      }
10887    };
10888    return res;
10889  }
10890
10891  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10892    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
10893    parseBackboneProperties(json, res);
10894    if (json.has("code"))
10895      res.setCodeElement(parseCode(json.get("code").getAsString()));
10896    if (json.has("_code"))
10897      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10898    if (json.has("display"))
10899      res.setDisplayElement(parseString(json.get("display").getAsString()));
10900    if (json.has("_display"))
10901      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10902    if (json.has("designation")) {
10903      JsonArray array = json.getAsJsonArray("designation");
10904      for (int i = 0; i < array.size(); i++) {
10905        res.getDesignation().add(parseValueSetConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
10906      }
10907    };
10908    return res;
10909  }
10910
10911  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10912    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
10913    parseBackboneProperties(json, res);
10914    if (json.has("property"))
10915      res.setPropertyElement(parseCode(json.get("property").getAsString()));
10916    if (json.has("_property"))
10917      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
10918    if (json.has("op"))
10919      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
10920    if (json.has("_op"))
10921      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
10922    if (json.has("value"))
10923      res.setValueElement(parseCode(json.get("value").getAsString()));
10924    if (json.has("_value"))
10925      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10926    return res;
10927  }
10928
10929  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10930    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
10931    parseBackboneProperties(json, res);
10932    if (json.has("identifier"))
10933      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
10934    if (json.has("_identifier"))
10935      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
10936    if (json.has("timestamp"))
10937      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
10938    if (json.has("_timestamp"))
10939      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
10940    if (json.has("total"))
10941      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
10942    if (json.has("_total"))
10943      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
10944    if (json.has("offset"))
10945      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
10946    if (json.has("_offset"))
10947      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
10948    if (json.has("parameter")) {
10949      JsonArray array = json.getAsJsonArray("parameter");
10950      for (int i = 0; i < array.size(); i++) {
10951        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
10952      }
10953    };
10954    if (json.has("contains")) {
10955      JsonArray array = json.getAsJsonArray("contains");
10956      for (int i = 0; i < array.size(); i++) {
10957        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
10958      }
10959    };
10960    return res;
10961  }
10962
10963  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10964    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
10965    parseBackboneProperties(json, res);
10966    if (json.has("name"))
10967      res.setNameElement(parseString(json.get("name").getAsString()));
10968    if (json.has("_name"))
10969      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10970    Type value = parseType("value", json);
10971    if (value != null)
10972      res.setValue(value);
10973    return res;
10974  }
10975
10976  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
10977    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
10978    parseBackboneProperties(json, res);
10979    if (json.has("system"))
10980      res.setSystemElement(parseUri(json.get("system").getAsString()));
10981    if (json.has("_system"))
10982      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
10983    if (json.has("abstract"))
10984      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
10985    if (json.has("_abstract"))
10986      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
10987    if (json.has("version"))
10988      res.setVersionElement(parseString(json.get("version").getAsString()));
10989    if (json.has("_version"))
10990      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10991    if (json.has("code"))
10992      res.setCodeElement(parseCode(json.get("code").getAsString()));
10993    if (json.has("_code"))
10994      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10995    if (json.has("display"))
10996      res.setDisplayElement(parseString(json.get("display").getAsString()));
10997    if (json.has("_display"))
10998      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
10999    if (json.has("contains")) {
11000      JsonArray array = json.getAsJsonArray("contains");
11001      for (int i = 0; i < array.size(); i++) {
11002        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
11003      }
11004    };
11005    return res;
11006  }
11007
11008  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
11009    VisionPrescription res = new VisionPrescription();
11010    parseDomainResourceProperties(json, res);
11011    if (json.has("identifier")) {
11012      JsonArray array = json.getAsJsonArray("identifier");
11013      for (int i = 0; i < array.size(); i++) {
11014        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11015      }
11016    };
11017    if (json.has("dateWritten"))
11018      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
11019    if (json.has("_dateWritten"))
11020      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
11021    if (json.has("patient"))
11022      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11023    if (json.has("prescriber"))
11024      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
11025    if (json.has("encounter"))
11026      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11027    Type reason = parseType("reason", json);
11028    if (reason != null)
11029      res.setReason(reason);
11030    if (json.has("dispense")) {
11031      JsonArray array = json.getAsJsonArray("dispense");
11032      for (int i = 0; i < array.size(); i++) {
11033        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
11034      }
11035    };
11036    return res;
11037  }
11038
11039  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
11040    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
11041    parseBackboneProperties(json, res);
11042    if (json.has("product"))
11043      res.setProduct(parseCoding(json.getAsJsonObject("product")));
11044    if (json.has("eye"))
11045      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
11046    if (json.has("_eye"))
11047      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
11048    if (json.has("sphere"))
11049      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
11050    if (json.has("_sphere"))
11051      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
11052    if (json.has("cylinder"))
11053      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
11054    if (json.has("_cylinder"))
11055      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
11056    if (json.has("axis"))
11057      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
11058    if (json.has("_axis"))
11059      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
11060    if (json.has("prism"))
11061      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
11062    if (json.has("_prism"))
11063      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
11064    if (json.has("base"))
11065      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
11066    if (json.has("_base"))
11067      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
11068    if (json.has("add"))
11069      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
11070    if (json.has("_add"))
11071      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
11072    if (json.has("power"))
11073      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
11074    if (json.has("_power"))
11075      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
11076    if (json.has("backCurve"))
11077      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
11078    if (json.has("_backCurve"))
11079      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
11080    if (json.has("diameter"))
11081      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
11082    if (json.has("_diameter"))
11083      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
11084    if (json.has("duration"))
11085      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
11086    if (json.has("color"))
11087      res.setColorElement(parseString(json.get("color").getAsString()));
11088    if (json.has("_color"))
11089      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
11090    if (json.has("brand"))
11091      res.setBrandElement(parseString(json.get("brand").getAsString()));
11092    if (json.has("_brand"))
11093      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
11094    if (json.has("notes"))
11095      res.setNotesElement(parseString(json.get("notes").getAsString()));
11096    if (json.has("_notes"))
11097      parseElementProperties(json.getAsJsonObject("_notes"), res.getNotesElement());
11098    return res;
11099  }
11100
11101  @Override
11102  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
11103    if (!json.has("resourceType")) {
11104      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11105    }
11106    String t = json.get("resourceType").getAsString();
11107    if (Utilities.noString(t))
11108      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
11109    if (t.equals("Parameters"))
11110      return parseParameters(json);
11111    else if (t.equals("Account"))
11112      return parseAccount(json);
11113    else if (t.equals("AllergyIntolerance"))
11114      return parseAllergyIntolerance(json);
11115    else if (t.equals("Appointment"))
11116      return parseAppointment(json);
11117    else if (t.equals("AppointmentResponse"))
11118      return parseAppointmentResponse(json);
11119    else if (t.equals("AuditEvent"))
11120      return parseAuditEvent(json);
11121    else if (t.equals("Basic"))
11122      return parseBasic(json);
11123    else if (t.equals("Binary"))
11124      return parseBinary(json);
11125    else if (t.equals("BodySite"))
11126      return parseBodySite(json);
11127    else if (t.equals("Bundle"))
11128      return parseBundle(json);
11129    else if (t.equals("CarePlan"))
11130      return parseCarePlan(json);
11131    else if (t.equals("Claim"))
11132      return parseClaim(json);
11133    else if (t.equals("ClaimResponse"))
11134      return parseClaimResponse(json);
11135    else if (t.equals("ClinicalImpression"))
11136      return parseClinicalImpression(json);
11137    else if (t.equals("Communication"))
11138      return parseCommunication(json);
11139    else if (t.equals("CommunicationRequest"))
11140      return parseCommunicationRequest(json);
11141    else if (t.equals("Composition"))
11142      return parseComposition(json);
11143    else if (t.equals("ConceptMap"))
11144      return parseConceptMap(json);
11145    else if (t.equals("Condition"))
11146      return parseCondition(json);
11147    else if (t.equals("Conformance"))
11148      return parseConformance(json);
11149    else if (t.equals("Contract"))
11150      return parseContract(json);
11151    else if (t.equals("Coverage"))
11152      return parseCoverage(json);
11153    else if (t.equals("DataElement"))
11154      return parseDataElement(json);
11155    else if (t.equals("DetectedIssue"))
11156      return parseDetectedIssue(json);
11157    else if (t.equals("Device"))
11158      return parseDevice(json);
11159    else if (t.equals("DeviceComponent"))
11160      return parseDeviceComponent(json);
11161    else if (t.equals("DeviceMetric"))
11162      return parseDeviceMetric(json);
11163    else if (t.equals("DeviceUseRequest"))
11164      return parseDeviceUseRequest(json);
11165    else if (t.equals("DeviceUseStatement"))
11166      return parseDeviceUseStatement(json);
11167    else if (t.equals("DiagnosticOrder"))
11168      return parseDiagnosticOrder(json);
11169    else if (t.equals("DiagnosticReport"))
11170      return parseDiagnosticReport(json);
11171    else if (t.equals("DocumentManifest"))
11172      return parseDocumentManifest(json);
11173    else if (t.equals("DocumentReference"))
11174      return parseDocumentReference(json);
11175    else if (t.equals("EligibilityRequest"))
11176      return parseEligibilityRequest(json);
11177    else if (t.equals("EligibilityResponse"))
11178      return parseEligibilityResponse(json);
11179    else if (t.equals("Encounter"))
11180      return parseEncounter(json);
11181    else if (t.equals("EnrollmentRequest"))
11182      return parseEnrollmentRequest(json);
11183    else if (t.equals("EnrollmentResponse"))
11184      return parseEnrollmentResponse(json);
11185    else if (t.equals("EpisodeOfCare"))
11186      return parseEpisodeOfCare(json);
11187    else if (t.equals("ExplanationOfBenefit"))
11188      return parseExplanationOfBenefit(json);
11189    else if (t.equals("FamilyMemberHistory"))
11190      return parseFamilyMemberHistory(json);
11191    else if (t.equals("Flag"))
11192      return parseFlag(json);
11193    else if (t.equals("Goal"))
11194      return parseGoal(json);
11195    else if (t.equals("Group"))
11196      return parseGroup(json);
11197    else if (t.equals("HealthcareService"))
11198      return parseHealthcareService(json);
11199    else if (t.equals("ImagingObjectSelection"))
11200      return parseImagingObjectSelection(json);
11201    else if (t.equals("ImagingStudy"))
11202      return parseImagingStudy(json);
11203    else if (t.equals("Immunization"))
11204      return parseImmunization(json);
11205    else if (t.equals("ImmunizationRecommendation"))
11206      return parseImmunizationRecommendation(json);
11207    else if (t.equals("ImplementationGuide"))
11208      return parseImplementationGuide(json);
11209    else if (t.equals("List"))
11210      return parseList_(json);
11211    else if (t.equals("Location"))
11212      return parseLocation(json);
11213    else if (t.equals("Media"))
11214      return parseMedia(json);
11215    else if (t.equals("Medication"))
11216      return parseMedication(json);
11217    else if (t.equals("MedicationAdministration"))
11218      return parseMedicationAdministration(json);
11219    else if (t.equals("MedicationDispense"))
11220      return parseMedicationDispense(json);
11221    else if (t.equals("MedicationOrder"))
11222      return parseMedicationOrder(json);
11223    else if (t.equals("MedicationStatement"))
11224      return parseMedicationStatement(json);
11225    else if (t.equals("MessageHeader"))
11226      return parseMessageHeader(json);
11227    else if (t.equals("NamingSystem"))
11228      return parseNamingSystem(json);
11229    else if (t.equals("NutritionOrder"))
11230      return parseNutritionOrder(json);
11231    else if (t.equals("Observation"))
11232      return parseObservation(json);
11233    else if (t.equals("OperationDefinition"))
11234      return parseOperationDefinition(json);
11235    else if (t.equals("OperationOutcome"))
11236      return parseOperationOutcome(json);
11237    else if (t.equals("Order"))
11238      return parseOrder(json);
11239    else if (t.equals("OrderResponse"))
11240      return parseOrderResponse(json);
11241    else if (t.equals("Organization"))
11242      return parseOrganization(json);
11243    else if (t.equals("Patient"))
11244      return parsePatient(json);
11245    else if (t.equals("PaymentNotice"))
11246      return parsePaymentNotice(json);
11247    else if (t.equals("PaymentReconciliation"))
11248      return parsePaymentReconciliation(json);
11249    else if (t.equals("Person"))
11250      return parsePerson(json);
11251    else if (t.equals("Practitioner"))
11252      return parsePractitioner(json);
11253    else if (t.equals("Procedure"))
11254      return parseProcedure(json);
11255    else if (t.equals("ProcedureRequest"))
11256      return parseProcedureRequest(json);
11257    else if (t.equals("ProcessRequest"))
11258      return parseProcessRequest(json);
11259    else if (t.equals("ProcessResponse"))
11260      return parseProcessResponse(json);
11261    else if (t.equals("Provenance"))
11262      return parseProvenance(json);
11263    else if (t.equals("Questionnaire"))
11264      return parseQuestionnaire(json);
11265    else if (t.equals("QuestionnaireResponse"))
11266      return parseQuestionnaireResponse(json);
11267    else if (t.equals("ReferralRequest"))
11268      return parseReferralRequest(json);
11269    else if (t.equals("RelatedPerson"))
11270      return parseRelatedPerson(json);
11271    else if (t.equals("RiskAssessment"))
11272      return parseRiskAssessment(json);
11273    else if (t.equals("Schedule"))
11274      return parseSchedule(json);
11275    else if (t.equals("SearchParameter"))
11276      return parseSearchParameter(json);
11277    else if (t.equals("Slot"))
11278      return parseSlot(json);
11279    else if (t.equals("Specimen"))
11280      return parseSpecimen(json);
11281    else if (t.equals("StructureDefinition"))
11282      return parseStructureDefinition(json);
11283    else if (t.equals("Subscription"))
11284      return parseSubscription(json);
11285    else if (t.equals("Substance"))
11286      return parseSubstance(json);
11287    else if (t.equals("SupplyDelivery"))
11288      return parseSupplyDelivery(json);
11289    else if (t.equals("SupplyRequest"))
11290      return parseSupplyRequest(json);
11291    else if (t.equals("TestScript"))
11292      return parseTestScript(json);
11293    else if (t.equals("ValueSet"))
11294      return parseValueSet(json);
11295    else if (t.equals("VisionPrescription"))
11296      return parseVisionPrescription(json);
11297    else if (t.equals("Binary"))
11298      return parseBinary(json);
11299    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
11300  }
11301
11302  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
11303    if (json.has(prefix+"Identifier"))
11304      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
11305    else if (json.has(prefix+"Coding"))
11306      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
11307    else if (json.has(prefix+"Reference"))
11308      return parseReference(json.getAsJsonObject(prefix+"Reference"));
11309    else if (json.has(prefix+"Signature"))
11310      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
11311    else if (json.has(prefix+"SampledData"))
11312      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
11313    else if (json.has(prefix+"Quantity"))
11314      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
11315    else if (json.has(prefix+"Period"))
11316      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
11317    else if (json.has(prefix+"Attachment"))
11318      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
11319    else if (json.has(prefix+"Ratio"))
11320      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
11321    else if (json.has(prefix+"Range"))
11322      return parseRange(json.getAsJsonObject(prefix+"Range"));
11323    else if (json.has(prefix+"Annotation"))
11324      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
11325    else if (json.has(prefix+"CodeableConcept"))
11326      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
11327    else if (json.has(prefix+"Money"))
11328      return parseMoney(json.getAsJsonObject(prefix+"Money"));
11329    else if (json.has(prefix+"SimpleQuantity"))
11330      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
11331    else if (json.has(prefix+"Duration"))
11332      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
11333    else if (json.has(prefix+"Count"))
11334      return parseCount(json.getAsJsonObject(prefix+"Count"));
11335    else if (json.has(prefix+"Distance"))
11336      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
11337    else if (json.has(prefix+"Age"))
11338      return parseAge(json.getAsJsonObject(prefix+"Age"));
11339    else if (json.has(prefix+"HumanName"))
11340      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
11341    else if (json.has(prefix+"ContactPoint"))
11342      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
11343    else if (json.has(prefix+"Meta"))
11344      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
11345    else if (json.has(prefix+"Address"))
11346      return parseAddress(json.getAsJsonObject(prefix+"Address"));
11347    else if (json.has(prefix+"Timing"))
11348      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
11349    else if (json.has(prefix+"ElementDefinition"))
11350      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
11351    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
11352      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
11353      if (json.has("_"+prefix+"Date"))
11354        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
11355      return t;
11356    }
11357    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
11358      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
11359      if (json.has("_"+prefix+"DateTime"))
11360        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
11361      return t;
11362    }
11363    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
11364      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
11365      if (json.has("_"+prefix+"Code"))
11366        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
11367      return t;
11368    }
11369    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
11370      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
11371      if (json.has("_"+prefix+"String"))
11372        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
11373      return t;
11374    }
11375    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
11376      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
11377      if (json.has("_"+prefix+"Integer"))
11378        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
11379      return t;
11380    }
11381    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
11382      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
11383      if (json.has("_"+prefix+"Oid"))
11384        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
11385      return t;
11386    }
11387    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
11388      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
11389      if (json.has("_"+prefix+"Uri"))
11390        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
11391      return t;
11392    }
11393    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
11394      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
11395      if (json.has("_"+prefix+"Uuid"))
11396        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
11397      return t;
11398    }
11399    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
11400      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
11401      if (json.has("_"+prefix+"Instant"))
11402        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
11403      return t;
11404    }
11405    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
11406      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
11407      if (json.has("_"+prefix+"Boolean"))
11408        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
11409      return t;
11410    }
11411    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
11412      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
11413      if (json.has("_"+prefix+"Base64Binary"))
11414        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
11415      return t;
11416    }
11417    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
11418      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
11419      if (json.has("_"+prefix+"UnsignedInt"))
11420        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
11421      return t;
11422    }
11423    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
11424      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
11425      if (json.has("_"+prefix+"Markdown"))
11426        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
11427      return t;
11428    }
11429    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
11430      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
11431      if (json.has("_"+prefix+"Time"))
11432        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
11433      return t;
11434    }
11435    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
11436      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
11437      if (json.has("_"+prefix+"Id"))
11438        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
11439      return t;
11440    }
11441    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
11442      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
11443      if (json.has("_"+prefix+"PositiveInt"))
11444        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
11445      return t;
11446    }
11447    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
11448      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
11449      if (json.has("_"+prefix+"Decimal"))
11450        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
11451      return t;
11452    }
11453    return null;
11454  }
11455
11456  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
11457    if (type.equals("Identifier"))
11458      return parseIdentifier(json);
11459    else if (type.equals("Coding"))
11460      return parseCoding(json);
11461    else if (type.equals("Reference"))
11462      return parseReference(json);
11463    else if (type.equals("Signature"))
11464      return parseSignature(json);
11465    else if (type.equals("SampledData"))
11466      return parseSampledData(json);
11467    else if (type.equals("Quantity"))
11468      return parseQuantity(json);
11469    else if (type.equals("Period"))
11470      return parsePeriod(json);
11471    else if (type.equals("Attachment"))
11472      return parseAttachment(json);
11473    else if (type.equals("Ratio"))
11474      return parseRatio(json);
11475    else if (type.equals("Range"))
11476      return parseRange(json);
11477    else if (type.equals("Annotation"))
11478      return parseAnnotation(json);
11479    else if (type.equals("CodeableConcept"))
11480      return parseCodeableConcept(json);
11481    else if (type.equals("Money"))
11482      return parseMoney(json);
11483    else if (type.equals("SimpleQuantity"))
11484      return parseSimpleQuantity(json);
11485    else if (type.equals("Duration"))
11486      return parseDuration(json);
11487    else if (type.equals("Count"))
11488      return parseCount(json);
11489    else if (type.equals("Distance"))
11490      return parseDistance(json);
11491    else if (type.equals("Age"))
11492      return parseAge(json);
11493    else if (type.equals("HumanName"))
11494      return parseHumanName(json);
11495    else if (type.equals("ContactPoint"))
11496      return parseContactPoint(json);
11497    else if (type.equals("Meta"))
11498      return parseMeta(json);
11499    else if (type.equals("Address"))
11500      return parseAddress(json);
11501    else if (type.equals("Timing"))
11502      return parseTiming(json);
11503    else if (type.equals("ElementDefinition"))
11504      return parseElementDefinition(json);
11505    throw new FHIRFormatError("Unknown Type "+type);
11506  }
11507
11508  protected boolean hasTypeName(JsonObject json, String prefix) {
11509        if (json.has(prefix+"Identifier"))
11510      return true;
11511    if (json.has(prefix+"Coding"))
11512      return true;
11513    if (json.has(prefix+"Reference"))
11514      return true;
11515    if (json.has(prefix+"Signature"))
11516      return true;
11517    if (json.has(prefix+"SampledData"))
11518      return true;
11519    if (json.has(prefix+"Quantity"))
11520      return true;
11521    if (json.has(prefix+"Period"))
11522      return true;
11523    if (json.has(prefix+"Attachment"))
11524      return true;
11525    if (json.has(prefix+"Ratio"))
11526      return true;
11527    if (json.has(prefix+"Range"))
11528      return true;
11529    if (json.has(prefix+"Annotation"))
11530      return true;
11531    if (json.has(prefix+"CodeableConcept"))
11532      return true;
11533    if (json.has(prefix+"Money"))
11534      return true;
11535    if (json.has(prefix+"SimpleQuantity"))
11536      return true;
11537    if (json.has(prefix+"Duration"))
11538      return true;
11539    if (json.has(prefix+"Count"))
11540      return true;
11541    if (json.has(prefix+"Distance"))
11542      return true;
11543    if (json.has(prefix+"Age"))
11544      return true;
11545    if (json.has(prefix+"HumanName"))
11546      return true;
11547    if (json.has(prefix+"ContactPoint"))
11548      return true;
11549    if (json.has(prefix+"Meta"))
11550      return true;
11551    if (json.has(prefix+"Address"))
11552      return true;
11553    if (json.has(prefix+"Timing"))
11554      return true;
11555    if (json.has(prefix+"ElementDefinition"))
11556      return true;
11557    if (json.has(prefix+"Parameters"))
11558      return true;
11559    if (json.has(prefix+"Account"))
11560      return true;
11561    if (json.has(prefix+"AllergyIntolerance"))
11562      return true;
11563    if (json.has(prefix+"Appointment"))
11564      return true;
11565    if (json.has(prefix+"AppointmentResponse"))
11566      return true;
11567    if (json.has(prefix+"AuditEvent"))
11568      return true;
11569    if (json.has(prefix+"Basic"))
11570      return true;
11571    if (json.has(prefix+"Binary"))
11572      return true;
11573    if (json.has(prefix+"BodySite"))
11574      return true;
11575    if (json.has(prefix+"Bundle"))
11576      return true;
11577    if (json.has(prefix+"CarePlan"))
11578      return true;
11579    if (json.has(prefix+"Claim"))
11580      return true;
11581    if (json.has(prefix+"ClaimResponse"))
11582      return true;
11583    if (json.has(prefix+"ClinicalImpression"))
11584      return true;
11585    if (json.has(prefix+"Communication"))
11586      return true;
11587    if (json.has(prefix+"CommunicationRequest"))
11588      return true;
11589    if (json.has(prefix+"Composition"))
11590      return true;
11591    if (json.has(prefix+"ConceptMap"))
11592      return true;
11593    if (json.has(prefix+"Condition"))
11594      return true;
11595    if (json.has(prefix+"Conformance"))
11596      return true;
11597    if (json.has(prefix+"Contract"))
11598      return true;
11599    if (json.has(prefix+"Coverage"))
11600      return true;
11601    if (json.has(prefix+"DataElement"))
11602      return true;
11603    if (json.has(prefix+"DetectedIssue"))
11604      return true;
11605    if (json.has(prefix+"Device"))
11606      return true;
11607    if (json.has(prefix+"DeviceComponent"))
11608      return true;
11609    if (json.has(prefix+"DeviceMetric"))
11610      return true;
11611    if (json.has(prefix+"DeviceUseRequest"))
11612      return true;
11613    if (json.has(prefix+"DeviceUseStatement"))
11614      return true;
11615    if (json.has(prefix+"DiagnosticOrder"))
11616      return true;
11617    if (json.has(prefix+"DiagnosticReport"))
11618      return true;
11619    if (json.has(prefix+"DocumentManifest"))
11620      return true;
11621    if (json.has(prefix+"DocumentReference"))
11622      return true;
11623    if (json.has(prefix+"EligibilityRequest"))
11624      return true;
11625    if (json.has(prefix+"EligibilityResponse"))
11626      return true;
11627    if (json.has(prefix+"Encounter"))
11628      return true;
11629    if (json.has(prefix+"EnrollmentRequest"))
11630      return true;
11631    if (json.has(prefix+"EnrollmentResponse"))
11632      return true;
11633    if (json.has(prefix+"EpisodeOfCare"))
11634      return true;
11635    if (json.has(prefix+"ExplanationOfBenefit"))
11636      return true;
11637    if (json.has(prefix+"FamilyMemberHistory"))
11638      return true;
11639    if (json.has(prefix+"Flag"))
11640      return true;
11641    if (json.has(prefix+"Goal"))
11642      return true;
11643    if (json.has(prefix+"Group"))
11644      return true;
11645    if (json.has(prefix+"HealthcareService"))
11646      return true;
11647    if (json.has(prefix+"ImagingObjectSelection"))
11648      return true;
11649    if (json.has(prefix+"ImagingStudy"))
11650      return true;
11651    if (json.has(prefix+"Immunization"))
11652      return true;
11653    if (json.has(prefix+"ImmunizationRecommendation"))
11654      return true;
11655    if (json.has(prefix+"ImplementationGuide"))
11656      return true;
11657    if (json.has(prefix+"List"))
11658      return true;
11659    if (json.has(prefix+"Location"))
11660      return true;
11661    if (json.has(prefix+"Media"))
11662      return true;
11663    if (json.has(prefix+"Medication"))
11664      return true;
11665    if (json.has(prefix+"MedicationAdministration"))
11666      return true;
11667    if (json.has(prefix+"MedicationDispense"))
11668      return true;
11669    if (json.has(prefix+"MedicationOrder"))
11670      return true;
11671    if (json.has(prefix+"MedicationStatement"))
11672      return true;
11673    if (json.has(prefix+"MessageHeader"))
11674      return true;
11675    if (json.has(prefix+"NamingSystem"))
11676      return true;
11677    if (json.has(prefix+"NutritionOrder"))
11678      return true;
11679    if (json.has(prefix+"Observation"))
11680      return true;
11681    if (json.has(prefix+"OperationDefinition"))
11682      return true;
11683    if (json.has(prefix+"OperationOutcome"))
11684      return true;
11685    if (json.has(prefix+"Order"))
11686      return true;
11687    if (json.has(prefix+"OrderResponse"))
11688      return true;
11689    if (json.has(prefix+"Organization"))
11690      return true;
11691    if (json.has(prefix+"Patient"))
11692      return true;
11693    if (json.has(prefix+"PaymentNotice"))
11694      return true;
11695    if (json.has(prefix+"PaymentReconciliation"))
11696      return true;
11697    if (json.has(prefix+"Person"))
11698      return true;
11699    if (json.has(prefix+"Practitioner"))
11700      return true;
11701    if (json.has(prefix+"Procedure"))
11702      return true;
11703    if (json.has(prefix+"ProcedureRequest"))
11704      return true;
11705    if (json.has(prefix+"ProcessRequest"))
11706      return true;
11707    if (json.has(prefix+"ProcessResponse"))
11708      return true;
11709    if (json.has(prefix+"Provenance"))
11710      return true;
11711    if (json.has(prefix+"Questionnaire"))
11712      return true;
11713    if (json.has(prefix+"QuestionnaireResponse"))
11714      return true;
11715    if (json.has(prefix+"ReferralRequest"))
11716      return true;
11717    if (json.has(prefix+"RelatedPerson"))
11718      return true;
11719    if (json.has(prefix+"RiskAssessment"))
11720      return true;
11721    if (json.has(prefix+"Schedule"))
11722      return true;
11723    if (json.has(prefix+"SearchParameter"))
11724      return true;
11725    if (json.has(prefix+"Slot"))
11726      return true;
11727    if (json.has(prefix+"Specimen"))
11728      return true;
11729    if (json.has(prefix+"StructureDefinition"))
11730      return true;
11731    if (json.has(prefix+"Subscription"))
11732      return true;
11733    if (json.has(prefix+"Substance"))
11734      return true;
11735    if (json.has(prefix+"SupplyDelivery"))
11736      return true;
11737    if (json.has(prefix+"SupplyRequest"))
11738      return true;
11739    if (json.has(prefix+"TestScript"))
11740      return true;
11741    if (json.has(prefix+"ValueSet"))
11742      return true;
11743    if (json.has(prefix+"VisionPrescription"))
11744      return true;
11745    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
11746      return true;
11747    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
11748      return true;
11749    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
11750      return true;
11751    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
11752      return true;
11753    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
11754      return true;
11755    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
11756      return true;
11757    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
11758      return true;
11759    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
11760      return true;
11761    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
11762      return true;
11763    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
11764      return true;
11765    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
11766      return true;
11767    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
11768      return true;
11769    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
11770      return true;
11771    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
11772      return true;
11773    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
11774      return true;
11775    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
11776      return true;
11777    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
11778      return true;
11779    return false;
11780  }
11781  protected void composeElement(Element element) throws IOException {
11782    if (element.hasId())
11783      prop("id", element.getId());
11784      if (makeComments(element)) {
11785        openArray("fhir_comments");
11786        for (String s : element.getFormatCommentsPre())
11787          prop(null,  s);
11788        for (String s : element.getFormatCommentsPost())
11789          prop(null,  s);
11790         closeArray();
11791      }
11792    if (element.hasExtension()) {
11793      openArray("extension");
11794      for (Extension e : element.getExtension())
11795        composeExtension(null, e);
11796      closeArray();
11797    }
11798  }
11799
11800  protected void composeBackbone(BackboneElement element) throws IOException {
11801    composeElement(element);
11802    if (element.hasModifierExtension()) {
11803      openArray("modifierExtension");
11804      for (Extension e : element.getModifierExtension())
11805        composeExtension(null, e);
11806      closeArray();
11807    }
11808  }
11809
11810  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11811    if (value != null && value.getValue() != null) {
11812      prop(name, e.toCode(value.getValue()));
11813    } else if (inArray)   
11814      writeNull(name);
11815  }    
11816
11817  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
11818    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11819      open(inArray ? null : "_"+name);
11820      composeElement(value);
11821      close();
11822    } else if (inArray)   
11823      writeNull(name);
11824  }    
11825
11826  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
11827    if (value != null && value.hasValue()) {
11828        prop(name, value.asStringValue());
11829    }    
11830    else if (inArray) 
11831      writeNull(name); 
11832  }    
11833
11834  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
11835    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11836      open(inArray ? null : "_"+name);
11837      composeElement(value);
11838      close();
11839    }
11840    else if (inArray) 
11841      writeNull(name); 
11842  }
11843
11844  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
11845    if (value != null && value.hasValue()) {
11846        prop(name, value.asStringValue());
11847    }    
11848    else if (inArray) 
11849      writeNull(name); 
11850  }    
11851
11852  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
11853    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11854      open(inArray ? null : "_"+name);
11855      composeElement(value);
11856      close();
11857    }
11858    else if (inArray) 
11859      writeNull(name); 
11860  }
11861
11862  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
11863    if (value != null && value.hasValue()) {
11864        prop(name, toString(value.getValue()));
11865    }    
11866    else if (inArray) 
11867      writeNull(name); 
11868  }    
11869
11870  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
11871    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11872      open(inArray ? null : "_"+name);
11873      composeElement(value);
11874      close();
11875    }
11876    else if (inArray) 
11877      writeNull(name); 
11878  }
11879
11880  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
11881    if (value != null && value.hasValue()) {
11882        prop(name, toString(value.getValue()));
11883    }    
11884    else if (inArray) 
11885      writeNull(name); 
11886  }    
11887
11888  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
11889    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11890      open(inArray ? null : "_"+name);
11891      composeElement(value);
11892      close();
11893    }
11894    else if (inArray) 
11895      writeNull(name); 
11896  }
11897
11898  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
11899    if (value != null && value.hasValue()) {
11900        prop(name, Integer.valueOf(value.getValue()));
11901    }    
11902    else if (inArray) 
11903      writeNull(name); 
11904  }    
11905
11906  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
11907    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11908      open(inArray ? null : "_"+name);
11909      composeElement(value);
11910      close();
11911    }
11912    else if (inArray) 
11913      writeNull(name); 
11914  }
11915
11916  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
11917    if (value != null && value.hasValue()) {
11918        prop(name, toString(value.getValue()));
11919    }    
11920    else if (inArray) 
11921      writeNull(name); 
11922  }    
11923
11924  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
11925    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11926      open(inArray ? null : "_"+name);
11927      composeElement(value);
11928      close();
11929    }
11930    else if (inArray) 
11931      writeNull(name); 
11932  }
11933
11934  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
11935    if (value != null && value.hasValue()) {
11936        prop(name, toString(value.getValue()));
11937    }    
11938    else if (inArray) 
11939      writeNull(name); 
11940  }    
11941
11942  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
11943    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11944      open(inArray ? null : "_"+name);
11945      composeElement(value);
11946      close();
11947    }
11948    else if (inArray) 
11949      writeNull(name); 
11950  }
11951
11952  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
11953    if (value != null && value.hasValue()) {
11954        prop(name, toString(value.getValue()));
11955    }    
11956    else if (inArray) 
11957      writeNull(name); 
11958  }    
11959
11960  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
11961    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11962      open(inArray ? null : "_"+name);
11963      composeElement(value);
11964      close();
11965    }
11966    else if (inArray) 
11967      writeNull(name); 
11968  }
11969
11970  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
11971    if (value != null && value.hasValue()) {
11972        prop(name, value.asStringValue());
11973    }    
11974    else if (inArray) 
11975      writeNull(name); 
11976  }    
11977
11978  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
11979    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11980      open(inArray ? null : "_"+name);
11981      composeElement(value);
11982      close();
11983    }
11984    else if (inArray) 
11985      writeNull(name); 
11986  }
11987
11988  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
11989    if (value != null && value.hasValue()) {
11990        prop(name, value.getValue());
11991    }    
11992    else if (inArray) 
11993      writeNull(name); 
11994  }    
11995
11996  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
11997    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
11998      open(inArray ? null : "_"+name);
11999      composeElement(value);
12000      close();
12001    }
12002    else if (inArray) 
12003      writeNull(name); 
12004  }
12005
12006  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
12007    if (value != null && value.hasValue()) {
12008        prop(name, toString(value.getValue()));
12009    }    
12010    else if (inArray) 
12011      writeNull(name); 
12012  }    
12013
12014  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
12015    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12016      open(inArray ? null : "_"+name);
12017      composeElement(value);
12018      close();
12019    }
12020    else if (inArray) 
12021      writeNull(name); 
12022  }
12023
12024  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
12025    if (value != null && value.hasValue()) {
12026        prop(name, Integer.valueOf(value.getValue()));
12027    }    
12028    else if (inArray) 
12029      writeNull(name); 
12030  }    
12031
12032  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
12033    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12034      open(inArray ? null : "_"+name);
12035      composeElement(value);
12036      close();
12037    }
12038    else if (inArray) 
12039      writeNull(name); 
12040  }
12041
12042  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
12043    if (value != null && value.hasValue()) {
12044        prop(name, toString(value.getValue()));
12045    }    
12046    else if (inArray) 
12047      writeNull(name); 
12048  }    
12049
12050  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
12051    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12052      open(inArray ? null : "_"+name);
12053      composeElement(value);
12054      close();
12055    }
12056    else if (inArray) 
12057      writeNull(name); 
12058  }
12059
12060  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
12061    if (value != null && value.hasValue()) {
12062        prop(name, value.asStringValue());
12063    }    
12064    else if (inArray) 
12065      writeNull(name); 
12066  }    
12067
12068  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
12069    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12070      open(inArray ? null : "_"+name);
12071      composeElement(value);
12072      close();
12073    }
12074    else if (inArray) 
12075      writeNull(name); 
12076  }
12077
12078  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
12079    if (value != null && value.hasValue()) {
12080        prop(name, toString(value.getValue()));
12081    }    
12082    else if (inArray) 
12083      writeNull(name); 
12084  }    
12085
12086  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
12087    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12088      open(inArray ? null : "_"+name);
12089      composeElement(value);
12090      close();
12091    }
12092    else if (inArray) 
12093      writeNull(name); 
12094  }
12095
12096  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
12097    if (value != null && value.hasValue()) {
12098        prop(name, Integer.valueOf(value.getValue()));
12099    }    
12100    else if (inArray) 
12101      writeNull(name); 
12102  }    
12103
12104  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
12105    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12106      open(inArray ? null : "_"+name);
12107      composeElement(value);
12108      close();
12109    }
12110    else if (inArray) 
12111      writeNull(name); 
12112  }
12113
12114  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
12115    if (value != null && value.hasValue()) {
12116        prop(name, value.getValue());
12117    }    
12118    else if (inArray) 
12119      writeNull(name); 
12120  }    
12121
12122  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
12123    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
12124      open(inArray ? null : "_"+name);
12125      composeElement(value);
12126      close();
12127    }
12128    else if (inArray) 
12129      writeNull(name); 
12130  }
12131
12132  protected void composeExtension(String name, Extension element) throws IOException {
12133    if (element != null) {
12134      open(name);
12135      composeExtensionInner(element);
12136      close();
12137    }
12138  }
12139
12140  protected void composeExtensionInner(Extension element) throws IOException {
12141      composeElement(element);
12142      if (element.hasUrlElement()) {
12143        composeUriCore("url", element.getUrlElement(), false);
12144        composeUriExtras("url", element.getUrlElement(), false);
12145      }
12146      if (element.hasValue()) {
12147        composeType("value", element.getValue());
12148      }
12149  }
12150
12151  protected void composeNarrative(String name, Narrative element) throws IOException {
12152    if (element != null) {
12153      open(name);
12154      composeNarrativeInner(element);
12155      close();
12156    }
12157  }
12158
12159  protected void composeNarrativeInner(Narrative element) throws IOException {
12160      composeElement(element);
12161      if (element.hasStatusElement()) {
12162        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12163        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
12164      }
12165      if (element.hasDiv()) {
12166        composeXhtml("div", element.getDiv());
12167      }
12168  }
12169
12170  protected void composeIdentifier(String name, Identifier element) throws IOException {
12171    if (element != null) {
12172      open(name);
12173      composeIdentifierInner(element);
12174      close();
12175    }
12176  }
12177
12178  protected void composeIdentifierInner(Identifier element) throws IOException {
12179      composeElement(element);
12180      if (element.hasUseElement()) {
12181        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12182        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
12183      }
12184      if (element.hasType()) {
12185        composeCodeableConcept("type", element.getType());
12186      }
12187      if (element.hasSystemElement()) {
12188        composeUriCore("system", element.getSystemElement(), false);
12189        composeUriExtras("system", element.getSystemElement(), false);
12190      }
12191      if (element.hasValueElement()) {
12192        composeStringCore("value", element.getValueElement(), false);
12193        composeStringExtras("value", element.getValueElement(), false);
12194      }
12195      if (element.hasPeriod()) {
12196        composePeriod("period", element.getPeriod());
12197      }
12198      if (element.hasAssigner()) {
12199        composeReference("assigner", element.getAssigner());
12200      }
12201  }
12202
12203  protected void composeCoding(String name, Coding element) throws IOException {
12204    if (element != null) {
12205      open(name);
12206      composeCodingInner(element);
12207      close();
12208    }
12209  }
12210
12211  protected void composeCodingInner(Coding element) throws IOException {
12212      composeElement(element);
12213      if (element.hasSystemElement()) {
12214        composeUriCore("system", element.getSystemElement(), false);
12215        composeUriExtras("system", element.getSystemElement(), false);
12216      }
12217      if (element.hasVersionElement()) {
12218        composeStringCore("version", element.getVersionElement(), false);
12219        composeStringExtras("version", element.getVersionElement(), false);
12220      }
12221      if (element.hasCodeElement()) {
12222        composeCodeCore("code", element.getCodeElement(), false);
12223        composeCodeExtras("code", element.getCodeElement(), false);
12224      }
12225      if (element.hasDisplayElement()) {
12226        composeStringCore("display", element.getDisplayElement(), false);
12227        composeStringExtras("display", element.getDisplayElement(), false);
12228      }
12229      if (element.hasUserSelectedElement()) {
12230        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
12231        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
12232      }
12233  }
12234
12235  protected void composeReference(String name, Reference element) throws IOException {
12236    if (element != null) {
12237      open(name);
12238      composeReferenceInner(element);
12239      close();
12240    }
12241  }
12242
12243  protected void composeReferenceInner(Reference element) throws IOException {
12244      composeElement(element);
12245      if (element.hasReferenceElement()) {
12246        composeStringCore("reference", element.getReferenceElement(), false);
12247        composeStringExtras("reference", element.getReferenceElement(), false);
12248      }
12249      if (element.hasDisplayElement()) {
12250        composeStringCore("display", element.getDisplayElement(), false);
12251        composeStringExtras("display", element.getDisplayElement(), false);
12252      }
12253  }
12254
12255  protected void composeSignature(String name, Signature element) throws IOException {
12256    if (element != null) {
12257      open(name);
12258      composeSignatureInner(element);
12259      close();
12260    }
12261  }
12262
12263  protected void composeSignatureInner(Signature element) throws IOException {
12264      composeElement(element);
12265      if (element.hasType()) {
12266        openArray("type");
12267        for (Coding e : element.getType()) 
12268          composeCoding(null, e);
12269        closeArray();
12270      };
12271      if (element.hasWhenElement()) {
12272        composeInstantCore("when", element.getWhenElement(), false);
12273        composeInstantExtras("when", element.getWhenElement(), false);
12274      }
12275      if (element.hasWho()) {
12276        composeType("who", element.getWho());
12277      }
12278      if (element.hasContentTypeElement()) {
12279        composeCodeCore("contentType", element.getContentTypeElement(), false);
12280        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12281      }
12282      if (element.hasBlobElement()) {
12283        composeBase64BinaryCore("blob", element.getBlobElement(), false);
12284        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
12285      }
12286  }
12287
12288  protected void composeSampledData(String name, SampledData element) throws IOException {
12289    if (element != null) {
12290      open(name);
12291      composeSampledDataInner(element);
12292      close();
12293    }
12294  }
12295
12296  protected void composeSampledDataInner(SampledData element) throws IOException {
12297      composeElement(element);
12298      if (element.hasOrigin()) {
12299        composeSimpleQuantity("origin", element.getOrigin());
12300      }
12301      if (element.hasPeriodElement()) {
12302        composeDecimalCore("period", element.getPeriodElement(), false);
12303        composeDecimalExtras("period", element.getPeriodElement(), false);
12304      }
12305      if (element.hasFactorElement()) {
12306        composeDecimalCore("factor", element.getFactorElement(), false);
12307        composeDecimalExtras("factor", element.getFactorElement(), false);
12308      }
12309      if (element.hasLowerLimitElement()) {
12310        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
12311        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
12312      }
12313      if (element.hasUpperLimitElement()) {
12314        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
12315        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
12316      }
12317      if (element.hasDimensionsElement()) {
12318        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
12319        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
12320      }
12321      if (element.hasDataElement()) {
12322        composeStringCore("data", element.getDataElement(), false);
12323        composeStringExtras("data", element.getDataElement(), false);
12324      }
12325  }
12326
12327  protected void composeQuantity(String name, Quantity element) throws IOException {
12328    if (element != null) {
12329      open(name);
12330      composeQuantityInner(element);
12331      close();
12332    }
12333  }
12334
12335  protected void composeQuantityInner(Quantity element) throws IOException {
12336      composeElement(element);
12337      if (element.hasValueElement()) {
12338        composeDecimalCore("value", element.getValueElement(), false);
12339        composeDecimalExtras("value", element.getValueElement(), false);
12340      }
12341      if (element.hasComparatorElement()) {
12342        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12343        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
12344      }
12345      if (element.hasUnitElement()) {
12346        composeStringCore("unit", element.getUnitElement(), false);
12347        composeStringExtras("unit", element.getUnitElement(), false);
12348      }
12349      if (element.hasSystemElement()) {
12350        composeUriCore("system", element.getSystemElement(), false);
12351        composeUriExtras("system", element.getSystemElement(), false);
12352      }
12353      if (element.hasCodeElement()) {
12354        composeCodeCore("code", element.getCodeElement(), false);
12355        composeCodeExtras("code", element.getCodeElement(), false);
12356      }
12357  }
12358
12359  protected void composePeriod(String name, Period element) throws IOException {
12360    if (element != null) {
12361      open(name);
12362      composePeriodInner(element);
12363      close();
12364    }
12365  }
12366
12367  protected void composePeriodInner(Period element) throws IOException {
12368      composeElement(element);
12369      if (element.hasStartElement()) {
12370        composeDateTimeCore("start", element.getStartElement(), false);
12371        composeDateTimeExtras("start", element.getStartElement(), false);
12372      }
12373      if (element.hasEndElement()) {
12374        composeDateTimeCore("end", element.getEndElement(), false);
12375        composeDateTimeExtras("end", element.getEndElement(), false);
12376      }
12377  }
12378
12379  protected void composeAttachment(String name, Attachment element) throws IOException {
12380    if (element != null) {
12381      open(name);
12382      composeAttachmentInner(element);
12383      close();
12384    }
12385  }
12386
12387  protected void composeAttachmentInner(Attachment element) throws IOException {
12388      composeElement(element);
12389      if (element.hasContentTypeElement()) {
12390        composeCodeCore("contentType", element.getContentTypeElement(), false);
12391        composeCodeExtras("contentType", element.getContentTypeElement(), false);
12392      }
12393      if (element.hasLanguageElement()) {
12394        composeCodeCore("language", element.getLanguageElement(), false);
12395        composeCodeExtras("language", element.getLanguageElement(), false);
12396      }
12397      if (element.hasDataElement()) {
12398        composeBase64BinaryCore("data", element.getDataElement(), false);
12399        composeBase64BinaryExtras("data", element.getDataElement(), false);
12400      }
12401      if (element.hasUrlElement()) {
12402        composeUriCore("url", element.getUrlElement(), false);
12403        composeUriExtras("url", element.getUrlElement(), false);
12404      }
12405      if (element.hasSizeElement()) {
12406        composeUnsignedIntCore("size", element.getSizeElement(), false);
12407        composeUnsignedIntExtras("size", element.getSizeElement(), false);
12408      }
12409      if (element.hasHashElement()) {
12410        composeBase64BinaryCore("hash", element.getHashElement(), false);
12411        composeBase64BinaryExtras("hash", element.getHashElement(), false);
12412      }
12413      if (element.hasTitleElement()) {
12414        composeStringCore("title", element.getTitleElement(), false);
12415        composeStringExtras("title", element.getTitleElement(), false);
12416      }
12417      if (element.hasCreationElement()) {
12418        composeDateTimeCore("creation", element.getCreationElement(), false);
12419        composeDateTimeExtras("creation", element.getCreationElement(), false);
12420      }
12421  }
12422
12423  protected void composeRatio(String name, Ratio element) throws IOException {
12424    if (element != null) {
12425      open(name);
12426      composeRatioInner(element);
12427      close();
12428    }
12429  }
12430
12431  protected void composeRatioInner(Ratio element) throws IOException {
12432      composeElement(element);
12433      if (element.hasNumerator()) {
12434        composeQuantity("numerator", element.getNumerator());
12435      }
12436      if (element.hasDenominator()) {
12437        composeQuantity("denominator", element.getDenominator());
12438      }
12439  }
12440
12441  protected void composeRange(String name, Range element) throws IOException {
12442    if (element != null) {
12443      open(name);
12444      composeRangeInner(element);
12445      close();
12446    }
12447  }
12448
12449  protected void composeRangeInner(Range element) throws IOException {
12450      composeElement(element);
12451      if (element.hasLow()) {
12452        composeSimpleQuantity("low", element.getLow());
12453      }
12454      if (element.hasHigh()) {
12455        composeSimpleQuantity("high", element.getHigh());
12456      }
12457  }
12458
12459  protected void composeAnnotation(String name, Annotation element) throws IOException {
12460    if (element != null) {
12461      open(name);
12462      composeAnnotationInner(element);
12463      close();
12464    }
12465  }
12466
12467  protected void composeAnnotationInner(Annotation element) throws IOException {
12468      composeElement(element);
12469      if (element.hasAuthor()) {
12470        composeType("author", element.getAuthor());
12471      }
12472      if (element.hasTimeElement()) {
12473        composeDateTimeCore("time", element.getTimeElement(), false);
12474        composeDateTimeExtras("time", element.getTimeElement(), false);
12475      }
12476      if (element.hasTextElement()) {
12477        composeStringCore("text", element.getTextElement(), false);
12478        composeStringExtras("text", element.getTextElement(), false);
12479      }
12480  }
12481
12482  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
12483    if (element != null) {
12484      open(name);
12485      composeCodeableConceptInner(element);
12486      close();
12487    }
12488  }
12489
12490  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
12491      composeElement(element);
12492      if (element.hasCoding()) {
12493        openArray("coding");
12494        for (Coding e : element.getCoding()) 
12495          composeCoding(null, e);
12496        closeArray();
12497      };
12498      if (element.hasTextElement()) {
12499        composeStringCore("text", element.getTextElement(), false);
12500        composeStringExtras("text", element.getTextElement(), false);
12501      }
12502  }
12503
12504  protected void composeMoney(String name, Money element) throws IOException {
12505    if (element != null) {
12506      open(name);
12507      composeMoneyInner(element);
12508      close();
12509    }
12510  }
12511
12512  protected void composeMoneyInner(Money element) throws IOException {
12513      composeElement(element);
12514      if (element.hasValueElement()) {
12515        composeDecimalCore("value", element.getValueElement(), false);
12516        composeDecimalExtras("value", element.getValueElement(), false);
12517      }
12518      if (element.hasComparatorElement()) {
12519        composeEnumerationCore("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12520        composeEnumerationExtras("comparator", element.getComparatorElement(), new Money.QuantityComparatorEnumFactory(), false);
12521      }
12522      if (element.hasUnitElement()) {
12523        composeStringCore("unit", element.getUnitElement(), false);
12524        composeStringExtras("unit", element.getUnitElement(), false);
12525      }
12526      if (element.hasSystemElement()) {
12527        composeUriCore("system", element.getSystemElement(), false);
12528        composeUriExtras("system", element.getSystemElement(), false);
12529      }
12530      if (element.hasCodeElement()) {
12531        composeCodeCore("code", element.getCodeElement(), false);
12532        composeCodeExtras("code", element.getCodeElement(), false);
12533      }
12534  }
12535
12536  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
12537    if (element != null) {
12538      open(name);
12539      composeSimpleQuantityInner(element);
12540      close();
12541    }
12542  }
12543
12544  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
12545      composeElement(element);
12546      if (element.hasValueElement()) {
12547        composeDecimalCore("value", element.getValueElement(), false);
12548        composeDecimalExtras("value", element.getValueElement(), false);
12549      }
12550      if (element.hasComparatorElement()) {
12551        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12552        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
12553      }
12554      if (element.hasUnitElement()) {
12555        composeStringCore("unit", element.getUnitElement(), false);
12556        composeStringExtras("unit", element.getUnitElement(), false);
12557      }
12558      if (element.hasSystemElement()) {
12559        composeUriCore("system", element.getSystemElement(), false);
12560        composeUriExtras("system", element.getSystemElement(), false);
12561      }
12562      if (element.hasCodeElement()) {
12563        composeCodeCore("code", element.getCodeElement(), false);
12564        composeCodeExtras("code", element.getCodeElement(), false);
12565      }
12566  }
12567
12568  protected void composeDuration(String name, Duration element) throws IOException {
12569    if (element != null) {
12570      open(name);
12571      composeDurationInner(element);
12572      close();
12573    }
12574  }
12575
12576  protected void composeDurationInner(Duration element) throws IOException {
12577      composeElement(element);
12578      if (element.hasValueElement()) {
12579        composeDecimalCore("value", element.getValueElement(), false);
12580        composeDecimalExtras("value", element.getValueElement(), false);
12581      }
12582      if (element.hasComparatorElement()) {
12583        composeEnumerationCore("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12584        composeEnumerationExtras("comparator", element.getComparatorElement(), new Duration.QuantityComparatorEnumFactory(), false);
12585      }
12586      if (element.hasUnitElement()) {
12587        composeStringCore("unit", element.getUnitElement(), false);
12588        composeStringExtras("unit", element.getUnitElement(), false);
12589      }
12590      if (element.hasSystemElement()) {
12591        composeUriCore("system", element.getSystemElement(), false);
12592        composeUriExtras("system", element.getSystemElement(), false);
12593      }
12594      if (element.hasCodeElement()) {
12595        composeCodeCore("code", element.getCodeElement(), false);
12596        composeCodeExtras("code", element.getCodeElement(), false);
12597      }
12598  }
12599
12600  protected void composeCount(String name, Count element) throws IOException {
12601    if (element != null) {
12602      open(name);
12603      composeCountInner(element);
12604      close();
12605    }
12606  }
12607
12608  protected void composeCountInner(Count element) throws IOException {
12609      composeElement(element);
12610      if (element.hasValueElement()) {
12611        composeDecimalCore("value", element.getValueElement(), false);
12612        composeDecimalExtras("value", element.getValueElement(), false);
12613      }
12614      if (element.hasComparatorElement()) {
12615        composeEnumerationCore("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12616        composeEnumerationExtras("comparator", element.getComparatorElement(), new Count.QuantityComparatorEnumFactory(), false);
12617      }
12618      if (element.hasUnitElement()) {
12619        composeStringCore("unit", element.getUnitElement(), false);
12620        composeStringExtras("unit", element.getUnitElement(), false);
12621      }
12622      if (element.hasSystemElement()) {
12623        composeUriCore("system", element.getSystemElement(), false);
12624        composeUriExtras("system", element.getSystemElement(), false);
12625      }
12626      if (element.hasCodeElement()) {
12627        composeCodeCore("code", element.getCodeElement(), false);
12628        composeCodeExtras("code", element.getCodeElement(), false);
12629      }
12630  }
12631
12632  protected void composeDistance(String name, Distance element) throws IOException {
12633    if (element != null) {
12634      open(name);
12635      composeDistanceInner(element);
12636      close();
12637    }
12638  }
12639
12640  protected void composeDistanceInner(Distance element) throws IOException {
12641      composeElement(element);
12642      if (element.hasValueElement()) {
12643        composeDecimalCore("value", element.getValueElement(), false);
12644        composeDecimalExtras("value", element.getValueElement(), false);
12645      }
12646      if (element.hasComparatorElement()) {
12647        composeEnumerationCore("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12648        composeEnumerationExtras("comparator", element.getComparatorElement(), new Distance.QuantityComparatorEnumFactory(), false);
12649      }
12650      if (element.hasUnitElement()) {
12651        composeStringCore("unit", element.getUnitElement(), false);
12652        composeStringExtras("unit", element.getUnitElement(), false);
12653      }
12654      if (element.hasSystemElement()) {
12655        composeUriCore("system", element.getSystemElement(), false);
12656        composeUriExtras("system", element.getSystemElement(), false);
12657      }
12658      if (element.hasCodeElement()) {
12659        composeCodeCore("code", element.getCodeElement(), false);
12660        composeCodeExtras("code", element.getCodeElement(), false);
12661      }
12662  }
12663
12664  protected void composeAge(String name, Age element) throws IOException {
12665    if (element != null) {
12666      open(name);
12667      composeAgeInner(element);
12668      close();
12669    }
12670  }
12671
12672  protected void composeAgeInner(Age element) throws IOException {
12673      composeElement(element);
12674      if (element.hasValueElement()) {
12675        composeDecimalCore("value", element.getValueElement(), false);
12676        composeDecimalExtras("value", element.getValueElement(), false);
12677      }
12678      if (element.hasComparatorElement()) {
12679        composeEnumerationCore("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12680        composeEnumerationExtras("comparator", element.getComparatorElement(), new Age.QuantityComparatorEnumFactory(), false);
12681      }
12682      if (element.hasUnitElement()) {
12683        composeStringCore("unit", element.getUnitElement(), false);
12684        composeStringExtras("unit", element.getUnitElement(), false);
12685      }
12686      if (element.hasSystemElement()) {
12687        composeUriCore("system", element.getSystemElement(), false);
12688        composeUriExtras("system", element.getSystemElement(), false);
12689      }
12690      if (element.hasCodeElement()) {
12691        composeCodeCore("code", element.getCodeElement(), false);
12692        composeCodeExtras("code", element.getCodeElement(), false);
12693      }
12694  }
12695
12696  protected void composeHumanName(String name, HumanName element) throws IOException {
12697    if (element != null) {
12698      open(name);
12699      composeHumanNameInner(element);
12700      close();
12701    }
12702  }
12703
12704  protected void composeHumanNameInner(HumanName element) throws IOException {
12705      composeElement(element);
12706      if (element.hasUseElement()) {
12707        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12708        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
12709      }
12710      if (element.hasTextElement()) {
12711        composeStringCore("text", element.getTextElement(), false);
12712        composeStringExtras("text", element.getTextElement(), false);
12713      }
12714      if (element.hasFamily()) {
12715        openArray("family");
12716        for (StringType e : element.getFamily()) 
12717          composeStringCore(null, e, true);
12718        closeArray();
12719        if (anyHasExtras(element.getFamily())) {
12720          openArray("_family");
12721          for (StringType e : element.getFamily()) 
12722            composeStringExtras(null, e, true);
12723          closeArray();
12724        }
12725      };
12726      if (element.hasGiven()) {
12727        openArray("given");
12728        for (StringType e : element.getGiven()) 
12729          composeStringCore(null, e, true);
12730        closeArray();
12731        if (anyHasExtras(element.getGiven())) {
12732          openArray("_given");
12733          for (StringType e : element.getGiven()) 
12734            composeStringExtras(null, e, true);
12735          closeArray();
12736        }
12737      };
12738      if (element.hasPrefix()) {
12739        openArray("prefix");
12740        for (StringType e : element.getPrefix()) 
12741          composeStringCore(null, e, true);
12742        closeArray();
12743        if (anyHasExtras(element.getPrefix())) {
12744          openArray("_prefix");
12745          for (StringType e : element.getPrefix()) 
12746            composeStringExtras(null, e, true);
12747          closeArray();
12748        }
12749      };
12750      if (element.hasSuffix()) {
12751        openArray("suffix");
12752        for (StringType e : element.getSuffix()) 
12753          composeStringCore(null, e, true);
12754        closeArray();
12755        if (anyHasExtras(element.getSuffix())) {
12756          openArray("_suffix");
12757          for (StringType e : element.getSuffix()) 
12758            composeStringExtras(null, e, true);
12759          closeArray();
12760        }
12761      };
12762      if (element.hasPeriod()) {
12763        composePeriod("period", element.getPeriod());
12764      }
12765  }
12766
12767  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
12768    if (element != null) {
12769      open(name);
12770      composeContactPointInner(element);
12771      close();
12772    }
12773  }
12774
12775  protected void composeContactPointInner(ContactPoint element) throws IOException {
12776      composeElement(element);
12777      if (element.hasSystemElement()) {
12778        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12779        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
12780      }
12781      if (element.hasValueElement()) {
12782        composeStringCore("value", element.getValueElement(), false);
12783        composeStringExtras("value", element.getValueElement(), false);
12784      }
12785      if (element.hasUseElement()) {
12786        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12787        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
12788      }
12789      if (element.hasRankElement()) {
12790        composePositiveIntCore("rank", element.getRankElement(), false);
12791        composePositiveIntExtras("rank", element.getRankElement(), false);
12792      }
12793      if (element.hasPeriod()) {
12794        composePeriod("period", element.getPeriod());
12795      }
12796  }
12797
12798  protected void composeMeta(String name, Meta element) throws IOException {
12799    if (element != null) {
12800      open(name);
12801      composeMetaInner(element);
12802      close();
12803    }
12804  }
12805
12806  protected void composeMetaInner(Meta element) throws IOException {
12807      composeElement(element);
12808      if (element.hasVersionIdElement()) {
12809        composeIdCore("versionId", element.getVersionIdElement(), false);
12810        composeIdExtras("versionId", element.getVersionIdElement(), false);
12811      }
12812      if (element.hasLastUpdatedElement()) {
12813        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
12814        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
12815      }
12816      if (element.hasProfile()) {
12817        openArray("profile");
12818        for (UriType e : element.getProfile()) 
12819          composeUriCore(null, e, true);
12820        closeArray();
12821        if (anyHasExtras(element.getProfile())) {
12822          openArray("_profile");
12823          for (UriType e : element.getProfile()) 
12824            composeUriExtras(null, e, true);
12825          closeArray();
12826        }
12827      };
12828      if (element.hasSecurity()) {
12829        openArray("security");
12830        for (Coding e : element.getSecurity()) 
12831          composeCoding(null, e);
12832        closeArray();
12833      };
12834      if (element.hasTag()) {
12835        openArray("tag");
12836        for (Coding e : element.getTag()) 
12837          composeCoding(null, e);
12838        closeArray();
12839      };
12840  }
12841
12842  protected void composeAddress(String name, Address element) throws IOException {
12843    if (element != null) {
12844      open(name);
12845      composeAddressInner(element);
12846      close();
12847    }
12848  }
12849
12850  protected void composeAddressInner(Address element) throws IOException {
12851      composeElement(element);
12852      if (element.hasUseElement()) {
12853        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12854        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
12855      }
12856      if (element.hasTypeElement()) {
12857        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12858        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
12859      }
12860      if (element.hasTextElement()) {
12861        composeStringCore("text", element.getTextElement(), false);
12862        composeStringExtras("text", element.getTextElement(), false);
12863      }
12864      if (element.hasLine()) {
12865        openArray("line");
12866        for (StringType e : element.getLine()) 
12867          composeStringCore(null, e, true);
12868        closeArray();
12869        if (anyHasExtras(element.getLine())) {
12870          openArray("_line");
12871          for (StringType e : element.getLine()) 
12872            composeStringExtras(null, e, true);
12873          closeArray();
12874        }
12875      };
12876      if (element.hasCityElement()) {
12877        composeStringCore("city", element.getCityElement(), false);
12878        composeStringExtras("city", element.getCityElement(), false);
12879      }
12880      if (element.hasDistrictElement()) {
12881        composeStringCore("district", element.getDistrictElement(), false);
12882        composeStringExtras("district", element.getDistrictElement(), false);
12883      }
12884      if (element.hasStateElement()) {
12885        composeStringCore("state", element.getStateElement(), false);
12886        composeStringExtras("state", element.getStateElement(), false);
12887      }
12888      if (element.hasPostalCodeElement()) {
12889        composeStringCore("postalCode", element.getPostalCodeElement(), false);
12890        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
12891      }
12892      if (element.hasCountryElement()) {
12893        composeStringCore("country", element.getCountryElement(), false);
12894        composeStringExtras("country", element.getCountryElement(), false);
12895      }
12896      if (element.hasPeriod()) {
12897        composePeriod("period", element.getPeriod());
12898      }
12899  }
12900
12901  protected void composeTiming(String name, Timing element) throws IOException {
12902    if (element != null) {
12903      open(name);
12904      composeTimingInner(element);
12905      close();
12906    }
12907  }
12908
12909  protected void composeTimingInner(Timing element) throws IOException {
12910      composeElement(element);
12911      if (element.hasEvent()) {
12912        openArray("event");
12913        for (DateTimeType e : element.getEvent()) 
12914          composeDateTimeCore(null, e, true);
12915        closeArray();
12916        if (anyHasExtras(element.getEvent())) {
12917          openArray("_event");
12918          for (DateTimeType e : element.getEvent()) 
12919            composeDateTimeExtras(null, e, true);
12920          closeArray();
12921        }
12922      };
12923      if (element.hasRepeat()) {
12924        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
12925      }
12926      if (element.hasCode()) {
12927        composeCodeableConcept("code", element.getCode());
12928      }
12929  }
12930
12931  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
12932    if (element != null) {
12933      open(name);
12934      composeTimingTimingRepeatComponentInner(element);
12935      close();
12936    }
12937  }
12938
12939  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
12940      composeElement(element);
12941      if (element.hasBounds()) {
12942        composeType("bounds", element.getBounds());
12943      }
12944      if (element.hasCountElement()) {
12945        composeIntegerCore("count", element.getCountElement(), false);
12946        composeIntegerExtras("count", element.getCountElement(), false);
12947      }
12948      if (element.hasDurationElement()) {
12949        composeDecimalCore("duration", element.getDurationElement(), false);
12950        composeDecimalExtras("duration", element.getDurationElement(), false);
12951      }
12952      if (element.hasDurationMaxElement()) {
12953        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
12954        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
12955      }
12956      if (element.hasDurationUnitsElement()) {
12957        composeEnumerationCore("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12958        composeEnumerationExtras("durationUnits", element.getDurationUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12959      }
12960      if (element.hasFrequencyElement()) {
12961        composeIntegerCore("frequency", element.getFrequencyElement(), false);
12962        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
12963      }
12964      if (element.hasFrequencyMaxElement()) {
12965        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
12966        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
12967      }
12968      if (element.hasPeriodElement()) {
12969        composeDecimalCore("period", element.getPeriodElement(), false);
12970        composeDecimalExtras("period", element.getPeriodElement(), false);
12971      }
12972      if (element.hasPeriodMaxElement()) {
12973        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
12974        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
12975      }
12976      if (element.hasPeriodUnitsElement()) {
12977        composeEnumerationCore("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12978        composeEnumerationExtras("periodUnits", element.getPeriodUnitsElement(), new Timing.UnitsOfTimeEnumFactory(), false);
12979      }
12980      if (element.hasWhenElement()) {
12981        composeEnumerationCore("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12982        composeEnumerationExtras("when", element.getWhenElement(), new Timing.EventTimingEnumFactory(), false);
12983      }
12984  }
12985
12986  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
12987    if (element != null) {
12988      open(name);
12989      composeElementDefinitionInner(element);
12990      close();
12991    }
12992  }
12993
12994  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
12995      composeElement(element);
12996      if (element.hasPathElement()) {
12997        composeStringCore("path", element.getPathElement(), false);
12998        composeStringExtras("path", element.getPathElement(), false);
12999      }
13000      if (element.hasRepresentation()) {
13001        openArray("representation");
13002        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
13003          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
13004        closeArray();
13005        if (anyHasExtras(element.getRepresentation())) {
13006          openArray("_representation");
13007          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
13008            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
13009          closeArray();
13010        }
13011      };
13012      if (element.hasNameElement()) {
13013        composeStringCore("name", element.getNameElement(), false);
13014        composeStringExtras("name", element.getNameElement(), false);
13015      }
13016      if (element.hasLabelElement()) {
13017        composeStringCore("label", element.getLabelElement(), false);
13018        composeStringExtras("label", element.getLabelElement(), false);
13019      }
13020      if (element.hasCode()) {
13021        openArray("code");
13022        for (Coding e : element.getCode()) 
13023          composeCoding(null, e);
13024        closeArray();
13025      };
13026      if (element.hasSlicing()) {
13027        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
13028      }
13029      if (element.hasShortElement()) {
13030        composeStringCore("short", element.getShortElement(), false);
13031        composeStringExtras("short", element.getShortElement(), false);
13032      }
13033      if (element.hasDefinitionElement()) {
13034        composeMarkdownCore("definition", element.getDefinitionElement(), false);
13035        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
13036      }
13037      if (element.hasCommentsElement()) {
13038        composeMarkdownCore("comments", element.getCommentsElement(), false);
13039        composeMarkdownExtras("comments", element.getCommentsElement(), false);
13040      }
13041      if (element.hasRequirementsElement()) {
13042        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
13043        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
13044      }
13045      if (element.hasAlias()) {
13046        openArray("alias");
13047        for (StringType e : element.getAlias()) 
13048          composeStringCore(null, e, true);
13049        closeArray();
13050        if (anyHasExtras(element.getAlias())) {
13051          openArray("_alias");
13052          for (StringType e : element.getAlias()) 
13053            composeStringExtras(null, e, true);
13054          closeArray();
13055        }
13056      };
13057      if (element.hasMinElement()) {
13058        composeIntegerCore("min", element.getMinElement(), false);
13059        composeIntegerExtras("min", element.getMinElement(), false);
13060      }
13061      if (element.hasMaxElement()) {
13062        composeStringCore("max", element.getMaxElement(), false);
13063        composeStringExtras("max", element.getMaxElement(), false);
13064      }
13065      if (element.hasBase()) {
13066        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
13067      }
13068      if (element.hasType()) {
13069        openArray("type");
13070        for (ElementDefinition.TypeRefComponent e : element.getType()) 
13071          composeElementDefinitionTypeRefComponent(null, e);
13072        closeArray();
13073      };
13074      if (element.hasNameReferenceElement()) {
13075        composeStringCore("nameReference", element.getNameReferenceElement(), false);
13076        composeStringExtras("nameReference", element.getNameReferenceElement(), false);
13077      }
13078      if (element.hasDefaultValue()) {
13079        composeType("defaultValue", element.getDefaultValue());
13080      }
13081      if (element.hasMeaningWhenMissingElement()) {
13082        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13083        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
13084      }
13085      if (element.hasFixed()) {
13086        composeType("fixed", element.getFixed());
13087      }
13088      if (element.hasPattern()) {
13089        composeType("pattern", element.getPattern());
13090      }
13091      if (element.hasExample()) {
13092        composeType("example", element.getExample());
13093      }
13094      if (element.hasMinValue()) {
13095        composeType("minValue", element.getMinValue());
13096      }
13097      if (element.hasMaxValue()) {
13098        composeType("maxValue", element.getMaxValue());
13099      }
13100      if (element.hasMaxLengthElement()) {
13101        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
13102        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
13103      }
13104      if (element.hasCondition()) {
13105        openArray("condition");
13106        for (IdType e : element.getCondition()) 
13107          composeIdCore(null, e, true);
13108        closeArray();
13109        if (anyHasExtras(element.getCondition())) {
13110          openArray("_condition");
13111          for (IdType e : element.getCondition()) 
13112            composeIdExtras(null, e, true);
13113          closeArray();
13114        }
13115      };
13116      if (element.hasConstraint()) {
13117        openArray("constraint");
13118        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
13119          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
13120        closeArray();
13121      };
13122      if (element.hasMustSupportElement()) {
13123        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
13124        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
13125      }
13126      if (element.hasIsModifierElement()) {
13127        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
13128        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
13129      }
13130      if (element.hasIsSummaryElement()) {
13131        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
13132        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
13133      }
13134      if (element.hasBinding()) {
13135        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
13136      }
13137      if (element.hasMapping()) {
13138        openArray("mapping");
13139        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
13140          composeElementDefinitionElementDefinitionMappingComponent(null, e);
13141        closeArray();
13142      };
13143  }
13144
13145  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13146    if (element != null) {
13147      open(name);
13148      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
13149      close();
13150    }
13151  }
13152
13153  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
13154      composeElement(element);
13155      if (element.hasDiscriminator()) {
13156        openArray("discriminator");
13157        for (StringType e : element.getDiscriminator()) 
13158          composeStringCore(null, e, true);
13159        closeArray();
13160        if (anyHasExtras(element.getDiscriminator())) {
13161          openArray("_discriminator");
13162          for (StringType e : element.getDiscriminator()) 
13163            composeStringExtras(null, e, true);
13164          closeArray();
13165        }
13166      };
13167      if (element.hasDescriptionElement()) {
13168        composeStringCore("description", element.getDescriptionElement(), false);
13169        composeStringExtras("description", element.getDescriptionElement(), false);
13170      }
13171      if (element.hasOrderedElement()) {
13172        composeBooleanCore("ordered", element.getOrderedElement(), false);
13173        composeBooleanExtras("ordered", element.getOrderedElement(), false);
13174      }
13175      if (element.hasRulesElement()) {
13176        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13177        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
13178      }
13179  }
13180
13181  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13182    if (element != null) {
13183      open(name);
13184      composeElementDefinitionElementDefinitionBaseComponentInner(element);
13185      close();
13186    }
13187  }
13188
13189  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
13190      composeElement(element);
13191      if (element.hasPathElement()) {
13192        composeStringCore("path", element.getPathElement(), false);
13193        composeStringExtras("path", element.getPathElement(), false);
13194      }
13195      if (element.hasMinElement()) {
13196        composeIntegerCore("min", element.getMinElement(), false);
13197        composeIntegerExtras("min", element.getMinElement(), false);
13198      }
13199      if (element.hasMaxElement()) {
13200        composeStringCore("max", element.getMaxElement(), false);
13201        composeStringExtras("max", element.getMaxElement(), false);
13202      }
13203  }
13204
13205  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
13206    if (element != null) {
13207      open(name);
13208      composeElementDefinitionTypeRefComponentInner(element);
13209      close();
13210    }
13211  }
13212
13213  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
13214      composeElement(element);
13215      if (element.hasCodeElement()) {
13216        composeCodeCore("code", element.getCodeElement(), false);
13217        composeCodeExtras("code", element.getCodeElement(), false);
13218      }
13219      if (element.hasProfile()) {
13220        openArray("profile");
13221        for (UriType e : element.getProfile()) 
13222          composeUriCore(null, e, true);
13223        closeArray();
13224        if (anyHasExtras(element.getProfile())) {
13225          openArray("_profile");
13226          for (UriType e : element.getProfile()) 
13227            composeUriExtras(null, e, true);
13228          closeArray();
13229        }
13230      };
13231      if (element.hasAggregation()) {
13232        openArray("aggregation");
13233        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13234          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13235        closeArray();
13236        if (anyHasExtras(element.getAggregation())) {
13237          openArray("_aggregation");
13238          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
13239            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
13240          closeArray();
13241        }
13242      };
13243  }
13244
13245  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13246    if (element != null) {
13247      open(name);
13248      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
13249      close();
13250    }
13251  }
13252
13253  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
13254      composeElement(element);
13255      if (element.hasKeyElement()) {
13256        composeIdCore("key", element.getKeyElement(), false);
13257        composeIdExtras("key", element.getKeyElement(), false);
13258      }
13259      if (element.hasRequirementsElement()) {
13260        composeStringCore("requirements", element.getRequirementsElement(), false);
13261        composeStringExtras("requirements", element.getRequirementsElement(), false);
13262      }
13263      if (element.hasSeverityElement()) {
13264        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13265        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
13266      }
13267      if (element.hasHumanElement()) {
13268        composeStringCore("human", element.getHumanElement(), false);
13269        composeStringExtras("human", element.getHumanElement(), false);
13270      }
13271      if (element.hasXpathElement()) {
13272        composeStringCore("xpath", element.getXpathElement(), false);
13273        composeStringExtras("xpath", element.getXpathElement(), false);
13274      }
13275  }
13276
13277  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13278    if (element != null) {
13279      open(name);
13280      composeElementDefinitionElementDefinitionBindingComponentInner(element);
13281      close();
13282    }
13283  }
13284
13285  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
13286      composeElement(element);
13287      if (element.hasStrengthElement()) {
13288        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13289        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
13290      }
13291      if (element.hasDescriptionElement()) {
13292        composeStringCore("description", element.getDescriptionElement(), false);
13293        composeStringExtras("description", element.getDescriptionElement(), false);
13294      }
13295      if (element.hasValueSet()) {
13296        composeType("valueSet", element.getValueSet());
13297      }
13298  }
13299
13300  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13301    if (element != null) {
13302      open(name);
13303      composeElementDefinitionElementDefinitionMappingComponentInner(element);
13304      close();
13305    }
13306  }
13307
13308  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
13309      composeElement(element);
13310      if (element.hasIdentityElement()) {
13311        composeIdCore("identity", element.getIdentityElement(), false);
13312        composeIdExtras("identity", element.getIdentityElement(), false);
13313      }
13314      if (element.hasLanguageElement()) {
13315        composeCodeCore("language", element.getLanguageElement(), false);
13316        composeCodeExtras("language", element.getLanguageElement(), false);
13317      }
13318      if (element.hasMapElement()) {
13319        composeStringCore("map", element.getMapElement(), false);
13320        composeStringExtras("map", element.getMapElement(), false);
13321      }
13322  }
13323
13324  protected void composeDomainResourceElements(DomainResource element) throws IOException {
13325      composeResourceElements(element);
13326      if (element.hasText()) {
13327        composeNarrative("text", element.getText());
13328      }
13329      if (element.hasContained()) {
13330        openArray("contained");
13331        for (Resource e : element.getContained()) {
13332          open(null);
13333          composeResource(e);
13334          close();
13335        }
13336        closeArray();
13337      };
13338      if (element.hasExtension()) {
13339        openArray("extension");
13340        for (Extension e : element.getExtension()) 
13341          composeExtension(null, e);
13342        closeArray();
13343      };
13344      if (element.hasModifierExtension()) {
13345        openArray("modifierExtension");
13346        for (Extension e : element.getModifierExtension()) 
13347          composeExtension(null, e);
13348        closeArray();
13349      };
13350  }
13351
13352  protected void composeParameters(String name, Parameters element) throws IOException {
13353    if (element != null) {
13354      prop("resourceType", name);
13355      composeParametersInner(element);
13356    }
13357  }
13358
13359  protected void composeParametersInner(Parameters element) throws IOException {
13360      composeResourceElements(element);
13361      if (element.hasParameter()) {
13362        openArray("parameter");
13363        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
13364          composeParametersParametersParameterComponent(null, e);
13365        closeArray();
13366      };
13367  }
13368
13369  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
13370    if (element != null) {
13371      open(name);
13372      composeParametersParametersParameterComponentInner(element);
13373      close();
13374    }
13375  }
13376
13377  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
13378      composeBackbone(element);
13379      if (element.hasNameElement()) {
13380        composeStringCore("name", element.getNameElement(), false);
13381        composeStringExtras("name", element.getNameElement(), false);
13382      }
13383      if (element.hasValue()) {
13384        composeType("value", element.getValue());
13385      }
13386        if (element.hasResource()) {
13387          open("resource");
13388          composeResource(element.getResource());
13389          close();
13390        }
13391      if (element.hasPart()) {
13392        openArray("part");
13393        for (Parameters.ParametersParameterComponent e : element.getPart()) 
13394          composeParametersParametersParameterComponent(null, e);
13395        closeArray();
13396      };
13397  }
13398
13399  protected void composeResourceElements(Resource element) throws IOException {
13400      if (element.hasIdElement()) {
13401        composeIdCore("id", element.getIdElement(), false);
13402        composeIdExtras("id", element.getIdElement(), false);
13403      }
13404      if (element.hasMeta()) {
13405        composeMeta("meta", element.getMeta());
13406      }
13407      if (element.hasImplicitRulesElement()) {
13408        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
13409        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
13410      }
13411      if (element.hasLanguageElement()) {
13412        composeCodeCore("language", element.getLanguageElement(), false);
13413        composeCodeExtras("language", element.getLanguageElement(), false);
13414      }
13415  }
13416
13417  protected void composeAccount(String name, Account element) throws IOException {
13418    if (element != null) {
13419      prop("resourceType", name);
13420      composeAccountInner(element);
13421    }
13422  }
13423
13424  protected void composeAccountInner(Account element) throws IOException {
13425      composeDomainResourceElements(element);
13426      if (element.hasIdentifier()) {
13427        openArray("identifier");
13428        for (Identifier e : element.getIdentifier()) 
13429          composeIdentifier(null, e);
13430        closeArray();
13431      };
13432      if (element.hasNameElement()) {
13433        composeStringCore("name", element.getNameElement(), false);
13434        composeStringExtras("name", element.getNameElement(), false);
13435      }
13436      if (element.hasType()) {
13437        composeCodeableConcept("type", element.getType());
13438      }
13439      if (element.hasStatusElement()) {
13440        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13441        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
13442      }
13443      if (element.hasActivePeriod()) {
13444        composePeriod("activePeriod", element.getActivePeriod());
13445      }
13446      if (element.hasCurrency()) {
13447        composeCoding("currency", element.getCurrency());
13448      }
13449      if (element.hasBalance()) {
13450        composeMoney("balance", element.getBalance());
13451      }
13452      if (element.hasCoveragePeriod()) {
13453        composePeriod("coveragePeriod", element.getCoveragePeriod());
13454      }
13455      if (element.hasSubject()) {
13456        composeReference("subject", element.getSubject());
13457      }
13458      if (element.hasOwner()) {
13459        composeReference("owner", element.getOwner());
13460      }
13461      if (element.hasDescriptionElement()) {
13462        composeStringCore("description", element.getDescriptionElement(), false);
13463        composeStringExtras("description", element.getDescriptionElement(), false);
13464      }
13465  }
13466
13467  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
13468    if (element != null) {
13469      prop("resourceType", name);
13470      composeAllergyIntoleranceInner(element);
13471    }
13472  }
13473
13474  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
13475      composeDomainResourceElements(element);
13476      if (element.hasIdentifier()) {
13477        openArray("identifier");
13478        for (Identifier e : element.getIdentifier()) 
13479          composeIdentifier(null, e);
13480        closeArray();
13481      };
13482      if (element.hasOnsetElement()) {
13483        composeDateTimeCore("onset", element.getOnsetElement(), false);
13484        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13485      }
13486      if (element.hasRecordedDateElement()) {
13487        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
13488        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
13489      }
13490      if (element.hasRecorder()) {
13491        composeReference("recorder", element.getRecorder());
13492      }
13493      if (element.hasPatient()) {
13494        composeReference("patient", element.getPatient());
13495      }
13496      if (element.hasReporter()) {
13497        composeReference("reporter", element.getReporter());
13498      }
13499      if (element.hasSubstance()) {
13500        composeCodeableConcept("substance", element.getSubstance());
13501      }
13502      if (element.hasStatusElement()) {
13503        composeEnumerationCore("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13504        composeEnumerationExtras("status", element.getStatusElement(), new AllergyIntolerance.AllergyIntoleranceStatusEnumFactory(), false);
13505      }
13506      if (element.hasCriticalityElement()) {
13507        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13508        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
13509      }
13510      if (element.hasTypeElement()) {
13511        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13512        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
13513      }
13514      if (element.hasCategoryElement()) {
13515        composeEnumerationCore("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13516        composeEnumerationExtras("category", element.getCategoryElement(), new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), false);
13517      }
13518      if (element.hasLastOccurenceElement()) {
13519        composeDateTimeCore("lastOccurence", element.getLastOccurenceElement(), false);
13520        composeDateTimeExtras("lastOccurence", element.getLastOccurenceElement(), false);
13521      }
13522      if (element.hasNote()) {
13523        composeAnnotation("note", element.getNote());
13524      }
13525      if (element.hasReaction()) {
13526        openArray("reaction");
13527        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
13528          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
13529        closeArray();
13530      };
13531  }
13532
13533  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13534    if (element != null) {
13535      open(name);
13536      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
13537      close();
13538    }
13539  }
13540
13541  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
13542      composeBackbone(element);
13543      if (element.hasSubstance()) {
13544        composeCodeableConcept("substance", element.getSubstance());
13545      }
13546      if (element.hasCertaintyElement()) {
13547        composeEnumerationCore("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13548        composeEnumerationExtras("certainty", element.getCertaintyElement(), new AllergyIntolerance.AllergyIntoleranceCertaintyEnumFactory(), false);
13549      }
13550      if (element.hasManifestation()) {
13551        openArray("manifestation");
13552        for (CodeableConcept e : element.getManifestation()) 
13553          composeCodeableConcept(null, e);
13554        closeArray();
13555      };
13556      if (element.hasDescriptionElement()) {
13557        composeStringCore("description", element.getDescriptionElement(), false);
13558        composeStringExtras("description", element.getDescriptionElement(), false);
13559      }
13560      if (element.hasOnsetElement()) {
13561        composeDateTimeCore("onset", element.getOnsetElement(), false);
13562        composeDateTimeExtras("onset", element.getOnsetElement(), false);
13563      }
13564      if (element.hasSeverityElement()) {
13565        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13566        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
13567      }
13568      if (element.hasExposureRoute()) {
13569        composeCodeableConcept("exposureRoute", element.getExposureRoute());
13570      }
13571      if (element.hasNote()) {
13572        composeAnnotation("note", element.getNote());
13573      }
13574  }
13575
13576  protected void composeAppointment(String name, Appointment element) throws IOException {
13577    if (element != null) {
13578      prop("resourceType", name);
13579      composeAppointmentInner(element);
13580    }
13581  }
13582
13583  protected void composeAppointmentInner(Appointment element) throws IOException {
13584      composeDomainResourceElements(element);
13585      if (element.hasIdentifier()) {
13586        openArray("identifier");
13587        for (Identifier e : element.getIdentifier()) 
13588          composeIdentifier(null, e);
13589        closeArray();
13590      };
13591      if (element.hasStatusElement()) {
13592        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13593        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
13594      }
13595      if (element.hasType()) {
13596        composeCodeableConcept("type", element.getType());
13597      }
13598      if (element.hasReason()) {
13599        composeCodeableConcept("reason", element.getReason());
13600      }
13601      if (element.hasPriorityElement()) {
13602        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
13603        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
13604      }
13605      if (element.hasDescriptionElement()) {
13606        composeStringCore("description", element.getDescriptionElement(), false);
13607        composeStringExtras("description", element.getDescriptionElement(), false);
13608      }
13609      if (element.hasStartElement()) {
13610        composeInstantCore("start", element.getStartElement(), false);
13611        composeInstantExtras("start", element.getStartElement(), false);
13612      }
13613      if (element.hasEndElement()) {
13614        composeInstantCore("end", element.getEndElement(), false);
13615        composeInstantExtras("end", element.getEndElement(), false);
13616      }
13617      if (element.hasMinutesDurationElement()) {
13618        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
13619        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
13620      }
13621      if (element.hasSlot()) {
13622        openArray("slot");
13623        for (Reference e : element.getSlot()) 
13624          composeReference(null, e);
13625        closeArray();
13626      };
13627      if (element.hasCommentElement()) {
13628        composeStringCore("comment", element.getCommentElement(), false);
13629        composeStringExtras("comment", element.getCommentElement(), false);
13630      }
13631      if (element.hasParticipant()) {
13632        openArray("participant");
13633        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
13634          composeAppointmentAppointmentParticipantComponent(null, e);
13635        closeArray();
13636      };
13637  }
13638
13639  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
13640    if (element != null) {
13641      open(name);
13642      composeAppointmentAppointmentParticipantComponentInner(element);
13643      close();
13644    }
13645  }
13646
13647  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
13648      composeBackbone(element);
13649      if (element.hasType()) {
13650        openArray("type");
13651        for (CodeableConcept e : element.getType()) 
13652          composeCodeableConcept(null, e);
13653        closeArray();
13654      };
13655      if (element.hasActor()) {
13656        composeReference("actor", element.getActor());
13657      }
13658      if (element.hasRequiredElement()) {
13659        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13660        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
13661      }
13662      if (element.hasStatusElement()) {
13663        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13664        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
13665      }
13666  }
13667
13668  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
13669    if (element != null) {
13670      prop("resourceType", name);
13671      composeAppointmentResponseInner(element);
13672    }
13673  }
13674
13675  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
13676      composeDomainResourceElements(element);
13677      if (element.hasIdentifier()) {
13678        openArray("identifier");
13679        for (Identifier e : element.getIdentifier()) 
13680          composeIdentifier(null, e);
13681        closeArray();
13682      };
13683      if (element.hasAppointment()) {
13684        composeReference("appointment", element.getAppointment());
13685      }
13686      if (element.hasStartElement()) {
13687        composeInstantCore("start", element.getStartElement(), false);
13688        composeInstantExtras("start", element.getStartElement(), false);
13689      }
13690      if (element.hasEndElement()) {
13691        composeInstantCore("end", element.getEndElement(), false);
13692        composeInstantExtras("end", element.getEndElement(), false);
13693      }
13694      if (element.hasParticipantType()) {
13695        openArray("participantType");
13696        for (CodeableConcept e : element.getParticipantType()) 
13697          composeCodeableConcept(null, e);
13698        closeArray();
13699      };
13700      if (element.hasActor()) {
13701        composeReference("actor", element.getActor());
13702      }
13703      if (element.hasParticipantStatusElement()) {
13704        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13705        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
13706      }
13707      if (element.hasCommentElement()) {
13708        composeStringCore("comment", element.getCommentElement(), false);
13709        composeStringExtras("comment", element.getCommentElement(), false);
13710      }
13711  }
13712
13713  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
13714    if (element != null) {
13715      prop("resourceType", name);
13716      composeAuditEventInner(element);
13717    }
13718  }
13719
13720  protected void composeAuditEventInner(AuditEvent element) throws IOException {
13721      composeDomainResourceElements(element);
13722      if (element.hasEvent()) {
13723        composeAuditEventAuditEventEventComponent("event", element.getEvent());
13724      }
13725      if (element.hasParticipant()) {
13726        openArray("participant");
13727        for (AuditEvent.AuditEventParticipantComponent e : element.getParticipant()) 
13728          composeAuditEventAuditEventParticipantComponent(null, e);
13729        closeArray();
13730      };
13731      if (element.hasSource()) {
13732        composeAuditEventAuditEventSourceComponent("source", element.getSource());
13733      }
13734      if (element.hasObject()) {
13735        openArray("object");
13736        for (AuditEvent.AuditEventObjectComponent e : element.getObject()) 
13737          composeAuditEventAuditEventObjectComponent(null, e);
13738        closeArray();
13739      };
13740  }
13741
13742  protected void composeAuditEventAuditEventEventComponent(String name, AuditEvent.AuditEventEventComponent element) throws IOException {
13743    if (element != null) {
13744      open(name);
13745      composeAuditEventAuditEventEventComponentInner(element);
13746      close();
13747    }
13748  }
13749
13750  protected void composeAuditEventAuditEventEventComponentInner(AuditEvent.AuditEventEventComponent element) throws IOException {
13751      composeBackbone(element);
13752      if (element.hasType()) {
13753        composeCoding("type", element.getType());
13754      }
13755      if (element.hasSubtype()) {
13756        openArray("subtype");
13757        for (Coding e : element.getSubtype()) 
13758          composeCoding(null, e);
13759        closeArray();
13760      };
13761      if (element.hasActionElement()) {
13762        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13763        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
13764      }
13765      if (element.hasDateTimeElement()) {
13766        composeInstantCore("dateTime", element.getDateTimeElement(), false);
13767        composeInstantExtras("dateTime", element.getDateTimeElement(), false);
13768      }
13769      if (element.hasOutcomeElement()) {
13770        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13771        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
13772      }
13773      if (element.hasOutcomeDescElement()) {
13774        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
13775        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
13776      }
13777      if (element.hasPurposeOfEvent()) {
13778        openArray("purposeOfEvent");
13779        for (Coding e : element.getPurposeOfEvent()) 
13780          composeCoding(null, e);
13781        closeArray();
13782      };
13783  }
13784
13785  protected void composeAuditEventAuditEventParticipantComponent(String name, AuditEvent.AuditEventParticipantComponent element) throws IOException {
13786    if (element != null) {
13787      open(name);
13788      composeAuditEventAuditEventParticipantComponentInner(element);
13789      close();
13790    }
13791  }
13792
13793  protected void composeAuditEventAuditEventParticipantComponentInner(AuditEvent.AuditEventParticipantComponent element) throws IOException {
13794      composeBackbone(element);
13795      if (element.hasRole()) {
13796        openArray("role");
13797        for (CodeableConcept e : element.getRole()) 
13798          composeCodeableConcept(null, e);
13799        closeArray();
13800      };
13801      if (element.hasReference()) {
13802        composeReference("reference", element.getReference());
13803      }
13804      if (element.hasUserId()) {
13805        composeIdentifier("userId", element.getUserId());
13806      }
13807      if (element.hasAltIdElement()) {
13808        composeStringCore("altId", element.getAltIdElement(), false);
13809        composeStringExtras("altId", element.getAltIdElement(), false);
13810      }
13811      if (element.hasNameElement()) {
13812        composeStringCore("name", element.getNameElement(), false);
13813        composeStringExtras("name", element.getNameElement(), false);
13814      }
13815      if (element.hasRequestorElement()) {
13816        composeBooleanCore("requestor", element.getRequestorElement(), false);
13817        composeBooleanExtras("requestor", element.getRequestorElement(), false);
13818      }
13819      if (element.hasLocation()) {
13820        composeReference("location", element.getLocation());
13821      }
13822      if (element.hasPolicy()) {
13823        openArray("policy");
13824        for (UriType e : element.getPolicy()) 
13825          composeUriCore(null, e, true);
13826        closeArray();
13827        if (anyHasExtras(element.getPolicy())) {
13828          openArray("_policy");
13829          for (UriType e : element.getPolicy()) 
13830            composeUriExtras(null, e, true);
13831          closeArray();
13832        }
13833      };
13834      if (element.hasMedia()) {
13835        composeCoding("media", element.getMedia());
13836      }
13837      if (element.hasNetwork()) {
13838        composeAuditEventAuditEventParticipantNetworkComponent("network", element.getNetwork());
13839      }
13840      if (element.hasPurposeOfUse()) {
13841        openArray("purposeOfUse");
13842        for (Coding e : element.getPurposeOfUse()) 
13843          composeCoding(null, e);
13844        closeArray();
13845      };
13846  }
13847
13848  protected void composeAuditEventAuditEventParticipantNetworkComponent(String name, AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13849    if (element != null) {
13850      open(name);
13851      composeAuditEventAuditEventParticipantNetworkComponentInner(element);
13852      close();
13853    }
13854  }
13855
13856  protected void composeAuditEventAuditEventParticipantNetworkComponentInner(AuditEvent.AuditEventParticipantNetworkComponent element) throws IOException {
13857      composeBackbone(element);
13858      if (element.hasAddressElement()) {
13859        composeStringCore("address", element.getAddressElement(), false);
13860        composeStringExtras("address", element.getAddressElement(), false);
13861      }
13862      if (element.hasTypeElement()) {
13863        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13864        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventParticipantNetworkTypeEnumFactory(), false);
13865      }
13866  }
13867
13868  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
13869    if (element != null) {
13870      open(name);
13871      composeAuditEventAuditEventSourceComponentInner(element);
13872      close();
13873    }
13874  }
13875
13876  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
13877      composeBackbone(element);
13878      if (element.hasSiteElement()) {
13879        composeStringCore("site", element.getSiteElement(), false);
13880        composeStringExtras("site", element.getSiteElement(), false);
13881      }
13882      if (element.hasIdentifier()) {
13883        composeIdentifier("identifier", element.getIdentifier());
13884      }
13885      if (element.hasType()) {
13886        openArray("type");
13887        for (Coding e : element.getType()) 
13888          composeCoding(null, e);
13889        closeArray();
13890      };
13891  }
13892
13893  protected void composeAuditEventAuditEventObjectComponent(String name, AuditEvent.AuditEventObjectComponent element) throws IOException {
13894    if (element != null) {
13895      open(name);
13896      composeAuditEventAuditEventObjectComponentInner(element);
13897      close();
13898    }
13899  }
13900
13901  protected void composeAuditEventAuditEventObjectComponentInner(AuditEvent.AuditEventObjectComponent element) throws IOException {
13902      composeBackbone(element);
13903      if (element.hasIdentifier()) {
13904        composeIdentifier("identifier", element.getIdentifier());
13905      }
13906      if (element.hasReference()) {
13907        composeReference("reference", element.getReference());
13908      }
13909      if (element.hasType()) {
13910        composeCoding("type", element.getType());
13911      }
13912      if (element.hasRole()) {
13913        composeCoding("role", element.getRole());
13914      }
13915      if (element.hasLifecycle()) {
13916        composeCoding("lifecycle", element.getLifecycle());
13917      }
13918      if (element.hasSecurityLabel()) {
13919        openArray("securityLabel");
13920        for (Coding e : element.getSecurityLabel()) 
13921          composeCoding(null, e);
13922        closeArray();
13923      };
13924      if (element.hasNameElement()) {
13925        composeStringCore("name", element.getNameElement(), false);
13926        composeStringExtras("name", element.getNameElement(), false);
13927      }
13928      if (element.hasDescriptionElement()) {
13929        composeStringCore("description", element.getDescriptionElement(), false);
13930        composeStringExtras("description", element.getDescriptionElement(), false);
13931      }
13932      if (element.hasQueryElement()) {
13933        composeBase64BinaryCore("query", element.getQueryElement(), false);
13934        composeBase64BinaryExtras("query", element.getQueryElement(), false);
13935      }
13936      if (element.hasDetail()) {
13937        openArray("detail");
13938        for (AuditEvent.AuditEventObjectDetailComponent e : element.getDetail()) 
13939          composeAuditEventAuditEventObjectDetailComponent(null, e);
13940        closeArray();
13941      };
13942  }
13943
13944  protected void composeAuditEventAuditEventObjectDetailComponent(String name, AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13945    if (element != null) {
13946      open(name);
13947      composeAuditEventAuditEventObjectDetailComponentInner(element);
13948      close();
13949    }
13950  }
13951
13952  protected void composeAuditEventAuditEventObjectDetailComponentInner(AuditEvent.AuditEventObjectDetailComponent element) throws IOException {
13953      composeBackbone(element);
13954      if (element.hasTypeElement()) {
13955        composeStringCore("type", element.getTypeElement(), false);
13956        composeStringExtras("type", element.getTypeElement(), false);
13957      }
13958      if (element.hasValueElement()) {
13959        composeBase64BinaryCore("value", element.getValueElement(), false);
13960        composeBase64BinaryExtras("value", element.getValueElement(), false);
13961      }
13962  }
13963
13964  protected void composeBasic(String name, Basic element) throws IOException {
13965    if (element != null) {
13966      prop("resourceType", name);
13967      composeBasicInner(element);
13968    }
13969  }
13970
13971  protected void composeBasicInner(Basic element) throws IOException {
13972      composeDomainResourceElements(element);
13973      if (element.hasIdentifier()) {
13974        openArray("identifier");
13975        for (Identifier e : element.getIdentifier()) 
13976          composeIdentifier(null, e);
13977        closeArray();
13978      };
13979      if (element.hasCode()) {
13980        composeCodeableConcept("code", element.getCode());
13981      }
13982      if (element.hasSubject()) {
13983        composeReference("subject", element.getSubject());
13984      }
13985      if (element.hasAuthor()) {
13986        composeReference("author", element.getAuthor());
13987      }
13988      if (element.hasCreatedElement()) {
13989        composeDateCore("created", element.getCreatedElement(), false);
13990        composeDateExtras("created", element.getCreatedElement(), false);
13991      }
13992  }
13993
13994  protected void composeBinary(String name, Binary element) throws IOException {
13995    if (element != null) {
13996      prop("resourceType", name);
13997      composeBinaryInner(element);
13998    }
13999  }
14000
14001  protected void composeBinaryInner(Binary element) throws IOException {
14002      composeResourceElements(element);
14003      if (element.hasContentTypeElement()) {
14004        composeCodeCore("contentType", element.getContentTypeElement(), false);
14005        composeCodeExtras("contentType", element.getContentTypeElement(), false);
14006      }
14007      if (element.hasContentElement()) {
14008        composeBase64BinaryCore("content", element.getContentElement(), false);
14009        composeBase64BinaryExtras("content", element.getContentElement(), false);
14010      }
14011  }
14012
14013  protected void composeBodySite(String name, BodySite element) throws IOException {
14014    if (element != null) {
14015      prop("resourceType", name);
14016      composeBodySiteInner(element);
14017    }
14018  }
14019
14020  protected void composeBodySiteInner(BodySite element) throws IOException {
14021      composeDomainResourceElements(element);
14022      if (element.hasPatient()) {
14023        composeReference("patient", element.getPatient());
14024      }
14025      if (element.hasIdentifier()) {
14026        openArray("identifier");
14027        for (Identifier e : element.getIdentifier()) 
14028          composeIdentifier(null, e);
14029        closeArray();
14030      };
14031      if (element.hasCode()) {
14032        composeCodeableConcept("code", element.getCode());
14033      }
14034      if (element.hasModifier()) {
14035        openArray("modifier");
14036        for (CodeableConcept e : element.getModifier()) 
14037          composeCodeableConcept(null, e);
14038        closeArray();
14039      };
14040      if (element.hasDescriptionElement()) {
14041        composeStringCore("description", element.getDescriptionElement(), false);
14042        composeStringExtras("description", element.getDescriptionElement(), false);
14043      }
14044      if (element.hasImage()) {
14045        openArray("image");
14046        for (Attachment e : element.getImage()) 
14047          composeAttachment(null, e);
14048        closeArray();
14049      };
14050  }
14051
14052  protected void composeBundle(String name, Bundle element) throws IOException {
14053    if (element != null) {
14054      prop("resourceType", name);
14055      composeBundleInner(element);
14056    }
14057  }
14058
14059  protected void composeBundleInner(Bundle element) throws IOException {
14060      composeResourceElements(element);
14061      if (element.hasTypeElement()) {
14062        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14063        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
14064      }
14065      if (element.hasTotalElement()) {
14066        composeUnsignedIntCore("total", element.getTotalElement(), false);
14067        composeUnsignedIntExtras("total", element.getTotalElement(), false);
14068      }
14069      if (element.hasLink()) {
14070        openArray("link");
14071        for (Bundle.BundleLinkComponent e : element.getLink()) 
14072          composeBundleBundleLinkComponent(null, e);
14073        closeArray();
14074      };
14075      if (element.hasEntry()) {
14076        openArray("entry");
14077        for (Bundle.BundleEntryComponent e : element.getEntry()) 
14078          composeBundleBundleEntryComponent(null, e);
14079        closeArray();
14080      };
14081      if (element.hasSignature()) {
14082        composeSignature("signature", element.getSignature());
14083      }
14084  }
14085
14086  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
14087    if (element != null) {
14088      open(name);
14089      composeBundleBundleLinkComponentInner(element);
14090      close();
14091    }
14092  }
14093
14094  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
14095      composeBackbone(element);
14096      if (element.hasRelationElement()) {
14097        composeStringCore("relation", element.getRelationElement(), false);
14098        composeStringExtras("relation", element.getRelationElement(), false);
14099      }
14100      if (element.hasUrlElement()) {
14101        composeUriCore("url", element.getUrlElement(), false);
14102        composeUriExtras("url", element.getUrlElement(), false);
14103      }
14104  }
14105
14106  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
14107    if (element != null) {
14108      open(name);
14109      composeBundleBundleEntryComponentInner(element);
14110      close();
14111    }
14112  }
14113
14114  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
14115      composeBackbone(element);
14116      if (element.hasLink()) {
14117        openArray("link");
14118        for (Bundle.BundleLinkComponent e : element.getLink()) 
14119          composeBundleBundleLinkComponent(null, e);
14120        closeArray();
14121      };
14122      if (element.hasFullUrlElement()) {
14123        composeUriCore("fullUrl", element.getFullUrlElement(), false);
14124        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
14125      }
14126        if (element.hasResource()) {
14127          open("resource");
14128          composeResource(element.getResource());
14129          close();
14130        }
14131      if (element.hasSearch()) {
14132        composeBundleBundleEntrySearchComponent("search", element.getSearch());
14133      }
14134      if (element.hasRequest()) {
14135        composeBundleBundleEntryRequestComponent("request", element.getRequest());
14136      }
14137      if (element.hasResponse()) {
14138        composeBundleBundleEntryResponseComponent("response", element.getResponse());
14139      }
14140  }
14141
14142  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
14143    if (element != null) {
14144      open(name);
14145      composeBundleBundleEntrySearchComponentInner(element);
14146      close();
14147    }
14148  }
14149
14150  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
14151      composeBackbone(element);
14152      if (element.hasModeElement()) {
14153        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14154        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
14155      }
14156      if (element.hasScoreElement()) {
14157        composeDecimalCore("score", element.getScoreElement(), false);
14158        composeDecimalExtras("score", element.getScoreElement(), false);
14159      }
14160  }
14161
14162  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
14163    if (element != null) {
14164      open(name);
14165      composeBundleBundleEntryRequestComponentInner(element);
14166      close();
14167    }
14168  }
14169
14170  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
14171      composeBackbone(element);
14172      if (element.hasMethodElement()) {
14173        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14174        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
14175      }
14176      if (element.hasUrlElement()) {
14177        composeUriCore("url", element.getUrlElement(), false);
14178        composeUriExtras("url", element.getUrlElement(), false);
14179      }
14180      if (element.hasIfNoneMatchElement()) {
14181        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
14182        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
14183      }
14184      if (element.hasIfModifiedSinceElement()) {
14185        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14186        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
14187      }
14188      if (element.hasIfMatchElement()) {
14189        composeStringCore("ifMatch", element.getIfMatchElement(), false);
14190        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
14191      }
14192      if (element.hasIfNoneExistElement()) {
14193        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
14194        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
14195      }
14196  }
14197
14198  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
14199    if (element != null) {
14200      open(name);
14201      composeBundleBundleEntryResponseComponentInner(element);
14202      close();
14203    }
14204  }
14205
14206  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
14207      composeBackbone(element);
14208      if (element.hasStatusElement()) {
14209        composeStringCore("status", element.getStatusElement(), false);
14210        composeStringExtras("status", element.getStatusElement(), false);
14211      }
14212      if (element.hasLocationElement()) {
14213        composeUriCore("location", element.getLocationElement(), false);
14214        composeUriExtras("location", element.getLocationElement(), false);
14215      }
14216      if (element.hasEtagElement()) {
14217        composeStringCore("etag", element.getEtagElement(), false);
14218        composeStringExtras("etag", element.getEtagElement(), false);
14219      }
14220      if (element.hasLastModifiedElement()) {
14221        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
14222        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
14223      }
14224  }
14225
14226  protected void composeCarePlan(String name, CarePlan element) throws IOException {
14227    if (element != null) {
14228      prop("resourceType", name);
14229      composeCarePlanInner(element);
14230    }
14231  }
14232
14233  protected void composeCarePlanInner(CarePlan element) throws IOException {
14234      composeDomainResourceElements(element);
14235      if (element.hasIdentifier()) {
14236        openArray("identifier");
14237        for (Identifier e : element.getIdentifier()) 
14238          composeIdentifier(null, e);
14239        closeArray();
14240      };
14241      if (element.hasSubject()) {
14242        composeReference("subject", element.getSubject());
14243      }
14244      if (element.hasStatusElement()) {
14245        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14246        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
14247      }
14248      if (element.hasContext()) {
14249        composeReference("context", element.getContext());
14250      }
14251      if (element.hasPeriod()) {
14252        composePeriod("period", element.getPeriod());
14253      }
14254      if (element.hasAuthor()) {
14255        openArray("author");
14256        for (Reference e : element.getAuthor()) 
14257          composeReference(null, e);
14258        closeArray();
14259      };
14260      if (element.hasModifiedElement()) {
14261        composeDateTimeCore("modified", element.getModifiedElement(), false);
14262        composeDateTimeExtras("modified", element.getModifiedElement(), false);
14263      }
14264      if (element.hasCategory()) {
14265        openArray("category");
14266        for (CodeableConcept e : element.getCategory()) 
14267          composeCodeableConcept(null, e);
14268        closeArray();
14269      };
14270      if (element.hasDescriptionElement()) {
14271        composeStringCore("description", element.getDescriptionElement(), false);
14272        composeStringExtras("description", element.getDescriptionElement(), false);
14273      }
14274      if (element.hasAddresses()) {
14275        openArray("addresses");
14276        for (Reference e : element.getAddresses()) 
14277          composeReference(null, e);
14278        closeArray();
14279      };
14280      if (element.hasSupport()) {
14281        openArray("support");
14282        for (Reference e : element.getSupport()) 
14283          composeReference(null, e);
14284        closeArray();
14285      };
14286      if (element.hasRelatedPlan()) {
14287        openArray("relatedPlan");
14288        for (CarePlan.CarePlanRelatedPlanComponent e : element.getRelatedPlan()) 
14289          composeCarePlanCarePlanRelatedPlanComponent(null, e);
14290        closeArray();
14291      };
14292      if (element.hasParticipant()) {
14293        openArray("participant");
14294        for (CarePlan.CarePlanParticipantComponent e : element.getParticipant()) 
14295          composeCarePlanCarePlanParticipantComponent(null, e);
14296        closeArray();
14297      };
14298      if (element.hasGoal()) {
14299        openArray("goal");
14300        for (Reference e : element.getGoal()) 
14301          composeReference(null, e);
14302        closeArray();
14303      };
14304      if (element.hasActivity()) {
14305        openArray("activity");
14306        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
14307          composeCarePlanCarePlanActivityComponent(null, e);
14308        closeArray();
14309      };
14310      if (element.hasNote()) {
14311        composeAnnotation("note", element.getNote());
14312      }
14313  }
14314
14315  protected void composeCarePlanCarePlanRelatedPlanComponent(String name, CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14316    if (element != null) {
14317      open(name);
14318      composeCarePlanCarePlanRelatedPlanComponentInner(element);
14319      close();
14320    }
14321  }
14322
14323  protected void composeCarePlanCarePlanRelatedPlanComponentInner(CarePlan.CarePlanRelatedPlanComponent element) throws IOException {
14324      composeBackbone(element);
14325      if (element.hasCodeElement()) {
14326        composeEnumerationCore("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14327        composeEnumerationExtras("code", element.getCodeElement(), new CarePlan.CarePlanRelationshipEnumFactory(), false);
14328      }
14329      if (element.hasPlan()) {
14330        composeReference("plan", element.getPlan());
14331      }
14332  }
14333
14334  protected void composeCarePlanCarePlanParticipantComponent(String name, CarePlan.CarePlanParticipantComponent element) throws IOException {
14335    if (element != null) {
14336      open(name);
14337      composeCarePlanCarePlanParticipantComponentInner(element);
14338      close();
14339    }
14340  }
14341
14342  protected void composeCarePlanCarePlanParticipantComponentInner(CarePlan.CarePlanParticipantComponent element) throws IOException {
14343      composeBackbone(element);
14344      if (element.hasRole()) {
14345        composeCodeableConcept("role", element.getRole());
14346      }
14347      if (element.hasMember()) {
14348        composeReference("member", element.getMember());
14349      }
14350  }
14351
14352  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
14353    if (element != null) {
14354      open(name);
14355      composeCarePlanCarePlanActivityComponentInner(element);
14356      close();
14357    }
14358  }
14359
14360  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
14361      composeBackbone(element);
14362      if (element.hasActionResulting()) {
14363        openArray("actionResulting");
14364        for (Reference e : element.getActionResulting()) 
14365          composeReference(null, e);
14366        closeArray();
14367      };
14368      if (element.hasProgress()) {
14369        openArray("progress");
14370        for (Annotation e : element.getProgress()) 
14371          composeAnnotation(null, e);
14372        closeArray();
14373      };
14374      if (element.hasReference()) {
14375        composeReference("reference", element.getReference());
14376      }
14377      if (element.hasDetail()) {
14378        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
14379      }
14380  }
14381
14382  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14383    if (element != null) {
14384      open(name);
14385      composeCarePlanCarePlanActivityDetailComponentInner(element);
14386      close();
14387    }
14388  }
14389
14390  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
14391      composeBackbone(element);
14392      if (element.hasCategory()) {
14393        composeCodeableConcept("category", element.getCategory());
14394      }
14395      if (element.hasCode()) {
14396        composeCodeableConcept("code", element.getCode());
14397      }
14398      if (element.hasReasonCode()) {
14399        openArray("reasonCode");
14400        for (CodeableConcept e : element.getReasonCode()) 
14401          composeCodeableConcept(null, e);
14402        closeArray();
14403      };
14404      if (element.hasReasonReference()) {
14405        openArray("reasonReference");
14406        for (Reference e : element.getReasonReference()) 
14407          composeReference(null, e);
14408        closeArray();
14409      };
14410      if (element.hasGoal()) {
14411        openArray("goal");
14412        for (Reference e : element.getGoal()) 
14413          composeReference(null, e);
14414        closeArray();
14415      };
14416      if (element.hasStatusElement()) {
14417        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14418        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
14419      }
14420      if (element.hasStatusReason()) {
14421        composeCodeableConcept("statusReason", element.getStatusReason());
14422      }
14423      if (element.hasProhibitedElement()) {
14424        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
14425        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
14426      }
14427      if (element.hasScheduled()) {
14428        composeType("scheduled", element.getScheduled());
14429      }
14430      if (element.hasLocation()) {
14431        composeReference("location", element.getLocation());
14432      }
14433      if (element.hasPerformer()) {
14434        openArray("performer");
14435        for (Reference e : element.getPerformer()) 
14436          composeReference(null, e);
14437        closeArray();
14438      };
14439      if (element.hasProduct()) {
14440        composeType("product", element.getProduct());
14441      }
14442      if (element.hasDailyAmount()) {
14443        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
14444      }
14445      if (element.hasQuantity()) {
14446        composeSimpleQuantity("quantity", element.getQuantity());
14447      }
14448      if (element.hasDescriptionElement()) {
14449        composeStringCore("description", element.getDescriptionElement(), false);
14450        composeStringExtras("description", element.getDescriptionElement(), false);
14451      }
14452  }
14453
14454  protected void composeClaim(String name, Claim element) throws IOException {
14455    if (element != null) {
14456      prop("resourceType", name);
14457      composeClaimInner(element);
14458    }
14459  }
14460
14461  protected void composeClaimInner(Claim element) throws IOException {
14462      composeDomainResourceElements(element);
14463      if (element.hasTypeElement()) {
14464        composeEnumerationCore("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14465        composeEnumerationExtras("type", element.getTypeElement(), new Claim.ClaimTypeEnumFactory(), false);
14466      }
14467      if (element.hasIdentifier()) {
14468        openArray("identifier");
14469        for (Identifier e : element.getIdentifier()) 
14470          composeIdentifier(null, e);
14471        closeArray();
14472      };
14473      if (element.hasRuleset()) {
14474        composeCoding("ruleset", element.getRuleset());
14475      }
14476      if (element.hasOriginalRuleset()) {
14477        composeCoding("originalRuleset", element.getOriginalRuleset());
14478      }
14479      if (element.hasCreatedElement()) {
14480        composeDateTimeCore("created", element.getCreatedElement(), false);
14481        composeDateTimeExtras("created", element.getCreatedElement(), false);
14482      }
14483      if (element.hasTarget()) {
14484        composeReference("target", element.getTarget());
14485      }
14486      if (element.hasProvider()) {
14487        composeReference("provider", element.getProvider());
14488      }
14489      if (element.hasOrganization()) {
14490        composeReference("organization", element.getOrganization());
14491      }
14492      if (element.hasUseElement()) {
14493        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14494        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
14495      }
14496      if (element.hasPriority()) {
14497        composeCoding("priority", element.getPriority());
14498      }
14499      if (element.hasFundsReserve()) {
14500        composeCoding("fundsReserve", element.getFundsReserve());
14501      }
14502      if (element.hasEnterer()) {
14503        composeReference("enterer", element.getEnterer());
14504      }
14505      if (element.hasFacility()) {
14506        composeReference("facility", element.getFacility());
14507      }
14508      if (element.hasPrescription()) {
14509        composeReference("prescription", element.getPrescription());
14510      }
14511      if (element.hasOriginalPrescription()) {
14512        composeReference("originalPrescription", element.getOriginalPrescription());
14513      }
14514      if (element.hasPayee()) {
14515        composeClaimPayeeComponent("payee", element.getPayee());
14516      }
14517      if (element.hasReferral()) {
14518        composeReference("referral", element.getReferral());
14519      }
14520      if (element.hasDiagnosis()) {
14521        openArray("diagnosis");
14522        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
14523          composeClaimDiagnosisComponent(null, e);
14524        closeArray();
14525      };
14526      if (element.hasCondition()) {
14527        openArray("condition");
14528        for (Coding e : element.getCondition()) 
14529          composeCoding(null, e);
14530        closeArray();
14531      };
14532      if (element.hasPatient()) {
14533        composeReference("patient", element.getPatient());
14534      }
14535      if (element.hasCoverage()) {
14536        openArray("coverage");
14537        for (Claim.CoverageComponent e : element.getCoverage()) 
14538          composeClaimCoverageComponent(null, e);
14539        closeArray();
14540      };
14541      if (element.hasException()) {
14542        openArray("exception");
14543        for (Coding e : element.getException()) 
14544          composeCoding(null, e);
14545        closeArray();
14546      };
14547      if (element.hasSchoolElement()) {
14548        composeStringCore("school", element.getSchoolElement(), false);
14549        composeStringExtras("school", element.getSchoolElement(), false);
14550      }
14551      if (element.hasAccidentElement()) {
14552        composeDateCore("accident", element.getAccidentElement(), false);
14553        composeDateExtras("accident", element.getAccidentElement(), false);
14554      }
14555      if (element.hasAccidentType()) {
14556        composeCoding("accidentType", element.getAccidentType());
14557      }
14558      if (element.hasInterventionException()) {
14559        openArray("interventionException");
14560        for (Coding e : element.getInterventionException()) 
14561          composeCoding(null, e);
14562        closeArray();
14563      };
14564      if (element.hasItem()) {
14565        openArray("item");
14566        for (Claim.ItemsComponent e : element.getItem()) 
14567          composeClaimItemsComponent(null, e);
14568        closeArray();
14569      };
14570      if (element.hasAdditionalMaterials()) {
14571        openArray("additionalMaterials");
14572        for (Coding e : element.getAdditionalMaterials()) 
14573          composeCoding(null, e);
14574        closeArray();
14575      };
14576      if (element.hasMissingTeeth()) {
14577        openArray("missingTeeth");
14578        for (Claim.MissingTeethComponent e : element.getMissingTeeth()) 
14579          composeClaimMissingTeethComponent(null, e);
14580        closeArray();
14581      };
14582  }
14583
14584  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
14585    if (element != null) {
14586      open(name);
14587      composeClaimPayeeComponentInner(element);
14588      close();
14589    }
14590  }
14591
14592  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
14593      composeBackbone(element);
14594      if (element.hasType()) {
14595        composeCoding("type", element.getType());
14596      }
14597      if (element.hasProvider()) {
14598        composeReference("provider", element.getProvider());
14599      }
14600      if (element.hasOrganization()) {
14601        composeReference("organization", element.getOrganization());
14602      }
14603      if (element.hasPerson()) {
14604        composeReference("person", element.getPerson());
14605      }
14606  }
14607
14608  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
14609    if (element != null) {
14610      open(name);
14611      composeClaimDiagnosisComponentInner(element);
14612      close();
14613    }
14614  }
14615
14616  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
14617      composeBackbone(element);
14618      if (element.hasSequenceElement()) {
14619        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14620        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14621      }
14622      if (element.hasDiagnosis()) {
14623        composeCoding("diagnosis", element.getDiagnosis());
14624      }
14625  }
14626
14627  protected void composeClaimCoverageComponent(String name, Claim.CoverageComponent element) throws IOException {
14628    if (element != null) {
14629      open(name);
14630      composeClaimCoverageComponentInner(element);
14631      close();
14632    }
14633  }
14634
14635  protected void composeClaimCoverageComponentInner(Claim.CoverageComponent element) throws IOException {
14636      composeBackbone(element);
14637      if (element.hasSequenceElement()) {
14638        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14639        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14640      }
14641      if (element.hasFocalElement()) {
14642        composeBooleanCore("focal", element.getFocalElement(), false);
14643        composeBooleanExtras("focal", element.getFocalElement(), false);
14644      }
14645      if (element.hasCoverage()) {
14646        composeReference("coverage", element.getCoverage());
14647      }
14648      if (element.hasBusinessArrangementElement()) {
14649        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
14650        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
14651      }
14652      if (element.hasRelationship()) {
14653        composeCoding("relationship", element.getRelationship());
14654      }
14655      if (element.hasPreAuthRef()) {
14656        openArray("preAuthRef");
14657        for (StringType e : element.getPreAuthRef()) 
14658          composeStringCore(null, e, true);
14659        closeArray();
14660        if (anyHasExtras(element.getPreAuthRef())) {
14661          openArray("_preAuthRef");
14662          for (StringType e : element.getPreAuthRef()) 
14663            composeStringExtras(null, e, true);
14664          closeArray();
14665        }
14666      };
14667      if (element.hasClaimResponse()) {
14668        composeReference("claimResponse", element.getClaimResponse());
14669      }
14670      if (element.hasOriginalRuleset()) {
14671        composeCoding("originalRuleset", element.getOriginalRuleset());
14672      }
14673  }
14674
14675  protected void composeClaimItemsComponent(String name, Claim.ItemsComponent element) throws IOException {
14676    if (element != null) {
14677      open(name);
14678      composeClaimItemsComponentInner(element);
14679      close();
14680    }
14681  }
14682
14683  protected void composeClaimItemsComponentInner(Claim.ItemsComponent element) throws IOException {
14684      composeBackbone(element);
14685      if (element.hasSequenceElement()) {
14686        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14687        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14688      }
14689      if (element.hasType()) {
14690        composeCoding("type", element.getType());
14691      }
14692      if (element.hasProvider()) {
14693        composeReference("provider", element.getProvider());
14694      }
14695      if (element.hasDiagnosisLinkId()) {
14696        openArray("diagnosisLinkId");
14697        for (PositiveIntType e : element.getDiagnosisLinkId()) 
14698          composePositiveIntCore(null, e, true);
14699        closeArray();
14700        if (anyHasExtras(element.getDiagnosisLinkId())) {
14701          openArray("_diagnosisLinkId");
14702          for (PositiveIntType e : element.getDiagnosisLinkId()) 
14703            composePositiveIntExtras(null, e, true);
14704          closeArray();
14705        }
14706      };
14707      if (element.hasService()) {
14708        composeCoding("service", element.getService());
14709      }
14710      if (element.hasServiceDateElement()) {
14711        composeDateCore("serviceDate", element.getServiceDateElement(), false);
14712        composeDateExtras("serviceDate", element.getServiceDateElement(), false);
14713      }
14714      if (element.hasQuantity()) {
14715        composeSimpleQuantity("quantity", element.getQuantity());
14716      }
14717      if (element.hasUnitPrice()) {
14718        composeMoney("unitPrice", element.getUnitPrice());
14719      }
14720      if (element.hasFactorElement()) {
14721        composeDecimalCore("factor", element.getFactorElement(), false);
14722        composeDecimalExtras("factor", element.getFactorElement(), false);
14723      }
14724      if (element.hasPointsElement()) {
14725        composeDecimalCore("points", element.getPointsElement(), false);
14726        composeDecimalExtras("points", element.getPointsElement(), false);
14727      }
14728      if (element.hasNet()) {
14729        composeMoney("net", element.getNet());
14730      }
14731      if (element.hasUdi()) {
14732        composeCoding("udi", element.getUdi());
14733      }
14734      if (element.hasBodySite()) {
14735        composeCoding("bodySite", element.getBodySite());
14736      }
14737      if (element.hasSubSite()) {
14738        openArray("subSite");
14739        for (Coding e : element.getSubSite()) 
14740          composeCoding(null, e);
14741        closeArray();
14742      };
14743      if (element.hasModifier()) {
14744        openArray("modifier");
14745        for (Coding e : element.getModifier()) 
14746          composeCoding(null, e);
14747        closeArray();
14748      };
14749      if (element.hasDetail()) {
14750        openArray("detail");
14751        for (Claim.DetailComponent e : element.getDetail()) 
14752          composeClaimDetailComponent(null, e);
14753        closeArray();
14754      };
14755      if (element.hasProsthesis()) {
14756        composeClaimProsthesisComponent("prosthesis", element.getProsthesis());
14757      }
14758  }
14759
14760  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
14761    if (element != null) {
14762      open(name);
14763      composeClaimDetailComponentInner(element);
14764      close();
14765    }
14766  }
14767
14768  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
14769      composeBackbone(element);
14770      if (element.hasSequenceElement()) {
14771        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14772        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14773      }
14774      if (element.hasType()) {
14775        composeCoding("type", element.getType());
14776      }
14777      if (element.hasService()) {
14778        composeCoding("service", element.getService());
14779      }
14780      if (element.hasQuantity()) {
14781        composeSimpleQuantity("quantity", element.getQuantity());
14782      }
14783      if (element.hasUnitPrice()) {
14784        composeMoney("unitPrice", element.getUnitPrice());
14785      }
14786      if (element.hasFactorElement()) {
14787        composeDecimalCore("factor", element.getFactorElement(), false);
14788        composeDecimalExtras("factor", element.getFactorElement(), false);
14789      }
14790      if (element.hasPointsElement()) {
14791        composeDecimalCore("points", element.getPointsElement(), false);
14792        composeDecimalExtras("points", element.getPointsElement(), false);
14793      }
14794      if (element.hasNet()) {
14795        composeMoney("net", element.getNet());
14796      }
14797      if (element.hasUdi()) {
14798        composeCoding("udi", element.getUdi());
14799      }
14800      if (element.hasSubDetail()) {
14801        openArray("subDetail");
14802        for (Claim.SubDetailComponent e : element.getSubDetail()) 
14803          composeClaimSubDetailComponent(null, e);
14804        closeArray();
14805      };
14806  }
14807
14808  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
14809    if (element != null) {
14810      open(name);
14811      composeClaimSubDetailComponentInner(element);
14812      close();
14813    }
14814  }
14815
14816  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
14817      composeBackbone(element);
14818      if (element.hasSequenceElement()) {
14819        composePositiveIntCore("sequence", element.getSequenceElement(), false);
14820        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
14821      }
14822      if (element.hasType()) {
14823        composeCoding("type", element.getType());
14824      }
14825      if (element.hasService()) {
14826        composeCoding("service", element.getService());
14827      }
14828      if (element.hasQuantity()) {
14829        composeSimpleQuantity("quantity", element.getQuantity());
14830      }
14831      if (element.hasUnitPrice()) {
14832        composeMoney("unitPrice", element.getUnitPrice());
14833      }
14834      if (element.hasFactorElement()) {
14835        composeDecimalCore("factor", element.getFactorElement(), false);
14836        composeDecimalExtras("factor", element.getFactorElement(), false);
14837      }
14838      if (element.hasPointsElement()) {
14839        composeDecimalCore("points", element.getPointsElement(), false);
14840        composeDecimalExtras("points", element.getPointsElement(), false);
14841      }
14842      if (element.hasNet()) {
14843        composeMoney("net", element.getNet());
14844      }
14845      if (element.hasUdi()) {
14846        composeCoding("udi", element.getUdi());
14847      }
14848  }
14849
14850  protected void composeClaimProsthesisComponent(String name, Claim.ProsthesisComponent element) throws IOException {
14851    if (element != null) {
14852      open(name);
14853      composeClaimProsthesisComponentInner(element);
14854      close();
14855    }
14856  }
14857
14858  protected void composeClaimProsthesisComponentInner(Claim.ProsthesisComponent element) throws IOException {
14859      composeBackbone(element);
14860      if (element.hasInitialElement()) {
14861        composeBooleanCore("initial", element.getInitialElement(), false);
14862        composeBooleanExtras("initial", element.getInitialElement(), false);
14863      }
14864      if (element.hasPriorDateElement()) {
14865        composeDateCore("priorDate", element.getPriorDateElement(), false);
14866        composeDateExtras("priorDate", element.getPriorDateElement(), false);
14867      }
14868      if (element.hasPriorMaterial()) {
14869        composeCoding("priorMaterial", element.getPriorMaterial());
14870      }
14871  }
14872
14873  protected void composeClaimMissingTeethComponent(String name, Claim.MissingTeethComponent element) throws IOException {
14874    if (element != null) {
14875      open(name);
14876      composeClaimMissingTeethComponentInner(element);
14877      close();
14878    }
14879  }
14880
14881  protected void composeClaimMissingTeethComponentInner(Claim.MissingTeethComponent element) throws IOException {
14882      composeBackbone(element);
14883      if (element.hasTooth()) {
14884        composeCoding("tooth", element.getTooth());
14885      }
14886      if (element.hasReason()) {
14887        composeCoding("reason", element.getReason());
14888      }
14889      if (element.hasExtractionDateElement()) {
14890        composeDateCore("extractionDate", element.getExtractionDateElement(), false);
14891        composeDateExtras("extractionDate", element.getExtractionDateElement(), false);
14892      }
14893  }
14894
14895  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
14896    if (element != null) {
14897      prop("resourceType", name);
14898      composeClaimResponseInner(element);
14899    }
14900  }
14901
14902  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
14903      composeDomainResourceElements(element);
14904      if (element.hasIdentifier()) {
14905        openArray("identifier");
14906        for (Identifier e : element.getIdentifier()) 
14907          composeIdentifier(null, e);
14908        closeArray();
14909      };
14910      if (element.hasRequest()) {
14911        composeReference("request", element.getRequest());
14912      }
14913      if (element.hasRuleset()) {
14914        composeCoding("ruleset", element.getRuleset());
14915      }
14916      if (element.hasOriginalRuleset()) {
14917        composeCoding("originalRuleset", element.getOriginalRuleset());
14918      }
14919      if (element.hasCreatedElement()) {
14920        composeDateTimeCore("created", element.getCreatedElement(), false);
14921        composeDateTimeExtras("created", element.getCreatedElement(), false);
14922      }
14923      if (element.hasOrganization()) {
14924        composeReference("organization", element.getOrganization());
14925      }
14926      if (element.hasRequestProvider()) {
14927        composeReference("requestProvider", element.getRequestProvider());
14928      }
14929      if (element.hasRequestOrganization()) {
14930        composeReference("requestOrganization", element.getRequestOrganization());
14931      }
14932      if (element.hasOutcomeElement()) {
14933        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14934        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
14935      }
14936      if (element.hasDispositionElement()) {
14937        composeStringCore("disposition", element.getDispositionElement(), false);
14938        composeStringExtras("disposition", element.getDispositionElement(), false);
14939      }
14940      if (element.hasPayeeType()) {
14941        composeCoding("payeeType", element.getPayeeType());
14942      }
14943      if (element.hasItem()) {
14944        openArray("item");
14945        for (ClaimResponse.ItemsComponent e : element.getItem()) 
14946          composeClaimResponseItemsComponent(null, e);
14947        closeArray();
14948      };
14949      if (element.hasAddItem()) {
14950        openArray("addItem");
14951        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
14952          composeClaimResponseAddedItemComponent(null, e);
14953        closeArray();
14954      };
14955      if (element.hasError()) {
14956        openArray("error");
14957        for (ClaimResponse.ErrorsComponent e : element.getError()) 
14958          composeClaimResponseErrorsComponent(null, e);
14959        closeArray();
14960      };
14961      if (element.hasTotalCost()) {
14962        composeMoney("totalCost", element.getTotalCost());
14963      }
14964      if (element.hasUnallocDeductable()) {
14965        composeMoney("unallocDeductable", element.getUnallocDeductable());
14966      }
14967      if (element.hasTotalBenefit()) {
14968        composeMoney("totalBenefit", element.getTotalBenefit());
14969      }
14970      if (element.hasPaymentAdjustment()) {
14971        composeMoney("paymentAdjustment", element.getPaymentAdjustment());
14972      }
14973      if (element.hasPaymentAdjustmentReason()) {
14974        composeCoding("paymentAdjustmentReason", element.getPaymentAdjustmentReason());
14975      }
14976      if (element.hasPaymentDateElement()) {
14977        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
14978        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
14979      }
14980      if (element.hasPaymentAmount()) {
14981        composeMoney("paymentAmount", element.getPaymentAmount());
14982      }
14983      if (element.hasPaymentRef()) {
14984        composeIdentifier("paymentRef", element.getPaymentRef());
14985      }
14986      if (element.hasReserved()) {
14987        composeCoding("reserved", element.getReserved());
14988      }
14989      if (element.hasForm()) {
14990        composeCoding("form", element.getForm());
14991      }
14992      if (element.hasNote()) {
14993        openArray("note");
14994        for (ClaimResponse.NotesComponent e : element.getNote()) 
14995          composeClaimResponseNotesComponent(null, e);
14996        closeArray();
14997      };
14998      if (element.hasCoverage()) {
14999        openArray("coverage");
15000        for (ClaimResponse.CoverageComponent e : element.getCoverage()) 
15001          composeClaimResponseCoverageComponent(null, e);
15002        closeArray();
15003      };
15004  }
15005
15006  protected void composeClaimResponseItemsComponent(String name, ClaimResponse.ItemsComponent element) throws IOException {
15007    if (element != null) {
15008      open(name);
15009      composeClaimResponseItemsComponentInner(element);
15010      close();
15011    }
15012  }
15013
15014  protected void composeClaimResponseItemsComponentInner(ClaimResponse.ItemsComponent element) throws IOException {
15015      composeBackbone(element);
15016      if (element.hasSequenceLinkIdElement()) {
15017        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15018        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15019      }
15020      if (element.hasNoteNumber()) {
15021        openArray("noteNumber");
15022        for (PositiveIntType e : element.getNoteNumber()) 
15023          composePositiveIntCore(null, e, true);
15024        closeArray();
15025        if (anyHasExtras(element.getNoteNumber())) {
15026          openArray("_noteNumber");
15027          for (PositiveIntType e : element.getNoteNumber()) 
15028            composePositiveIntExtras(null, e, true);
15029          closeArray();
15030        }
15031      };
15032      if (element.hasAdjudication()) {
15033        openArray("adjudication");
15034        for (ClaimResponse.ItemAdjudicationComponent e : element.getAdjudication()) 
15035          composeClaimResponseItemAdjudicationComponent(null, e);
15036        closeArray();
15037      };
15038      if (element.hasDetail()) {
15039        openArray("detail");
15040        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
15041          composeClaimResponseItemDetailComponent(null, e);
15042        closeArray();
15043      };
15044  }
15045
15046  protected void composeClaimResponseItemAdjudicationComponent(String name, ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15047    if (element != null) {
15048      open(name);
15049      composeClaimResponseItemAdjudicationComponentInner(element);
15050      close();
15051    }
15052  }
15053
15054  protected void composeClaimResponseItemAdjudicationComponentInner(ClaimResponse.ItemAdjudicationComponent element) throws IOException {
15055      composeBackbone(element);
15056      if (element.hasCode()) {
15057        composeCoding("code", element.getCode());
15058      }
15059      if (element.hasAmount()) {
15060        composeMoney("amount", element.getAmount());
15061      }
15062      if (element.hasValueElement()) {
15063        composeDecimalCore("value", element.getValueElement(), false);
15064        composeDecimalExtras("value", element.getValueElement(), false);
15065      }
15066  }
15067
15068  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
15069    if (element != null) {
15070      open(name);
15071      composeClaimResponseItemDetailComponentInner(element);
15072      close();
15073    }
15074  }
15075
15076  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
15077      composeBackbone(element);
15078      if (element.hasSequenceLinkIdElement()) {
15079        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15080        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15081      }
15082      if (element.hasAdjudication()) {
15083        openArray("adjudication");
15084        for (ClaimResponse.DetailAdjudicationComponent e : element.getAdjudication()) 
15085          composeClaimResponseDetailAdjudicationComponent(null, e);
15086        closeArray();
15087      };
15088      if (element.hasSubDetail()) {
15089        openArray("subDetail");
15090        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
15091          composeClaimResponseSubDetailComponent(null, e);
15092        closeArray();
15093      };
15094  }
15095
15096  protected void composeClaimResponseDetailAdjudicationComponent(String name, ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15097    if (element != null) {
15098      open(name);
15099      composeClaimResponseDetailAdjudicationComponentInner(element);
15100      close();
15101    }
15102  }
15103
15104  protected void composeClaimResponseDetailAdjudicationComponentInner(ClaimResponse.DetailAdjudicationComponent element) throws IOException {
15105      composeBackbone(element);
15106      if (element.hasCode()) {
15107        composeCoding("code", element.getCode());
15108      }
15109      if (element.hasAmount()) {
15110        composeMoney("amount", element.getAmount());
15111      }
15112      if (element.hasValueElement()) {
15113        composeDecimalCore("value", element.getValueElement(), false);
15114        composeDecimalExtras("value", element.getValueElement(), false);
15115      }
15116  }
15117
15118  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
15119    if (element != null) {
15120      open(name);
15121      composeClaimResponseSubDetailComponentInner(element);
15122      close();
15123    }
15124  }
15125
15126  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
15127      composeBackbone(element);
15128      if (element.hasSequenceLinkIdElement()) {
15129        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15130        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15131      }
15132      if (element.hasAdjudication()) {
15133        openArray("adjudication");
15134        for (ClaimResponse.SubdetailAdjudicationComponent e : element.getAdjudication()) 
15135          composeClaimResponseSubdetailAdjudicationComponent(null, e);
15136        closeArray();
15137      };
15138  }
15139
15140  protected void composeClaimResponseSubdetailAdjudicationComponent(String name, ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15141    if (element != null) {
15142      open(name);
15143      composeClaimResponseSubdetailAdjudicationComponentInner(element);
15144      close();
15145    }
15146  }
15147
15148  protected void composeClaimResponseSubdetailAdjudicationComponentInner(ClaimResponse.SubdetailAdjudicationComponent element) throws IOException {
15149      composeBackbone(element);
15150      if (element.hasCode()) {
15151        composeCoding("code", element.getCode());
15152      }
15153      if (element.hasAmount()) {
15154        composeMoney("amount", element.getAmount());
15155      }
15156      if (element.hasValueElement()) {
15157        composeDecimalCore("value", element.getValueElement(), false);
15158        composeDecimalExtras("value", element.getValueElement(), false);
15159      }
15160  }
15161
15162  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
15163    if (element != null) {
15164      open(name);
15165      composeClaimResponseAddedItemComponentInner(element);
15166      close();
15167    }
15168  }
15169
15170  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
15171      composeBackbone(element);
15172      if (element.hasSequenceLinkId()) {
15173        openArray("sequenceLinkId");
15174        for (PositiveIntType e : element.getSequenceLinkId()) 
15175          composePositiveIntCore(null, e, true);
15176        closeArray();
15177        if (anyHasExtras(element.getSequenceLinkId())) {
15178          openArray("_sequenceLinkId");
15179          for (PositiveIntType e : element.getSequenceLinkId()) 
15180            composePositiveIntExtras(null, e, true);
15181          closeArray();
15182        }
15183      };
15184      if (element.hasService()) {
15185        composeCoding("service", element.getService());
15186      }
15187      if (element.hasFee()) {
15188        composeMoney("fee", element.getFee());
15189      }
15190      if (element.hasNoteNumberLinkId()) {
15191        openArray("noteNumberLinkId");
15192        for (PositiveIntType e : element.getNoteNumberLinkId()) 
15193          composePositiveIntCore(null, e, true);
15194        closeArray();
15195        if (anyHasExtras(element.getNoteNumberLinkId())) {
15196          openArray("_noteNumberLinkId");
15197          for (PositiveIntType e : element.getNoteNumberLinkId()) 
15198            composePositiveIntExtras(null, e, true);
15199          closeArray();
15200        }
15201      };
15202      if (element.hasAdjudication()) {
15203        openArray("adjudication");
15204        for (ClaimResponse.AddedItemAdjudicationComponent e : element.getAdjudication()) 
15205          composeClaimResponseAddedItemAdjudicationComponent(null, e);
15206        closeArray();
15207      };
15208      if (element.hasDetail()) {
15209        openArray("detail");
15210        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
15211          composeClaimResponseAddedItemsDetailComponent(null, e);
15212        closeArray();
15213      };
15214  }
15215
15216  protected void composeClaimResponseAddedItemAdjudicationComponent(String name, ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15217    if (element != null) {
15218      open(name);
15219      composeClaimResponseAddedItemAdjudicationComponentInner(element);
15220      close();
15221    }
15222  }
15223
15224  protected void composeClaimResponseAddedItemAdjudicationComponentInner(ClaimResponse.AddedItemAdjudicationComponent element) throws IOException {
15225      composeBackbone(element);
15226      if (element.hasCode()) {
15227        composeCoding("code", element.getCode());
15228      }
15229      if (element.hasAmount()) {
15230        composeMoney("amount", element.getAmount());
15231      }
15232      if (element.hasValueElement()) {
15233        composeDecimalCore("value", element.getValueElement(), false);
15234        composeDecimalExtras("value", element.getValueElement(), false);
15235      }
15236  }
15237
15238  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15239    if (element != null) {
15240      open(name);
15241      composeClaimResponseAddedItemsDetailComponentInner(element);
15242      close();
15243    }
15244  }
15245
15246  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
15247      composeBackbone(element);
15248      if (element.hasService()) {
15249        composeCoding("service", element.getService());
15250      }
15251      if (element.hasFee()) {
15252        composeMoney("fee", element.getFee());
15253      }
15254      if (element.hasAdjudication()) {
15255        openArray("adjudication");
15256        for (ClaimResponse.AddedItemDetailAdjudicationComponent e : element.getAdjudication()) 
15257          composeClaimResponseAddedItemDetailAdjudicationComponent(null, e);
15258        closeArray();
15259      };
15260  }
15261
15262  protected void composeClaimResponseAddedItemDetailAdjudicationComponent(String name, ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15263    if (element != null) {
15264      open(name);
15265      composeClaimResponseAddedItemDetailAdjudicationComponentInner(element);
15266      close();
15267    }
15268  }
15269
15270  protected void composeClaimResponseAddedItemDetailAdjudicationComponentInner(ClaimResponse.AddedItemDetailAdjudicationComponent element) throws IOException {
15271      composeBackbone(element);
15272      if (element.hasCode()) {
15273        composeCoding("code", element.getCode());
15274      }
15275      if (element.hasAmount()) {
15276        composeMoney("amount", element.getAmount());
15277      }
15278      if (element.hasValueElement()) {
15279        composeDecimalCore("value", element.getValueElement(), false);
15280        composeDecimalExtras("value", element.getValueElement(), false);
15281      }
15282  }
15283
15284  protected void composeClaimResponseErrorsComponent(String name, ClaimResponse.ErrorsComponent element) throws IOException {
15285    if (element != null) {
15286      open(name);
15287      composeClaimResponseErrorsComponentInner(element);
15288      close();
15289    }
15290  }
15291
15292  protected void composeClaimResponseErrorsComponentInner(ClaimResponse.ErrorsComponent element) throws IOException {
15293      composeBackbone(element);
15294      if (element.hasSequenceLinkIdElement()) {
15295        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15296        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
15297      }
15298      if (element.hasDetailSequenceLinkIdElement()) {
15299        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15300        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
15301      }
15302      if (element.hasSubdetailSequenceLinkIdElement()) {
15303        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15304        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
15305      }
15306      if (element.hasCode()) {
15307        composeCoding("code", element.getCode());
15308      }
15309  }
15310
15311  protected void composeClaimResponseNotesComponent(String name, ClaimResponse.NotesComponent element) throws IOException {
15312    if (element != null) {
15313      open(name);
15314      composeClaimResponseNotesComponentInner(element);
15315      close();
15316    }
15317  }
15318
15319  protected void composeClaimResponseNotesComponentInner(ClaimResponse.NotesComponent element) throws IOException {
15320      composeBackbone(element);
15321      if (element.hasNumberElement()) {
15322        composePositiveIntCore("number", element.getNumberElement(), false);
15323        composePositiveIntExtras("number", element.getNumberElement(), false);
15324      }
15325      if (element.hasType()) {
15326        composeCoding("type", element.getType());
15327      }
15328      if (element.hasTextElement()) {
15329        composeStringCore("text", element.getTextElement(), false);
15330        composeStringExtras("text", element.getTextElement(), false);
15331      }
15332  }
15333
15334  protected void composeClaimResponseCoverageComponent(String name, ClaimResponse.CoverageComponent element) throws IOException {
15335    if (element != null) {
15336      open(name);
15337      composeClaimResponseCoverageComponentInner(element);
15338      close();
15339    }
15340  }
15341
15342  protected void composeClaimResponseCoverageComponentInner(ClaimResponse.CoverageComponent element) throws IOException {
15343      composeBackbone(element);
15344      if (element.hasSequenceElement()) {
15345        composePositiveIntCore("sequence", element.getSequenceElement(), false);
15346        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
15347      }
15348      if (element.hasFocalElement()) {
15349        composeBooleanCore("focal", element.getFocalElement(), false);
15350        composeBooleanExtras("focal", element.getFocalElement(), false);
15351      }
15352      if (element.hasCoverage()) {
15353        composeReference("coverage", element.getCoverage());
15354      }
15355      if (element.hasBusinessArrangementElement()) {
15356        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
15357        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
15358      }
15359      if (element.hasRelationship()) {
15360        composeCoding("relationship", element.getRelationship());
15361      }
15362      if (element.hasPreAuthRef()) {
15363        openArray("preAuthRef");
15364        for (StringType e : element.getPreAuthRef()) 
15365          composeStringCore(null, e, true);
15366        closeArray();
15367        if (anyHasExtras(element.getPreAuthRef())) {
15368          openArray("_preAuthRef");
15369          for (StringType e : element.getPreAuthRef()) 
15370            composeStringExtras(null, e, true);
15371          closeArray();
15372        }
15373      };
15374      if (element.hasClaimResponse()) {
15375        composeReference("claimResponse", element.getClaimResponse());
15376      }
15377      if (element.hasOriginalRuleset()) {
15378        composeCoding("originalRuleset", element.getOriginalRuleset());
15379      }
15380  }
15381
15382  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
15383    if (element != null) {
15384      prop("resourceType", name);
15385      composeClinicalImpressionInner(element);
15386    }
15387  }
15388
15389  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
15390      composeDomainResourceElements(element);
15391      if (element.hasPatient()) {
15392        composeReference("patient", element.getPatient());
15393      }
15394      if (element.hasAssessor()) {
15395        composeReference("assessor", element.getAssessor());
15396      }
15397      if (element.hasStatusElement()) {
15398        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15399        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
15400      }
15401      if (element.hasDateElement()) {
15402        composeDateTimeCore("date", element.getDateElement(), false);
15403        composeDateTimeExtras("date", element.getDateElement(), false);
15404      }
15405      if (element.hasDescriptionElement()) {
15406        composeStringCore("description", element.getDescriptionElement(), false);
15407        composeStringExtras("description", element.getDescriptionElement(), false);
15408      }
15409      if (element.hasPrevious()) {
15410        composeReference("previous", element.getPrevious());
15411      }
15412      if (element.hasProblem()) {
15413        openArray("problem");
15414        for (Reference e : element.getProblem()) 
15415          composeReference(null, e);
15416        closeArray();
15417      };
15418      if (element.hasTrigger()) {
15419        composeType("trigger", element.getTrigger());
15420      }
15421      if (element.hasInvestigations()) {
15422        openArray("investigations");
15423        for (ClinicalImpression.ClinicalImpressionInvestigationsComponent e : element.getInvestigations()) 
15424          composeClinicalImpressionClinicalImpressionInvestigationsComponent(null, e);
15425        closeArray();
15426      };
15427      if (element.hasProtocolElement()) {
15428        composeUriCore("protocol", element.getProtocolElement(), false);
15429        composeUriExtras("protocol", element.getProtocolElement(), false);
15430      }
15431      if (element.hasSummaryElement()) {
15432        composeStringCore("summary", element.getSummaryElement(), false);
15433        composeStringExtras("summary", element.getSummaryElement(), false);
15434      }
15435      if (element.hasFinding()) {
15436        openArray("finding");
15437        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
15438          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
15439        closeArray();
15440      };
15441      if (element.hasResolved()) {
15442        openArray("resolved");
15443        for (CodeableConcept e : element.getResolved()) 
15444          composeCodeableConcept(null, e);
15445        closeArray();
15446      };
15447      if (element.hasRuledOut()) {
15448        openArray("ruledOut");
15449        for (ClinicalImpression.ClinicalImpressionRuledOutComponent e : element.getRuledOut()) 
15450          composeClinicalImpressionClinicalImpressionRuledOutComponent(null, e);
15451        closeArray();
15452      };
15453      if (element.hasPrognosisElement()) {
15454        composeStringCore("prognosis", element.getPrognosisElement(), false);
15455        composeStringExtras("prognosis", element.getPrognosisElement(), false);
15456      }
15457      if (element.hasPlan()) {
15458        openArray("plan");
15459        for (Reference e : element.getPlan()) 
15460          composeReference(null, e);
15461        closeArray();
15462      };
15463      if (element.hasAction()) {
15464        openArray("action");
15465        for (Reference e : element.getAction()) 
15466          composeReference(null, e);
15467        closeArray();
15468      };
15469  }
15470
15471  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15472    if (element != null) {
15473      open(name);
15474      composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(element);
15475      close();
15476    }
15477  }
15478
15479  protected void composeClinicalImpressionClinicalImpressionInvestigationsComponentInner(ClinicalImpression.ClinicalImpressionInvestigationsComponent element) throws IOException {
15480      composeBackbone(element);
15481      if (element.hasCode()) {
15482        composeCodeableConcept("code", element.getCode());
15483      }
15484      if (element.hasItem()) {
15485        openArray("item");
15486        for (Reference e : element.getItem()) 
15487          composeReference(null, e);
15488        closeArray();
15489      };
15490  }
15491
15492  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15493    if (element != null) {
15494      open(name);
15495      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
15496      close();
15497    }
15498  }
15499
15500  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
15501      composeBackbone(element);
15502      if (element.hasItem()) {
15503        composeCodeableConcept("item", element.getItem());
15504      }
15505      if (element.hasCauseElement()) {
15506        composeStringCore("cause", element.getCauseElement(), false);
15507        composeStringExtras("cause", element.getCauseElement(), false);
15508      }
15509  }
15510
15511  protected void composeClinicalImpressionClinicalImpressionRuledOutComponent(String name, ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15512    if (element != null) {
15513      open(name);
15514      composeClinicalImpressionClinicalImpressionRuledOutComponentInner(element);
15515      close();
15516    }
15517  }
15518
15519  protected void composeClinicalImpressionClinicalImpressionRuledOutComponentInner(ClinicalImpression.ClinicalImpressionRuledOutComponent element) throws IOException {
15520      composeBackbone(element);
15521      if (element.hasItem()) {
15522        composeCodeableConcept("item", element.getItem());
15523      }
15524      if (element.hasReasonElement()) {
15525        composeStringCore("reason", element.getReasonElement(), false);
15526        composeStringExtras("reason", element.getReasonElement(), false);
15527      }
15528  }
15529
15530  protected void composeCommunication(String name, Communication element) throws IOException {
15531    if (element != null) {
15532      prop("resourceType", name);
15533      composeCommunicationInner(element);
15534    }
15535  }
15536
15537  protected void composeCommunicationInner(Communication element) throws IOException {
15538      composeDomainResourceElements(element);
15539      if (element.hasIdentifier()) {
15540        openArray("identifier");
15541        for (Identifier e : element.getIdentifier()) 
15542          composeIdentifier(null, e);
15543        closeArray();
15544      };
15545      if (element.hasCategory()) {
15546        composeCodeableConcept("category", element.getCategory());
15547      }
15548      if (element.hasSender()) {
15549        composeReference("sender", element.getSender());
15550      }
15551      if (element.hasRecipient()) {
15552        openArray("recipient");
15553        for (Reference e : element.getRecipient()) 
15554          composeReference(null, e);
15555        closeArray();
15556      };
15557      if (element.hasPayload()) {
15558        openArray("payload");
15559        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
15560          composeCommunicationCommunicationPayloadComponent(null, e);
15561        closeArray();
15562      };
15563      if (element.hasMedium()) {
15564        openArray("medium");
15565        for (CodeableConcept e : element.getMedium()) 
15566          composeCodeableConcept(null, e);
15567        closeArray();
15568      };
15569      if (element.hasStatusElement()) {
15570        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15571        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
15572      }
15573      if (element.hasEncounter()) {
15574        composeReference("encounter", element.getEncounter());
15575      }
15576      if (element.hasSentElement()) {
15577        composeDateTimeCore("sent", element.getSentElement(), false);
15578        composeDateTimeExtras("sent", element.getSentElement(), false);
15579      }
15580      if (element.hasReceivedElement()) {
15581        composeDateTimeCore("received", element.getReceivedElement(), false);
15582        composeDateTimeExtras("received", element.getReceivedElement(), false);
15583      }
15584      if (element.hasReason()) {
15585        openArray("reason");
15586        for (CodeableConcept e : element.getReason()) 
15587          composeCodeableConcept(null, e);
15588        closeArray();
15589      };
15590      if (element.hasSubject()) {
15591        composeReference("subject", element.getSubject());
15592      }
15593      if (element.hasRequestDetail()) {
15594        composeReference("requestDetail", element.getRequestDetail());
15595      }
15596  }
15597
15598  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
15599    if (element != null) {
15600      open(name);
15601      composeCommunicationCommunicationPayloadComponentInner(element);
15602      close();
15603    }
15604  }
15605
15606  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
15607      composeBackbone(element);
15608      if (element.hasContent()) {
15609        composeType("content", element.getContent());
15610      }
15611  }
15612
15613  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
15614    if (element != null) {
15615      prop("resourceType", name);
15616      composeCommunicationRequestInner(element);
15617    }
15618  }
15619
15620  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
15621      composeDomainResourceElements(element);
15622      if (element.hasIdentifier()) {
15623        openArray("identifier");
15624        for (Identifier e : element.getIdentifier()) 
15625          composeIdentifier(null, e);
15626        closeArray();
15627      };
15628      if (element.hasCategory()) {
15629        composeCodeableConcept("category", element.getCategory());
15630      }
15631      if (element.hasSender()) {
15632        composeReference("sender", element.getSender());
15633      }
15634      if (element.hasRecipient()) {
15635        openArray("recipient");
15636        for (Reference e : element.getRecipient()) 
15637          composeReference(null, e);
15638        closeArray();
15639      };
15640      if (element.hasPayload()) {
15641        openArray("payload");
15642        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
15643          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
15644        closeArray();
15645      };
15646      if (element.hasMedium()) {
15647        openArray("medium");
15648        for (CodeableConcept e : element.getMedium()) 
15649          composeCodeableConcept(null, e);
15650        closeArray();
15651      };
15652      if (element.hasRequester()) {
15653        composeReference("requester", element.getRequester());
15654      }
15655      if (element.hasStatusElement()) {
15656        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15657        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
15658      }
15659      if (element.hasEncounter()) {
15660        composeReference("encounter", element.getEncounter());
15661      }
15662      if (element.hasScheduled()) {
15663        composeType("scheduled", element.getScheduled());
15664      }
15665      if (element.hasReason()) {
15666        openArray("reason");
15667        for (CodeableConcept e : element.getReason()) 
15668          composeCodeableConcept(null, e);
15669        closeArray();
15670      };
15671      if (element.hasRequestedOnElement()) {
15672        composeDateTimeCore("requestedOn", element.getRequestedOnElement(), false);
15673        composeDateTimeExtras("requestedOn", element.getRequestedOnElement(), false);
15674      }
15675      if (element.hasSubject()) {
15676        composeReference("subject", element.getSubject());
15677      }
15678      if (element.hasPriority()) {
15679        composeCodeableConcept("priority", element.getPriority());
15680      }
15681  }
15682
15683  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15684    if (element != null) {
15685      open(name);
15686      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
15687      close();
15688    }
15689  }
15690
15691  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
15692      composeBackbone(element);
15693      if (element.hasContent()) {
15694        composeType("content", element.getContent());
15695      }
15696  }
15697
15698  protected void composeComposition(String name, Composition element) throws IOException {
15699    if (element != null) {
15700      prop("resourceType", name);
15701      composeCompositionInner(element);
15702    }
15703  }
15704
15705  protected void composeCompositionInner(Composition element) throws IOException {
15706      composeDomainResourceElements(element);
15707      if (element.hasIdentifier()) {
15708        composeIdentifier("identifier", element.getIdentifier());
15709      }
15710      if (element.hasDateElement()) {
15711        composeDateTimeCore("date", element.getDateElement(), false);
15712        composeDateTimeExtras("date", element.getDateElement(), false);
15713      }
15714      if (element.hasType()) {
15715        composeCodeableConcept("type", element.getType());
15716      }
15717      if (element.hasClass_()) {
15718        composeCodeableConcept("class", element.getClass_());
15719      }
15720      if (element.hasTitleElement()) {
15721        composeStringCore("title", element.getTitleElement(), false);
15722        composeStringExtras("title", element.getTitleElement(), false);
15723      }
15724      if (element.hasStatusElement()) {
15725        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15726        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
15727      }
15728      if (element.hasConfidentialityElement()) {
15729        composeCodeCore("confidentiality", element.getConfidentialityElement(), false);
15730        composeCodeExtras("confidentiality", element.getConfidentialityElement(), false);
15731      }
15732      if (element.hasSubject()) {
15733        composeReference("subject", element.getSubject());
15734      }
15735      if (element.hasAuthor()) {
15736        openArray("author");
15737        for (Reference e : element.getAuthor()) 
15738          composeReference(null, e);
15739        closeArray();
15740      };
15741      if (element.hasAttester()) {
15742        openArray("attester");
15743        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
15744          composeCompositionCompositionAttesterComponent(null, e);
15745        closeArray();
15746      };
15747      if (element.hasCustodian()) {
15748        composeReference("custodian", element.getCustodian());
15749      }
15750      if (element.hasEvent()) {
15751        openArray("event");
15752        for (Composition.CompositionEventComponent e : element.getEvent()) 
15753          composeCompositionCompositionEventComponent(null, e);
15754        closeArray();
15755      };
15756      if (element.hasEncounter()) {
15757        composeReference("encounter", element.getEncounter());
15758      }
15759      if (element.hasSection()) {
15760        openArray("section");
15761        for (Composition.SectionComponent e : element.getSection()) 
15762          composeCompositionSectionComponent(null, e);
15763        closeArray();
15764      };
15765  }
15766
15767  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
15768    if (element != null) {
15769      open(name);
15770      composeCompositionCompositionAttesterComponentInner(element);
15771      close();
15772    }
15773  }
15774
15775  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
15776      composeBackbone(element);
15777      if (element.hasMode()) {
15778        openArray("mode");
15779        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15780          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15781        closeArray();
15782        if (anyHasExtras(element.getMode())) {
15783          openArray("_mode");
15784          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
15785            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
15786          closeArray();
15787        }
15788      };
15789      if (element.hasTimeElement()) {
15790        composeDateTimeCore("time", element.getTimeElement(), false);
15791        composeDateTimeExtras("time", element.getTimeElement(), false);
15792      }
15793      if (element.hasParty()) {
15794        composeReference("party", element.getParty());
15795      }
15796  }
15797
15798  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
15799    if (element != null) {
15800      open(name);
15801      composeCompositionCompositionEventComponentInner(element);
15802      close();
15803    }
15804  }
15805
15806  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
15807      composeBackbone(element);
15808      if (element.hasCode()) {
15809        openArray("code");
15810        for (CodeableConcept e : element.getCode()) 
15811          composeCodeableConcept(null, e);
15812        closeArray();
15813      };
15814      if (element.hasPeriod()) {
15815        composePeriod("period", element.getPeriod());
15816      }
15817      if (element.hasDetail()) {
15818        openArray("detail");
15819        for (Reference e : element.getDetail()) 
15820          composeReference(null, e);
15821        closeArray();
15822      };
15823  }
15824
15825  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
15826    if (element != null) {
15827      open(name);
15828      composeCompositionSectionComponentInner(element);
15829      close();
15830    }
15831  }
15832
15833  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
15834      composeBackbone(element);
15835      if (element.hasTitleElement()) {
15836        composeStringCore("title", element.getTitleElement(), false);
15837        composeStringExtras("title", element.getTitleElement(), false);
15838      }
15839      if (element.hasCode()) {
15840        composeCodeableConcept("code", element.getCode());
15841      }
15842      if (element.hasText()) {
15843        composeNarrative("text", element.getText());
15844      }
15845      if (element.hasModeElement()) {
15846        composeCodeCore("mode", element.getModeElement(), false);
15847        composeCodeExtras("mode", element.getModeElement(), false);
15848      }
15849      if (element.hasOrderedBy()) {
15850        composeCodeableConcept("orderedBy", element.getOrderedBy());
15851      }
15852      if (element.hasEntry()) {
15853        openArray("entry");
15854        for (Reference e : element.getEntry()) 
15855          composeReference(null, e);
15856        closeArray();
15857      };
15858      if (element.hasEmptyReason()) {
15859        composeCodeableConcept("emptyReason", element.getEmptyReason());
15860      }
15861      if (element.hasSection()) {
15862        openArray("section");
15863        for (Composition.SectionComponent e : element.getSection()) 
15864          composeCompositionSectionComponent(null, e);
15865        closeArray();
15866      };
15867  }
15868
15869  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
15870    if (element != null) {
15871      prop("resourceType", name);
15872      composeConceptMapInner(element);
15873    }
15874  }
15875
15876  protected void composeConceptMapInner(ConceptMap element) throws IOException {
15877      composeDomainResourceElements(element);
15878      if (element.hasUrlElement()) {
15879        composeUriCore("url", element.getUrlElement(), false);
15880        composeUriExtras("url", element.getUrlElement(), false);
15881      }
15882      if (element.hasIdentifier()) {
15883        composeIdentifier("identifier", element.getIdentifier());
15884      }
15885      if (element.hasVersionElement()) {
15886        composeStringCore("version", element.getVersionElement(), false);
15887        composeStringExtras("version", element.getVersionElement(), false);
15888      }
15889      if (element.hasNameElement()) {
15890        composeStringCore("name", element.getNameElement(), false);
15891        composeStringExtras("name", element.getNameElement(), false);
15892      }
15893      if (element.hasStatusElement()) {
15894        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15895        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
15896      }
15897      if (element.hasExperimentalElement()) {
15898        composeBooleanCore("experimental", element.getExperimentalElement(), false);
15899        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
15900      }
15901      if (element.hasPublisherElement()) {
15902        composeStringCore("publisher", element.getPublisherElement(), false);
15903        composeStringExtras("publisher", element.getPublisherElement(), false);
15904      }
15905      if (element.hasContact()) {
15906        openArray("contact");
15907        for (ConceptMap.ConceptMapContactComponent e : element.getContact()) 
15908          composeConceptMapConceptMapContactComponent(null, e);
15909        closeArray();
15910      };
15911      if (element.hasDateElement()) {
15912        composeDateTimeCore("date", element.getDateElement(), false);
15913        composeDateTimeExtras("date", element.getDateElement(), false);
15914      }
15915      if (element.hasDescriptionElement()) {
15916        composeStringCore("description", element.getDescriptionElement(), false);
15917        composeStringExtras("description", element.getDescriptionElement(), false);
15918      }
15919      if (element.hasUseContext()) {
15920        openArray("useContext");
15921        for (CodeableConcept e : element.getUseContext()) 
15922          composeCodeableConcept(null, e);
15923        closeArray();
15924      };
15925      if (element.hasRequirementsElement()) {
15926        composeStringCore("requirements", element.getRequirementsElement(), false);
15927        composeStringExtras("requirements", element.getRequirementsElement(), false);
15928      }
15929      if (element.hasCopyrightElement()) {
15930        composeStringCore("copyright", element.getCopyrightElement(), false);
15931        composeStringExtras("copyright", element.getCopyrightElement(), false);
15932      }
15933      if (element.hasSource()) {
15934        composeType("source", element.getSource());
15935      }
15936      if (element.hasTarget()) {
15937        composeType("target", element.getTarget());
15938      }
15939      if (element.hasElement()) {
15940        openArray("element");
15941        for (ConceptMap.SourceElementComponent e : element.getElement()) 
15942          composeConceptMapSourceElementComponent(null, e);
15943        closeArray();
15944      };
15945  }
15946
15947  protected void composeConceptMapConceptMapContactComponent(String name, ConceptMap.ConceptMapContactComponent element) throws IOException {
15948    if (element != null) {
15949      open(name);
15950      composeConceptMapConceptMapContactComponentInner(element);
15951      close();
15952    }
15953  }
15954
15955  protected void composeConceptMapConceptMapContactComponentInner(ConceptMap.ConceptMapContactComponent element) throws IOException {
15956      composeBackbone(element);
15957      if (element.hasNameElement()) {
15958        composeStringCore("name", element.getNameElement(), false);
15959        composeStringExtras("name", element.getNameElement(), false);
15960      }
15961      if (element.hasTelecom()) {
15962        openArray("telecom");
15963        for (ContactPoint e : element.getTelecom()) 
15964          composeContactPoint(null, e);
15965        closeArray();
15966      };
15967  }
15968
15969  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
15970    if (element != null) {
15971      open(name);
15972      composeConceptMapSourceElementComponentInner(element);
15973      close();
15974    }
15975  }
15976
15977  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
15978      composeBackbone(element);
15979      if (element.hasCodeSystemElement()) {
15980        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
15981        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
15982      }
15983      if (element.hasCodeElement()) {
15984        composeCodeCore("code", element.getCodeElement(), false);
15985        composeCodeExtras("code", element.getCodeElement(), false);
15986      }
15987      if (element.hasTarget()) {
15988        openArray("target");
15989        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
15990          composeConceptMapTargetElementComponent(null, e);
15991        closeArray();
15992      };
15993  }
15994
15995  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
15996    if (element != null) {
15997      open(name);
15998      composeConceptMapTargetElementComponentInner(element);
15999      close();
16000    }
16001  }
16002
16003  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
16004      composeBackbone(element);
16005      if (element.hasCodeSystemElement()) {
16006        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
16007        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
16008      }
16009      if (element.hasCodeElement()) {
16010        composeCodeCore("code", element.getCodeElement(), false);
16011        composeCodeExtras("code", element.getCodeElement(), false);
16012      }
16013      if (element.hasEquivalenceElement()) {
16014        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
16015        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
16016      }
16017      if (element.hasCommentsElement()) {
16018        composeStringCore("comments", element.getCommentsElement(), false);
16019        composeStringExtras("comments", element.getCommentsElement(), false);
16020      }
16021      if (element.hasDependsOn()) {
16022        openArray("dependsOn");
16023        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
16024          composeConceptMapOtherElementComponent(null, e);
16025        closeArray();
16026      };
16027      if (element.hasProduct()) {
16028        openArray("product");
16029        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
16030          composeConceptMapOtherElementComponent(null, e);
16031        closeArray();
16032      };
16033  }
16034
16035  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
16036    if (element != null) {
16037      open(name);
16038      composeConceptMapOtherElementComponentInner(element);
16039      close();
16040    }
16041  }
16042
16043  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
16044      composeBackbone(element);
16045      if (element.hasElementElement()) {
16046        composeUriCore("element", element.getElementElement(), false);
16047        composeUriExtras("element", element.getElementElement(), false);
16048      }
16049      if (element.hasCodeSystemElement()) {
16050        composeUriCore("codeSystem", element.getCodeSystemElement(), false);
16051        composeUriExtras("codeSystem", element.getCodeSystemElement(), false);
16052      }
16053      if (element.hasCodeElement()) {
16054        composeStringCore("code", element.getCodeElement(), false);
16055        composeStringExtras("code", element.getCodeElement(), false);
16056      }
16057  }
16058
16059  protected void composeCondition(String name, Condition element) throws IOException {
16060    if (element != null) {
16061      prop("resourceType", name);
16062      composeConditionInner(element);
16063    }
16064  }
16065
16066  protected void composeConditionInner(Condition element) throws IOException {
16067      composeDomainResourceElements(element);
16068      if (element.hasIdentifier()) {
16069        openArray("identifier");
16070        for (Identifier e : element.getIdentifier()) 
16071          composeIdentifier(null, e);
16072        closeArray();
16073      };
16074      if (element.hasPatient()) {
16075        composeReference("patient", element.getPatient());
16076      }
16077      if (element.hasEncounter()) {
16078        composeReference("encounter", element.getEncounter());
16079      }
16080      if (element.hasAsserter()) {
16081        composeReference("asserter", element.getAsserter());
16082      }
16083      if (element.hasDateRecordedElement()) {
16084        composeDateCore("dateRecorded", element.getDateRecordedElement(), false);
16085        composeDateExtras("dateRecorded", element.getDateRecordedElement(), false);
16086      }
16087      if (element.hasCode()) {
16088        composeCodeableConcept("code", element.getCode());
16089      }
16090      if (element.hasCategory()) {
16091        composeCodeableConcept("category", element.getCategory());
16092      }
16093      if (element.hasClinicalStatusElement()) {
16094        composeCodeCore("clinicalStatus", element.getClinicalStatusElement(), false);
16095        composeCodeExtras("clinicalStatus", element.getClinicalStatusElement(), false);
16096      }
16097      if (element.hasVerificationStatusElement()) {
16098        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16099        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
16100      }
16101      if (element.hasSeverity()) {
16102        composeCodeableConcept("severity", element.getSeverity());
16103      }
16104      if (element.hasOnset()) {
16105        composeType("onset", element.getOnset());
16106      }
16107      if (element.hasAbatement()) {
16108        composeType("abatement", element.getAbatement());
16109      }
16110      if (element.hasStage()) {
16111        composeConditionConditionStageComponent("stage", element.getStage());
16112      }
16113      if (element.hasEvidence()) {
16114        openArray("evidence");
16115        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
16116          composeConditionConditionEvidenceComponent(null, e);
16117        closeArray();
16118      };
16119      if (element.hasBodySite()) {
16120        openArray("bodySite");
16121        for (CodeableConcept e : element.getBodySite()) 
16122          composeCodeableConcept(null, e);
16123        closeArray();
16124      };
16125      if (element.hasNotesElement()) {
16126        composeStringCore("notes", element.getNotesElement(), false);
16127        composeStringExtras("notes", element.getNotesElement(), false);
16128      }
16129  }
16130
16131  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
16132    if (element != null) {
16133      open(name);
16134      composeConditionConditionStageComponentInner(element);
16135      close();
16136    }
16137  }
16138
16139  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
16140      composeBackbone(element);
16141      if (element.hasSummary()) {
16142        composeCodeableConcept("summary", element.getSummary());
16143      }
16144      if (element.hasAssessment()) {
16145        openArray("assessment");
16146        for (Reference e : element.getAssessment()) 
16147          composeReference(null, e);
16148        closeArray();
16149      };
16150  }
16151
16152  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
16153    if (element != null) {
16154      open(name);
16155      composeConditionConditionEvidenceComponentInner(element);
16156      close();
16157    }
16158  }
16159
16160  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
16161      composeBackbone(element);
16162      if (element.hasCode()) {
16163        composeCodeableConcept("code", element.getCode());
16164      }
16165      if (element.hasDetail()) {
16166        openArray("detail");
16167        for (Reference e : element.getDetail()) 
16168          composeReference(null, e);
16169        closeArray();
16170      };
16171  }
16172
16173  protected void composeConformance(String name, Conformance element) throws IOException {
16174    if (element != null) {
16175      prop("resourceType", name);
16176      composeConformanceInner(element);
16177    }
16178  }
16179
16180  protected void composeConformanceInner(Conformance element) throws IOException {
16181      composeDomainResourceElements(element);
16182      if (element.hasUrlElement()) {
16183        composeUriCore("url", element.getUrlElement(), false);
16184        composeUriExtras("url", element.getUrlElement(), false);
16185      }
16186      if (element.hasVersionElement()) {
16187        composeStringCore("version", element.getVersionElement(), false);
16188        composeStringExtras("version", element.getVersionElement(), false);
16189      }
16190      if (element.hasNameElement()) {
16191        composeStringCore("name", element.getNameElement(), false);
16192        composeStringExtras("name", element.getNameElement(), false);
16193      }
16194      if (element.hasStatusElement()) {
16195        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16196        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
16197      }
16198      if (element.hasExperimentalElement()) {
16199        composeBooleanCore("experimental", element.getExperimentalElement(), false);
16200        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
16201      }
16202      if (element.hasPublisherElement()) {
16203        composeStringCore("publisher", element.getPublisherElement(), false);
16204        composeStringExtras("publisher", element.getPublisherElement(), false);
16205      }
16206      if (element.hasContact()) {
16207        openArray("contact");
16208        for (Conformance.ConformanceContactComponent e : element.getContact()) 
16209          composeConformanceConformanceContactComponent(null, e);
16210        closeArray();
16211      };
16212      if (element.hasDateElement()) {
16213        composeDateTimeCore("date", element.getDateElement(), false);
16214        composeDateTimeExtras("date", element.getDateElement(), false);
16215      }
16216      if (element.hasDescriptionElement()) {
16217        composeStringCore("description", element.getDescriptionElement(), false);
16218        composeStringExtras("description", element.getDescriptionElement(), false);
16219      }
16220      if (element.hasRequirementsElement()) {
16221        composeStringCore("requirements", element.getRequirementsElement(), false);
16222        composeStringExtras("requirements", element.getRequirementsElement(), false);
16223      }
16224      if (element.hasCopyrightElement()) {
16225        composeStringCore("copyright", element.getCopyrightElement(), false);
16226        composeStringExtras("copyright", element.getCopyrightElement(), false);
16227      }
16228      if (element.hasKindElement()) {
16229        composeEnumerationCore("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16230        composeEnumerationExtras("kind", element.getKindElement(), new Conformance.ConformanceStatementKindEnumFactory(), false);
16231      }
16232      if (element.hasSoftware()) {
16233        composeConformanceConformanceSoftwareComponent("software", element.getSoftware());
16234      }
16235      if (element.hasImplementation()) {
16236        composeConformanceConformanceImplementationComponent("implementation", element.getImplementation());
16237      }
16238      if (element.hasFhirVersionElement()) {
16239        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
16240        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
16241      }
16242      if (element.hasAcceptUnknownElement()) {
16243        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16244        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new Conformance.UnknownContentCodeEnumFactory(), false);
16245      }
16246      if (element.hasFormat()) {
16247        openArray("format");
16248        for (CodeType e : element.getFormat()) 
16249          composeCodeCore(null, e, true);
16250        closeArray();
16251        if (anyHasExtras(element.getFormat())) {
16252          openArray("_format");
16253          for (CodeType e : element.getFormat()) 
16254            composeCodeExtras(null, e, true);
16255          closeArray();
16256        }
16257      };
16258      if (element.hasProfile()) {
16259        openArray("profile");
16260        for (Reference e : element.getProfile()) 
16261          composeReference(null, e);
16262        closeArray();
16263      };
16264      if (element.hasRest()) {
16265        openArray("rest");
16266        for (Conformance.ConformanceRestComponent e : element.getRest()) 
16267          composeConformanceConformanceRestComponent(null, e);
16268        closeArray();
16269      };
16270      if (element.hasMessaging()) {
16271        openArray("messaging");
16272        for (Conformance.ConformanceMessagingComponent e : element.getMessaging()) 
16273          composeConformanceConformanceMessagingComponent(null, e);
16274        closeArray();
16275      };
16276      if (element.hasDocument()) {
16277        openArray("document");
16278        for (Conformance.ConformanceDocumentComponent e : element.getDocument()) 
16279          composeConformanceConformanceDocumentComponent(null, e);
16280        closeArray();
16281      };
16282  }
16283
16284  protected void composeConformanceConformanceContactComponent(String name, Conformance.ConformanceContactComponent element) throws IOException {
16285    if (element != null) {
16286      open(name);
16287      composeConformanceConformanceContactComponentInner(element);
16288      close();
16289    }
16290  }
16291
16292  protected void composeConformanceConformanceContactComponentInner(Conformance.ConformanceContactComponent element) throws IOException {
16293      composeBackbone(element);
16294      if (element.hasNameElement()) {
16295        composeStringCore("name", element.getNameElement(), false);
16296        composeStringExtras("name", element.getNameElement(), false);
16297      }
16298      if (element.hasTelecom()) {
16299        openArray("telecom");
16300        for (ContactPoint e : element.getTelecom()) 
16301          composeContactPoint(null, e);
16302        closeArray();
16303      };
16304  }
16305
16306  protected void composeConformanceConformanceSoftwareComponent(String name, Conformance.ConformanceSoftwareComponent element) throws IOException {
16307    if (element != null) {
16308      open(name);
16309      composeConformanceConformanceSoftwareComponentInner(element);
16310      close();
16311    }
16312  }
16313
16314  protected void composeConformanceConformanceSoftwareComponentInner(Conformance.ConformanceSoftwareComponent element) throws IOException {
16315      composeBackbone(element);
16316      if (element.hasNameElement()) {
16317        composeStringCore("name", element.getNameElement(), false);
16318        composeStringExtras("name", element.getNameElement(), false);
16319      }
16320      if (element.hasVersionElement()) {
16321        composeStringCore("version", element.getVersionElement(), false);
16322        composeStringExtras("version", element.getVersionElement(), false);
16323      }
16324      if (element.hasReleaseDateElement()) {
16325        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
16326        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
16327      }
16328  }
16329
16330  protected void composeConformanceConformanceImplementationComponent(String name, Conformance.ConformanceImplementationComponent element) throws IOException {
16331    if (element != null) {
16332      open(name);
16333      composeConformanceConformanceImplementationComponentInner(element);
16334      close();
16335    }
16336  }
16337
16338  protected void composeConformanceConformanceImplementationComponentInner(Conformance.ConformanceImplementationComponent element) throws IOException {
16339      composeBackbone(element);
16340      if (element.hasDescriptionElement()) {
16341        composeStringCore("description", element.getDescriptionElement(), false);
16342        composeStringExtras("description", element.getDescriptionElement(), false);
16343      }
16344      if (element.hasUrlElement()) {
16345        composeUriCore("url", element.getUrlElement(), false);
16346        composeUriExtras("url", element.getUrlElement(), false);
16347      }
16348  }
16349
16350  protected void composeConformanceConformanceRestComponent(String name, Conformance.ConformanceRestComponent element) throws IOException {
16351    if (element != null) {
16352      open(name);
16353      composeConformanceConformanceRestComponentInner(element);
16354      close();
16355    }
16356  }
16357
16358  protected void composeConformanceConformanceRestComponentInner(Conformance.ConformanceRestComponent element) throws IOException {
16359      composeBackbone(element);
16360      if (element.hasModeElement()) {
16361        composeEnumerationCore("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16362        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.RestfulConformanceModeEnumFactory(), false);
16363      }
16364      if (element.hasDocumentationElement()) {
16365        composeStringCore("documentation", element.getDocumentationElement(), false);
16366        composeStringExtras("documentation", element.getDocumentationElement(), false);
16367      }
16368      if (element.hasSecurity()) {
16369        composeConformanceConformanceRestSecurityComponent("security", element.getSecurity());
16370      }
16371      if (element.hasResource()) {
16372        openArray("resource");
16373        for (Conformance.ConformanceRestResourceComponent e : element.getResource()) 
16374          composeConformanceConformanceRestResourceComponent(null, e);
16375        closeArray();
16376      };
16377      if (element.hasInteraction()) {
16378        openArray("interaction");
16379        for (Conformance.SystemInteractionComponent e : element.getInteraction()) 
16380          composeConformanceSystemInteractionComponent(null, e);
16381        closeArray();
16382      };
16383      if (element.hasTransactionModeElement()) {
16384        composeEnumerationCore("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16385        composeEnumerationExtras("transactionMode", element.getTransactionModeElement(), new Conformance.TransactionModeEnumFactory(), false);
16386      }
16387      if (element.hasSearchParam()) {
16388        openArray("searchParam");
16389        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16390          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16391        closeArray();
16392      };
16393      if (element.hasOperation()) {
16394        openArray("operation");
16395        for (Conformance.ConformanceRestOperationComponent e : element.getOperation()) 
16396          composeConformanceConformanceRestOperationComponent(null, e);
16397        closeArray();
16398      };
16399      if (element.hasCompartment()) {
16400        openArray("compartment");
16401        for (UriType e : element.getCompartment()) 
16402          composeUriCore(null, e, true);
16403        closeArray();
16404        if (anyHasExtras(element.getCompartment())) {
16405          openArray("_compartment");
16406          for (UriType e : element.getCompartment()) 
16407            composeUriExtras(null, e, true);
16408          closeArray();
16409        }
16410      };
16411  }
16412
16413  protected void composeConformanceConformanceRestSecurityComponent(String name, Conformance.ConformanceRestSecurityComponent element) throws IOException {
16414    if (element != null) {
16415      open(name);
16416      composeConformanceConformanceRestSecurityComponentInner(element);
16417      close();
16418    }
16419  }
16420
16421  protected void composeConformanceConformanceRestSecurityComponentInner(Conformance.ConformanceRestSecurityComponent element) throws IOException {
16422      composeBackbone(element);
16423      if (element.hasCorsElement()) {
16424        composeBooleanCore("cors", element.getCorsElement(), false);
16425        composeBooleanExtras("cors", element.getCorsElement(), false);
16426      }
16427      if (element.hasService()) {
16428        openArray("service");
16429        for (CodeableConcept e : element.getService()) 
16430          composeCodeableConcept(null, e);
16431        closeArray();
16432      };
16433      if (element.hasDescriptionElement()) {
16434        composeStringCore("description", element.getDescriptionElement(), false);
16435        composeStringExtras("description", element.getDescriptionElement(), false);
16436      }
16437      if (element.hasCertificate()) {
16438        openArray("certificate");
16439        for (Conformance.ConformanceRestSecurityCertificateComponent e : element.getCertificate()) 
16440          composeConformanceConformanceRestSecurityCertificateComponent(null, e);
16441        closeArray();
16442      };
16443  }
16444
16445  protected void composeConformanceConformanceRestSecurityCertificateComponent(String name, Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16446    if (element != null) {
16447      open(name);
16448      composeConformanceConformanceRestSecurityCertificateComponentInner(element);
16449      close();
16450    }
16451  }
16452
16453  protected void composeConformanceConformanceRestSecurityCertificateComponentInner(Conformance.ConformanceRestSecurityCertificateComponent element) throws IOException {
16454      composeBackbone(element);
16455      if (element.hasTypeElement()) {
16456        composeCodeCore("type", element.getTypeElement(), false);
16457        composeCodeExtras("type", element.getTypeElement(), false);
16458      }
16459      if (element.hasBlobElement()) {
16460        composeBase64BinaryCore("blob", element.getBlobElement(), false);
16461        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
16462      }
16463  }
16464
16465  protected void composeConformanceConformanceRestResourceComponent(String name, Conformance.ConformanceRestResourceComponent element) throws IOException {
16466    if (element != null) {
16467      open(name);
16468      composeConformanceConformanceRestResourceComponentInner(element);
16469      close();
16470    }
16471  }
16472
16473  protected void composeConformanceConformanceRestResourceComponentInner(Conformance.ConformanceRestResourceComponent element) throws IOException {
16474      composeBackbone(element);
16475      if (element.hasTypeElement()) {
16476        composeCodeCore("type", element.getTypeElement(), false);
16477        composeCodeExtras("type", element.getTypeElement(), false);
16478      }
16479      if (element.hasProfile()) {
16480        composeReference("profile", element.getProfile());
16481      }
16482      if (element.hasInteraction()) {
16483        openArray("interaction");
16484        for (Conformance.ResourceInteractionComponent e : element.getInteraction()) 
16485          composeConformanceResourceInteractionComponent(null, e);
16486        closeArray();
16487      };
16488      if (element.hasVersioningElement()) {
16489        composeEnumerationCore("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16490        composeEnumerationExtras("versioning", element.getVersioningElement(), new Conformance.ResourceVersionPolicyEnumFactory(), false);
16491      }
16492      if (element.hasReadHistoryElement()) {
16493        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
16494        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
16495      }
16496      if (element.hasUpdateCreateElement()) {
16497        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
16498        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
16499      }
16500      if (element.hasConditionalCreateElement()) {
16501        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
16502        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
16503      }
16504      if (element.hasConditionalUpdateElement()) {
16505        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
16506        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
16507      }
16508      if (element.hasConditionalDeleteElement()) {
16509        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16510        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new Conformance.ConditionalDeleteStatusEnumFactory(), false);
16511      }
16512      if (element.hasSearchInclude()) {
16513        openArray("searchInclude");
16514        for (StringType e : element.getSearchInclude()) 
16515          composeStringCore(null, e, true);
16516        closeArray();
16517        if (anyHasExtras(element.getSearchInclude())) {
16518          openArray("_searchInclude");
16519          for (StringType e : element.getSearchInclude()) 
16520            composeStringExtras(null, e, true);
16521          closeArray();
16522        }
16523      };
16524      if (element.hasSearchRevInclude()) {
16525        openArray("searchRevInclude");
16526        for (StringType e : element.getSearchRevInclude()) 
16527          composeStringCore(null, e, true);
16528        closeArray();
16529        if (anyHasExtras(element.getSearchRevInclude())) {
16530          openArray("_searchRevInclude");
16531          for (StringType e : element.getSearchRevInclude()) 
16532            composeStringExtras(null, e, true);
16533          closeArray();
16534        }
16535      };
16536      if (element.hasSearchParam()) {
16537        openArray("searchParam");
16538        for (Conformance.ConformanceRestResourceSearchParamComponent e : element.getSearchParam()) 
16539          composeConformanceConformanceRestResourceSearchParamComponent(null, e);
16540        closeArray();
16541      };
16542  }
16543
16544  protected void composeConformanceResourceInteractionComponent(String name, Conformance.ResourceInteractionComponent element) throws IOException {
16545    if (element != null) {
16546      open(name);
16547      composeConformanceResourceInteractionComponentInner(element);
16548      close();
16549    }
16550  }
16551
16552  protected void composeConformanceResourceInteractionComponentInner(Conformance.ResourceInteractionComponent element) throws IOException {
16553      composeBackbone(element);
16554      if (element.hasCodeElement()) {
16555        composeEnumerationCore("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16556        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.TypeRestfulInteractionEnumFactory(), false);
16557      }
16558      if (element.hasDocumentationElement()) {
16559        composeStringCore("documentation", element.getDocumentationElement(), false);
16560        composeStringExtras("documentation", element.getDocumentationElement(), false);
16561      }
16562  }
16563
16564  protected void composeConformanceConformanceRestResourceSearchParamComponent(String name, Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16565    if (element != null) {
16566      open(name);
16567      composeConformanceConformanceRestResourceSearchParamComponentInner(element);
16568      close();
16569    }
16570  }
16571
16572  protected void composeConformanceConformanceRestResourceSearchParamComponentInner(Conformance.ConformanceRestResourceSearchParamComponent element) throws IOException {
16573      composeBackbone(element);
16574      if (element.hasNameElement()) {
16575        composeStringCore("name", element.getNameElement(), false);
16576        composeStringExtras("name", element.getNameElement(), false);
16577      }
16578      if (element.hasDefinitionElement()) {
16579        composeUriCore("definition", element.getDefinitionElement(), false);
16580        composeUriExtras("definition", element.getDefinitionElement(), false);
16581      }
16582      if (element.hasTypeElement()) {
16583        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16584        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
16585      }
16586      if (element.hasDocumentationElement()) {
16587        composeStringCore("documentation", element.getDocumentationElement(), false);
16588        composeStringExtras("documentation", element.getDocumentationElement(), false);
16589      }
16590      if (element.hasTarget()) {
16591        openArray("target");
16592        for (CodeType e : element.getTarget()) 
16593          composeCodeCore(null, e, true);
16594        closeArray();
16595        if (anyHasExtras(element.getTarget())) {
16596          openArray("_target");
16597          for (CodeType e : element.getTarget()) 
16598            composeCodeExtras(null, e, true);
16599          closeArray();
16600        }
16601      };
16602      if (element.hasModifier()) {
16603        openArray("modifier");
16604        for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16605          composeEnumerationCore(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16606        closeArray();
16607        if (anyHasExtras(element.getModifier())) {
16608          openArray("_modifier");
16609          for (Enumeration<Conformance.SearchModifierCode> e : element.getModifier()) 
16610            composeEnumerationExtras(null, e, new Conformance.SearchModifierCodeEnumFactory(), true);
16611          closeArray();
16612        }
16613      };
16614      if (element.hasChain()) {
16615        openArray("chain");
16616        for (StringType e : element.getChain()) 
16617          composeStringCore(null, e, true);
16618        closeArray();
16619        if (anyHasExtras(element.getChain())) {
16620          openArray("_chain");
16621          for (StringType e : element.getChain()) 
16622            composeStringExtras(null, e, true);
16623          closeArray();
16624        }
16625      };
16626  }
16627
16628  protected void composeConformanceSystemInteractionComponent(String name, Conformance.SystemInteractionComponent element) throws IOException {
16629    if (element != null) {
16630      open(name);
16631      composeConformanceSystemInteractionComponentInner(element);
16632      close();
16633    }
16634  }
16635
16636  protected void composeConformanceSystemInteractionComponentInner(Conformance.SystemInteractionComponent element) throws IOException {
16637      composeBackbone(element);
16638      if (element.hasCodeElement()) {
16639        composeEnumerationCore("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16640        composeEnumerationExtras("code", element.getCodeElement(), new Conformance.SystemRestfulInteractionEnumFactory(), false);
16641      }
16642      if (element.hasDocumentationElement()) {
16643        composeStringCore("documentation", element.getDocumentationElement(), false);
16644        composeStringExtras("documentation", element.getDocumentationElement(), false);
16645      }
16646  }
16647
16648  protected void composeConformanceConformanceRestOperationComponent(String name, Conformance.ConformanceRestOperationComponent element) throws IOException {
16649    if (element != null) {
16650      open(name);
16651      composeConformanceConformanceRestOperationComponentInner(element);
16652      close();
16653    }
16654  }
16655
16656  protected void composeConformanceConformanceRestOperationComponentInner(Conformance.ConformanceRestOperationComponent element) throws IOException {
16657      composeBackbone(element);
16658      if (element.hasNameElement()) {
16659        composeStringCore("name", element.getNameElement(), false);
16660        composeStringExtras("name", element.getNameElement(), false);
16661      }
16662      if (element.hasDefinition()) {
16663        composeReference("definition", element.getDefinition());
16664      }
16665  }
16666
16667  protected void composeConformanceConformanceMessagingComponent(String name, Conformance.ConformanceMessagingComponent element) throws IOException {
16668    if (element != null) {
16669      open(name);
16670      composeConformanceConformanceMessagingComponentInner(element);
16671      close();
16672    }
16673  }
16674
16675  protected void composeConformanceConformanceMessagingComponentInner(Conformance.ConformanceMessagingComponent element) throws IOException {
16676      composeBackbone(element);
16677      if (element.hasEndpoint()) {
16678        openArray("endpoint");
16679        for (Conformance.ConformanceMessagingEndpointComponent e : element.getEndpoint()) 
16680          composeConformanceConformanceMessagingEndpointComponent(null, e);
16681        closeArray();
16682      };
16683      if (element.hasReliableCacheElement()) {
16684        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
16685        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
16686      }
16687      if (element.hasDocumentationElement()) {
16688        composeStringCore("documentation", element.getDocumentationElement(), false);
16689        composeStringExtras("documentation", element.getDocumentationElement(), false);
16690      }
16691      if (element.hasEvent()) {
16692        openArray("event");
16693        for (Conformance.ConformanceMessagingEventComponent e : element.getEvent()) 
16694          composeConformanceConformanceMessagingEventComponent(null, e);
16695        closeArray();
16696      };
16697  }
16698
16699  protected void composeConformanceConformanceMessagingEndpointComponent(String name, Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16700    if (element != null) {
16701      open(name);
16702      composeConformanceConformanceMessagingEndpointComponentInner(element);
16703      close();
16704    }
16705  }
16706
16707  protected void composeConformanceConformanceMessagingEndpointComponentInner(Conformance.ConformanceMessagingEndpointComponent element) throws IOException {
16708      composeBackbone(element);
16709      if (element.hasProtocol()) {
16710        composeCoding("protocol", element.getProtocol());
16711      }
16712      if (element.hasAddressElement()) {
16713        composeUriCore("address", element.getAddressElement(), false);
16714        composeUriExtras("address", element.getAddressElement(), false);
16715      }
16716  }
16717
16718  protected void composeConformanceConformanceMessagingEventComponent(String name, Conformance.ConformanceMessagingEventComponent element) throws IOException {
16719    if (element != null) {
16720      open(name);
16721      composeConformanceConformanceMessagingEventComponentInner(element);
16722      close();
16723    }
16724  }
16725
16726  protected void composeConformanceConformanceMessagingEventComponentInner(Conformance.ConformanceMessagingEventComponent element) throws IOException {
16727      composeBackbone(element);
16728      if (element.hasCode()) {
16729        composeCoding("code", element.getCode());
16730      }
16731      if (element.hasCategoryElement()) {
16732        composeEnumerationCore("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16733        composeEnumerationExtras("category", element.getCategoryElement(), new Conformance.MessageSignificanceCategoryEnumFactory(), false);
16734      }
16735      if (element.hasModeElement()) {
16736        composeEnumerationCore("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16737        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.ConformanceEventModeEnumFactory(), false);
16738      }
16739      if (element.hasFocusElement()) {
16740        composeCodeCore("focus", element.getFocusElement(), false);
16741        composeCodeExtras("focus", element.getFocusElement(), false);
16742      }
16743      if (element.hasRequest()) {
16744        composeReference("request", element.getRequest());
16745      }
16746      if (element.hasResponse()) {
16747        composeReference("response", element.getResponse());
16748      }
16749      if (element.hasDocumentationElement()) {
16750        composeStringCore("documentation", element.getDocumentationElement(), false);
16751        composeStringExtras("documentation", element.getDocumentationElement(), false);
16752      }
16753  }
16754
16755  protected void composeConformanceConformanceDocumentComponent(String name, Conformance.ConformanceDocumentComponent element) throws IOException {
16756    if (element != null) {
16757      open(name);
16758      composeConformanceConformanceDocumentComponentInner(element);
16759      close();
16760    }
16761  }
16762
16763  protected void composeConformanceConformanceDocumentComponentInner(Conformance.ConformanceDocumentComponent element) throws IOException {
16764      composeBackbone(element);
16765      if (element.hasModeElement()) {
16766        composeEnumerationCore("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16767        composeEnumerationExtras("mode", element.getModeElement(), new Conformance.DocumentModeEnumFactory(), false);
16768      }
16769      if (element.hasDocumentationElement()) {
16770        composeStringCore("documentation", element.getDocumentationElement(), false);
16771        composeStringExtras("documentation", element.getDocumentationElement(), false);
16772      }
16773      if (element.hasProfile()) {
16774        composeReference("profile", element.getProfile());
16775      }
16776  }
16777
16778  protected void composeContract(String name, Contract element) throws IOException {
16779    if (element != null) {
16780      prop("resourceType", name);
16781      composeContractInner(element);
16782    }
16783  }
16784
16785  protected void composeContractInner(Contract element) throws IOException {
16786      composeDomainResourceElements(element);
16787      if (element.hasIdentifier()) {
16788        composeIdentifier("identifier", element.getIdentifier());
16789      }
16790      if (element.hasIssuedElement()) {
16791        composeDateTimeCore("issued", element.getIssuedElement(), false);
16792        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16793      }
16794      if (element.hasApplies()) {
16795        composePeriod("applies", element.getApplies());
16796      }
16797      if (element.hasSubject()) {
16798        openArray("subject");
16799        for (Reference e : element.getSubject()) 
16800          composeReference(null, e);
16801        closeArray();
16802      };
16803      if (element.hasAuthority()) {
16804        openArray("authority");
16805        for (Reference e : element.getAuthority()) 
16806          composeReference(null, e);
16807        closeArray();
16808      };
16809      if (element.hasDomain()) {
16810        openArray("domain");
16811        for (Reference e : element.getDomain()) 
16812          composeReference(null, e);
16813        closeArray();
16814      };
16815      if (element.hasType()) {
16816        composeCodeableConcept("type", element.getType());
16817      }
16818      if (element.hasSubType()) {
16819        openArray("subType");
16820        for (CodeableConcept e : element.getSubType()) 
16821          composeCodeableConcept(null, e);
16822        closeArray();
16823      };
16824      if (element.hasAction()) {
16825        openArray("action");
16826        for (CodeableConcept e : element.getAction()) 
16827          composeCodeableConcept(null, e);
16828        closeArray();
16829      };
16830      if (element.hasActionReason()) {
16831        openArray("actionReason");
16832        for (CodeableConcept e : element.getActionReason()) 
16833          composeCodeableConcept(null, e);
16834        closeArray();
16835      };
16836      if (element.hasActor()) {
16837        openArray("actor");
16838        for (Contract.ActorComponent e : element.getActor()) 
16839          composeContractActorComponent(null, e);
16840        closeArray();
16841      };
16842      if (element.hasValuedItem()) {
16843        openArray("valuedItem");
16844        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
16845          composeContractValuedItemComponent(null, e);
16846        closeArray();
16847      };
16848      if (element.hasSigner()) {
16849        openArray("signer");
16850        for (Contract.SignatoryComponent e : element.getSigner()) 
16851          composeContractSignatoryComponent(null, e);
16852        closeArray();
16853      };
16854      if (element.hasTerm()) {
16855        openArray("term");
16856        for (Contract.TermComponent e : element.getTerm()) 
16857          composeContractTermComponent(null, e);
16858        closeArray();
16859      };
16860      if (element.hasBinding()) {
16861        composeType("binding", element.getBinding());
16862      }
16863      if (element.hasFriendly()) {
16864        openArray("friendly");
16865        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
16866          composeContractFriendlyLanguageComponent(null, e);
16867        closeArray();
16868      };
16869      if (element.hasLegal()) {
16870        openArray("legal");
16871        for (Contract.LegalLanguageComponent e : element.getLegal()) 
16872          composeContractLegalLanguageComponent(null, e);
16873        closeArray();
16874      };
16875      if (element.hasRule()) {
16876        openArray("rule");
16877        for (Contract.ComputableLanguageComponent e : element.getRule()) 
16878          composeContractComputableLanguageComponent(null, e);
16879        closeArray();
16880      };
16881  }
16882
16883  protected void composeContractActorComponent(String name, Contract.ActorComponent element) throws IOException {
16884    if (element != null) {
16885      open(name);
16886      composeContractActorComponentInner(element);
16887      close();
16888    }
16889  }
16890
16891  protected void composeContractActorComponentInner(Contract.ActorComponent element) throws IOException {
16892      composeBackbone(element);
16893      if (element.hasEntity()) {
16894        composeReference("entity", element.getEntity());
16895      }
16896      if (element.hasRole()) {
16897        openArray("role");
16898        for (CodeableConcept e : element.getRole()) 
16899          composeCodeableConcept(null, e);
16900        closeArray();
16901      };
16902  }
16903
16904  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
16905    if (element != null) {
16906      open(name);
16907      composeContractValuedItemComponentInner(element);
16908      close();
16909    }
16910  }
16911
16912  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
16913      composeBackbone(element);
16914      if (element.hasEntity()) {
16915        composeType("entity", element.getEntity());
16916      }
16917      if (element.hasIdentifier()) {
16918        composeIdentifier("identifier", element.getIdentifier());
16919      }
16920      if (element.hasEffectiveTimeElement()) {
16921        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
16922        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
16923      }
16924      if (element.hasQuantity()) {
16925        composeSimpleQuantity("quantity", element.getQuantity());
16926      }
16927      if (element.hasUnitPrice()) {
16928        composeMoney("unitPrice", element.getUnitPrice());
16929      }
16930      if (element.hasFactorElement()) {
16931        composeDecimalCore("factor", element.getFactorElement(), false);
16932        composeDecimalExtras("factor", element.getFactorElement(), false);
16933      }
16934      if (element.hasPointsElement()) {
16935        composeDecimalCore("points", element.getPointsElement(), false);
16936        composeDecimalExtras("points", element.getPointsElement(), false);
16937      }
16938      if (element.hasNet()) {
16939        composeMoney("net", element.getNet());
16940      }
16941  }
16942
16943  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
16944    if (element != null) {
16945      open(name);
16946      composeContractSignatoryComponentInner(element);
16947      close();
16948    }
16949  }
16950
16951  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
16952      composeBackbone(element);
16953      if (element.hasType()) {
16954        composeCoding("type", element.getType());
16955      }
16956      if (element.hasParty()) {
16957        composeReference("party", element.getParty());
16958      }
16959      if (element.hasSignatureElement()) {
16960        composeStringCore("signature", element.getSignatureElement(), false);
16961        composeStringExtras("signature", element.getSignatureElement(), false);
16962      }
16963  }
16964
16965  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
16966    if (element != null) {
16967      open(name);
16968      composeContractTermComponentInner(element);
16969      close();
16970    }
16971  }
16972
16973  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
16974      composeBackbone(element);
16975      if (element.hasIdentifier()) {
16976        composeIdentifier("identifier", element.getIdentifier());
16977      }
16978      if (element.hasIssuedElement()) {
16979        composeDateTimeCore("issued", element.getIssuedElement(), false);
16980        composeDateTimeExtras("issued", element.getIssuedElement(), false);
16981      }
16982      if (element.hasApplies()) {
16983        composePeriod("applies", element.getApplies());
16984      }
16985      if (element.hasType()) {
16986        composeCodeableConcept("type", element.getType());
16987      }
16988      if (element.hasSubType()) {
16989        composeCodeableConcept("subType", element.getSubType());
16990      }
16991      if (element.hasSubject()) {
16992        composeReference("subject", element.getSubject());
16993      }
16994      if (element.hasAction()) {
16995        openArray("action");
16996        for (CodeableConcept e : element.getAction()) 
16997          composeCodeableConcept(null, e);
16998        closeArray();
16999      };
17000      if (element.hasActionReason()) {
17001        openArray("actionReason");
17002        for (CodeableConcept e : element.getActionReason()) 
17003          composeCodeableConcept(null, e);
17004        closeArray();
17005      };
17006      if (element.hasActor()) {
17007        openArray("actor");
17008        for (Contract.TermActorComponent e : element.getActor()) 
17009          composeContractTermActorComponent(null, e);
17010        closeArray();
17011      };
17012      if (element.hasTextElement()) {
17013        composeStringCore("text", element.getTextElement(), false);
17014        composeStringExtras("text", element.getTextElement(), false);
17015      }
17016      if (element.hasValuedItem()) {
17017        openArray("valuedItem");
17018        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
17019          composeContractTermValuedItemComponent(null, e);
17020        closeArray();
17021      };
17022      if (element.hasGroup()) {
17023        openArray("group");
17024        for (Contract.TermComponent e : element.getGroup()) 
17025          composeContractTermComponent(null, e);
17026        closeArray();
17027      };
17028  }
17029
17030  protected void composeContractTermActorComponent(String name, Contract.TermActorComponent element) throws IOException {
17031    if (element != null) {
17032      open(name);
17033      composeContractTermActorComponentInner(element);
17034      close();
17035    }
17036  }
17037
17038  protected void composeContractTermActorComponentInner(Contract.TermActorComponent element) throws IOException {
17039      composeBackbone(element);
17040      if (element.hasEntity()) {
17041        composeReference("entity", element.getEntity());
17042      }
17043      if (element.hasRole()) {
17044        openArray("role");
17045        for (CodeableConcept e : element.getRole()) 
17046          composeCodeableConcept(null, e);
17047        closeArray();
17048      };
17049  }
17050
17051  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
17052    if (element != null) {
17053      open(name);
17054      composeContractTermValuedItemComponentInner(element);
17055      close();
17056    }
17057  }
17058
17059  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
17060      composeBackbone(element);
17061      if (element.hasEntity()) {
17062        composeType("entity", element.getEntity());
17063      }
17064      if (element.hasIdentifier()) {
17065        composeIdentifier("identifier", element.getIdentifier());
17066      }
17067      if (element.hasEffectiveTimeElement()) {
17068        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
17069        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
17070      }
17071      if (element.hasQuantity()) {
17072        composeSimpleQuantity("quantity", element.getQuantity());
17073      }
17074      if (element.hasUnitPrice()) {
17075        composeMoney("unitPrice", element.getUnitPrice());
17076      }
17077      if (element.hasFactorElement()) {
17078        composeDecimalCore("factor", element.getFactorElement(), false);
17079        composeDecimalExtras("factor", element.getFactorElement(), false);
17080      }
17081      if (element.hasPointsElement()) {
17082        composeDecimalCore("points", element.getPointsElement(), false);
17083        composeDecimalExtras("points", element.getPointsElement(), false);
17084      }
17085      if (element.hasNet()) {
17086        composeMoney("net", element.getNet());
17087      }
17088  }
17089
17090  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
17091    if (element != null) {
17092      open(name);
17093      composeContractFriendlyLanguageComponentInner(element);
17094      close();
17095    }
17096  }
17097
17098  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
17099      composeBackbone(element);
17100      if (element.hasContent()) {
17101        composeType("content", element.getContent());
17102      }
17103  }
17104
17105  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
17106    if (element != null) {
17107      open(name);
17108      composeContractLegalLanguageComponentInner(element);
17109      close();
17110    }
17111  }
17112
17113  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
17114      composeBackbone(element);
17115      if (element.hasContent()) {
17116        composeType("content", element.getContent());
17117      }
17118  }
17119
17120  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
17121    if (element != null) {
17122      open(name);
17123      composeContractComputableLanguageComponentInner(element);
17124      close();
17125    }
17126  }
17127
17128  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
17129      composeBackbone(element);
17130      if (element.hasContent()) {
17131        composeType("content", element.getContent());
17132      }
17133  }
17134
17135  protected void composeCoverage(String name, Coverage element) throws IOException {
17136    if (element != null) {
17137      prop("resourceType", name);
17138      composeCoverageInner(element);
17139    }
17140  }
17141
17142  protected void composeCoverageInner(Coverage element) throws IOException {
17143      composeDomainResourceElements(element);
17144      if (element.hasIssuer()) {
17145        composeReference("issuer", element.getIssuer());
17146      }
17147      if (element.hasBin()) {
17148        composeIdentifier("bin", element.getBin());
17149      }
17150      if (element.hasPeriod()) {
17151        composePeriod("period", element.getPeriod());
17152      }
17153      if (element.hasType()) {
17154        composeCoding("type", element.getType());
17155      }
17156      if (element.hasSubscriberId()) {
17157        composeIdentifier("subscriberId", element.getSubscriberId());
17158      }
17159      if (element.hasIdentifier()) {
17160        openArray("identifier");
17161        for (Identifier e : element.getIdentifier()) 
17162          composeIdentifier(null, e);
17163        closeArray();
17164      };
17165      if (element.hasGroupElement()) {
17166        composeStringCore("group", element.getGroupElement(), false);
17167        composeStringExtras("group", element.getGroupElement(), false);
17168      }
17169      if (element.hasPlanElement()) {
17170        composeStringCore("plan", element.getPlanElement(), false);
17171        composeStringExtras("plan", element.getPlanElement(), false);
17172      }
17173      if (element.hasSubPlanElement()) {
17174        composeStringCore("subPlan", element.getSubPlanElement(), false);
17175        composeStringExtras("subPlan", element.getSubPlanElement(), false);
17176      }
17177      if (element.hasDependentElement()) {
17178        composePositiveIntCore("dependent", element.getDependentElement(), false);
17179        composePositiveIntExtras("dependent", element.getDependentElement(), false);
17180      }
17181      if (element.hasSequenceElement()) {
17182        composePositiveIntCore("sequence", element.getSequenceElement(), false);
17183        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
17184      }
17185      if (element.hasSubscriber()) {
17186        composeReference("subscriber", element.getSubscriber());
17187      }
17188      if (element.hasNetwork()) {
17189        composeIdentifier("network", element.getNetwork());
17190      }
17191      if (element.hasContract()) {
17192        openArray("contract");
17193        for (Reference e : element.getContract()) 
17194          composeReference(null, e);
17195        closeArray();
17196      };
17197  }
17198
17199  protected void composeDataElement(String name, DataElement element) throws IOException {
17200    if (element != null) {
17201      prop("resourceType", name);
17202      composeDataElementInner(element);
17203    }
17204  }
17205
17206  protected void composeDataElementInner(DataElement element) throws IOException {
17207      composeDomainResourceElements(element);
17208      if (element.hasUrlElement()) {
17209        composeUriCore("url", element.getUrlElement(), false);
17210        composeUriExtras("url", element.getUrlElement(), false);
17211      }
17212      if (element.hasIdentifier()) {
17213        openArray("identifier");
17214        for (Identifier e : element.getIdentifier()) 
17215          composeIdentifier(null, e);
17216        closeArray();
17217      };
17218      if (element.hasVersionElement()) {
17219        composeStringCore("version", element.getVersionElement(), false);
17220        composeStringExtras("version", element.getVersionElement(), false);
17221      }
17222      if (element.hasNameElement()) {
17223        composeStringCore("name", element.getNameElement(), false);
17224        composeStringExtras("name", element.getNameElement(), false);
17225      }
17226      if (element.hasStatusElement()) {
17227        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17228        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
17229      }
17230      if (element.hasExperimentalElement()) {
17231        composeBooleanCore("experimental", element.getExperimentalElement(), false);
17232        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
17233      }
17234      if (element.hasPublisherElement()) {
17235        composeStringCore("publisher", element.getPublisherElement(), false);
17236        composeStringExtras("publisher", element.getPublisherElement(), false);
17237      }
17238      if (element.hasContact()) {
17239        openArray("contact");
17240        for (DataElement.DataElementContactComponent e : element.getContact()) 
17241          composeDataElementDataElementContactComponent(null, e);
17242        closeArray();
17243      };
17244      if (element.hasDateElement()) {
17245        composeDateTimeCore("date", element.getDateElement(), false);
17246        composeDateTimeExtras("date", element.getDateElement(), false);
17247      }
17248      if (element.hasUseContext()) {
17249        openArray("useContext");
17250        for (CodeableConcept e : element.getUseContext()) 
17251          composeCodeableConcept(null, e);
17252        closeArray();
17253      };
17254      if (element.hasCopyrightElement()) {
17255        composeStringCore("copyright", element.getCopyrightElement(), false);
17256        composeStringExtras("copyright", element.getCopyrightElement(), false);
17257      }
17258      if (element.hasStringencyElement()) {
17259        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17260        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
17261      }
17262      if (element.hasMapping()) {
17263        openArray("mapping");
17264        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
17265          composeDataElementDataElementMappingComponent(null, e);
17266        closeArray();
17267      };
17268      if (element.hasElement()) {
17269        openArray("element");
17270        for (ElementDefinition e : element.getElement()) 
17271          composeElementDefinition(null, e);
17272        closeArray();
17273      };
17274  }
17275
17276  protected void composeDataElementDataElementContactComponent(String name, DataElement.DataElementContactComponent element) throws IOException {
17277    if (element != null) {
17278      open(name);
17279      composeDataElementDataElementContactComponentInner(element);
17280      close();
17281    }
17282  }
17283
17284  protected void composeDataElementDataElementContactComponentInner(DataElement.DataElementContactComponent element) throws IOException {
17285      composeBackbone(element);
17286      if (element.hasNameElement()) {
17287        composeStringCore("name", element.getNameElement(), false);
17288        composeStringExtras("name", element.getNameElement(), false);
17289      }
17290      if (element.hasTelecom()) {
17291        openArray("telecom");
17292        for (ContactPoint e : element.getTelecom()) 
17293          composeContactPoint(null, e);
17294        closeArray();
17295      };
17296  }
17297
17298  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
17299    if (element != null) {
17300      open(name);
17301      composeDataElementDataElementMappingComponentInner(element);
17302      close();
17303    }
17304  }
17305
17306  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
17307      composeBackbone(element);
17308      if (element.hasIdentityElement()) {
17309        composeIdCore("identity", element.getIdentityElement(), false);
17310        composeIdExtras("identity", element.getIdentityElement(), false);
17311      }
17312      if (element.hasUriElement()) {
17313        composeUriCore("uri", element.getUriElement(), false);
17314        composeUriExtras("uri", element.getUriElement(), false);
17315      }
17316      if (element.hasNameElement()) {
17317        composeStringCore("name", element.getNameElement(), false);
17318        composeStringExtras("name", element.getNameElement(), false);
17319      }
17320      if (element.hasCommentsElement()) {
17321        composeStringCore("comments", element.getCommentsElement(), false);
17322        composeStringExtras("comments", element.getCommentsElement(), false);
17323      }
17324  }
17325
17326  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
17327    if (element != null) {
17328      prop("resourceType", name);
17329      composeDetectedIssueInner(element);
17330    }
17331  }
17332
17333  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
17334      composeDomainResourceElements(element);
17335      if (element.hasPatient()) {
17336        composeReference("patient", element.getPatient());
17337      }
17338      if (element.hasCategory()) {
17339        composeCodeableConcept("category", element.getCategory());
17340      }
17341      if (element.hasSeverityElement()) {
17342        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17343        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
17344      }
17345      if (element.hasImplicated()) {
17346        openArray("implicated");
17347        for (Reference e : element.getImplicated()) 
17348          composeReference(null, e);
17349        closeArray();
17350      };
17351      if (element.hasDetailElement()) {
17352        composeStringCore("detail", element.getDetailElement(), false);
17353        composeStringExtras("detail", element.getDetailElement(), false);
17354      }
17355      if (element.hasDateElement()) {
17356        composeDateTimeCore("date", element.getDateElement(), false);
17357        composeDateTimeExtras("date", element.getDateElement(), false);
17358      }
17359      if (element.hasAuthor()) {
17360        composeReference("author", element.getAuthor());
17361      }
17362      if (element.hasIdentifier()) {
17363        composeIdentifier("identifier", element.getIdentifier());
17364      }
17365      if (element.hasReferenceElement()) {
17366        composeUriCore("reference", element.getReferenceElement(), false);
17367        composeUriExtras("reference", element.getReferenceElement(), false);
17368      }
17369      if (element.hasMitigation()) {
17370        openArray("mitigation");
17371        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
17372          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
17373        closeArray();
17374      };
17375  }
17376
17377  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17378    if (element != null) {
17379      open(name);
17380      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
17381      close();
17382    }
17383  }
17384
17385  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
17386      composeBackbone(element);
17387      if (element.hasAction()) {
17388        composeCodeableConcept("action", element.getAction());
17389      }
17390      if (element.hasDateElement()) {
17391        composeDateTimeCore("date", element.getDateElement(), false);
17392        composeDateTimeExtras("date", element.getDateElement(), false);
17393      }
17394      if (element.hasAuthor()) {
17395        composeReference("author", element.getAuthor());
17396      }
17397  }
17398
17399  protected void composeDevice(String name, Device element) throws IOException {
17400    if (element != null) {
17401      prop("resourceType", name);
17402      composeDeviceInner(element);
17403    }
17404  }
17405
17406  protected void composeDeviceInner(Device element) throws IOException {
17407      composeDomainResourceElements(element);
17408      if (element.hasIdentifier()) {
17409        openArray("identifier");
17410        for (Identifier e : element.getIdentifier()) 
17411          composeIdentifier(null, e);
17412        closeArray();
17413      };
17414      if (element.hasType()) {
17415        composeCodeableConcept("type", element.getType());
17416      }
17417      if (element.hasNote()) {
17418        openArray("note");
17419        for (Annotation e : element.getNote()) 
17420          composeAnnotation(null, e);
17421        closeArray();
17422      };
17423      if (element.hasStatusElement()) {
17424        composeEnumerationCore("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17425        composeEnumerationExtras("status", element.getStatusElement(), new Device.DeviceStatusEnumFactory(), false);
17426      }
17427      if (element.hasManufacturerElement()) {
17428        composeStringCore("manufacturer", element.getManufacturerElement(), false);
17429        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
17430      }
17431      if (element.hasModelElement()) {
17432        composeStringCore("model", element.getModelElement(), false);
17433        composeStringExtras("model", element.getModelElement(), false);
17434      }
17435      if (element.hasVersionElement()) {
17436        composeStringCore("version", element.getVersionElement(), false);
17437        composeStringExtras("version", element.getVersionElement(), false);
17438      }
17439      if (element.hasManufactureDateElement()) {
17440        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
17441        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
17442      }
17443      if (element.hasExpiryElement()) {
17444        composeDateTimeCore("expiry", element.getExpiryElement(), false);
17445        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
17446      }
17447      if (element.hasUdiElement()) {
17448        composeStringCore("udi", element.getUdiElement(), false);
17449        composeStringExtras("udi", element.getUdiElement(), false);
17450      }
17451      if (element.hasLotNumberElement()) {
17452        composeStringCore("lotNumber", element.getLotNumberElement(), false);
17453        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
17454      }
17455      if (element.hasOwner()) {
17456        composeReference("owner", element.getOwner());
17457      }
17458      if (element.hasLocation()) {
17459        composeReference("location", element.getLocation());
17460      }
17461      if (element.hasPatient()) {
17462        composeReference("patient", element.getPatient());
17463      }
17464      if (element.hasContact()) {
17465        openArray("contact");
17466        for (ContactPoint e : element.getContact()) 
17467          composeContactPoint(null, e);
17468        closeArray();
17469      };
17470      if (element.hasUrlElement()) {
17471        composeUriCore("url", element.getUrlElement(), false);
17472        composeUriExtras("url", element.getUrlElement(), false);
17473      }
17474  }
17475
17476  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
17477    if (element != null) {
17478      prop("resourceType", name);
17479      composeDeviceComponentInner(element);
17480    }
17481  }
17482
17483  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
17484      composeDomainResourceElements(element);
17485      if (element.hasType()) {
17486        composeCodeableConcept("type", element.getType());
17487      }
17488      if (element.hasIdentifier()) {
17489        composeIdentifier("identifier", element.getIdentifier());
17490      }
17491      if (element.hasLastSystemChangeElement()) {
17492        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
17493        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
17494      }
17495      if (element.hasSource()) {
17496        composeReference("source", element.getSource());
17497      }
17498      if (element.hasParent()) {
17499        composeReference("parent", element.getParent());
17500      }
17501      if (element.hasOperationalStatus()) {
17502        openArray("operationalStatus");
17503        for (CodeableConcept e : element.getOperationalStatus()) 
17504          composeCodeableConcept(null, e);
17505        closeArray();
17506      };
17507      if (element.hasParameterGroup()) {
17508        composeCodeableConcept("parameterGroup", element.getParameterGroup());
17509      }
17510      if (element.hasMeasurementPrincipleElement()) {
17511        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17512        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
17513      }
17514      if (element.hasProductionSpecification()) {
17515        openArray("productionSpecification");
17516        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
17517          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
17518        closeArray();
17519      };
17520      if (element.hasLanguageCode()) {
17521        composeCodeableConcept("languageCode", element.getLanguageCode());
17522      }
17523  }
17524
17525  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17526    if (element != null) {
17527      open(name);
17528      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
17529      close();
17530    }
17531  }
17532
17533  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
17534      composeBackbone(element);
17535      if (element.hasSpecType()) {
17536        composeCodeableConcept("specType", element.getSpecType());
17537      }
17538      if (element.hasComponentId()) {
17539        composeIdentifier("componentId", element.getComponentId());
17540      }
17541      if (element.hasProductionSpecElement()) {
17542        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
17543        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
17544      }
17545  }
17546
17547  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
17548    if (element != null) {
17549      prop("resourceType", name);
17550      composeDeviceMetricInner(element);
17551    }
17552  }
17553
17554  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
17555      composeDomainResourceElements(element);
17556      if (element.hasType()) {
17557        composeCodeableConcept("type", element.getType());
17558      }
17559      if (element.hasIdentifier()) {
17560        composeIdentifier("identifier", element.getIdentifier());
17561      }
17562      if (element.hasUnit()) {
17563        composeCodeableConcept("unit", element.getUnit());
17564      }
17565      if (element.hasSource()) {
17566        composeReference("source", element.getSource());
17567      }
17568      if (element.hasParent()) {
17569        composeReference("parent", element.getParent());
17570      }
17571      if (element.hasOperationalStatusElement()) {
17572        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17573        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
17574      }
17575      if (element.hasColorElement()) {
17576        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17577        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
17578      }
17579      if (element.hasCategoryElement()) {
17580        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17581        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
17582      }
17583      if (element.hasMeasurementPeriod()) {
17584        composeTiming("measurementPeriod", element.getMeasurementPeriod());
17585      }
17586      if (element.hasCalibration()) {
17587        openArray("calibration");
17588        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
17589          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
17590        closeArray();
17591      };
17592  }
17593
17594  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17595    if (element != null) {
17596      open(name);
17597      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
17598      close();
17599    }
17600  }
17601
17602  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
17603      composeBackbone(element);
17604      if (element.hasTypeElement()) {
17605        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17606        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
17607      }
17608      if (element.hasStateElement()) {
17609        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17610        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
17611      }
17612      if (element.hasTimeElement()) {
17613        composeInstantCore("time", element.getTimeElement(), false);
17614        composeInstantExtras("time", element.getTimeElement(), false);
17615      }
17616  }
17617
17618  protected void composeDeviceUseRequest(String name, DeviceUseRequest element) throws IOException {
17619    if (element != null) {
17620      prop("resourceType", name);
17621      composeDeviceUseRequestInner(element);
17622    }
17623  }
17624
17625  protected void composeDeviceUseRequestInner(DeviceUseRequest element) throws IOException {
17626      composeDomainResourceElements(element);
17627      if (element.hasBodySite()) {
17628        composeType("bodySite", element.getBodySite());
17629      }
17630      if (element.hasStatusElement()) {
17631        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17632        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseRequest.DeviceUseRequestStatusEnumFactory(), false);
17633      }
17634      if (element.hasDevice()) {
17635        composeReference("device", element.getDevice());
17636      }
17637      if (element.hasEncounter()) {
17638        composeReference("encounter", element.getEncounter());
17639      }
17640      if (element.hasIdentifier()) {
17641        openArray("identifier");
17642        for (Identifier e : element.getIdentifier()) 
17643          composeIdentifier(null, e);
17644        closeArray();
17645      };
17646      if (element.hasIndication()) {
17647        openArray("indication");
17648        for (CodeableConcept e : element.getIndication()) 
17649          composeCodeableConcept(null, e);
17650        closeArray();
17651      };
17652      if (element.hasNotes()) {
17653        openArray("notes");
17654        for (StringType e : element.getNotes()) 
17655          composeStringCore(null, e, true);
17656        closeArray();
17657        if (anyHasExtras(element.getNotes())) {
17658          openArray("_notes");
17659          for (StringType e : element.getNotes()) 
17660            composeStringExtras(null, e, true);
17661          closeArray();
17662        }
17663      };
17664      if (element.hasPrnReason()) {
17665        openArray("prnReason");
17666        for (CodeableConcept e : element.getPrnReason()) 
17667          composeCodeableConcept(null, e);
17668        closeArray();
17669      };
17670      if (element.hasOrderedOnElement()) {
17671        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
17672        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
17673      }
17674      if (element.hasRecordedOnElement()) {
17675        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17676        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17677      }
17678      if (element.hasSubject()) {
17679        composeReference("subject", element.getSubject());
17680      }
17681      if (element.hasTiming()) {
17682        composeType("timing", element.getTiming());
17683      }
17684      if (element.hasPriorityElement()) {
17685        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17686        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceUseRequest.DeviceUseRequestPriorityEnumFactory(), false);
17687      }
17688  }
17689
17690  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
17691    if (element != null) {
17692      prop("resourceType", name);
17693      composeDeviceUseStatementInner(element);
17694    }
17695  }
17696
17697  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
17698      composeDomainResourceElements(element);
17699      if (element.hasBodySite()) {
17700        composeType("bodySite", element.getBodySite());
17701      }
17702      if (element.hasWhenUsed()) {
17703        composePeriod("whenUsed", element.getWhenUsed());
17704      }
17705      if (element.hasDevice()) {
17706        composeReference("device", element.getDevice());
17707      }
17708      if (element.hasIdentifier()) {
17709        openArray("identifier");
17710        for (Identifier e : element.getIdentifier()) 
17711          composeIdentifier(null, e);
17712        closeArray();
17713      };
17714      if (element.hasIndication()) {
17715        openArray("indication");
17716        for (CodeableConcept e : element.getIndication()) 
17717          composeCodeableConcept(null, e);
17718        closeArray();
17719      };
17720      if (element.hasNotes()) {
17721        openArray("notes");
17722        for (StringType e : element.getNotes()) 
17723          composeStringCore(null, e, true);
17724        closeArray();
17725        if (anyHasExtras(element.getNotes())) {
17726          openArray("_notes");
17727          for (StringType e : element.getNotes()) 
17728            composeStringExtras(null, e, true);
17729          closeArray();
17730        }
17731      };
17732      if (element.hasRecordedOnElement()) {
17733        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
17734        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
17735      }
17736      if (element.hasSubject()) {
17737        composeReference("subject", element.getSubject());
17738      }
17739      if (element.hasTiming()) {
17740        composeType("timing", element.getTiming());
17741      }
17742  }
17743
17744  protected void composeDiagnosticOrder(String name, DiagnosticOrder element) throws IOException {
17745    if (element != null) {
17746      prop("resourceType", name);
17747      composeDiagnosticOrderInner(element);
17748    }
17749  }
17750
17751  protected void composeDiagnosticOrderInner(DiagnosticOrder element) throws IOException {
17752      composeDomainResourceElements(element);
17753      if (element.hasSubject()) {
17754        composeReference("subject", element.getSubject());
17755      }
17756      if (element.hasOrderer()) {
17757        composeReference("orderer", element.getOrderer());
17758      }
17759      if (element.hasIdentifier()) {
17760        openArray("identifier");
17761        for (Identifier e : element.getIdentifier()) 
17762          composeIdentifier(null, e);
17763        closeArray();
17764      };
17765      if (element.hasEncounter()) {
17766        composeReference("encounter", element.getEncounter());
17767      }
17768      if (element.hasReason()) {
17769        openArray("reason");
17770        for (CodeableConcept e : element.getReason()) 
17771          composeCodeableConcept(null, e);
17772        closeArray();
17773      };
17774      if (element.hasSupportingInformation()) {
17775        openArray("supportingInformation");
17776        for (Reference e : element.getSupportingInformation()) 
17777          composeReference(null, e);
17778        closeArray();
17779      };
17780      if (element.hasSpecimen()) {
17781        openArray("specimen");
17782        for (Reference e : element.getSpecimen()) 
17783          composeReference(null, e);
17784        closeArray();
17785      };
17786      if (element.hasStatusElement()) {
17787        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17788        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17789      }
17790      if (element.hasPriorityElement()) {
17791        composeEnumerationCore("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17792        composeEnumerationExtras("priority", element.getPriorityElement(), new DiagnosticOrder.DiagnosticOrderPriorityEnumFactory(), false);
17793      }
17794      if (element.hasEvent()) {
17795        openArray("event");
17796        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17797          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17798        closeArray();
17799      };
17800      if (element.hasItem()) {
17801        openArray("item");
17802        for (DiagnosticOrder.DiagnosticOrderItemComponent e : element.getItem()) 
17803          composeDiagnosticOrderDiagnosticOrderItemComponent(null, e);
17804        closeArray();
17805      };
17806      if (element.hasNote()) {
17807        openArray("note");
17808        for (Annotation e : element.getNote()) 
17809          composeAnnotation(null, e);
17810        closeArray();
17811      };
17812  }
17813
17814  protected void composeDiagnosticOrderDiagnosticOrderEventComponent(String name, DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17815    if (element != null) {
17816      open(name);
17817      composeDiagnosticOrderDiagnosticOrderEventComponentInner(element);
17818      close();
17819    }
17820  }
17821
17822  protected void composeDiagnosticOrderDiagnosticOrderEventComponentInner(DiagnosticOrder.DiagnosticOrderEventComponent element) throws IOException {
17823      composeBackbone(element);
17824      if (element.hasStatusElement()) {
17825        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17826        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17827      }
17828      if (element.hasDescription()) {
17829        composeCodeableConcept("description", element.getDescription());
17830      }
17831      if (element.hasDateTimeElement()) {
17832        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
17833        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
17834      }
17835      if (element.hasActor()) {
17836        composeReference("actor", element.getActor());
17837      }
17838  }
17839
17840  protected void composeDiagnosticOrderDiagnosticOrderItemComponent(String name, DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17841    if (element != null) {
17842      open(name);
17843      composeDiagnosticOrderDiagnosticOrderItemComponentInner(element);
17844      close();
17845    }
17846  }
17847
17848  protected void composeDiagnosticOrderDiagnosticOrderItemComponentInner(DiagnosticOrder.DiagnosticOrderItemComponent element) throws IOException {
17849      composeBackbone(element);
17850      if (element.hasCode()) {
17851        composeCodeableConcept("code", element.getCode());
17852      }
17853      if (element.hasSpecimen()) {
17854        openArray("specimen");
17855        for (Reference e : element.getSpecimen()) 
17856          composeReference(null, e);
17857        closeArray();
17858      };
17859      if (element.hasBodySite()) {
17860        composeCodeableConcept("bodySite", element.getBodySite());
17861      }
17862      if (element.hasStatusElement()) {
17863        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17864        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticOrder.DiagnosticOrderStatusEnumFactory(), false);
17865      }
17866      if (element.hasEvent()) {
17867        openArray("event");
17868        for (DiagnosticOrder.DiagnosticOrderEventComponent e : element.getEvent()) 
17869          composeDiagnosticOrderDiagnosticOrderEventComponent(null, e);
17870        closeArray();
17871      };
17872  }
17873
17874  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
17875    if (element != null) {
17876      prop("resourceType", name);
17877      composeDiagnosticReportInner(element);
17878    }
17879  }
17880
17881  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
17882      composeDomainResourceElements(element);
17883      if (element.hasIdentifier()) {
17884        openArray("identifier");
17885        for (Identifier e : element.getIdentifier()) 
17886          composeIdentifier(null, e);
17887        closeArray();
17888      };
17889      if (element.hasStatusElement()) {
17890        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17891        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
17892      }
17893      if (element.hasCategory()) {
17894        composeCodeableConcept("category", element.getCategory());
17895      }
17896      if (element.hasCode()) {
17897        composeCodeableConcept("code", element.getCode());
17898      }
17899      if (element.hasSubject()) {
17900        composeReference("subject", element.getSubject());
17901      }
17902      if (element.hasEncounter()) {
17903        composeReference("encounter", element.getEncounter());
17904      }
17905      if (element.hasEffective()) {
17906        composeType("effective", element.getEffective());
17907      }
17908      if (element.hasIssuedElement()) {
17909        composeInstantCore("issued", element.getIssuedElement(), false);
17910        composeInstantExtras("issued", element.getIssuedElement(), false);
17911      }
17912      if (element.hasPerformer()) {
17913        composeReference("performer", element.getPerformer());
17914      }
17915      if (element.hasRequest()) {
17916        openArray("request");
17917        for (Reference e : element.getRequest()) 
17918          composeReference(null, e);
17919        closeArray();
17920      };
17921      if (element.hasSpecimen()) {
17922        openArray("specimen");
17923        for (Reference e : element.getSpecimen()) 
17924          composeReference(null, e);
17925        closeArray();
17926      };
17927      if (element.hasResult()) {
17928        openArray("result");
17929        for (Reference e : element.getResult()) 
17930          composeReference(null, e);
17931        closeArray();
17932      };
17933      if (element.hasImagingStudy()) {
17934        openArray("imagingStudy");
17935        for (Reference e : element.getImagingStudy()) 
17936          composeReference(null, e);
17937        closeArray();
17938      };
17939      if (element.hasImage()) {
17940        openArray("image");
17941        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
17942          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
17943        closeArray();
17944      };
17945      if (element.hasConclusionElement()) {
17946        composeStringCore("conclusion", element.getConclusionElement(), false);
17947        composeStringExtras("conclusion", element.getConclusionElement(), false);
17948      }
17949      if (element.hasCodedDiagnosis()) {
17950        openArray("codedDiagnosis");
17951        for (CodeableConcept e : element.getCodedDiagnosis()) 
17952          composeCodeableConcept(null, e);
17953        closeArray();
17954      };
17955      if (element.hasPresentedForm()) {
17956        openArray("presentedForm");
17957        for (Attachment e : element.getPresentedForm()) 
17958          composeAttachment(null, e);
17959        closeArray();
17960      };
17961  }
17962
17963  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17964    if (element != null) {
17965      open(name);
17966      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
17967      close();
17968    }
17969  }
17970
17971  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
17972      composeBackbone(element);
17973      if (element.hasCommentElement()) {
17974        composeStringCore("comment", element.getCommentElement(), false);
17975        composeStringExtras("comment", element.getCommentElement(), false);
17976      }
17977      if (element.hasLink()) {
17978        composeReference("link", element.getLink());
17979      }
17980  }
17981
17982  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
17983    if (element != null) {
17984      prop("resourceType", name);
17985      composeDocumentManifestInner(element);
17986    }
17987  }
17988
17989  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
17990      composeDomainResourceElements(element);
17991      if (element.hasMasterIdentifier()) {
17992        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
17993      }
17994      if (element.hasIdentifier()) {
17995        openArray("identifier");
17996        for (Identifier e : element.getIdentifier()) 
17997          composeIdentifier(null, e);
17998        closeArray();
17999      };
18000      if (element.hasSubject()) {
18001        composeReference("subject", element.getSubject());
18002      }
18003      if (element.hasRecipient()) {
18004        openArray("recipient");
18005        for (Reference e : element.getRecipient()) 
18006          composeReference(null, e);
18007        closeArray();
18008      };
18009      if (element.hasType()) {
18010        composeCodeableConcept("type", element.getType());
18011      }
18012      if (element.hasAuthor()) {
18013        openArray("author");
18014        for (Reference e : element.getAuthor()) 
18015          composeReference(null, e);
18016        closeArray();
18017      };
18018      if (element.hasCreatedElement()) {
18019        composeDateTimeCore("created", element.getCreatedElement(), false);
18020        composeDateTimeExtras("created", element.getCreatedElement(), false);
18021      }
18022      if (element.hasSourceElement()) {
18023        composeUriCore("source", element.getSourceElement(), false);
18024        composeUriExtras("source", element.getSourceElement(), false);
18025      }
18026      if (element.hasStatusElement()) {
18027        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18028        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18029      }
18030      if (element.hasDescriptionElement()) {
18031        composeStringCore("description", element.getDescriptionElement(), false);
18032        composeStringExtras("description", element.getDescriptionElement(), false);
18033      }
18034      if (element.hasContent()) {
18035        openArray("content");
18036        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
18037          composeDocumentManifestDocumentManifestContentComponent(null, e);
18038        closeArray();
18039      };
18040      if (element.hasRelated()) {
18041        openArray("related");
18042        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
18043          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
18044        closeArray();
18045      };
18046  }
18047
18048  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18049    if (element != null) {
18050      open(name);
18051      composeDocumentManifestDocumentManifestContentComponentInner(element);
18052      close();
18053    }
18054  }
18055
18056  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
18057      composeBackbone(element);
18058      if (element.hasP()) {
18059        composeType("p", element.getP());
18060      }
18061  }
18062
18063  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18064    if (element != null) {
18065      open(name);
18066      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
18067      close();
18068    }
18069  }
18070
18071  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
18072      composeBackbone(element);
18073      if (element.hasIdentifier()) {
18074        composeIdentifier("identifier", element.getIdentifier());
18075      }
18076      if (element.hasRef()) {
18077        composeReference("ref", element.getRef());
18078      }
18079  }
18080
18081  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
18082    if (element != null) {
18083      prop("resourceType", name);
18084      composeDocumentReferenceInner(element);
18085    }
18086  }
18087
18088  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
18089      composeDomainResourceElements(element);
18090      if (element.hasMasterIdentifier()) {
18091        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
18092      }
18093      if (element.hasIdentifier()) {
18094        openArray("identifier");
18095        for (Identifier e : element.getIdentifier()) 
18096          composeIdentifier(null, e);
18097        closeArray();
18098      };
18099      if (element.hasSubject()) {
18100        composeReference("subject", element.getSubject());
18101      }
18102      if (element.hasType()) {
18103        composeCodeableConcept("type", element.getType());
18104      }
18105      if (element.hasClass_()) {
18106        composeCodeableConcept("class", element.getClass_());
18107      }
18108      if (element.hasAuthor()) {
18109        openArray("author");
18110        for (Reference e : element.getAuthor()) 
18111          composeReference(null, e);
18112        closeArray();
18113      };
18114      if (element.hasCustodian()) {
18115        composeReference("custodian", element.getCustodian());
18116      }
18117      if (element.hasAuthenticator()) {
18118        composeReference("authenticator", element.getAuthenticator());
18119      }
18120      if (element.hasCreatedElement()) {
18121        composeDateTimeCore("created", element.getCreatedElement(), false);
18122        composeDateTimeExtras("created", element.getCreatedElement(), false);
18123      }
18124      if (element.hasIndexedElement()) {
18125        composeInstantCore("indexed", element.getIndexedElement(), false);
18126        composeInstantExtras("indexed", element.getIndexedElement(), false);
18127      }
18128      if (element.hasStatusElement()) {
18129        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18130        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
18131      }
18132      if (element.hasDocStatus()) {
18133        composeCodeableConcept("docStatus", element.getDocStatus());
18134      }
18135      if (element.hasRelatesTo()) {
18136        openArray("relatesTo");
18137        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
18138          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
18139        closeArray();
18140      };
18141      if (element.hasDescriptionElement()) {
18142        composeStringCore("description", element.getDescriptionElement(), false);
18143        composeStringExtras("description", element.getDescriptionElement(), false);
18144      }
18145      if (element.hasSecurityLabel()) {
18146        openArray("securityLabel");
18147        for (CodeableConcept e : element.getSecurityLabel()) 
18148          composeCodeableConcept(null, e);
18149        closeArray();
18150      };
18151      if (element.hasContent()) {
18152        openArray("content");
18153        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
18154          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
18155        closeArray();
18156      };
18157      if (element.hasContext()) {
18158        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
18159      }
18160  }
18161
18162  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18163    if (element != null) {
18164      open(name);
18165      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
18166      close();
18167    }
18168  }
18169
18170  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
18171      composeBackbone(element);
18172      if (element.hasCodeElement()) {
18173        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18174        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
18175      }
18176      if (element.hasTarget()) {
18177        composeReference("target", element.getTarget());
18178      }
18179  }
18180
18181  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18182    if (element != null) {
18183      open(name);
18184      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
18185      close();
18186    }
18187  }
18188
18189  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
18190      composeBackbone(element);
18191      if (element.hasAttachment()) {
18192        composeAttachment("attachment", element.getAttachment());
18193      }
18194      if (element.hasFormat()) {
18195        openArray("format");
18196        for (Coding e : element.getFormat()) 
18197          composeCoding(null, e);
18198        closeArray();
18199      };
18200  }
18201
18202  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18203    if (element != null) {
18204      open(name);
18205      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
18206      close();
18207    }
18208  }
18209
18210  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
18211      composeBackbone(element);
18212      if (element.hasEncounter()) {
18213        composeReference("encounter", element.getEncounter());
18214      }
18215      if (element.hasEvent()) {
18216        openArray("event");
18217        for (CodeableConcept e : element.getEvent()) 
18218          composeCodeableConcept(null, e);
18219        closeArray();
18220      };
18221      if (element.hasPeriod()) {
18222        composePeriod("period", element.getPeriod());
18223      }
18224      if (element.hasFacilityType()) {
18225        composeCodeableConcept("facilityType", element.getFacilityType());
18226      }
18227      if (element.hasPracticeSetting()) {
18228        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
18229      }
18230      if (element.hasSourcePatientInfo()) {
18231        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
18232      }
18233      if (element.hasRelated()) {
18234        openArray("related");
18235        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
18236          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
18237        closeArray();
18238      };
18239  }
18240
18241  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18242    if (element != null) {
18243      open(name);
18244      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
18245      close();
18246    }
18247  }
18248
18249  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
18250      composeBackbone(element);
18251      if (element.hasIdentifier()) {
18252        composeIdentifier("identifier", element.getIdentifier());
18253      }
18254      if (element.hasRef()) {
18255        composeReference("ref", element.getRef());
18256      }
18257  }
18258
18259  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
18260    if (element != null) {
18261      prop("resourceType", name);
18262      composeEligibilityRequestInner(element);
18263    }
18264  }
18265
18266  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
18267      composeDomainResourceElements(element);
18268      if (element.hasIdentifier()) {
18269        openArray("identifier");
18270        for (Identifier e : element.getIdentifier()) 
18271          composeIdentifier(null, e);
18272        closeArray();
18273      };
18274      if (element.hasRuleset()) {
18275        composeCoding("ruleset", element.getRuleset());
18276      }
18277      if (element.hasOriginalRuleset()) {
18278        composeCoding("originalRuleset", element.getOriginalRuleset());
18279      }
18280      if (element.hasCreatedElement()) {
18281        composeDateTimeCore("created", element.getCreatedElement(), false);
18282        composeDateTimeExtras("created", element.getCreatedElement(), false);
18283      }
18284      if (element.hasTarget()) {
18285        composeReference("target", element.getTarget());
18286      }
18287      if (element.hasProvider()) {
18288        composeReference("provider", element.getProvider());
18289      }
18290      if (element.hasOrganization()) {
18291        composeReference("organization", element.getOrganization());
18292      }
18293  }
18294
18295  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
18296    if (element != null) {
18297      prop("resourceType", name);
18298      composeEligibilityResponseInner(element);
18299    }
18300  }
18301
18302  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
18303      composeDomainResourceElements(element);
18304      if (element.hasIdentifier()) {
18305        openArray("identifier");
18306        for (Identifier e : element.getIdentifier()) 
18307          composeIdentifier(null, e);
18308        closeArray();
18309      };
18310      if (element.hasRequest()) {
18311        composeReference("request", element.getRequest());
18312      }
18313      if (element.hasOutcomeElement()) {
18314        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18315        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18316      }
18317      if (element.hasDispositionElement()) {
18318        composeStringCore("disposition", element.getDispositionElement(), false);
18319        composeStringExtras("disposition", element.getDispositionElement(), false);
18320      }
18321      if (element.hasRuleset()) {
18322        composeCoding("ruleset", element.getRuleset());
18323      }
18324      if (element.hasOriginalRuleset()) {
18325        composeCoding("originalRuleset", element.getOriginalRuleset());
18326      }
18327      if (element.hasCreatedElement()) {
18328        composeDateTimeCore("created", element.getCreatedElement(), false);
18329        composeDateTimeExtras("created", element.getCreatedElement(), false);
18330      }
18331      if (element.hasOrganization()) {
18332        composeReference("organization", element.getOrganization());
18333      }
18334      if (element.hasRequestProvider()) {
18335        composeReference("requestProvider", element.getRequestProvider());
18336      }
18337      if (element.hasRequestOrganization()) {
18338        composeReference("requestOrganization", element.getRequestOrganization());
18339      }
18340  }
18341
18342  protected void composeEncounter(String name, Encounter element) throws IOException {
18343    if (element != null) {
18344      prop("resourceType", name);
18345      composeEncounterInner(element);
18346    }
18347  }
18348
18349  protected void composeEncounterInner(Encounter element) throws IOException {
18350      composeDomainResourceElements(element);
18351      if (element.hasIdentifier()) {
18352        openArray("identifier");
18353        for (Identifier e : element.getIdentifier()) 
18354          composeIdentifier(null, e);
18355        closeArray();
18356      };
18357      if (element.hasStatusElement()) {
18358        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18359        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18360      }
18361      if (element.hasStatusHistory()) {
18362        openArray("statusHistory");
18363        for (Encounter.EncounterStatusHistoryComponent e : element.getStatusHistory()) 
18364          composeEncounterEncounterStatusHistoryComponent(null, e);
18365        closeArray();
18366      };
18367      if (element.hasClass_Element()) {
18368        composeEnumerationCore("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18369        composeEnumerationExtras("class", element.getClass_Element(), new Encounter.EncounterClassEnumFactory(), false);
18370      }
18371      if (element.hasType()) {
18372        openArray("type");
18373        for (CodeableConcept e : element.getType()) 
18374          composeCodeableConcept(null, e);
18375        closeArray();
18376      };
18377      if (element.hasPriority()) {
18378        composeCodeableConcept("priority", element.getPriority());
18379      }
18380      if (element.hasPatient()) {
18381        composeReference("patient", element.getPatient());
18382      }
18383      if (element.hasEpisodeOfCare()) {
18384        openArray("episodeOfCare");
18385        for (Reference e : element.getEpisodeOfCare()) 
18386          composeReference(null, e);
18387        closeArray();
18388      };
18389      if (element.hasIncomingReferral()) {
18390        openArray("incomingReferral");
18391        for (Reference e : element.getIncomingReferral()) 
18392          composeReference(null, e);
18393        closeArray();
18394      };
18395      if (element.hasParticipant()) {
18396        openArray("participant");
18397        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
18398          composeEncounterEncounterParticipantComponent(null, e);
18399        closeArray();
18400      };
18401      if (element.hasAppointment()) {
18402        composeReference("appointment", element.getAppointment());
18403      }
18404      if (element.hasPeriod()) {
18405        composePeriod("period", element.getPeriod());
18406      }
18407      if (element.hasLength()) {
18408        composeDuration("length", element.getLength());
18409      }
18410      if (element.hasReason()) {
18411        openArray("reason");
18412        for (CodeableConcept e : element.getReason()) 
18413          composeCodeableConcept(null, e);
18414        closeArray();
18415      };
18416      if (element.hasIndication()) {
18417        openArray("indication");
18418        for (Reference e : element.getIndication()) 
18419          composeReference(null, e);
18420        closeArray();
18421      };
18422      if (element.hasHospitalization()) {
18423        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
18424      }
18425      if (element.hasLocation()) {
18426        openArray("location");
18427        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
18428          composeEncounterEncounterLocationComponent(null, e);
18429        closeArray();
18430      };
18431      if (element.hasServiceProvider()) {
18432        composeReference("serviceProvider", element.getServiceProvider());
18433      }
18434      if (element.hasPartOf()) {
18435        composeReference("partOf", element.getPartOf());
18436      }
18437  }
18438
18439  protected void composeEncounterEncounterStatusHistoryComponent(String name, Encounter.EncounterStatusHistoryComponent element) throws IOException {
18440    if (element != null) {
18441      open(name);
18442      composeEncounterEncounterStatusHistoryComponentInner(element);
18443      close();
18444    }
18445  }
18446
18447  protected void composeEncounterEncounterStatusHistoryComponentInner(Encounter.EncounterStatusHistoryComponent element) throws IOException {
18448      composeBackbone(element);
18449      if (element.hasStatusElement()) {
18450        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18451        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStateEnumFactory(), false);
18452      }
18453      if (element.hasPeriod()) {
18454        composePeriod("period", element.getPeriod());
18455      }
18456  }
18457
18458  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
18459    if (element != null) {
18460      open(name);
18461      composeEncounterEncounterParticipantComponentInner(element);
18462      close();
18463    }
18464  }
18465
18466  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
18467      composeBackbone(element);
18468      if (element.hasType()) {
18469        openArray("type");
18470        for (CodeableConcept e : element.getType()) 
18471          composeCodeableConcept(null, e);
18472        closeArray();
18473      };
18474      if (element.hasPeriod()) {
18475        composePeriod("period", element.getPeriod());
18476      }
18477      if (element.hasIndividual()) {
18478        composeReference("individual", element.getIndividual());
18479      }
18480  }
18481
18482  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
18483    if (element != null) {
18484      open(name);
18485      composeEncounterEncounterHospitalizationComponentInner(element);
18486      close();
18487    }
18488  }
18489
18490  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
18491      composeBackbone(element);
18492      if (element.hasPreAdmissionIdentifier()) {
18493        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
18494      }
18495      if (element.hasOrigin()) {
18496        composeReference("origin", element.getOrigin());
18497      }
18498      if (element.hasAdmitSource()) {
18499        composeCodeableConcept("admitSource", element.getAdmitSource());
18500      }
18501      if (element.hasAdmittingDiagnosis()) {
18502        openArray("admittingDiagnosis");
18503        for (Reference e : element.getAdmittingDiagnosis()) 
18504          composeReference(null, e);
18505        closeArray();
18506      };
18507      if (element.hasReAdmission()) {
18508        composeCodeableConcept("reAdmission", element.getReAdmission());
18509      }
18510      if (element.hasDietPreference()) {
18511        openArray("dietPreference");
18512        for (CodeableConcept e : element.getDietPreference()) 
18513          composeCodeableConcept(null, e);
18514        closeArray();
18515      };
18516      if (element.hasSpecialCourtesy()) {
18517        openArray("specialCourtesy");
18518        for (CodeableConcept e : element.getSpecialCourtesy()) 
18519          composeCodeableConcept(null, e);
18520        closeArray();
18521      };
18522      if (element.hasSpecialArrangement()) {
18523        openArray("specialArrangement");
18524        for (CodeableConcept e : element.getSpecialArrangement()) 
18525          composeCodeableConcept(null, e);
18526        closeArray();
18527      };
18528      if (element.hasDestination()) {
18529        composeReference("destination", element.getDestination());
18530      }
18531      if (element.hasDischargeDisposition()) {
18532        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
18533      }
18534      if (element.hasDischargeDiagnosis()) {
18535        openArray("dischargeDiagnosis");
18536        for (Reference e : element.getDischargeDiagnosis()) 
18537          composeReference(null, e);
18538        closeArray();
18539      };
18540  }
18541
18542  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
18543    if (element != null) {
18544      open(name);
18545      composeEncounterEncounterLocationComponentInner(element);
18546      close();
18547    }
18548  }
18549
18550  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
18551      composeBackbone(element);
18552      if (element.hasLocation()) {
18553        composeReference("location", element.getLocation());
18554      }
18555      if (element.hasStatusElement()) {
18556        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18557        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
18558      }
18559      if (element.hasPeriod()) {
18560        composePeriod("period", element.getPeriod());
18561      }
18562  }
18563
18564  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
18565    if (element != null) {
18566      prop("resourceType", name);
18567      composeEnrollmentRequestInner(element);
18568    }
18569  }
18570
18571  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
18572      composeDomainResourceElements(element);
18573      if (element.hasIdentifier()) {
18574        openArray("identifier");
18575        for (Identifier e : element.getIdentifier()) 
18576          composeIdentifier(null, e);
18577        closeArray();
18578      };
18579      if (element.hasRuleset()) {
18580        composeCoding("ruleset", element.getRuleset());
18581      }
18582      if (element.hasOriginalRuleset()) {
18583        composeCoding("originalRuleset", element.getOriginalRuleset());
18584      }
18585      if (element.hasCreatedElement()) {
18586        composeDateTimeCore("created", element.getCreatedElement(), false);
18587        composeDateTimeExtras("created", element.getCreatedElement(), false);
18588      }
18589      if (element.hasTarget()) {
18590        composeReference("target", element.getTarget());
18591      }
18592      if (element.hasProvider()) {
18593        composeReference("provider", element.getProvider());
18594      }
18595      if (element.hasOrganization()) {
18596        composeReference("organization", element.getOrganization());
18597      }
18598      if (element.hasSubject()) {
18599        composeReference("subject", element.getSubject());
18600      }
18601      if (element.hasCoverage()) {
18602        composeReference("coverage", element.getCoverage());
18603      }
18604      if (element.hasRelationship()) {
18605        composeCoding("relationship", element.getRelationship());
18606      }
18607  }
18608
18609  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
18610    if (element != null) {
18611      prop("resourceType", name);
18612      composeEnrollmentResponseInner(element);
18613    }
18614  }
18615
18616  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
18617      composeDomainResourceElements(element);
18618      if (element.hasIdentifier()) {
18619        openArray("identifier");
18620        for (Identifier e : element.getIdentifier()) 
18621          composeIdentifier(null, e);
18622        closeArray();
18623      };
18624      if (element.hasRequest()) {
18625        composeReference("request", element.getRequest());
18626      }
18627      if (element.hasOutcomeElement()) {
18628        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18629        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18630      }
18631      if (element.hasDispositionElement()) {
18632        composeStringCore("disposition", element.getDispositionElement(), false);
18633        composeStringExtras("disposition", element.getDispositionElement(), false);
18634      }
18635      if (element.hasRuleset()) {
18636        composeCoding("ruleset", element.getRuleset());
18637      }
18638      if (element.hasOriginalRuleset()) {
18639        composeCoding("originalRuleset", element.getOriginalRuleset());
18640      }
18641      if (element.hasCreatedElement()) {
18642        composeDateTimeCore("created", element.getCreatedElement(), false);
18643        composeDateTimeExtras("created", element.getCreatedElement(), false);
18644      }
18645      if (element.hasOrganization()) {
18646        composeReference("organization", element.getOrganization());
18647      }
18648      if (element.hasRequestProvider()) {
18649        composeReference("requestProvider", element.getRequestProvider());
18650      }
18651      if (element.hasRequestOrganization()) {
18652        composeReference("requestOrganization", element.getRequestOrganization());
18653      }
18654  }
18655
18656  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
18657    if (element != null) {
18658      prop("resourceType", name);
18659      composeEpisodeOfCareInner(element);
18660    }
18661  }
18662
18663  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
18664      composeDomainResourceElements(element);
18665      if (element.hasIdentifier()) {
18666        openArray("identifier");
18667        for (Identifier e : element.getIdentifier()) 
18668          composeIdentifier(null, e);
18669        closeArray();
18670      };
18671      if (element.hasStatusElement()) {
18672        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18673        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18674      }
18675      if (element.hasStatusHistory()) {
18676        openArray("statusHistory");
18677        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
18678          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
18679        closeArray();
18680      };
18681      if (element.hasType()) {
18682        openArray("type");
18683        for (CodeableConcept e : element.getType()) 
18684          composeCodeableConcept(null, e);
18685        closeArray();
18686      };
18687      if (element.hasCondition()) {
18688        openArray("condition");
18689        for (Reference e : element.getCondition()) 
18690          composeReference(null, e);
18691        closeArray();
18692      };
18693      if (element.hasPatient()) {
18694        composeReference("patient", element.getPatient());
18695      }
18696      if (element.hasManagingOrganization()) {
18697        composeReference("managingOrganization", element.getManagingOrganization());
18698      }
18699      if (element.hasPeriod()) {
18700        composePeriod("period", element.getPeriod());
18701      }
18702      if (element.hasReferralRequest()) {
18703        openArray("referralRequest");
18704        for (Reference e : element.getReferralRequest()) 
18705          composeReference(null, e);
18706        closeArray();
18707      };
18708      if (element.hasCareManager()) {
18709        composeReference("careManager", element.getCareManager());
18710      }
18711      if (element.hasCareTeam()) {
18712        openArray("careTeam");
18713        for (EpisodeOfCare.EpisodeOfCareCareTeamComponent e : element.getCareTeam()) 
18714          composeEpisodeOfCareEpisodeOfCareCareTeamComponent(null, e);
18715        closeArray();
18716      };
18717  }
18718
18719  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18720    if (element != null) {
18721      open(name);
18722      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
18723      close();
18724    }
18725  }
18726
18727  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
18728      composeBackbone(element);
18729      if (element.hasStatusElement()) {
18730        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18731        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
18732      }
18733      if (element.hasPeriod()) {
18734        composePeriod("period", element.getPeriod());
18735      }
18736  }
18737
18738  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponent(String name, EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18739    if (element != null) {
18740      open(name);
18741      composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(element);
18742      close();
18743    }
18744  }
18745
18746  protected void composeEpisodeOfCareEpisodeOfCareCareTeamComponentInner(EpisodeOfCare.EpisodeOfCareCareTeamComponent element) throws IOException {
18747      composeBackbone(element);
18748      if (element.hasRole()) {
18749        openArray("role");
18750        for (CodeableConcept e : element.getRole()) 
18751          composeCodeableConcept(null, e);
18752        closeArray();
18753      };
18754      if (element.hasPeriod()) {
18755        composePeriod("period", element.getPeriod());
18756      }
18757      if (element.hasMember()) {
18758        composeReference("member", element.getMember());
18759      }
18760  }
18761
18762  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
18763    if (element != null) {
18764      prop("resourceType", name);
18765      composeExplanationOfBenefitInner(element);
18766    }
18767  }
18768
18769  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
18770      composeDomainResourceElements(element);
18771      if (element.hasIdentifier()) {
18772        openArray("identifier");
18773        for (Identifier e : element.getIdentifier()) 
18774          composeIdentifier(null, e);
18775        closeArray();
18776      };
18777      if (element.hasRequest()) {
18778        composeReference("request", element.getRequest());
18779      }
18780      if (element.hasOutcomeElement()) {
18781        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18782        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
18783      }
18784      if (element.hasDispositionElement()) {
18785        composeStringCore("disposition", element.getDispositionElement(), false);
18786        composeStringExtras("disposition", element.getDispositionElement(), false);
18787      }
18788      if (element.hasRuleset()) {
18789        composeCoding("ruleset", element.getRuleset());
18790      }
18791      if (element.hasOriginalRuleset()) {
18792        composeCoding("originalRuleset", element.getOriginalRuleset());
18793      }
18794      if (element.hasCreatedElement()) {
18795        composeDateTimeCore("created", element.getCreatedElement(), false);
18796        composeDateTimeExtras("created", element.getCreatedElement(), false);
18797      }
18798      if (element.hasOrganization()) {
18799        composeReference("organization", element.getOrganization());
18800      }
18801      if (element.hasRequestProvider()) {
18802        composeReference("requestProvider", element.getRequestProvider());
18803      }
18804      if (element.hasRequestOrganization()) {
18805        composeReference("requestOrganization", element.getRequestOrganization());
18806      }
18807  }
18808
18809  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
18810    if (element != null) {
18811      prop("resourceType", name);
18812      composeFamilyMemberHistoryInner(element);
18813    }
18814  }
18815
18816  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
18817      composeDomainResourceElements(element);
18818      if (element.hasIdentifier()) {
18819        openArray("identifier");
18820        for (Identifier e : element.getIdentifier()) 
18821          composeIdentifier(null, e);
18822        closeArray();
18823      };
18824      if (element.hasPatient()) {
18825        composeReference("patient", element.getPatient());
18826      }
18827      if (element.hasDateElement()) {
18828        composeDateTimeCore("date", element.getDateElement(), false);
18829        composeDateTimeExtras("date", element.getDateElement(), false);
18830      }
18831      if (element.hasStatusElement()) {
18832        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18833        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
18834      }
18835      if (element.hasNameElement()) {
18836        composeStringCore("name", element.getNameElement(), false);
18837        composeStringExtras("name", element.getNameElement(), false);
18838      }
18839      if (element.hasRelationship()) {
18840        composeCodeableConcept("relationship", element.getRelationship());
18841      }
18842      if (element.hasGenderElement()) {
18843        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18844        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
18845      }
18846      if (element.hasBorn()) {
18847        composeType("born", element.getBorn());
18848      }
18849      if (element.hasAge()) {
18850        composeType("age", element.getAge());
18851      }
18852      if (element.hasDeceased()) {
18853        composeType("deceased", element.getDeceased());
18854      }
18855      if (element.hasNote()) {
18856        composeAnnotation("note", element.getNote());
18857      }
18858      if (element.hasCondition()) {
18859        openArray("condition");
18860        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
18861          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
18862        closeArray();
18863      };
18864  }
18865
18866  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18867    if (element != null) {
18868      open(name);
18869      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
18870      close();
18871    }
18872  }
18873
18874  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
18875      composeBackbone(element);
18876      if (element.hasCode()) {
18877        composeCodeableConcept("code", element.getCode());
18878      }
18879      if (element.hasOutcome()) {
18880        composeCodeableConcept("outcome", element.getOutcome());
18881      }
18882      if (element.hasOnset()) {
18883        composeType("onset", element.getOnset());
18884      }
18885      if (element.hasNote()) {
18886        composeAnnotation("note", element.getNote());
18887      }
18888  }
18889
18890  protected void composeFlag(String name, Flag element) throws IOException {
18891    if (element != null) {
18892      prop("resourceType", name);
18893      composeFlagInner(element);
18894    }
18895  }
18896
18897  protected void composeFlagInner(Flag element) throws IOException {
18898      composeDomainResourceElements(element);
18899      if (element.hasIdentifier()) {
18900        openArray("identifier");
18901        for (Identifier e : element.getIdentifier()) 
18902          composeIdentifier(null, e);
18903        closeArray();
18904      };
18905      if (element.hasCategory()) {
18906        composeCodeableConcept("category", element.getCategory());
18907      }
18908      if (element.hasStatusElement()) {
18909        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18910        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
18911      }
18912      if (element.hasPeriod()) {
18913        composePeriod("period", element.getPeriod());
18914      }
18915      if (element.hasSubject()) {
18916        composeReference("subject", element.getSubject());
18917      }
18918      if (element.hasEncounter()) {
18919        composeReference("encounter", element.getEncounter());
18920      }
18921      if (element.hasAuthor()) {
18922        composeReference("author", element.getAuthor());
18923      }
18924      if (element.hasCode()) {
18925        composeCodeableConcept("code", element.getCode());
18926      }
18927  }
18928
18929  protected void composeGoal(String name, Goal element) throws IOException {
18930    if (element != null) {
18931      prop("resourceType", name);
18932      composeGoalInner(element);
18933    }
18934  }
18935
18936  protected void composeGoalInner(Goal element) throws IOException {
18937      composeDomainResourceElements(element);
18938      if (element.hasIdentifier()) {
18939        openArray("identifier");
18940        for (Identifier e : element.getIdentifier()) 
18941          composeIdentifier(null, e);
18942        closeArray();
18943      };
18944      if (element.hasSubject()) {
18945        composeReference("subject", element.getSubject());
18946      }
18947      if (element.hasStart()) {
18948        composeType("start", element.getStart());
18949      }
18950      if (element.hasTarget()) {
18951        composeType("target", element.getTarget());
18952      }
18953      if (element.hasCategory()) {
18954        openArray("category");
18955        for (CodeableConcept e : element.getCategory()) 
18956          composeCodeableConcept(null, e);
18957        closeArray();
18958      };
18959      if (element.hasDescriptionElement()) {
18960        composeStringCore("description", element.getDescriptionElement(), false);
18961        composeStringExtras("description", element.getDescriptionElement(), false);
18962      }
18963      if (element.hasStatusElement()) {
18964        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18965        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
18966      }
18967      if (element.hasStatusDateElement()) {
18968        composeDateCore("statusDate", element.getStatusDateElement(), false);
18969        composeDateExtras("statusDate", element.getStatusDateElement(), false);
18970      }
18971      if (element.hasStatusReason()) {
18972        composeCodeableConcept("statusReason", element.getStatusReason());
18973      }
18974      if (element.hasAuthor()) {
18975        composeReference("author", element.getAuthor());
18976      }
18977      if (element.hasPriority()) {
18978        composeCodeableConcept("priority", element.getPriority());
18979      }
18980      if (element.hasAddresses()) {
18981        openArray("addresses");
18982        for (Reference e : element.getAddresses()) 
18983          composeReference(null, e);
18984        closeArray();
18985      };
18986      if (element.hasNote()) {
18987        openArray("note");
18988        for (Annotation e : element.getNote()) 
18989          composeAnnotation(null, e);
18990        closeArray();
18991      };
18992      if (element.hasOutcome()) {
18993        openArray("outcome");
18994        for (Goal.GoalOutcomeComponent e : element.getOutcome()) 
18995          composeGoalGoalOutcomeComponent(null, e);
18996        closeArray();
18997      };
18998  }
18999
19000  protected void composeGoalGoalOutcomeComponent(String name, Goal.GoalOutcomeComponent element) throws IOException {
19001    if (element != null) {
19002      open(name);
19003      composeGoalGoalOutcomeComponentInner(element);
19004      close();
19005    }
19006  }
19007
19008  protected void composeGoalGoalOutcomeComponentInner(Goal.GoalOutcomeComponent element) throws IOException {
19009      composeBackbone(element);
19010      if (element.hasResult()) {
19011        composeType("result", element.getResult());
19012      }
19013  }
19014
19015  protected void composeGroup(String name, Group element) throws IOException {
19016    if (element != null) {
19017      prop("resourceType", name);
19018      composeGroupInner(element);
19019    }
19020  }
19021
19022  protected void composeGroupInner(Group element) throws IOException {
19023      composeDomainResourceElements(element);
19024      if (element.hasIdentifier()) {
19025        openArray("identifier");
19026        for (Identifier e : element.getIdentifier()) 
19027          composeIdentifier(null, e);
19028        closeArray();
19029      };
19030      if (element.hasTypeElement()) {
19031        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19032        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
19033      }
19034      if (element.hasActualElement()) {
19035        composeBooleanCore("actual", element.getActualElement(), false);
19036        composeBooleanExtras("actual", element.getActualElement(), false);
19037      }
19038      if (element.hasCode()) {
19039        composeCodeableConcept("code", element.getCode());
19040      }
19041      if (element.hasNameElement()) {
19042        composeStringCore("name", element.getNameElement(), false);
19043        composeStringExtras("name", element.getNameElement(), false);
19044      }
19045      if (element.hasQuantityElement()) {
19046        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
19047        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
19048      }
19049      if (element.hasCharacteristic()) {
19050        openArray("characteristic");
19051        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
19052          composeGroupGroupCharacteristicComponent(null, e);
19053        closeArray();
19054      };
19055      if (element.hasMember()) {
19056        openArray("member");
19057        for (Group.GroupMemberComponent e : element.getMember()) 
19058          composeGroupGroupMemberComponent(null, e);
19059        closeArray();
19060      };
19061  }
19062
19063  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
19064    if (element != null) {
19065      open(name);
19066      composeGroupGroupCharacteristicComponentInner(element);
19067      close();
19068    }
19069  }
19070
19071  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
19072      composeBackbone(element);
19073      if (element.hasCode()) {
19074        composeCodeableConcept("code", element.getCode());
19075      }
19076      if (element.hasValue()) {
19077        composeType("value", element.getValue());
19078      }
19079      if (element.hasExcludeElement()) {
19080        composeBooleanCore("exclude", element.getExcludeElement(), false);
19081        composeBooleanExtras("exclude", element.getExcludeElement(), false);
19082      }
19083      if (element.hasPeriod()) {
19084        composePeriod("period", element.getPeriod());
19085      }
19086  }
19087
19088  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
19089    if (element != null) {
19090      open(name);
19091      composeGroupGroupMemberComponentInner(element);
19092      close();
19093    }
19094  }
19095
19096  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
19097      composeBackbone(element);
19098      if (element.hasEntity()) {
19099        composeReference("entity", element.getEntity());
19100      }
19101      if (element.hasPeriod()) {
19102        composePeriod("period", element.getPeriod());
19103      }
19104      if (element.hasInactiveElement()) {
19105        composeBooleanCore("inactive", element.getInactiveElement(), false);
19106        composeBooleanExtras("inactive", element.getInactiveElement(), false);
19107      }
19108  }
19109
19110  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
19111    if (element != null) {
19112      prop("resourceType", name);
19113      composeHealthcareServiceInner(element);
19114    }
19115  }
19116
19117  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
19118      composeDomainResourceElements(element);
19119      if (element.hasIdentifier()) {
19120        openArray("identifier");
19121        for (Identifier e : element.getIdentifier()) 
19122          composeIdentifier(null, e);
19123        closeArray();
19124      };
19125      if (element.hasProvidedBy()) {
19126        composeReference("providedBy", element.getProvidedBy());
19127      }
19128      if (element.hasServiceCategory()) {
19129        composeCodeableConcept("serviceCategory", element.getServiceCategory());
19130      }
19131      if (element.hasServiceType()) {
19132        openArray("serviceType");
19133        for (HealthcareService.ServiceTypeComponent e : element.getServiceType()) 
19134          composeHealthcareServiceServiceTypeComponent(null, e);
19135        closeArray();
19136      };
19137      if (element.hasLocation()) {
19138        composeReference("location", element.getLocation());
19139      }
19140      if (element.hasServiceNameElement()) {
19141        composeStringCore("serviceName", element.getServiceNameElement(), false);
19142        composeStringExtras("serviceName", element.getServiceNameElement(), false);
19143      }
19144      if (element.hasCommentElement()) {
19145        composeStringCore("comment", element.getCommentElement(), false);
19146        composeStringExtras("comment", element.getCommentElement(), false);
19147      }
19148      if (element.hasExtraDetailsElement()) {
19149        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
19150        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
19151      }
19152      if (element.hasPhoto()) {
19153        composeAttachment("photo", element.getPhoto());
19154      }
19155      if (element.hasTelecom()) {
19156        openArray("telecom");
19157        for (ContactPoint e : element.getTelecom()) 
19158          composeContactPoint(null, e);
19159        closeArray();
19160      };
19161      if (element.hasCoverageArea()) {
19162        openArray("coverageArea");
19163        for (Reference e : element.getCoverageArea()) 
19164          composeReference(null, e);
19165        closeArray();
19166      };
19167      if (element.hasServiceProvisionCode()) {
19168        openArray("serviceProvisionCode");
19169        for (CodeableConcept e : element.getServiceProvisionCode()) 
19170          composeCodeableConcept(null, e);
19171        closeArray();
19172      };
19173      if (element.hasEligibility()) {
19174        composeCodeableConcept("eligibility", element.getEligibility());
19175      }
19176      if (element.hasEligibilityNoteElement()) {
19177        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
19178        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
19179      }
19180      if (element.hasProgramName()) {
19181        openArray("programName");
19182        for (StringType e : element.getProgramName()) 
19183          composeStringCore(null, e, true);
19184        closeArray();
19185        if (anyHasExtras(element.getProgramName())) {
19186          openArray("_programName");
19187          for (StringType e : element.getProgramName()) 
19188            composeStringExtras(null, e, true);
19189          closeArray();
19190        }
19191      };
19192      if (element.hasCharacteristic()) {
19193        openArray("characteristic");
19194        for (CodeableConcept e : element.getCharacteristic()) 
19195          composeCodeableConcept(null, e);
19196        closeArray();
19197      };
19198      if (element.hasReferralMethod()) {
19199        openArray("referralMethod");
19200        for (CodeableConcept e : element.getReferralMethod()) 
19201          composeCodeableConcept(null, e);
19202        closeArray();
19203      };
19204      if (element.hasPublicKeyElement()) {
19205        composeStringCore("publicKey", element.getPublicKeyElement(), false);
19206        composeStringExtras("publicKey", element.getPublicKeyElement(), false);
19207      }
19208      if (element.hasAppointmentRequiredElement()) {
19209        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
19210        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
19211      }
19212      if (element.hasAvailableTime()) {
19213        openArray("availableTime");
19214        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
19215          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
19216        closeArray();
19217      };
19218      if (element.hasNotAvailable()) {
19219        openArray("notAvailable");
19220        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
19221          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
19222        closeArray();
19223      };
19224      if (element.hasAvailabilityExceptionsElement()) {
19225        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19226        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
19227      }
19228  }
19229
19230  protected void composeHealthcareServiceServiceTypeComponent(String name, HealthcareService.ServiceTypeComponent element) throws IOException {
19231    if (element != null) {
19232      open(name);
19233      composeHealthcareServiceServiceTypeComponentInner(element);
19234      close();
19235    }
19236  }
19237
19238  protected void composeHealthcareServiceServiceTypeComponentInner(HealthcareService.ServiceTypeComponent element) throws IOException {
19239      composeBackbone(element);
19240      if (element.hasType()) {
19241        composeCodeableConcept("type", element.getType());
19242      }
19243      if (element.hasSpecialty()) {
19244        openArray("specialty");
19245        for (CodeableConcept e : element.getSpecialty()) 
19246          composeCodeableConcept(null, e);
19247        closeArray();
19248      };
19249  }
19250
19251  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19252    if (element != null) {
19253      open(name);
19254      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
19255      close();
19256    }
19257  }
19258
19259  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
19260      composeBackbone(element);
19261      if (element.hasDaysOfWeek()) {
19262        openArray("daysOfWeek");
19263        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19264          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19265        closeArray();
19266        if (anyHasExtras(element.getDaysOfWeek())) {
19267          openArray("_daysOfWeek");
19268          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
19269            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
19270          closeArray();
19271        }
19272      };
19273      if (element.hasAllDayElement()) {
19274        composeBooleanCore("allDay", element.getAllDayElement(), false);
19275        composeBooleanExtras("allDay", element.getAllDayElement(), false);
19276      }
19277      if (element.hasAvailableStartTimeElement()) {
19278        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
19279        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
19280      }
19281      if (element.hasAvailableEndTimeElement()) {
19282        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
19283        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
19284      }
19285  }
19286
19287  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19288    if (element != null) {
19289      open(name);
19290      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
19291      close();
19292    }
19293  }
19294
19295  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
19296      composeBackbone(element);
19297      if (element.hasDescriptionElement()) {
19298        composeStringCore("description", element.getDescriptionElement(), false);
19299        composeStringExtras("description", element.getDescriptionElement(), false);
19300      }
19301      if (element.hasDuring()) {
19302        composePeriod("during", element.getDuring());
19303      }
19304  }
19305
19306  protected void composeImagingObjectSelection(String name, ImagingObjectSelection element) throws IOException {
19307    if (element != null) {
19308      prop("resourceType", name);
19309      composeImagingObjectSelectionInner(element);
19310    }
19311  }
19312
19313  protected void composeImagingObjectSelectionInner(ImagingObjectSelection element) throws IOException {
19314      composeDomainResourceElements(element);
19315      if (element.hasUidElement()) {
19316        composeOidCore("uid", element.getUidElement(), false);
19317        composeOidExtras("uid", element.getUidElement(), false);
19318      }
19319      if (element.hasPatient()) {
19320        composeReference("patient", element.getPatient());
19321      }
19322      if (element.hasTitle()) {
19323        composeCodeableConcept("title", element.getTitle());
19324      }
19325      if (element.hasDescriptionElement()) {
19326        composeStringCore("description", element.getDescriptionElement(), false);
19327        composeStringExtras("description", element.getDescriptionElement(), false);
19328      }
19329      if (element.hasAuthor()) {
19330        composeReference("author", element.getAuthor());
19331      }
19332      if (element.hasAuthoringTimeElement()) {
19333        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
19334        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
19335      }
19336      if (element.hasStudy()) {
19337        openArray("study");
19338        for (ImagingObjectSelection.StudyComponent e : element.getStudy()) 
19339          composeImagingObjectSelectionStudyComponent(null, e);
19340        closeArray();
19341      };
19342  }
19343
19344  protected void composeImagingObjectSelectionStudyComponent(String name, ImagingObjectSelection.StudyComponent element) throws IOException {
19345    if (element != null) {
19346      open(name);
19347      composeImagingObjectSelectionStudyComponentInner(element);
19348      close();
19349    }
19350  }
19351
19352  protected void composeImagingObjectSelectionStudyComponentInner(ImagingObjectSelection.StudyComponent element) throws IOException {
19353      composeBackbone(element);
19354      if (element.hasUidElement()) {
19355        composeOidCore("uid", element.getUidElement(), false);
19356        composeOidExtras("uid", element.getUidElement(), false);
19357      }
19358      if (element.hasUrlElement()) {
19359        composeUriCore("url", element.getUrlElement(), false);
19360        composeUriExtras("url", element.getUrlElement(), false);
19361      }
19362      if (element.hasImagingStudy()) {
19363        composeReference("imagingStudy", element.getImagingStudy());
19364      }
19365      if (element.hasSeries()) {
19366        openArray("series");
19367        for (ImagingObjectSelection.SeriesComponent e : element.getSeries()) 
19368          composeImagingObjectSelectionSeriesComponent(null, e);
19369        closeArray();
19370      };
19371  }
19372
19373  protected void composeImagingObjectSelectionSeriesComponent(String name, ImagingObjectSelection.SeriesComponent element) throws IOException {
19374    if (element != null) {
19375      open(name);
19376      composeImagingObjectSelectionSeriesComponentInner(element);
19377      close();
19378    }
19379  }
19380
19381  protected void composeImagingObjectSelectionSeriesComponentInner(ImagingObjectSelection.SeriesComponent element) throws IOException {
19382      composeBackbone(element);
19383      if (element.hasUidElement()) {
19384        composeOidCore("uid", element.getUidElement(), false);
19385        composeOidExtras("uid", element.getUidElement(), false);
19386      }
19387      if (element.hasUrlElement()) {
19388        composeUriCore("url", element.getUrlElement(), false);
19389        composeUriExtras("url", element.getUrlElement(), false);
19390      }
19391      if (element.hasInstance()) {
19392        openArray("instance");
19393        for (ImagingObjectSelection.InstanceComponent e : element.getInstance()) 
19394          composeImagingObjectSelectionInstanceComponent(null, e);
19395        closeArray();
19396      };
19397  }
19398
19399  protected void composeImagingObjectSelectionInstanceComponent(String name, ImagingObjectSelection.InstanceComponent element) throws IOException {
19400    if (element != null) {
19401      open(name);
19402      composeImagingObjectSelectionInstanceComponentInner(element);
19403      close();
19404    }
19405  }
19406
19407  protected void composeImagingObjectSelectionInstanceComponentInner(ImagingObjectSelection.InstanceComponent element) throws IOException {
19408      composeBackbone(element);
19409      if (element.hasSopClassElement()) {
19410        composeOidCore("sopClass", element.getSopClassElement(), false);
19411        composeOidExtras("sopClass", element.getSopClassElement(), false);
19412      }
19413      if (element.hasUidElement()) {
19414        composeOidCore("uid", element.getUidElement(), false);
19415        composeOidExtras("uid", element.getUidElement(), false);
19416      }
19417      if (element.hasUrlElement()) {
19418        composeUriCore("url", element.getUrlElement(), false);
19419        composeUriExtras("url", element.getUrlElement(), false);
19420      }
19421      if (element.hasFrames()) {
19422        openArray("frames");
19423        for (ImagingObjectSelection.FramesComponent e : element.getFrames()) 
19424          composeImagingObjectSelectionFramesComponent(null, e);
19425        closeArray();
19426      };
19427  }
19428
19429  protected void composeImagingObjectSelectionFramesComponent(String name, ImagingObjectSelection.FramesComponent element) throws IOException {
19430    if (element != null) {
19431      open(name);
19432      composeImagingObjectSelectionFramesComponentInner(element);
19433      close();
19434    }
19435  }
19436
19437  protected void composeImagingObjectSelectionFramesComponentInner(ImagingObjectSelection.FramesComponent element) throws IOException {
19438      composeBackbone(element);
19439      if (element.hasFrameNumbers()) {
19440        openArray("frameNumbers");
19441        for (UnsignedIntType e : element.getFrameNumbers()) 
19442          composeUnsignedIntCore(null, e, true);
19443        closeArray();
19444        if (anyHasExtras(element.getFrameNumbers())) {
19445          openArray("_frameNumbers");
19446          for (UnsignedIntType e : element.getFrameNumbers()) 
19447            composeUnsignedIntExtras(null, e, true);
19448          closeArray();
19449        }
19450      };
19451      if (element.hasUrlElement()) {
19452        composeUriCore("url", element.getUrlElement(), false);
19453        composeUriExtras("url", element.getUrlElement(), false);
19454      }
19455  }
19456
19457  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
19458    if (element != null) {
19459      prop("resourceType", name);
19460      composeImagingStudyInner(element);
19461    }
19462  }
19463
19464  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
19465      composeDomainResourceElements(element);
19466      if (element.hasStartedElement()) {
19467        composeDateTimeCore("started", element.getStartedElement(), false);
19468        composeDateTimeExtras("started", element.getStartedElement(), false);
19469      }
19470      if (element.hasPatient()) {
19471        composeReference("patient", element.getPatient());
19472      }
19473      if (element.hasUidElement()) {
19474        composeOidCore("uid", element.getUidElement(), false);
19475        composeOidExtras("uid", element.getUidElement(), false);
19476      }
19477      if (element.hasAccession()) {
19478        composeIdentifier("accession", element.getAccession());
19479      }
19480      if (element.hasIdentifier()) {
19481        openArray("identifier");
19482        for (Identifier e : element.getIdentifier()) 
19483          composeIdentifier(null, e);
19484        closeArray();
19485      };
19486      if (element.hasOrder()) {
19487        openArray("order");
19488        for (Reference e : element.getOrder()) 
19489          composeReference(null, e);
19490        closeArray();
19491      };
19492      if (element.hasModalityList()) {
19493        openArray("modalityList");
19494        for (Coding e : element.getModalityList()) 
19495          composeCoding(null, e);
19496        closeArray();
19497      };
19498      if (element.hasReferrer()) {
19499        composeReference("referrer", element.getReferrer());
19500      }
19501      if (element.hasAvailabilityElement()) {
19502        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19503        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19504      }
19505      if (element.hasUrlElement()) {
19506        composeUriCore("url", element.getUrlElement(), false);
19507        composeUriExtras("url", element.getUrlElement(), false);
19508      }
19509      if (element.hasNumberOfSeriesElement()) {
19510        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
19511        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
19512      }
19513      if (element.hasNumberOfInstancesElement()) {
19514        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19515        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19516      }
19517      if (element.hasProcedure()) {
19518        openArray("procedure");
19519        for (Reference e : element.getProcedure()) 
19520          composeReference(null, e);
19521        closeArray();
19522      };
19523      if (element.hasInterpreter()) {
19524        composeReference("interpreter", element.getInterpreter());
19525      }
19526      if (element.hasDescriptionElement()) {
19527        composeStringCore("description", element.getDescriptionElement(), false);
19528        composeStringExtras("description", element.getDescriptionElement(), false);
19529      }
19530      if (element.hasSeries()) {
19531        openArray("series");
19532        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
19533          composeImagingStudyImagingStudySeriesComponent(null, e);
19534        closeArray();
19535      };
19536  }
19537
19538  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19539    if (element != null) {
19540      open(name);
19541      composeImagingStudyImagingStudySeriesComponentInner(element);
19542      close();
19543    }
19544  }
19545
19546  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
19547      composeBackbone(element);
19548      if (element.hasNumberElement()) {
19549        composeUnsignedIntCore("number", element.getNumberElement(), false);
19550        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19551      }
19552      if (element.hasModality()) {
19553        composeCoding("modality", element.getModality());
19554      }
19555      if (element.hasUidElement()) {
19556        composeOidCore("uid", element.getUidElement(), false);
19557        composeOidExtras("uid", element.getUidElement(), false);
19558      }
19559      if (element.hasDescriptionElement()) {
19560        composeStringCore("description", element.getDescriptionElement(), false);
19561        composeStringExtras("description", element.getDescriptionElement(), false);
19562      }
19563      if (element.hasNumberOfInstancesElement()) {
19564        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
19565        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
19566      }
19567      if (element.hasAvailabilityElement()) {
19568        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19569        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
19570      }
19571      if (element.hasUrlElement()) {
19572        composeUriCore("url", element.getUrlElement(), false);
19573        composeUriExtras("url", element.getUrlElement(), false);
19574      }
19575      if (element.hasBodySite()) {
19576        composeCoding("bodySite", element.getBodySite());
19577      }
19578      if (element.hasLaterality()) {
19579        composeCoding("laterality", element.getLaterality());
19580      }
19581      if (element.hasStartedElement()) {
19582        composeDateTimeCore("started", element.getStartedElement(), false);
19583        composeDateTimeExtras("started", element.getStartedElement(), false);
19584      }
19585      if (element.hasInstance()) {
19586        openArray("instance");
19587        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
19588          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
19589        closeArray();
19590      };
19591  }
19592
19593  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19594    if (element != null) {
19595      open(name);
19596      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
19597      close();
19598    }
19599  }
19600
19601  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
19602      composeBackbone(element);
19603      if (element.hasNumberElement()) {
19604        composeUnsignedIntCore("number", element.getNumberElement(), false);
19605        composeUnsignedIntExtras("number", element.getNumberElement(), false);
19606      }
19607      if (element.hasUidElement()) {
19608        composeOidCore("uid", element.getUidElement(), false);
19609        composeOidExtras("uid", element.getUidElement(), false);
19610      }
19611      if (element.hasSopClassElement()) {
19612        composeOidCore("sopClass", element.getSopClassElement(), false);
19613        composeOidExtras("sopClass", element.getSopClassElement(), false);
19614      }
19615      if (element.hasTypeElement()) {
19616        composeStringCore("type", element.getTypeElement(), false);
19617        composeStringExtras("type", element.getTypeElement(), false);
19618      }
19619      if (element.hasTitleElement()) {
19620        composeStringCore("title", element.getTitleElement(), false);
19621        composeStringExtras("title", element.getTitleElement(), false);
19622      }
19623      if (element.hasContent()) {
19624        openArray("content");
19625        for (Attachment e : element.getContent()) 
19626          composeAttachment(null, e);
19627        closeArray();
19628      };
19629  }
19630
19631  protected void composeImmunization(String name, Immunization element) throws IOException {
19632    if (element != null) {
19633      prop("resourceType", name);
19634      composeImmunizationInner(element);
19635    }
19636  }
19637
19638  protected void composeImmunizationInner(Immunization element) throws IOException {
19639      composeDomainResourceElements(element);
19640      if (element.hasIdentifier()) {
19641        openArray("identifier");
19642        for (Identifier e : element.getIdentifier()) 
19643          composeIdentifier(null, e);
19644        closeArray();
19645      };
19646      if (element.hasStatusElement()) {
19647        composeCodeCore("status", element.getStatusElement(), false);
19648        composeCodeExtras("status", element.getStatusElement(), false);
19649      }
19650      if (element.hasDateElement()) {
19651        composeDateTimeCore("date", element.getDateElement(), false);
19652        composeDateTimeExtras("date", element.getDateElement(), false);
19653      }
19654      if (element.hasVaccineCode()) {
19655        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19656      }
19657      if (element.hasPatient()) {
19658        composeReference("patient", element.getPatient());
19659      }
19660      if (element.hasWasNotGivenElement()) {
19661        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
19662        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
19663      }
19664      if (element.hasReportedElement()) {
19665        composeBooleanCore("reported", element.getReportedElement(), false);
19666        composeBooleanExtras("reported", element.getReportedElement(), false);
19667      }
19668      if (element.hasPerformer()) {
19669        composeReference("performer", element.getPerformer());
19670      }
19671      if (element.hasRequester()) {
19672        composeReference("requester", element.getRequester());
19673      }
19674      if (element.hasEncounter()) {
19675        composeReference("encounter", element.getEncounter());
19676      }
19677      if (element.hasManufacturer()) {
19678        composeReference("manufacturer", element.getManufacturer());
19679      }
19680      if (element.hasLocation()) {
19681        composeReference("location", element.getLocation());
19682      }
19683      if (element.hasLotNumberElement()) {
19684        composeStringCore("lotNumber", element.getLotNumberElement(), false);
19685        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
19686      }
19687      if (element.hasExpirationDateElement()) {
19688        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
19689        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
19690      }
19691      if (element.hasSite()) {
19692        composeCodeableConcept("site", element.getSite());
19693      }
19694      if (element.hasRoute()) {
19695        composeCodeableConcept("route", element.getRoute());
19696      }
19697      if (element.hasDoseQuantity()) {
19698        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
19699      }
19700      if (element.hasNote()) {
19701        openArray("note");
19702        for (Annotation e : element.getNote()) 
19703          composeAnnotation(null, e);
19704        closeArray();
19705      };
19706      if (element.hasExplanation()) {
19707        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
19708      }
19709      if (element.hasReaction()) {
19710        openArray("reaction");
19711        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
19712          composeImmunizationImmunizationReactionComponent(null, e);
19713        closeArray();
19714      };
19715      if (element.hasVaccinationProtocol()) {
19716        openArray("vaccinationProtocol");
19717        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
19718          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
19719        closeArray();
19720      };
19721  }
19722
19723  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
19724    if (element != null) {
19725      open(name);
19726      composeImmunizationImmunizationExplanationComponentInner(element);
19727      close();
19728    }
19729  }
19730
19731  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
19732      composeBackbone(element);
19733      if (element.hasReason()) {
19734        openArray("reason");
19735        for (CodeableConcept e : element.getReason()) 
19736          composeCodeableConcept(null, e);
19737        closeArray();
19738      };
19739      if (element.hasReasonNotGiven()) {
19740        openArray("reasonNotGiven");
19741        for (CodeableConcept e : element.getReasonNotGiven()) 
19742          composeCodeableConcept(null, e);
19743        closeArray();
19744      };
19745  }
19746
19747  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
19748    if (element != null) {
19749      open(name);
19750      composeImmunizationImmunizationReactionComponentInner(element);
19751      close();
19752    }
19753  }
19754
19755  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
19756      composeBackbone(element);
19757      if (element.hasDateElement()) {
19758        composeDateTimeCore("date", element.getDateElement(), false);
19759        composeDateTimeExtras("date", element.getDateElement(), false);
19760      }
19761      if (element.hasDetail()) {
19762        composeReference("detail", element.getDetail());
19763      }
19764      if (element.hasReportedElement()) {
19765        composeBooleanCore("reported", element.getReportedElement(), false);
19766        composeBooleanExtras("reported", element.getReportedElement(), false);
19767      }
19768  }
19769
19770  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19771    if (element != null) {
19772      open(name);
19773      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
19774      close();
19775    }
19776  }
19777
19778  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
19779      composeBackbone(element);
19780      if (element.hasDoseSequenceElement()) {
19781        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
19782        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
19783      }
19784      if (element.hasDescriptionElement()) {
19785        composeStringCore("description", element.getDescriptionElement(), false);
19786        composeStringExtras("description", element.getDescriptionElement(), false);
19787      }
19788      if (element.hasAuthority()) {
19789        composeReference("authority", element.getAuthority());
19790      }
19791      if (element.hasSeriesElement()) {
19792        composeStringCore("series", element.getSeriesElement(), false);
19793        composeStringExtras("series", element.getSeriesElement(), false);
19794      }
19795      if (element.hasSeriesDosesElement()) {
19796        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
19797        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
19798      }
19799      if (element.hasTargetDisease()) {
19800        openArray("targetDisease");
19801        for (CodeableConcept e : element.getTargetDisease()) 
19802          composeCodeableConcept(null, e);
19803        closeArray();
19804      };
19805      if (element.hasDoseStatus()) {
19806        composeCodeableConcept("doseStatus", element.getDoseStatus());
19807      }
19808      if (element.hasDoseStatusReason()) {
19809        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
19810      }
19811  }
19812
19813  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
19814    if (element != null) {
19815      prop("resourceType", name);
19816      composeImmunizationRecommendationInner(element);
19817    }
19818  }
19819
19820  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
19821      composeDomainResourceElements(element);
19822      if (element.hasIdentifier()) {
19823        openArray("identifier");
19824        for (Identifier e : element.getIdentifier()) 
19825          composeIdentifier(null, e);
19826        closeArray();
19827      };
19828      if (element.hasPatient()) {
19829        composeReference("patient", element.getPatient());
19830      }
19831      if (element.hasRecommendation()) {
19832        openArray("recommendation");
19833        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
19834          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
19835        closeArray();
19836      };
19837  }
19838
19839  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19840    if (element != null) {
19841      open(name);
19842      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
19843      close();
19844    }
19845  }
19846
19847  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
19848      composeBackbone(element);
19849      if (element.hasDateElement()) {
19850        composeDateTimeCore("date", element.getDateElement(), false);
19851        composeDateTimeExtras("date", element.getDateElement(), false);
19852      }
19853      if (element.hasVaccineCode()) {
19854        composeCodeableConcept("vaccineCode", element.getVaccineCode());
19855      }
19856      if (element.hasDoseNumberElement()) {
19857        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
19858        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
19859      }
19860      if (element.hasForecastStatus()) {
19861        composeCodeableConcept("forecastStatus", element.getForecastStatus());
19862      }
19863      if (element.hasDateCriterion()) {
19864        openArray("dateCriterion");
19865        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
19866          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
19867        closeArray();
19868      };
19869      if (element.hasProtocol()) {
19870        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
19871      }
19872      if (element.hasSupportingImmunization()) {
19873        openArray("supportingImmunization");
19874        for (Reference e : element.getSupportingImmunization()) 
19875          composeReference(null, e);
19876        closeArray();
19877      };
19878      if (element.hasSupportingPatientInformation()) {
19879        openArray("supportingPatientInformation");
19880        for (Reference e : element.getSupportingPatientInformation()) 
19881          composeReference(null, e);
19882        closeArray();
19883      };
19884  }
19885
19886  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19887    if (element != null) {
19888      open(name);
19889      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
19890      close();
19891    }
19892  }
19893
19894  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
19895      composeBackbone(element);
19896      if (element.hasCode()) {
19897        composeCodeableConcept("code", element.getCode());
19898      }
19899      if (element.hasValueElement()) {
19900        composeDateTimeCore("value", element.getValueElement(), false);
19901        composeDateTimeExtras("value", element.getValueElement(), false);
19902      }
19903  }
19904
19905  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19906    if (element != null) {
19907      open(name);
19908      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
19909      close();
19910    }
19911  }
19912
19913  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
19914      composeBackbone(element);
19915      if (element.hasDoseSequenceElement()) {
19916        composeIntegerCore("doseSequence", element.getDoseSequenceElement(), false);
19917        composeIntegerExtras("doseSequence", element.getDoseSequenceElement(), false);
19918      }
19919      if (element.hasDescriptionElement()) {
19920        composeStringCore("description", element.getDescriptionElement(), false);
19921        composeStringExtras("description", element.getDescriptionElement(), false);
19922      }
19923      if (element.hasAuthority()) {
19924        composeReference("authority", element.getAuthority());
19925      }
19926      if (element.hasSeriesElement()) {
19927        composeStringCore("series", element.getSeriesElement(), false);
19928        composeStringExtras("series", element.getSeriesElement(), false);
19929      }
19930  }
19931
19932  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
19933    if (element != null) {
19934      prop("resourceType", name);
19935      composeImplementationGuideInner(element);
19936    }
19937  }
19938
19939  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
19940      composeDomainResourceElements(element);
19941      if (element.hasUrlElement()) {
19942        composeUriCore("url", element.getUrlElement(), false);
19943        composeUriExtras("url", element.getUrlElement(), false);
19944      }
19945      if (element.hasVersionElement()) {
19946        composeStringCore("version", element.getVersionElement(), false);
19947        composeStringExtras("version", element.getVersionElement(), false);
19948      }
19949      if (element.hasNameElement()) {
19950        composeStringCore("name", element.getNameElement(), false);
19951        composeStringExtras("name", element.getNameElement(), false);
19952      }
19953      if (element.hasStatusElement()) {
19954        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19955        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
19956      }
19957      if (element.hasExperimentalElement()) {
19958        composeBooleanCore("experimental", element.getExperimentalElement(), false);
19959        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
19960      }
19961      if (element.hasPublisherElement()) {
19962        composeStringCore("publisher", element.getPublisherElement(), false);
19963        composeStringExtras("publisher", element.getPublisherElement(), false);
19964      }
19965      if (element.hasContact()) {
19966        openArray("contact");
19967        for (ImplementationGuide.ImplementationGuideContactComponent e : element.getContact()) 
19968          composeImplementationGuideImplementationGuideContactComponent(null, e);
19969        closeArray();
19970      };
19971      if (element.hasDateElement()) {
19972        composeDateTimeCore("date", element.getDateElement(), false);
19973        composeDateTimeExtras("date", element.getDateElement(), false);
19974      }
19975      if (element.hasDescriptionElement()) {
19976        composeStringCore("description", element.getDescriptionElement(), false);
19977        composeStringExtras("description", element.getDescriptionElement(), false);
19978      }
19979      if (element.hasUseContext()) {
19980        openArray("useContext");
19981        for (CodeableConcept e : element.getUseContext()) 
19982          composeCodeableConcept(null, e);
19983        closeArray();
19984      };
19985      if (element.hasCopyrightElement()) {
19986        composeStringCore("copyright", element.getCopyrightElement(), false);
19987        composeStringExtras("copyright", element.getCopyrightElement(), false);
19988      }
19989      if (element.hasFhirVersionElement()) {
19990        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
19991        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
19992      }
19993      if (element.hasDependency()) {
19994        openArray("dependency");
19995        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
19996          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
19997        closeArray();
19998      };
19999      if (element.hasPackage()) {
20000        openArray("package");
20001        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
20002          composeImplementationGuideImplementationGuidePackageComponent(null, e);
20003        closeArray();
20004      };
20005      if (element.hasGlobal()) {
20006        openArray("global");
20007        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
20008          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
20009        closeArray();
20010      };
20011      if (element.hasBinary()) {
20012        openArray("binary");
20013        for (UriType e : element.getBinary()) 
20014          composeUriCore(null, e, true);
20015        closeArray();
20016        if (anyHasExtras(element.getBinary())) {
20017          openArray("_binary");
20018          for (UriType e : element.getBinary()) 
20019            composeUriExtras(null, e, true);
20020          closeArray();
20021        }
20022      };
20023      if (element.hasPage()) {
20024        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
20025      }
20026  }
20027
20028  protected void composeImplementationGuideImplementationGuideContactComponent(String name, ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20029    if (element != null) {
20030      open(name);
20031      composeImplementationGuideImplementationGuideContactComponentInner(element);
20032      close();
20033    }
20034  }
20035
20036  protected void composeImplementationGuideImplementationGuideContactComponentInner(ImplementationGuide.ImplementationGuideContactComponent element) throws IOException {
20037      composeBackbone(element);
20038      if (element.hasNameElement()) {
20039        composeStringCore("name", element.getNameElement(), false);
20040        composeStringExtras("name", element.getNameElement(), false);
20041      }
20042      if (element.hasTelecom()) {
20043        openArray("telecom");
20044        for (ContactPoint e : element.getTelecom()) 
20045          composeContactPoint(null, e);
20046        closeArray();
20047      };
20048  }
20049
20050  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20051    if (element != null) {
20052      open(name);
20053      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
20054      close();
20055    }
20056  }
20057
20058  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
20059      composeBackbone(element);
20060      if (element.hasTypeElement()) {
20061        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20062        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
20063      }
20064      if (element.hasUriElement()) {
20065        composeUriCore("uri", element.getUriElement(), false);
20066        composeUriExtras("uri", element.getUriElement(), false);
20067      }
20068  }
20069
20070  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20071    if (element != null) {
20072      open(name);
20073      composeImplementationGuideImplementationGuidePackageComponentInner(element);
20074      close();
20075    }
20076  }
20077
20078  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
20079      composeBackbone(element);
20080      if (element.hasNameElement()) {
20081        composeStringCore("name", element.getNameElement(), false);
20082        composeStringExtras("name", element.getNameElement(), false);
20083      }
20084      if (element.hasDescriptionElement()) {
20085        composeStringCore("description", element.getDescriptionElement(), false);
20086        composeStringExtras("description", element.getDescriptionElement(), false);
20087      }
20088      if (element.hasResource()) {
20089        openArray("resource");
20090        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
20091          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
20092        closeArray();
20093      };
20094  }
20095
20096  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20097    if (element != null) {
20098      open(name);
20099      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
20100      close();
20101    }
20102  }
20103
20104  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
20105      composeBackbone(element);
20106      if (element.hasPurposeElement()) {
20107        composeEnumerationCore("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20108        composeEnumerationExtras("purpose", element.getPurposeElement(), new ImplementationGuide.GuideResourcePurposeEnumFactory(), false);
20109      }
20110      if (element.hasNameElement()) {
20111        composeStringCore("name", element.getNameElement(), false);
20112        composeStringExtras("name", element.getNameElement(), false);
20113      }
20114      if (element.hasDescriptionElement()) {
20115        composeStringCore("description", element.getDescriptionElement(), false);
20116        composeStringExtras("description", element.getDescriptionElement(), false);
20117      }
20118      if (element.hasAcronymElement()) {
20119        composeStringCore("acronym", element.getAcronymElement(), false);
20120        composeStringExtras("acronym", element.getAcronymElement(), false);
20121      }
20122      if (element.hasSource()) {
20123        composeType("source", element.getSource());
20124      }
20125      if (element.hasExampleFor()) {
20126        composeReference("exampleFor", element.getExampleFor());
20127      }
20128  }
20129
20130  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20131    if (element != null) {
20132      open(name);
20133      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
20134      close();
20135    }
20136  }
20137
20138  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
20139      composeBackbone(element);
20140      if (element.hasTypeElement()) {
20141        composeCodeCore("type", element.getTypeElement(), false);
20142        composeCodeExtras("type", element.getTypeElement(), false);
20143      }
20144      if (element.hasProfile()) {
20145        composeReference("profile", element.getProfile());
20146      }
20147  }
20148
20149  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20150    if (element != null) {
20151      open(name);
20152      composeImplementationGuideImplementationGuidePageComponentInner(element);
20153      close();
20154    }
20155  }
20156
20157  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
20158      composeBackbone(element);
20159      if (element.hasSourceElement()) {
20160        composeUriCore("source", element.getSourceElement(), false);
20161        composeUriExtras("source", element.getSourceElement(), false);
20162      }
20163      if (element.hasNameElement()) {
20164        composeStringCore("name", element.getNameElement(), false);
20165        composeStringExtras("name", element.getNameElement(), false);
20166      }
20167      if (element.hasKindElement()) {
20168        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20169        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
20170      }
20171      if (element.hasType()) {
20172        openArray("type");
20173        for (CodeType e : element.getType()) 
20174          composeCodeCore(null, e, true);
20175        closeArray();
20176        if (anyHasExtras(element.getType())) {
20177          openArray("_type");
20178          for (CodeType e : element.getType()) 
20179            composeCodeExtras(null, e, true);
20180          closeArray();
20181        }
20182      };
20183      if (element.hasPackage()) {
20184        openArray("package");
20185        for (StringType e : element.getPackage()) 
20186          composeStringCore(null, e, true);
20187        closeArray();
20188        if (anyHasExtras(element.getPackage())) {
20189          openArray("_package");
20190          for (StringType e : element.getPackage()) 
20191            composeStringExtras(null, e, true);
20192          closeArray();
20193        }
20194      };
20195      if (element.hasFormatElement()) {
20196        composeCodeCore("format", element.getFormatElement(), false);
20197        composeCodeExtras("format", element.getFormatElement(), false);
20198      }
20199      if (element.hasPage()) {
20200        openArray("page");
20201        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
20202          composeImplementationGuideImplementationGuidePageComponent(null, e);
20203        closeArray();
20204      };
20205  }
20206
20207  protected void composeList_(String name, List_ element) throws IOException {
20208    if (element != null) {
20209      prop("resourceType", name);
20210      composeList_Inner(element);
20211    }
20212  }
20213
20214  protected void composeList_Inner(List_ element) throws IOException {
20215      composeDomainResourceElements(element);
20216      if (element.hasIdentifier()) {
20217        openArray("identifier");
20218        for (Identifier e : element.getIdentifier()) 
20219          composeIdentifier(null, e);
20220        closeArray();
20221      };
20222      if (element.hasTitleElement()) {
20223        composeStringCore("title", element.getTitleElement(), false);
20224        composeStringExtras("title", element.getTitleElement(), false);
20225      }
20226      if (element.hasCode()) {
20227        composeCodeableConcept("code", element.getCode());
20228      }
20229      if (element.hasSubject()) {
20230        composeReference("subject", element.getSubject());
20231      }
20232      if (element.hasSource()) {
20233        composeReference("source", element.getSource());
20234      }
20235      if (element.hasEncounter()) {
20236        composeReference("encounter", element.getEncounter());
20237      }
20238      if (element.hasStatusElement()) {
20239        composeEnumerationCore("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20240        composeEnumerationExtras("status", element.getStatusElement(), new List_.ListStatusEnumFactory(), false);
20241      }
20242      if (element.hasDateElement()) {
20243        composeDateTimeCore("date", element.getDateElement(), false);
20244        composeDateTimeExtras("date", element.getDateElement(), false);
20245      }
20246      if (element.hasOrderedBy()) {
20247        composeCodeableConcept("orderedBy", element.getOrderedBy());
20248      }
20249      if (element.hasModeElement()) {
20250        composeEnumerationCore("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20251        composeEnumerationExtras("mode", element.getModeElement(), new List_.ListModeEnumFactory(), false);
20252      }
20253      if (element.hasNoteElement()) {
20254        composeStringCore("note", element.getNoteElement(), false);
20255        composeStringExtras("note", element.getNoteElement(), false);
20256      }
20257      if (element.hasEntry()) {
20258        openArray("entry");
20259        for (List_.ListEntryComponent e : element.getEntry()) 
20260          composeList_ListEntryComponent(null, e);
20261        closeArray();
20262      };
20263      if (element.hasEmptyReason()) {
20264        composeCodeableConcept("emptyReason", element.getEmptyReason());
20265      }
20266  }
20267
20268  protected void composeList_ListEntryComponent(String name, List_.ListEntryComponent element) throws IOException {
20269    if (element != null) {
20270      open(name);
20271      composeList_ListEntryComponentInner(element);
20272      close();
20273    }
20274  }
20275
20276  protected void composeList_ListEntryComponentInner(List_.ListEntryComponent element) throws IOException {
20277      composeBackbone(element);
20278      if (element.hasFlag()) {
20279        composeCodeableConcept("flag", element.getFlag());
20280      }
20281      if (element.hasDeletedElement()) {
20282        composeBooleanCore("deleted", element.getDeletedElement(), false);
20283        composeBooleanExtras("deleted", element.getDeletedElement(), false);
20284      }
20285      if (element.hasDateElement()) {
20286        composeDateTimeCore("date", element.getDateElement(), false);
20287        composeDateTimeExtras("date", element.getDateElement(), false);
20288      }
20289      if (element.hasItem()) {
20290        composeReference("item", element.getItem());
20291      }
20292  }
20293
20294  protected void composeLocation(String name, Location element) throws IOException {
20295    if (element != null) {
20296      prop("resourceType", name);
20297      composeLocationInner(element);
20298    }
20299  }
20300
20301  protected void composeLocationInner(Location element) throws IOException {
20302      composeDomainResourceElements(element);
20303      if (element.hasIdentifier()) {
20304        openArray("identifier");
20305        for (Identifier e : element.getIdentifier()) 
20306          composeIdentifier(null, e);
20307        closeArray();
20308      };
20309      if (element.hasStatusElement()) {
20310        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20311        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
20312      }
20313      if (element.hasNameElement()) {
20314        composeStringCore("name", element.getNameElement(), false);
20315        composeStringExtras("name", element.getNameElement(), false);
20316      }
20317      if (element.hasDescriptionElement()) {
20318        composeStringCore("description", element.getDescriptionElement(), false);
20319        composeStringExtras("description", element.getDescriptionElement(), false);
20320      }
20321      if (element.hasModeElement()) {
20322        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20323        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
20324      }
20325      if (element.hasType()) {
20326        composeCodeableConcept("type", element.getType());
20327      }
20328      if (element.hasTelecom()) {
20329        openArray("telecom");
20330        for (ContactPoint e : element.getTelecom()) 
20331          composeContactPoint(null, e);
20332        closeArray();
20333      };
20334      if (element.hasAddress()) {
20335        composeAddress("address", element.getAddress());
20336      }
20337      if (element.hasPhysicalType()) {
20338        composeCodeableConcept("physicalType", element.getPhysicalType());
20339      }
20340      if (element.hasPosition()) {
20341        composeLocationLocationPositionComponent("position", element.getPosition());
20342      }
20343      if (element.hasManagingOrganization()) {
20344        composeReference("managingOrganization", element.getManagingOrganization());
20345      }
20346      if (element.hasPartOf()) {
20347        composeReference("partOf", element.getPartOf());
20348      }
20349  }
20350
20351  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
20352    if (element != null) {
20353      open(name);
20354      composeLocationLocationPositionComponentInner(element);
20355      close();
20356    }
20357  }
20358
20359  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
20360      composeBackbone(element);
20361      if (element.hasLongitudeElement()) {
20362        composeDecimalCore("longitude", element.getLongitudeElement(), false);
20363        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
20364      }
20365      if (element.hasLatitudeElement()) {
20366        composeDecimalCore("latitude", element.getLatitudeElement(), false);
20367        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
20368      }
20369      if (element.hasAltitudeElement()) {
20370        composeDecimalCore("altitude", element.getAltitudeElement(), false);
20371        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
20372      }
20373  }
20374
20375  protected void composeMedia(String name, Media element) throws IOException {
20376    if (element != null) {
20377      prop("resourceType", name);
20378      composeMediaInner(element);
20379    }
20380  }
20381
20382  protected void composeMediaInner(Media element) throws IOException {
20383      composeDomainResourceElements(element);
20384      if (element.hasTypeElement()) {
20385        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20386        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
20387      }
20388      if (element.hasSubtype()) {
20389        composeCodeableConcept("subtype", element.getSubtype());
20390      }
20391      if (element.hasIdentifier()) {
20392        openArray("identifier");
20393        for (Identifier e : element.getIdentifier()) 
20394          composeIdentifier(null, e);
20395        closeArray();
20396      };
20397      if (element.hasSubject()) {
20398        composeReference("subject", element.getSubject());
20399      }
20400      if (element.hasOperator()) {
20401        composeReference("operator", element.getOperator());
20402      }
20403      if (element.hasView()) {
20404        composeCodeableConcept("view", element.getView());
20405      }
20406      if (element.hasDeviceNameElement()) {
20407        composeStringCore("deviceName", element.getDeviceNameElement(), false);
20408        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
20409      }
20410      if (element.hasHeightElement()) {
20411        composePositiveIntCore("height", element.getHeightElement(), false);
20412        composePositiveIntExtras("height", element.getHeightElement(), false);
20413      }
20414      if (element.hasWidthElement()) {
20415        composePositiveIntCore("width", element.getWidthElement(), false);
20416        composePositiveIntExtras("width", element.getWidthElement(), false);
20417      }
20418      if (element.hasFramesElement()) {
20419        composePositiveIntCore("frames", element.getFramesElement(), false);
20420        composePositiveIntExtras("frames", element.getFramesElement(), false);
20421      }
20422      if (element.hasDurationElement()) {
20423        composeUnsignedIntCore("duration", element.getDurationElement(), false);
20424        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
20425      }
20426      if (element.hasContent()) {
20427        composeAttachment("content", element.getContent());
20428      }
20429  }
20430
20431  protected void composeMedication(String name, Medication element) throws IOException {
20432    if (element != null) {
20433      prop("resourceType", name);
20434      composeMedicationInner(element);
20435    }
20436  }
20437
20438  protected void composeMedicationInner(Medication element) throws IOException {
20439      composeDomainResourceElements(element);
20440      if (element.hasCode()) {
20441        composeCodeableConcept("code", element.getCode());
20442      }
20443      if (element.hasIsBrandElement()) {
20444        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
20445        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
20446      }
20447      if (element.hasManufacturer()) {
20448        composeReference("manufacturer", element.getManufacturer());
20449      }
20450      if (element.hasProduct()) {
20451        composeMedicationMedicationProductComponent("product", element.getProduct());
20452      }
20453      if (element.hasPackage()) {
20454        composeMedicationMedicationPackageComponent("package", element.getPackage());
20455      }
20456  }
20457
20458  protected void composeMedicationMedicationProductComponent(String name, Medication.MedicationProductComponent element) throws IOException {
20459    if (element != null) {
20460      open(name);
20461      composeMedicationMedicationProductComponentInner(element);
20462      close();
20463    }
20464  }
20465
20466  protected void composeMedicationMedicationProductComponentInner(Medication.MedicationProductComponent element) throws IOException {
20467      composeBackbone(element);
20468      if (element.hasForm()) {
20469        composeCodeableConcept("form", element.getForm());
20470      }
20471      if (element.hasIngredient()) {
20472        openArray("ingredient");
20473        for (Medication.MedicationProductIngredientComponent e : element.getIngredient()) 
20474          composeMedicationMedicationProductIngredientComponent(null, e);
20475        closeArray();
20476      };
20477      if (element.hasBatch()) {
20478        openArray("batch");
20479        for (Medication.MedicationProductBatchComponent e : element.getBatch()) 
20480          composeMedicationMedicationProductBatchComponent(null, e);
20481        closeArray();
20482      };
20483  }
20484
20485  protected void composeMedicationMedicationProductIngredientComponent(String name, Medication.MedicationProductIngredientComponent element) throws IOException {
20486    if (element != null) {
20487      open(name);
20488      composeMedicationMedicationProductIngredientComponentInner(element);
20489      close();
20490    }
20491  }
20492
20493  protected void composeMedicationMedicationProductIngredientComponentInner(Medication.MedicationProductIngredientComponent element) throws IOException {
20494      composeBackbone(element);
20495      if (element.hasItem()) {
20496        composeReference("item", element.getItem());
20497      }
20498      if (element.hasAmount()) {
20499        composeRatio("amount", element.getAmount());
20500      }
20501  }
20502
20503  protected void composeMedicationMedicationProductBatchComponent(String name, Medication.MedicationProductBatchComponent element) throws IOException {
20504    if (element != null) {
20505      open(name);
20506      composeMedicationMedicationProductBatchComponentInner(element);
20507      close();
20508    }
20509  }
20510
20511  protected void composeMedicationMedicationProductBatchComponentInner(Medication.MedicationProductBatchComponent element) throws IOException {
20512      composeBackbone(element);
20513      if (element.hasLotNumberElement()) {
20514        composeStringCore("lotNumber", element.getLotNumberElement(), false);
20515        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
20516      }
20517      if (element.hasExpirationDateElement()) {
20518        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
20519        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
20520      }
20521  }
20522
20523  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
20524    if (element != null) {
20525      open(name);
20526      composeMedicationMedicationPackageComponentInner(element);
20527      close();
20528    }
20529  }
20530
20531  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
20532      composeBackbone(element);
20533      if (element.hasContainer()) {
20534        composeCodeableConcept("container", element.getContainer());
20535      }
20536      if (element.hasContent()) {
20537        openArray("content");
20538        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
20539          composeMedicationMedicationPackageContentComponent(null, e);
20540        closeArray();
20541      };
20542  }
20543
20544  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
20545    if (element != null) {
20546      open(name);
20547      composeMedicationMedicationPackageContentComponentInner(element);
20548      close();
20549    }
20550  }
20551
20552  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
20553      composeBackbone(element);
20554      if (element.hasItem()) {
20555        composeReference("item", element.getItem());
20556      }
20557      if (element.hasAmount()) {
20558        composeSimpleQuantity("amount", element.getAmount());
20559      }
20560  }
20561
20562  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
20563    if (element != null) {
20564      prop("resourceType", name);
20565      composeMedicationAdministrationInner(element);
20566    }
20567  }
20568
20569  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
20570      composeDomainResourceElements(element);
20571      if (element.hasIdentifier()) {
20572        openArray("identifier");
20573        for (Identifier e : element.getIdentifier()) 
20574          composeIdentifier(null, e);
20575        closeArray();
20576      };
20577      if (element.hasStatusElement()) {
20578        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20579        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
20580      }
20581      if (element.hasPatient()) {
20582        composeReference("patient", element.getPatient());
20583      }
20584      if (element.hasPractitioner()) {
20585        composeReference("practitioner", element.getPractitioner());
20586      }
20587      if (element.hasEncounter()) {
20588        composeReference("encounter", element.getEncounter());
20589      }
20590      if (element.hasPrescription()) {
20591        composeReference("prescription", element.getPrescription());
20592      }
20593      if (element.hasWasNotGivenElement()) {
20594        composeBooleanCore("wasNotGiven", element.getWasNotGivenElement(), false);
20595        composeBooleanExtras("wasNotGiven", element.getWasNotGivenElement(), false);
20596      }
20597      if (element.hasReasonNotGiven()) {
20598        openArray("reasonNotGiven");
20599        for (CodeableConcept e : element.getReasonNotGiven()) 
20600          composeCodeableConcept(null, e);
20601        closeArray();
20602      };
20603      if (element.hasReasonGiven()) {
20604        openArray("reasonGiven");
20605        for (CodeableConcept e : element.getReasonGiven()) 
20606          composeCodeableConcept(null, e);
20607        closeArray();
20608      };
20609      if (element.hasEffectiveTime()) {
20610        composeType("effectiveTime", element.getEffectiveTime());
20611      }
20612      if (element.hasMedication()) {
20613        composeType("medication", element.getMedication());
20614      }
20615      if (element.hasDevice()) {
20616        openArray("device");
20617        for (Reference e : element.getDevice()) 
20618          composeReference(null, e);
20619        closeArray();
20620      };
20621      if (element.hasNoteElement()) {
20622        composeStringCore("note", element.getNoteElement(), false);
20623        composeStringExtras("note", element.getNoteElement(), false);
20624      }
20625      if (element.hasDosage()) {
20626        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
20627      }
20628  }
20629
20630  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20631    if (element != null) {
20632      open(name);
20633      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
20634      close();
20635    }
20636  }
20637
20638  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
20639      composeBackbone(element);
20640      if (element.hasTextElement()) {
20641        composeStringCore("text", element.getTextElement(), false);
20642        composeStringExtras("text", element.getTextElement(), false);
20643      }
20644      if (element.hasSite()) {
20645        composeType("site", element.getSite());
20646      }
20647      if (element.hasRoute()) {
20648        composeCodeableConcept("route", element.getRoute());
20649      }
20650      if (element.hasMethod()) {
20651        composeCodeableConcept("method", element.getMethod());
20652      }
20653      if (element.hasQuantity()) {
20654        composeSimpleQuantity("quantity", element.getQuantity());
20655      }
20656      if (element.hasRate()) {
20657        composeType("rate", element.getRate());
20658      }
20659  }
20660
20661  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
20662    if (element != null) {
20663      prop("resourceType", name);
20664      composeMedicationDispenseInner(element);
20665    }
20666  }
20667
20668  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
20669      composeDomainResourceElements(element);
20670      if (element.hasIdentifier()) {
20671        composeIdentifier("identifier", element.getIdentifier());
20672      }
20673      if (element.hasStatusElement()) {
20674        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20675        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
20676      }
20677      if (element.hasPatient()) {
20678        composeReference("patient", element.getPatient());
20679      }
20680      if (element.hasDispenser()) {
20681        composeReference("dispenser", element.getDispenser());
20682      }
20683      if (element.hasAuthorizingPrescription()) {
20684        openArray("authorizingPrescription");
20685        for (Reference e : element.getAuthorizingPrescription()) 
20686          composeReference(null, e);
20687        closeArray();
20688      };
20689      if (element.hasType()) {
20690        composeCodeableConcept("type", element.getType());
20691      }
20692      if (element.hasQuantity()) {
20693        composeSimpleQuantity("quantity", element.getQuantity());
20694      }
20695      if (element.hasDaysSupply()) {
20696        composeSimpleQuantity("daysSupply", element.getDaysSupply());
20697      }
20698      if (element.hasMedication()) {
20699        composeType("medication", element.getMedication());
20700      }
20701      if (element.hasWhenPreparedElement()) {
20702        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
20703        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
20704      }
20705      if (element.hasWhenHandedOverElement()) {
20706        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
20707        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
20708      }
20709      if (element.hasDestination()) {
20710        composeReference("destination", element.getDestination());
20711      }
20712      if (element.hasReceiver()) {
20713        openArray("receiver");
20714        for (Reference e : element.getReceiver()) 
20715          composeReference(null, e);
20716        closeArray();
20717      };
20718      if (element.hasNoteElement()) {
20719        composeStringCore("note", element.getNoteElement(), false);
20720        composeStringExtras("note", element.getNoteElement(), false);
20721      }
20722      if (element.hasDosageInstruction()) {
20723        openArray("dosageInstruction");
20724        for (MedicationDispense.MedicationDispenseDosageInstructionComponent e : element.getDosageInstruction()) 
20725          composeMedicationDispenseMedicationDispenseDosageInstructionComponent(null, e);
20726        closeArray();
20727      };
20728      if (element.hasSubstitution()) {
20729        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
20730      }
20731  }
20732
20733  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponent(String name, MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20734    if (element != null) {
20735      open(name);
20736      composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(element);
20737      close();
20738    }
20739  }
20740
20741  protected void composeMedicationDispenseMedicationDispenseDosageInstructionComponentInner(MedicationDispense.MedicationDispenseDosageInstructionComponent element) throws IOException {
20742      composeBackbone(element);
20743      if (element.hasTextElement()) {
20744        composeStringCore("text", element.getTextElement(), false);
20745        composeStringExtras("text", element.getTextElement(), false);
20746      }
20747      if (element.hasAdditionalInstructions()) {
20748        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20749      }
20750      if (element.hasTiming()) {
20751        composeTiming("timing", element.getTiming());
20752      }
20753      if (element.hasAsNeeded()) {
20754        composeType("asNeeded", element.getAsNeeded());
20755      }
20756      if (element.hasSite()) {
20757        composeType("site", element.getSite());
20758      }
20759      if (element.hasRoute()) {
20760        composeCodeableConcept("route", element.getRoute());
20761      }
20762      if (element.hasMethod()) {
20763        composeCodeableConcept("method", element.getMethod());
20764      }
20765      if (element.hasDose()) {
20766        composeType("dose", element.getDose());
20767      }
20768      if (element.hasRate()) {
20769        composeType("rate", element.getRate());
20770      }
20771      if (element.hasMaxDosePerPeriod()) {
20772        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20773      }
20774  }
20775
20776  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20777    if (element != null) {
20778      open(name);
20779      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
20780      close();
20781    }
20782  }
20783
20784  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
20785      composeBackbone(element);
20786      if (element.hasType()) {
20787        composeCodeableConcept("type", element.getType());
20788      }
20789      if (element.hasReason()) {
20790        openArray("reason");
20791        for (CodeableConcept e : element.getReason()) 
20792          composeCodeableConcept(null, e);
20793        closeArray();
20794      };
20795      if (element.hasResponsibleParty()) {
20796        openArray("responsibleParty");
20797        for (Reference e : element.getResponsibleParty()) 
20798          composeReference(null, e);
20799        closeArray();
20800      };
20801  }
20802
20803  protected void composeMedicationOrder(String name, MedicationOrder element) throws IOException {
20804    if (element != null) {
20805      prop("resourceType", name);
20806      composeMedicationOrderInner(element);
20807    }
20808  }
20809
20810  protected void composeMedicationOrderInner(MedicationOrder element) throws IOException {
20811      composeDomainResourceElements(element);
20812      if (element.hasIdentifier()) {
20813        openArray("identifier");
20814        for (Identifier e : element.getIdentifier()) 
20815          composeIdentifier(null, e);
20816        closeArray();
20817      };
20818      if (element.hasDateWrittenElement()) {
20819        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
20820        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
20821      }
20822      if (element.hasStatusElement()) {
20823        composeEnumerationCore("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20824        composeEnumerationExtras("status", element.getStatusElement(), new MedicationOrder.MedicationOrderStatusEnumFactory(), false);
20825      }
20826      if (element.hasDateEndedElement()) {
20827        composeDateTimeCore("dateEnded", element.getDateEndedElement(), false);
20828        composeDateTimeExtras("dateEnded", element.getDateEndedElement(), false);
20829      }
20830      if (element.hasReasonEnded()) {
20831        composeCodeableConcept("reasonEnded", element.getReasonEnded());
20832      }
20833      if (element.hasPatient()) {
20834        composeReference("patient", element.getPatient());
20835      }
20836      if (element.hasPrescriber()) {
20837        composeReference("prescriber", element.getPrescriber());
20838      }
20839      if (element.hasEncounter()) {
20840        composeReference("encounter", element.getEncounter());
20841      }
20842      if (element.hasReason()) {
20843        composeType("reason", element.getReason());
20844      }
20845      if (element.hasNoteElement()) {
20846        composeStringCore("note", element.getNoteElement(), false);
20847        composeStringExtras("note", element.getNoteElement(), false);
20848      }
20849      if (element.hasMedication()) {
20850        composeType("medication", element.getMedication());
20851      }
20852      if (element.hasDosageInstruction()) {
20853        openArray("dosageInstruction");
20854        for (MedicationOrder.MedicationOrderDosageInstructionComponent e : element.getDosageInstruction()) 
20855          composeMedicationOrderMedicationOrderDosageInstructionComponent(null, e);
20856        closeArray();
20857      };
20858      if (element.hasDispenseRequest()) {
20859        composeMedicationOrderMedicationOrderDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
20860      }
20861      if (element.hasSubstitution()) {
20862        composeMedicationOrderMedicationOrderSubstitutionComponent("substitution", element.getSubstitution());
20863      }
20864      if (element.hasPriorPrescription()) {
20865        composeReference("priorPrescription", element.getPriorPrescription());
20866      }
20867  }
20868
20869  protected void composeMedicationOrderMedicationOrderDosageInstructionComponent(String name, MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20870    if (element != null) {
20871      open(name);
20872      composeMedicationOrderMedicationOrderDosageInstructionComponentInner(element);
20873      close();
20874    }
20875  }
20876
20877  protected void composeMedicationOrderMedicationOrderDosageInstructionComponentInner(MedicationOrder.MedicationOrderDosageInstructionComponent element) throws IOException {
20878      composeBackbone(element);
20879      if (element.hasTextElement()) {
20880        composeStringCore("text", element.getTextElement(), false);
20881        composeStringExtras("text", element.getTextElement(), false);
20882      }
20883      if (element.hasAdditionalInstructions()) {
20884        composeCodeableConcept("additionalInstructions", element.getAdditionalInstructions());
20885      }
20886      if (element.hasTiming()) {
20887        composeTiming("timing", element.getTiming());
20888      }
20889      if (element.hasAsNeeded()) {
20890        composeType("asNeeded", element.getAsNeeded());
20891      }
20892      if (element.hasSite()) {
20893        composeType("site", element.getSite());
20894      }
20895      if (element.hasRoute()) {
20896        composeCodeableConcept("route", element.getRoute());
20897      }
20898      if (element.hasMethod()) {
20899        composeCodeableConcept("method", element.getMethod());
20900      }
20901      if (element.hasDose()) {
20902        composeType("dose", element.getDose());
20903      }
20904      if (element.hasRate()) {
20905        composeType("rate", element.getRate());
20906      }
20907      if (element.hasMaxDosePerPeriod()) {
20908        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
20909      }
20910  }
20911
20912  protected void composeMedicationOrderMedicationOrderDispenseRequestComponent(String name, MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20913    if (element != null) {
20914      open(name);
20915      composeMedicationOrderMedicationOrderDispenseRequestComponentInner(element);
20916      close();
20917    }
20918  }
20919
20920  protected void composeMedicationOrderMedicationOrderDispenseRequestComponentInner(MedicationOrder.MedicationOrderDispenseRequestComponent element) throws IOException {
20921      composeBackbone(element);
20922      if (element.hasMedication()) {
20923        composeType("medication", element.getMedication());
20924      }
20925      if (element.hasValidityPeriod()) {
20926        composePeriod("validityPeriod", element.getValidityPeriod());
20927      }
20928      if (element.hasNumberOfRepeatsAllowedElement()) {
20929        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20930        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
20931      }
20932      if (element.hasQuantity()) {
20933        composeSimpleQuantity("quantity", element.getQuantity());
20934      }
20935      if (element.hasExpectedSupplyDuration()) {
20936        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
20937      }
20938  }
20939
20940  protected void composeMedicationOrderMedicationOrderSubstitutionComponent(String name, MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20941    if (element != null) {
20942      open(name);
20943      composeMedicationOrderMedicationOrderSubstitutionComponentInner(element);
20944      close();
20945    }
20946  }
20947
20948  protected void composeMedicationOrderMedicationOrderSubstitutionComponentInner(MedicationOrder.MedicationOrderSubstitutionComponent element) throws IOException {
20949      composeBackbone(element);
20950      if (element.hasType()) {
20951        composeCodeableConcept("type", element.getType());
20952      }
20953      if (element.hasReason()) {
20954        composeCodeableConcept("reason", element.getReason());
20955      }
20956  }
20957
20958  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
20959    if (element != null) {
20960      prop("resourceType", name);
20961      composeMedicationStatementInner(element);
20962    }
20963  }
20964
20965  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
20966      composeDomainResourceElements(element);
20967      if (element.hasIdentifier()) {
20968        openArray("identifier");
20969        for (Identifier e : element.getIdentifier()) 
20970          composeIdentifier(null, e);
20971        closeArray();
20972      };
20973      if (element.hasPatient()) {
20974        composeReference("patient", element.getPatient());
20975      }
20976      if (element.hasInformationSource()) {
20977        composeReference("informationSource", element.getInformationSource());
20978      }
20979      if (element.hasDateAssertedElement()) {
20980        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
20981        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
20982      }
20983      if (element.hasStatusElement()) {
20984        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20985        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
20986      }
20987      if (element.hasWasNotTakenElement()) {
20988        composeBooleanCore("wasNotTaken", element.getWasNotTakenElement(), false);
20989        composeBooleanExtras("wasNotTaken", element.getWasNotTakenElement(), false);
20990      }
20991      if (element.hasReasonNotTaken()) {
20992        openArray("reasonNotTaken");
20993        for (CodeableConcept e : element.getReasonNotTaken()) 
20994          composeCodeableConcept(null, e);
20995        closeArray();
20996      };
20997      if (element.hasReasonForUse()) {
20998        composeType("reasonForUse", element.getReasonForUse());
20999      }
21000      if (element.hasEffective()) {
21001        composeType("effective", element.getEffective());
21002      }
21003      if (element.hasNoteElement()) {
21004        composeStringCore("note", element.getNoteElement(), false);
21005        composeStringExtras("note", element.getNoteElement(), false);
21006      }
21007      if (element.hasSupportingInformation()) {
21008        openArray("supportingInformation");
21009        for (Reference e : element.getSupportingInformation()) 
21010          composeReference(null, e);
21011        closeArray();
21012      };
21013      if (element.hasMedication()) {
21014        composeType("medication", element.getMedication());
21015      }
21016      if (element.hasDosage()) {
21017        openArray("dosage");
21018        for (MedicationStatement.MedicationStatementDosageComponent e : element.getDosage()) 
21019          composeMedicationStatementMedicationStatementDosageComponent(null, e);
21020        closeArray();
21021      };
21022  }
21023
21024  protected void composeMedicationStatementMedicationStatementDosageComponent(String name, MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21025    if (element != null) {
21026      open(name);
21027      composeMedicationStatementMedicationStatementDosageComponentInner(element);
21028      close();
21029    }
21030  }
21031
21032  protected void composeMedicationStatementMedicationStatementDosageComponentInner(MedicationStatement.MedicationStatementDosageComponent element) throws IOException {
21033      composeBackbone(element);
21034      if (element.hasTextElement()) {
21035        composeStringCore("text", element.getTextElement(), false);
21036        composeStringExtras("text", element.getTextElement(), false);
21037      }
21038      if (element.hasTiming()) {
21039        composeTiming("timing", element.getTiming());
21040      }
21041      if (element.hasAsNeeded()) {
21042        composeType("asNeeded", element.getAsNeeded());
21043      }
21044      if (element.hasSite()) {
21045        composeType("site", element.getSite());
21046      }
21047      if (element.hasRoute()) {
21048        composeCodeableConcept("route", element.getRoute());
21049      }
21050      if (element.hasMethod()) {
21051        composeCodeableConcept("method", element.getMethod());
21052      }
21053      if (element.hasQuantity()) {
21054        composeType("quantity", element.getQuantity());
21055      }
21056      if (element.hasRate()) {
21057        composeType("rate", element.getRate());
21058      }
21059      if (element.hasMaxDosePerPeriod()) {
21060        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21061      }
21062  }
21063
21064  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
21065    if (element != null) {
21066      prop("resourceType", name);
21067      composeMessageHeaderInner(element);
21068    }
21069  }
21070
21071  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
21072      composeDomainResourceElements(element);
21073      if (element.hasTimestampElement()) {
21074        composeInstantCore("timestamp", element.getTimestampElement(), false);
21075        composeInstantExtras("timestamp", element.getTimestampElement(), false);
21076      }
21077      if (element.hasEvent()) {
21078        composeCoding("event", element.getEvent());
21079      }
21080      if (element.hasResponse()) {
21081        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
21082      }
21083      if (element.hasSource()) {
21084        composeMessageHeaderMessageSourceComponent("source", element.getSource());
21085      }
21086      if (element.hasDestination()) {
21087        openArray("destination");
21088        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
21089          composeMessageHeaderMessageDestinationComponent(null, e);
21090        closeArray();
21091      };
21092      if (element.hasEnterer()) {
21093        composeReference("enterer", element.getEnterer());
21094      }
21095      if (element.hasAuthor()) {
21096        composeReference("author", element.getAuthor());
21097      }
21098      if (element.hasReceiver()) {
21099        composeReference("receiver", element.getReceiver());
21100      }
21101      if (element.hasResponsible()) {
21102        composeReference("responsible", element.getResponsible());
21103      }
21104      if (element.hasReason()) {
21105        composeCodeableConcept("reason", element.getReason());
21106      }
21107      if (element.hasData()) {
21108        openArray("data");
21109        for (Reference e : element.getData()) 
21110          composeReference(null, e);
21111        closeArray();
21112      };
21113  }
21114
21115  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21116    if (element != null) {
21117      open(name);
21118      composeMessageHeaderMessageHeaderResponseComponentInner(element);
21119      close();
21120    }
21121  }
21122
21123  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
21124      composeBackbone(element);
21125      if (element.hasIdentifierElement()) {
21126        composeIdCore("identifier", element.getIdentifierElement(), false);
21127        composeIdExtras("identifier", element.getIdentifierElement(), false);
21128      }
21129      if (element.hasCodeElement()) {
21130        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21131        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
21132      }
21133      if (element.hasDetails()) {
21134        composeReference("details", element.getDetails());
21135      }
21136  }
21137
21138  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
21139    if (element != null) {
21140      open(name);
21141      composeMessageHeaderMessageSourceComponentInner(element);
21142      close();
21143    }
21144  }
21145
21146  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
21147      composeBackbone(element);
21148      if (element.hasNameElement()) {
21149        composeStringCore("name", element.getNameElement(), false);
21150        composeStringExtras("name", element.getNameElement(), false);
21151      }
21152      if (element.hasSoftwareElement()) {
21153        composeStringCore("software", element.getSoftwareElement(), false);
21154        composeStringExtras("software", element.getSoftwareElement(), false);
21155      }
21156      if (element.hasVersionElement()) {
21157        composeStringCore("version", element.getVersionElement(), false);
21158        composeStringExtras("version", element.getVersionElement(), false);
21159      }
21160      if (element.hasContact()) {
21161        composeContactPoint("contact", element.getContact());
21162      }
21163      if (element.hasEndpointElement()) {
21164        composeUriCore("endpoint", element.getEndpointElement(), false);
21165        composeUriExtras("endpoint", element.getEndpointElement(), false);
21166      }
21167  }
21168
21169  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
21170    if (element != null) {
21171      open(name);
21172      composeMessageHeaderMessageDestinationComponentInner(element);
21173      close();
21174    }
21175  }
21176
21177  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
21178      composeBackbone(element);
21179      if (element.hasNameElement()) {
21180        composeStringCore("name", element.getNameElement(), false);
21181        composeStringExtras("name", element.getNameElement(), false);
21182      }
21183      if (element.hasTarget()) {
21184        composeReference("target", element.getTarget());
21185      }
21186      if (element.hasEndpointElement()) {
21187        composeUriCore("endpoint", element.getEndpointElement(), false);
21188        composeUriExtras("endpoint", element.getEndpointElement(), false);
21189      }
21190  }
21191
21192  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
21193    if (element != null) {
21194      prop("resourceType", name);
21195      composeNamingSystemInner(element);
21196    }
21197  }
21198
21199  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
21200      composeDomainResourceElements(element);
21201      if (element.hasNameElement()) {
21202        composeStringCore("name", element.getNameElement(), false);
21203        composeStringExtras("name", element.getNameElement(), false);
21204      }
21205      if (element.hasStatusElement()) {
21206        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21207        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21208      }
21209      if (element.hasKindElement()) {
21210        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21211        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
21212      }
21213      if (element.hasPublisherElement()) {
21214        composeStringCore("publisher", element.getPublisherElement(), false);
21215        composeStringExtras("publisher", element.getPublisherElement(), false);
21216      }
21217      if (element.hasContact()) {
21218        openArray("contact");
21219        for (NamingSystem.NamingSystemContactComponent e : element.getContact()) 
21220          composeNamingSystemNamingSystemContactComponent(null, e);
21221        closeArray();
21222      };
21223      if (element.hasResponsibleElement()) {
21224        composeStringCore("responsible", element.getResponsibleElement(), false);
21225        composeStringExtras("responsible", element.getResponsibleElement(), false);
21226      }
21227      if (element.hasDateElement()) {
21228        composeDateTimeCore("date", element.getDateElement(), false);
21229        composeDateTimeExtras("date", element.getDateElement(), false);
21230      }
21231      if (element.hasType()) {
21232        composeCodeableConcept("type", element.getType());
21233      }
21234      if (element.hasDescriptionElement()) {
21235        composeStringCore("description", element.getDescriptionElement(), false);
21236        composeStringExtras("description", element.getDescriptionElement(), false);
21237      }
21238      if (element.hasUseContext()) {
21239        openArray("useContext");
21240        for (CodeableConcept e : element.getUseContext()) 
21241          composeCodeableConcept(null, e);
21242        closeArray();
21243      };
21244      if (element.hasUsageElement()) {
21245        composeStringCore("usage", element.getUsageElement(), false);
21246        composeStringExtras("usage", element.getUsageElement(), false);
21247      }
21248      if (element.hasUniqueId()) {
21249        openArray("uniqueId");
21250        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
21251          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
21252        closeArray();
21253      };
21254      if (element.hasReplacedBy()) {
21255        composeReference("replacedBy", element.getReplacedBy());
21256      }
21257  }
21258
21259  protected void composeNamingSystemNamingSystemContactComponent(String name, NamingSystem.NamingSystemContactComponent element) throws IOException {
21260    if (element != null) {
21261      open(name);
21262      composeNamingSystemNamingSystemContactComponentInner(element);
21263      close();
21264    }
21265  }
21266
21267  protected void composeNamingSystemNamingSystemContactComponentInner(NamingSystem.NamingSystemContactComponent element) throws IOException {
21268      composeBackbone(element);
21269      if (element.hasNameElement()) {
21270        composeStringCore("name", element.getNameElement(), false);
21271        composeStringExtras("name", element.getNameElement(), false);
21272      }
21273      if (element.hasTelecom()) {
21274        openArray("telecom");
21275        for (ContactPoint e : element.getTelecom()) 
21276          composeContactPoint(null, e);
21277        closeArray();
21278      };
21279  }
21280
21281  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21282    if (element != null) {
21283      open(name);
21284      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
21285      close();
21286    }
21287  }
21288
21289  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
21290      composeBackbone(element);
21291      if (element.hasTypeElement()) {
21292        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21293        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
21294      }
21295      if (element.hasValueElement()) {
21296        composeStringCore("value", element.getValueElement(), false);
21297        composeStringExtras("value", element.getValueElement(), false);
21298      }
21299      if (element.hasPreferredElement()) {
21300        composeBooleanCore("preferred", element.getPreferredElement(), false);
21301        composeBooleanExtras("preferred", element.getPreferredElement(), false);
21302      }
21303      if (element.hasPeriod()) {
21304        composePeriod("period", element.getPeriod());
21305      }
21306  }
21307
21308  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
21309    if (element != null) {
21310      prop("resourceType", name);
21311      composeNutritionOrderInner(element);
21312    }
21313  }
21314
21315  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
21316      composeDomainResourceElements(element);
21317      if (element.hasPatient()) {
21318        composeReference("patient", element.getPatient());
21319      }
21320      if (element.hasOrderer()) {
21321        composeReference("orderer", element.getOrderer());
21322      }
21323      if (element.hasIdentifier()) {
21324        openArray("identifier");
21325        for (Identifier e : element.getIdentifier()) 
21326          composeIdentifier(null, e);
21327        closeArray();
21328      };
21329      if (element.hasEncounter()) {
21330        composeReference("encounter", element.getEncounter());
21331      }
21332      if (element.hasDateTimeElement()) {
21333        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
21334        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
21335      }
21336      if (element.hasStatusElement()) {
21337        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21338        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
21339      }
21340      if (element.hasAllergyIntolerance()) {
21341        openArray("allergyIntolerance");
21342        for (Reference e : element.getAllergyIntolerance()) 
21343          composeReference(null, e);
21344        closeArray();
21345      };
21346      if (element.hasFoodPreferenceModifier()) {
21347        openArray("foodPreferenceModifier");
21348        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
21349          composeCodeableConcept(null, e);
21350        closeArray();
21351      };
21352      if (element.hasExcludeFoodModifier()) {
21353        openArray("excludeFoodModifier");
21354        for (CodeableConcept e : element.getExcludeFoodModifier()) 
21355          composeCodeableConcept(null, e);
21356        closeArray();
21357      };
21358      if (element.hasOralDiet()) {
21359        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
21360      }
21361      if (element.hasSupplement()) {
21362        openArray("supplement");
21363        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
21364          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
21365        closeArray();
21366      };
21367      if (element.hasEnteralFormula()) {
21368        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
21369      }
21370  }
21371
21372  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21373    if (element != null) {
21374      open(name);
21375      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
21376      close();
21377    }
21378  }
21379
21380  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
21381      composeBackbone(element);
21382      if (element.hasType()) {
21383        openArray("type");
21384        for (CodeableConcept e : element.getType()) 
21385          composeCodeableConcept(null, e);
21386        closeArray();
21387      };
21388      if (element.hasSchedule()) {
21389        openArray("schedule");
21390        for (Timing e : element.getSchedule()) 
21391          composeTiming(null, e);
21392        closeArray();
21393      };
21394      if (element.hasNutrient()) {
21395        openArray("nutrient");
21396        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
21397          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
21398        closeArray();
21399      };
21400      if (element.hasTexture()) {
21401        openArray("texture");
21402        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
21403          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
21404        closeArray();
21405      };
21406      if (element.hasFluidConsistencyType()) {
21407        openArray("fluidConsistencyType");
21408        for (CodeableConcept e : element.getFluidConsistencyType()) 
21409          composeCodeableConcept(null, e);
21410        closeArray();
21411      };
21412      if (element.hasInstructionElement()) {
21413        composeStringCore("instruction", element.getInstructionElement(), false);
21414        composeStringExtras("instruction", element.getInstructionElement(), false);
21415      }
21416  }
21417
21418  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21419    if (element != null) {
21420      open(name);
21421      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
21422      close();
21423    }
21424  }
21425
21426  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
21427      composeBackbone(element);
21428      if (element.hasModifier()) {
21429        composeCodeableConcept("modifier", element.getModifier());
21430      }
21431      if (element.hasAmount()) {
21432        composeSimpleQuantity("amount", element.getAmount());
21433      }
21434  }
21435
21436  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21437    if (element != null) {
21438      open(name);
21439      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
21440      close();
21441    }
21442  }
21443
21444  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
21445      composeBackbone(element);
21446      if (element.hasModifier()) {
21447        composeCodeableConcept("modifier", element.getModifier());
21448      }
21449      if (element.hasFoodType()) {
21450        composeCodeableConcept("foodType", element.getFoodType());
21451      }
21452  }
21453
21454  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21455    if (element != null) {
21456      open(name);
21457      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
21458      close();
21459    }
21460  }
21461
21462  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
21463      composeBackbone(element);
21464      if (element.hasType()) {
21465        composeCodeableConcept("type", element.getType());
21466      }
21467      if (element.hasProductNameElement()) {
21468        composeStringCore("productName", element.getProductNameElement(), false);
21469        composeStringExtras("productName", element.getProductNameElement(), false);
21470      }
21471      if (element.hasSchedule()) {
21472        openArray("schedule");
21473        for (Timing e : element.getSchedule()) 
21474          composeTiming(null, e);
21475        closeArray();
21476      };
21477      if (element.hasQuantity()) {
21478        composeSimpleQuantity("quantity", element.getQuantity());
21479      }
21480      if (element.hasInstructionElement()) {
21481        composeStringCore("instruction", element.getInstructionElement(), false);
21482        composeStringExtras("instruction", element.getInstructionElement(), false);
21483      }
21484  }
21485
21486  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21487    if (element != null) {
21488      open(name);
21489      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
21490      close();
21491    }
21492  }
21493
21494  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
21495      composeBackbone(element);
21496      if (element.hasBaseFormulaType()) {
21497        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
21498      }
21499      if (element.hasBaseFormulaProductNameElement()) {
21500        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21501        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
21502      }
21503      if (element.hasAdditiveType()) {
21504        composeCodeableConcept("additiveType", element.getAdditiveType());
21505      }
21506      if (element.hasAdditiveProductNameElement()) {
21507        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
21508        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
21509      }
21510      if (element.hasCaloricDensity()) {
21511        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
21512      }
21513      if (element.hasRouteofAdministration()) {
21514        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
21515      }
21516      if (element.hasAdministration()) {
21517        openArray("administration");
21518        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
21519          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
21520        closeArray();
21521      };
21522      if (element.hasMaxVolumeToDeliver()) {
21523        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
21524      }
21525      if (element.hasAdministrationInstructionElement()) {
21526        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
21527        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
21528      }
21529  }
21530
21531  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21532    if (element != null) {
21533      open(name);
21534      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
21535      close();
21536    }
21537  }
21538
21539  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
21540      composeBackbone(element);
21541      if (element.hasSchedule()) {
21542        composeTiming("schedule", element.getSchedule());
21543      }
21544      if (element.hasQuantity()) {
21545        composeSimpleQuantity("quantity", element.getQuantity());
21546      }
21547      if (element.hasRate()) {
21548        composeType("rate", element.getRate());
21549      }
21550  }
21551
21552  protected void composeObservation(String name, Observation element) throws IOException {
21553    if (element != null) {
21554      prop("resourceType", name);
21555      composeObservationInner(element);
21556    }
21557  }
21558
21559  protected void composeObservationInner(Observation element) throws IOException {
21560      composeDomainResourceElements(element);
21561      if (element.hasIdentifier()) {
21562        openArray("identifier");
21563        for (Identifier e : element.getIdentifier()) 
21564          composeIdentifier(null, e);
21565        closeArray();
21566      };
21567      if (element.hasStatusElement()) {
21568        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21569        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
21570      }
21571      if (element.hasCategory()) {
21572        composeCodeableConcept("category", element.getCategory());
21573      }
21574      if (element.hasCode()) {
21575        composeCodeableConcept("code", element.getCode());
21576      }
21577      if (element.hasSubject()) {
21578        composeReference("subject", element.getSubject());
21579      }
21580      if (element.hasEncounter()) {
21581        composeReference("encounter", element.getEncounter());
21582      }
21583      if (element.hasEffective()) {
21584        composeType("effective", element.getEffective());
21585      }
21586      if (element.hasIssuedElement()) {
21587        composeInstantCore("issued", element.getIssuedElement(), false);
21588        composeInstantExtras("issued", element.getIssuedElement(), false);
21589      }
21590      if (element.hasPerformer()) {
21591        openArray("performer");
21592        for (Reference e : element.getPerformer()) 
21593          composeReference(null, e);
21594        closeArray();
21595      };
21596      if (element.hasValue()) {
21597        composeType("value", element.getValue());
21598      }
21599      if (element.hasDataAbsentReason()) {
21600        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21601      }
21602      if (element.hasInterpretation()) {
21603        composeCodeableConcept("interpretation", element.getInterpretation());
21604      }
21605      if (element.hasCommentsElement()) {
21606        composeStringCore("comments", element.getCommentsElement(), false);
21607        composeStringExtras("comments", element.getCommentsElement(), false);
21608      }
21609      if (element.hasBodySite()) {
21610        composeCodeableConcept("bodySite", element.getBodySite());
21611      }
21612      if (element.hasMethod()) {
21613        composeCodeableConcept("method", element.getMethod());
21614      }
21615      if (element.hasSpecimen()) {
21616        composeReference("specimen", element.getSpecimen());
21617      }
21618      if (element.hasDevice()) {
21619        composeReference("device", element.getDevice());
21620      }
21621      if (element.hasReferenceRange()) {
21622        openArray("referenceRange");
21623        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21624          composeObservationObservationReferenceRangeComponent(null, e);
21625        closeArray();
21626      };
21627      if (element.hasRelated()) {
21628        openArray("related");
21629        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
21630          composeObservationObservationRelatedComponent(null, e);
21631        closeArray();
21632      };
21633      if (element.hasComponent()) {
21634        openArray("component");
21635        for (Observation.ObservationComponentComponent e : element.getComponent()) 
21636          composeObservationObservationComponentComponent(null, e);
21637        closeArray();
21638      };
21639  }
21640
21641  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
21642    if (element != null) {
21643      open(name);
21644      composeObservationObservationReferenceRangeComponentInner(element);
21645      close();
21646    }
21647  }
21648
21649  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
21650      composeBackbone(element);
21651      if (element.hasLow()) {
21652        composeSimpleQuantity("low", element.getLow());
21653      }
21654      if (element.hasHigh()) {
21655        composeSimpleQuantity("high", element.getHigh());
21656      }
21657      if (element.hasMeaning()) {
21658        composeCodeableConcept("meaning", element.getMeaning());
21659      }
21660      if (element.hasAge()) {
21661        composeRange("age", element.getAge());
21662      }
21663      if (element.hasTextElement()) {
21664        composeStringCore("text", element.getTextElement(), false);
21665        composeStringExtras("text", element.getTextElement(), false);
21666      }
21667  }
21668
21669  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
21670    if (element != null) {
21671      open(name);
21672      composeObservationObservationRelatedComponentInner(element);
21673      close();
21674    }
21675  }
21676
21677  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
21678      composeBackbone(element);
21679      if (element.hasTypeElement()) {
21680        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21681        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
21682      }
21683      if (element.hasTarget()) {
21684        composeReference("target", element.getTarget());
21685      }
21686  }
21687
21688  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
21689    if (element != null) {
21690      open(name);
21691      composeObservationObservationComponentComponentInner(element);
21692      close();
21693    }
21694  }
21695
21696  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
21697      composeBackbone(element);
21698      if (element.hasCode()) {
21699        composeCodeableConcept("code", element.getCode());
21700      }
21701      if (element.hasValue()) {
21702        composeType("value", element.getValue());
21703      }
21704      if (element.hasDataAbsentReason()) {
21705        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
21706      }
21707      if (element.hasReferenceRange()) {
21708        openArray("referenceRange");
21709        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
21710          composeObservationObservationReferenceRangeComponent(null, e);
21711        closeArray();
21712      };
21713  }
21714
21715  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
21716    if (element != null) {
21717      prop("resourceType", name);
21718      composeOperationDefinitionInner(element);
21719    }
21720  }
21721
21722  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
21723      composeDomainResourceElements(element);
21724      if (element.hasUrlElement()) {
21725        composeUriCore("url", element.getUrlElement(), false);
21726        composeUriExtras("url", element.getUrlElement(), false);
21727      }
21728      if (element.hasVersionElement()) {
21729        composeStringCore("version", element.getVersionElement(), false);
21730        composeStringExtras("version", element.getVersionElement(), false);
21731      }
21732      if (element.hasNameElement()) {
21733        composeStringCore("name", element.getNameElement(), false);
21734        composeStringExtras("name", element.getNameElement(), false);
21735      }
21736      if (element.hasStatusElement()) {
21737        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21738        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
21739      }
21740      if (element.hasKindElement()) {
21741        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21742        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
21743      }
21744      if (element.hasExperimentalElement()) {
21745        composeBooleanCore("experimental", element.getExperimentalElement(), false);
21746        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
21747      }
21748      if (element.hasPublisherElement()) {
21749        composeStringCore("publisher", element.getPublisherElement(), false);
21750        composeStringExtras("publisher", element.getPublisherElement(), false);
21751      }
21752      if (element.hasContact()) {
21753        openArray("contact");
21754        for (OperationDefinition.OperationDefinitionContactComponent e : element.getContact()) 
21755          composeOperationDefinitionOperationDefinitionContactComponent(null, e);
21756        closeArray();
21757      };
21758      if (element.hasDateElement()) {
21759        composeDateTimeCore("date", element.getDateElement(), false);
21760        composeDateTimeExtras("date", element.getDateElement(), false);
21761      }
21762      if (element.hasDescriptionElement()) {
21763        composeStringCore("description", element.getDescriptionElement(), false);
21764        composeStringExtras("description", element.getDescriptionElement(), false);
21765      }
21766      if (element.hasRequirementsElement()) {
21767        composeStringCore("requirements", element.getRequirementsElement(), false);
21768        composeStringExtras("requirements", element.getRequirementsElement(), false);
21769      }
21770      if (element.hasIdempotentElement()) {
21771        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
21772        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
21773      }
21774      if (element.hasCodeElement()) {
21775        composeCodeCore("code", element.getCodeElement(), false);
21776        composeCodeExtras("code", element.getCodeElement(), false);
21777      }
21778      if (element.hasNotesElement()) {
21779        composeStringCore("notes", element.getNotesElement(), false);
21780        composeStringExtras("notes", element.getNotesElement(), false);
21781      }
21782      if (element.hasBase()) {
21783        composeReference("base", element.getBase());
21784      }
21785      if (element.hasSystemElement()) {
21786        composeBooleanCore("system", element.getSystemElement(), false);
21787        composeBooleanExtras("system", element.getSystemElement(), false);
21788      }
21789      if (element.hasType()) {
21790        openArray("type");
21791        for (CodeType e : element.getType()) 
21792          composeCodeCore(null, e, true);
21793        closeArray();
21794        if (anyHasExtras(element.getType())) {
21795          openArray("_type");
21796          for (CodeType e : element.getType()) 
21797            composeCodeExtras(null, e, true);
21798          closeArray();
21799        }
21800      };
21801      if (element.hasInstanceElement()) {
21802        composeBooleanCore("instance", element.getInstanceElement(), false);
21803        composeBooleanExtras("instance", element.getInstanceElement(), false);
21804      }
21805      if (element.hasParameter()) {
21806        openArray("parameter");
21807        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
21808          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21809        closeArray();
21810      };
21811  }
21812
21813  protected void composeOperationDefinitionOperationDefinitionContactComponent(String name, OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21814    if (element != null) {
21815      open(name);
21816      composeOperationDefinitionOperationDefinitionContactComponentInner(element);
21817      close();
21818    }
21819  }
21820
21821  protected void composeOperationDefinitionOperationDefinitionContactComponentInner(OperationDefinition.OperationDefinitionContactComponent element) throws IOException {
21822      composeBackbone(element);
21823      if (element.hasNameElement()) {
21824        composeStringCore("name", element.getNameElement(), false);
21825        composeStringExtras("name", element.getNameElement(), false);
21826      }
21827      if (element.hasTelecom()) {
21828        openArray("telecom");
21829        for (ContactPoint e : element.getTelecom()) 
21830          composeContactPoint(null, e);
21831        closeArray();
21832      };
21833  }
21834
21835  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21836    if (element != null) {
21837      open(name);
21838      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
21839      close();
21840    }
21841  }
21842
21843  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
21844      composeBackbone(element);
21845      if (element.hasNameElement()) {
21846        composeCodeCore("name", element.getNameElement(), false);
21847        composeCodeExtras("name", element.getNameElement(), false);
21848      }
21849      if (element.hasUseElement()) {
21850        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21851        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
21852      }
21853      if (element.hasMinElement()) {
21854        composeIntegerCore("min", element.getMinElement(), false);
21855        composeIntegerExtras("min", element.getMinElement(), false);
21856      }
21857      if (element.hasMaxElement()) {
21858        composeStringCore("max", element.getMaxElement(), false);
21859        composeStringExtras("max", element.getMaxElement(), false);
21860      }
21861      if (element.hasDocumentationElement()) {
21862        composeStringCore("documentation", element.getDocumentationElement(), false);
21863        composeStringExtras("documentation", element.getDocumentationElement(), false);
21864      }
21865      if (element.hasTypeElement()) {
21866        composeCodeCore("type", element.getTypeElement(), false);
21867        composeCodeExtras("type", element.getTypeElement(), false);
21868      }
21869      if (element.hasProfile()) {
21870        composeReference("profile", element.getProfile());
21871      }
21872      if (element.hasBinding()) {
21873        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
21874      }
21875      if (element.hasPart()) {
21876        openArray("part");
21877        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
21878          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
21879        closeArray();
21880      };
21881  }
21882
21883  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21884    if (element != null) {
21885      open(name);
21886      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
21887      close();
21888    }
21889  }
21890
21891  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
21892      composeBackbone(element);
21893      if (element.hasStrengthElement()) {
21894        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21895        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
21896      }
21897      if (element.hasValueSet()) {
21898        composeType("valueSet", element.getValueSet());
21899      }
21900  }
21901
21902  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
21903    if (element != null) {
21904      prop("resourceType", name);
21905      composeOperationOutcomeInner(element);
21906    }
21907  }
21908
21909  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
21910      composeDomainResourceElements(element);
21911      if (element.hasIssue()) {
21912        openArray("issue");
21913        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
21914          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
21915        closeArray();
21916      };
21917  }
21918
21919  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21920    if (element != null) {
21921      open(name);
21922      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
21923      close();
21924    }
21925  }
21926
21927  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
21928      composeBackbone(element);
21929      if (element.hasSeverityElement()) {
21930        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21931        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
21932      }
21933      if (element.hasCodeElement()) {
21934        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21935        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
21936      }
21937      if (element.hasDetails()) {
21938        composeCodeableConcept("details", element.getDetails());
21939      }
21940      if (element.hasDiagnosticsElement()) {
21941        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
21942        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
21943      }
21944      if (element.hasLocation()) {
21945        openArray("location");
21946        for (StringType e : element.getLocation()) 
21947          composeStringCore(null, e, true);
21948        closeArray();
21949        if (anyHasExtras(element.getLocation())) {
21950          openArray("_location");
21951          for (StringType e : element.getLocation()) 
21952            composeStringExtras(null, e, true);
21953          closeArray();
21954        }
21955      };
21956  }
21957
21958  protected void composeOrder(String name, Order element) throws IOException {
21959    if (element != null) {
21960      prop("resourceType", name);
21961      composeOrderInner(element);
21962    }
21963  }
21964
21965  protected void composeOrderInner(Order element) throws IOException {
21966      composeDomainResourceElements(element);
21967      if (element.hasIdentifier()) {
21968        openArray("identifier");
21969        for (Identifier e : element.getIdentifier()) 
21970          composeIdentifier(null, e);
21971        closeArray();
21972      };
21973      if (element.hasDateElement()) {
21974        composeDateTimeCore("date", element.getDateElement(), false);
21975        composeDateTimeExtras("date", element.getDateElement(), false);
21976      }
21977      if (element.hasSubject()) {
21978        composeReference("subject", element.getSubject());
21979      }
21980      if (element.hasSource()) {
21981        composeReference("source", element.getSource());
21982      }
21983      if (element.hasTarget()) {
21984        composeReference("target", element.getTarget());
21985      }
21986      if (element.hasReason()) {
21987        composeType("reason", element.getReason());
21988      }
21989      if (element.hasWhen()) {
21990        composeOrderOrderWhenComponent("when", element.getWhen());
21991      }
21992      if (element.hasDetail()) {
21993        openArray("detail");
21994        for (Reference e : element.getDetail()) 
21995          composeReference(null, e);
21996        closeArray();
21997      };
21998  }
21999
22000  protected void composeOrderOrderWhenComponent(String name, Order.OrderWhenComponent element) throws IOException {
22001    if (element != null) {
22002      open(name);
22003      composeOrderOrderWhenComponentInner(element);
22004      close();
22005    }
22006  }
22007
22008  protected void composeOrderOrderWhenComponentInner(Order.OrderWhenComponent element) throws IOException {
22009      composeBackbone(element);
22010      if (element.hasCode()) {
22011        composeCodeableConcept("code", element.getCode());
22012      }
22013      if (element.hasSchedule()) {
22014        composeTiming("schedule", element.getSchedule());
22015      }
22016  }
22017
22018  protected void composeOrderResponse(String name, OrderResponse element) throws IOException {
22019    if (element != null) {
22020      prop("resourceType", name);
22021      composeOrderResponseInner(element);
22022    }
22023  }
22024
22025  protected void composeOrderResponseInner(OrderResponse element) throws IOException {
22026      composeDomainResourceElements(element);
22027      if (element.hasIdentifier()) {
22028        openArray("identifier");
22029        for (Identifier e : element.getIdentifier()) 
22030          composeIdentifier(null, e);
22031        closeArray();
22032      };
22033      if (element.hasRequest()) {
22034        composeReference("request", element.getRequest());
22035      }
22036      if (element.hasDateElement()) {
22037        composeDateTimeCore("date", element.getDateElement(), false);
22038        composeDateTimeExtras("date", element.getDateElement(), false);
22039      }
22040      if (element.hasWho()) {
22041        composeReference("who", element.getWho());
22042      }
22043      if (element.hasOrderStatusElement()) {
22044        composeEnumerationCore("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22045        composeEnumerationExtras("orderStatus", element.getOrderStatusElement(), new OrderResponse.OrderStatusEnumFactory(), false);
22046      }
22047      if (element.hasDescriptionElement()) {
22048        composeStringCore("description", element.getDescriptionElement(), false);
22049        composeStringExtras("description", element.getDescriptionElement(), false);
22050      }
22051      if (element.hasFulfillment()) {
22052        openArray("fulfillment");
22053        for (Reference e : element.getFulfillment()) 
22054          composeReference(null, e);
22055        closeArray();
22056      };
22057  }
22058
22059  protected void composeOrganization(String name, Organization element) throws IOException {
22060    if (element != null) {
22061      prop("resourceType", name);
22062      composeOrganizationInner(element);
22063    }
22064  }
22065
22066  protected void composeOrganizationInner(Organization element) throws IOException {
22067      composeDomainResourceElements(element);
22068      if (element.hasIdentifier()) {
22069        openArray("identifier");
22070        for (Identifier e : element.getIdentifier()) 
22071          composeIdentifier(null, e);
22072        closeArray();
22073      };
22074      if (element.hasActiveElement()) {
22075        composeBooleanCore("active", element.getActiveElement(), false);
22076        composeBooleanExtras("active", element.getActiveElement(), false);
22077      }
22078      if (element.hasType()) {
22079        composeCodeableConcept("type", element.getType());
22080      }
22081      if (element.hasNameElement()) {
22082        composeStringCore("name", element.getNameElement(), false);
22083        composeStringExtras("name", element.getNameElement(), false);
22084      }
22085      if (element.hasTelecom()) {
22086        openArray("telecom");
22087        for (ContactPoint e : element.getTelecom()) 
22088          composeContactPoint(null, e);
22089        closeArray();
22090      };
22091      if (element.hasAddress()) {
22092        openArray("address");
22093        for (Address e : element.getAddress()) 
22094          composeAddress(null, e);
22095        closeArray();
22096      };
22097      if (element.hasPartOf()) {
22098        composeReference("partOf", element.getPartOf());
22099      }
22100      if (element.hasContact()) {
22101        openArray("contact");
22102        for (Organization.OrganizationContactComponent e : element.getContact()) 
22103          composeOrganizationOrganizationContactComponent(null, e);
22104        closeArray();
22105      };
22106  }
22107
22108  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
22109    if (element != null) {
22110      open(name);
22111      composeOrganizationOrganizationContactComponentInner(element);
22112      close();
22113    }
22114  }
22115
22116  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
22117      composeBackbone(element);
22118      if (element.hasPurpose()) {
22119        composeCodeableConcept("purpose", element.getPurpose());
22120      }
22121      if (element.hasName()) {
22122        composeHumanName("name", element.getName());
22123      }
22124      if (element.hasTelecom()) {
22125        openArray("telecom");
22126        for (ContactPoint e : element.getTelecom()) 
22127          composeContactPoint(null, e);
22128        closeArray();
22129      };
22130      if (element.hasAddress()) {
22131        composeAddress("address", element.getAddress());
22132      }
22133  }
22134
22135  protected void composePatient(String name, Patient element) throws IOException {
22136    if (element != null) {
22137      prop("resourceType", name);
22138      composePatientInner(element);
22139    }
22140  }
22141
22142  protected void composePatientInner(Patient element) throws IOException {
22143      composeDomainResourceElements(element);
22144      if (element.hasIdentifier()) {
22145        openArray("identifier");
22146        for (Identifier e : element.getIdentifier()) 
22147          composeIdentifier(null, e);
22148        closeArray();
22149      };
22150      if (element.hasActiveElement()) {
22151        composeBooleanCore("active", element.getActiveElement(), false);
22152        composeBooleanExtras("active", element.getActiveElement(), false);
22153      }
22154      if (element.hasName()) {
22155        openArray("name");
22156        for (HumanName e : element.getName()) 
22157          composeHumanName(null, e);
22158        closeArray();
22159      };
22160      if (element.hasTelecom()) {
22161        openArray("telecom");
22162        for (ContactPoint e : element.getTelecom()) 
22163          composeContactPoint(null, e);
22164        closeArray();
22165      };
22166      if (element.hasGenderElement()) {
22167        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22168        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22169      }
22170      if (element.hasBirthDateElement()) {
22171        composeDateCore("birthDate", element.getBirthDateElement(), false);
22172        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22173      }
22174      if (element.hasDeceased()) {
22175        composeType("deceased", element.getDeceased());
22176      }
22177      if (element.hasAddress()) {
22178        openArray("address");
22179        for (Address e : element.getAddress()) 
22180          composeAddress(null, e);
22181        closeArray();
22182      };
22183      if (element.hasMaritalStatus()) {
22184        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
22185      }
22186      if (element.hasMultipleBirth()) {
22187        composeType("multipleBirth", element.getMultipleBirth());
22188      }
22189      if (element.hasPhoto()) {
22190        openArray("photo");
22191        for (Attachment e : element.getPhoto()) 
22192          composeAttachment(null, e);
22193        closeArray();
22194      };
22195      if (element.hasContact()) {
22196        openArray("contact");
22197        for (Patient.ContactComponent e : element.getContact()) 
22198          composePatientContactComponent(null, e);
22199        closeArray();
22200      };
22201      if (element.hasAnimal()) {
22202        composePatientAnimalComponent("animal", element.getAnimal());
22203      }
22204      if (element.hasCommunication()) {
22205        openArray("communication");
22206        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
22207          composePatientPatientCommunicationComponent(null, e);
22208        closeArray();
22209      };
22210      if (element.hasCareProvider()) {
22211        openArray("careProvider");
22212        for (Reference e : element.getCareProvider()) 
22213          composeReference(null, e);
22214        closeArray();
22215      };
22216      if (element.hasManagingOrganization()) {
22217        composeReference("managingOrganization", element.getManagingOrganization());
22218      }
22219      if (element.hasLink()) {
22220        openArray("link");
22221        for (Patient.PatientLinkComponent e : element.getLink()) 
22222          composePatientPatientLinkComponent(null, e);
22223        closeArray();
22224      };
22225  }
22226
22227  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
22228    if (element != null) {
22229      open(name);
22230      composePatientContactComponentInner(element);
22231      close();
22232    }
22233  }
22234
22235  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
22236      composeBackbone(element);
22237      if (element.hasRelationship()) {
22238        openArray("relationship");
22239        for (CodeableConcept e : element.getRelationship()) 
22240          composeCodeableConcept(null, e);
22241        closeArray();
22242      };
22243      if (element.hasName()) {
22244        composeHumanName("name", element.getName());
22245      }
22246      if (element.hasTelecom()) {
22247        openArray("telecom");
22248        for (ContactPoint e : element.getTelecom()) 
22249          composeContactPoint(null, e);
22250        closeArray();
22251      };
22252      if (element.hasAddress()) {
22253        composeAddress("address", element.getAddress());
22254      }
22255      if (element.hasGenderElement()) {
22256        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22257        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22258      }
22259      if (element.hasOrganization()) {
22260        composeReference("organization", element.getOrganization());
22261      }
22262      if (element.hasPeriod()) {
22263        composePeriod("period", element.getPeriod());
22264      }
22265  }
22266
22267  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
22268    if (element != null) {
22269      open(name);
22270      composePatientAnimalComponentInner(element);
22271      close();
22272    }
22273  }
22274
22275  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
22276      composeBackbone(element);
22277      if (element.hasSpecies()) {
22278        composeCodeableConcept("species", element.getSpecies());
22279      }
22280      if (element.hasBreed()) {
22281        composeCodeableConcept("breed", element.getBreed());
22282      }
22283      if (element.hasGenderStatus()) {
22284        composeCodeableConcept("genderStatus", element.getGenderStatus());
22285      }
22286  }
22287
22288  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
22289    if (element != null) {
22290      open(name);
22291      composePatientPatientCommunicationComponentInner(element);
22292      close();
22293    }
22294  }
22295
22296  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
22297      composeBackbone(element);
22298      if (element.hasLanguage()) {
22299        composeCodeableConcept("language", element.getLanguage());
22300      }
22301      if (element.hasPreferredElement()) {
22302        composeBooleanCore("preferred", element.getPreferredElement(), false);
22303        composeBooleanExtras("preferred", element.getPreferredElement(), false);
22304      }
22305  }
22306
22307  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
22308    if (element != null) {
22309      open(name);
22310      composePatientPatientLinkComponentInner(element);
22311      close();
22312    }
22313  }
22314
22315  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
22316      composeBackbone(element);
22317      if (element.hasOther()) {
22318        composeReference("other", element.getOther());
22319      }
22320      if (element.hasTypeElement()) {
22321        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22322        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
22323      }
22324  }
22325
22326  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
22327    if (element != null) {
22328      prop("resourceType", name);
22329      composePaymentNoticeInner(element);
22330    }
22331  }
22332
22333  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
22334      composeDomainResourceElements(element);
22335      if (element.hasIdentifier()) {
22336        openArray("identifier");
22337        for (Identifier e : element.getIdentifier()) 
22338          composeIdentifier(null, e);
22339        closeArray();
22340      };
22341      if (element.hasRuleset()) {
22342        composeCoding("ruleset", element.getRuleset());
22343      }
22344      if (element.hasOriginalRuleset()) {
22345        composeCoding("originalRuleset", element.getOriginalRuleset());
22346      }
22347      if (element.hasCreatedElement()) {
22348        composeDateTimeCore("created", element.getCreatedElement(), false);
22349        composeDateTimeExtras("created", element.getCreatedElement(), false);
22350      }
22351      if (element.hasTarget()) {
22352        composeReference("target", element.getTarget());
22353      }
22354      if (element.hasProvider()) {
22355        composeReference("provider", element.getProvider());
22356      }
22357      if (element.hasOrganization()) {
22358        composeReference("organization", element.getOrganization());
22359      }
22360      if (element.hasRequest()) {
22361        composeReference("request", element.getRequest());
22362      }
22363      if (element.hasResponse()) {
22364        composeReference("response", element.getResponse());
22365      }
22366      if (element.hasPaymentStatus()) {
22367        composeCoding("paymentStatus", element.getPaymentStatus());
22368      }
22369  }
22370
22371  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
22372    if (element != null) {
22373      prop("resourceType", name);
22374      composePaymentReconciliationInner(element);
22375    }
22376  }
22377
22378  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
22379      composeDomainResourceElements(element);
22380      if (element.hasIdentifier()) {
22381        openArray("identifier");
22382        for (Identifier e : element.getIdentifier()) 
22383          composeIdentifier(null, e);
22384        closeArray();
22385      };
22386      if (element.hasRequest()) {
22387        composeReference("request", element.getRequest());
22388      }
22389      if (element.hasOutcomeElement()) {
22390        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22391        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
22392      }
22393      if (element.hasDispositionElement()) {
22394        composeStringCore("disposition", element.getDispositionElement(), false);
22395        composeStringExtras("disposition", element.getDispositionElement(), false);
22396      }
22397      if (element.hasRuleset()) {
22398        composeCoding("ruleset", element.getRuleset());
22399      }
22400      if (element.hasOriginalRuleset()) {
22401        composeCoding("originalRuleset", element.getOriginalRuleset());
22402      }
22403      if (element.hasCreatedElement()) {
22404        composeDateTimeCore("created", element.getCreatedElement(), false);
22405        composeDateTimeExtras("created", element.getCreatedElement(), false);
22406      }
22407      if (element.hasPeriod()) {
22408        composePeriod("period", element.getPeriod());
22409      }
22410      if (element.hasOrganization()) {
22411        composeReference("organization", element.getOrganization());
22412      }
22413      if (element.hasRequestProvider()) {
22414        composeReference("requestProvider", element.getRequestProvider());
22415      }
22416      if (element.hasRequestOrganization()) {
22417        composeReference("requestOrganization", element.getRequestOrganization());
22418      }
22419      if (element.hasDetail()) {
22420        openArray("detail");
22421        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
22422          composePaymentReconciliationDetailsComponent(null, e);
22423        closeArray();
22424      };
22425      if (element.hasForm()) {
22426        composeCoding("form", element.getForm());
22427      }
22428      if (element.hasTotal()) {
22429        composeMoney("total", element.getTotal());
22430      }
22431      if (element.hasNote()) {
22432        openArray("note");
22433        for (PaymentReconciliation.NotesComponent e : element.getNote()) 
22434          composePaymentReconciliationNotesComponent(null, e);
22435        closeArray();
22436      };
22437  }
22438
22439  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
22440    if (element != null) {
22441      open(name);
22442      composePaymentReconciliationDetailsComponentInner(element);
22443      close();
22444    }
22445  }
22446
22447  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
22448      composeBackbone(element);
22449      if (element.hasType()) {
22450        composeCoding("type", element.getType());
22451      }
22452      if (element.hasRequest()) {
22453        composeReference("request", element.getRequest());
22454      }
22455      if (element.hasResponce()) {
22456        composeReference("responce", element.getResponce());
22457      }
22458      if (element.hasSubmitter()) {
22459        composeReference("submitter", element.getSubmitter());
22460      }
22461      if (element.hasPayee()) {
22462        composeReference("payee", element.getPayee());
22463      }
22464      if (element.hasDateElement()) {
22465        composeDateCore("date", element.getDateElement(), false);
22466        composeDateExtras("date", element.getDateElement(), false);
22467      }
22468      if (element.hasAmount()) {
22469        composeMoney("amount", element.getAmount());
22470      }
22471  }
22472
22473  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
22474    if (element != null) {
22475      open(name);
22476      composePaymentReconciliationNotesComponentInner(element);
22477      close();
22478    }
22479  }
22480
22481  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
22482      composeBackbone(element);
22483      if (element.hasType()) {
22484        composeCoding("type", element.getType());
22485      }
22486      if (element.hasTextElement()) {
22487        composeStringCore("text", element.getTextElement(), false);
22488        composeStringExtras("text", element.getTextElement(), false);
22489      }
22490  }
22491
22492  protected void composePerson(String name, Person element) throws IOException {
22493    if (element != null) {
22494      prop("resourceType", name);
22495      composePersonInner(element);
22496    }
22497  }
22498
22499  protected void composePersonInner(Person element) throws IOException {
22500      composeDomainResourceElements(element);
22501      if (element.hasIdentifier()) {
22502        openArray("identifier");
22503        for (Identifier e : element.getIdentifier()) 
22504          composeIdentifier(null, e);
22505        closeArray();
22506      };
22507      if (element.hasName()) {
22508        openArray("name");
22509        for (HumanName e : element.getName()) 
22510          composeHumanName(null, e);
22511        closeArray();
22512      };
22513      if (element.hasTelecom()) {
22514        openArray("telecom");
22515        for (ContactPoint e : element.getTelecom()) 
22516          composeContactPoint(null, e);
22517        closeArray();
22518      };
22519      if (element.hasGenderElement()) {
22520        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22521        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22522      }
22523      if (element.hasBirthDateElement()) {
22524        composeDateCore("birthDate", element.getBirthDateElement(), false);
22525        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22526      }
22527      if (element.hasAddress()) {
22528        openArray("address");
22529        for (Address e : element.getAddress()) 
22530          composeAddress(null, e);
22531        closeArray();
22532      };
22533      if (element.hasPhoto()) {
22534        composeAttachment("photo", element.getPhoto());
22535      }
22536      if (element.hasManagingOrganization()) {
22537        composeReference("managingOrganization", element.getManagingOrganization());
22538      }
22539      if (element.hasActiveElement()) {
22540        composeBooleanCore("active", element.getActiveElement(), false);
22541        composeBooleanExtras("active", element.getActiveElement(), false);
22542      }
22543      if (element.hasLink()) {
22544        openArray("link");
22545        for (Person.PersonLinkComponent e : element.getLink()) 
22546          composePersonPersonLinkComponent(null, e);
22547        closeArray();
22548      };
22549  }
22550
22551  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
22552    if (element != null) {
22553      open(name);
22554      composePersonPersonLinkComponentInner(element);
22555      close();
22556    }
22557  }
22558
22559  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
22560      composeBackbone(element);
22561      if (element.hasTarget()) {
22562        composeReference("target", element.getTarget());
22563      }
22564      if (element.hasAssuranceElement()) {
22565        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22566        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
22567      }
22568  }
22569
22570  protected void composePractitioner(String name, Practitioner element) throws IOException {
22571    if (element != null) {
22572      prop("resourceType", name);
22573      composePractitionerInner(element);
22574    }
22575  }
22576
22577  protected void composePractitionerInner(Practitioner element) throws IOException {
22578      composeDomainResourceElements(element);
22579      if (element.hasIdentifier()) {
22580        openArray("identifier");
22581        for (Identifier e : element.getIdentifier()) 
22582          composeIdentifier(null, e);
22583        closeArray();
22584      };
22585      if (element.hasActiveElement()) {
22586        composeBooleanCore("active", element.getActiveElement(), false);
22587        composeBooleanExtras("active", element.getActiveElement(), false);
22588      }
22589      if (element.hasName()) {
22590        composeHumanName("name", element.getName());
22591      }
22592      if (element.hasTelecom()) {
22593        openArray("telecom");
22594        for (ContactPoint e : element.getTelecom()) 
22595          composeContactPoint(null, e);
22596        closeArray();
22597      };
22598      if (element.hasAddress()) {
22599        openArray("address");
22600        for (Address e : element.getAddress()) 
22601          composeAddress(null, e);
22602        closeArray();
22603      };
22604      if (element.hasGenderElement()) {
22605        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22606        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
22607      }
22608      if (element.hasBirthDateElement()) {
22609        composeDateCore("birthDate", element.getBirthDateElement(), false);
22610        composeDateExtras("birthDate", element.getBirthDateElement(), false);
22611      }
22612      if (element.hasPhoto()) {
22613        openArray("photo");
22614        for (Attachment e : element.getPhoto()) 
22615          composeAttachment(null, e);
22616        closeArray();
22617      };
22618      if (element.hasPractitionerRole()) {
22619        openArray("practitionerRole");
22620        for (Practitioner.PractitionerPractitionerRoleComponent e : element.getPractitionerRole()) 
22621          composePractitionerPractitionerPractitionerRoleComponent(null, e);
22622        closeArray();
22623      };
22624      if (element.hasQualification()) {
22625        openArray("qualification");
22626        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
22627          composePractitionerPractitionerQualificationComponent(null, e);
22628        closeArray();
22629      };
22630      if (element.hasCommunication()) {
22631        openArray("communication");
22632        for (CodeableConcept e : element.getCommunication()) 
22633          composeCodeableConcept(null, e);
22634        closeArray();
22635      };
22636  }
22637
22638  protected void composePractitionerPractitionerPractitionerRoleComponent(String name, Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22639    if (element != null) {
22640      open(name);
22641      composePractitionerPractitionerPractitionerRoleComponentInner(element);
22642      close();
22643    }
22644  }
22645
22646  protected void composePractitionerPractitionerPractitionerRoleComponentInner(Practitioner.PractitionerPractitionerRoleComponent element) throws IOException {
22647      composeBackbone(element);
22648      if (element.hasManagingOrganization()) {
22649        composeReference("managingOrganization", element.getManagingOrganization());
22650      }
22651      if (element.hasRole()) {
22652        composeCodeableConcept("role", element.getRole());
22653      }
22654      if (element.hasSpecialty()) {
22655        openArray("specialty");
22656        for (CodeableConcept e : element.getSpecialty()) 
22657          composeCodeableConcept(null, e);
22658        closeArray();
22659      };
22660      if (element.hasPeriod()) {
22661        composePeriod("period", element.getPeriod());
22662      }
22663      if (element.hasLocation()) {
22664        openArray("location");
22665        for (Reference e : element.getLocation()) 
22666          composeReference(null, e);
22667        closeArray();
22668      };
22669      if (element.hasHealthcareService()) {
22670        openArray("healthcareService");
22671        for (Reference e : element.getHealthcareService()) 
22672          composeReference(null, e);
22673        closeArray();
22674      };
22675  }
22676
22677  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
22678    if (element != null) {
22679      open(name);
22680      composePractitionerPractitionerQualificationComponentInner(element);
22681      close();
22682    }
22683  }
22684
22685  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
22686      composeBackbone(element);
22687      if (element.hasIdentifier()) {
22688        openArray("identifier");
22689        for (Identifier e : element.getIdentifier()) 
22690          composeIdentifier(null, e);
22691        closeArray();
22692      };
22693      if (element.hasCode()) {
22694        composeCodeableConcept("code", element.getCode());
22695      }
22696      if (element.hasPeriod()) {
22697        composePeriod("period", element.getPeriod());
22698      }
22699      if (element.hasIssuer()) {
22700        composeReference("issuer", element.getIssuer());
22701      }
22702  }
22703
22704  protected void composeProcedure(String name, Procedure element) throws IOException {
22705    if (element != null) {
22706      prop("resourceType", name);
22707      composeProcedureInner(element);
22708    }
22709  }
22710
22711  protected void composeProcedureInner(Procedure element) throws IOException {
22712      composeDomainResourceElements(element);
22713      if (element.hasIdentifier()) {
22714        openArray("identifier");
22715        for (Identifier e : element.getIdentifier()) 
22716          composeIdentifier(null, e);
22717        closeArray();
22718      };
22719      if (element.hasSubject()) {
22720        composeReference("subject", element.getSubject());
22721      }
22722      if (element.hasStatusElement()) {
22723        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22724        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
22725      }
22726      if (element.hasCategory()) {
22727        composeCodeableConcept("category", element.getCategory());
22728      }
22729      if (element.hasCode()) {
22730        composeCodeableConcept("code", element.getCode());
22731      }
22732      if (element.hasNotPerformedElement()) {
22733        composeBooleanCore("notPerformed", element.getNotPerformedElement(), false);
22734        composeBooleanExtras("notPerformed", element.getNotPerformedElement(), false);
22735      }
22736      if (element.hasReasonNotPerformed()) {
22737        openArray("reasonNotPerformed");
22738        for (CodeableConcept e : element.getReasonNotPerformed()) 
22739          composeCodeableConcept(null, e);
22740        closeArray();
22741      };
22742      if (element.hasBodySite()) {
22743        openArray("bodySite");
22744        for (CodeableConcept e : element.getBodySite()) 
22745          composeCodeableConcept(null, e);
22746        closeArray();
22747      };
22748      if (element.hasReason()) {
22749        composeType("reason", element.getReason());
22750      }
22751      if (element.hasPerformer()) {
22752        openArray("performer");
22753        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
22754          composeProcedureProcedurePerformerComponent(null, e);
22755        closeArray();
22756      };
22757      if (element.hasPerformed()) {
22758        composeType("performed", element.getPerformed());
22759      }
22760      if (element.hasEncounter()) {
22761        composeReference("encounter", element.getEncounter());
22762      }
22763      if (element.hasLocation()) {
22764        composeReference("location", element.getLocation());
22765      }
22766      if (element.hasOutcome()) {
22767        composeCodeableConcept("outcome", element.getOutcome());
22768      }
22769      if (element.hasReport()) {
22770        openArray("report");
22771        for (Reference e : element.getReport()) 
22772          composeReference(null, e);
22773        closeArray();
22774      };
22775      if (element.hasComplication()) {
22776        openArray("complication");
22777        for (CodeableConcept e : element.getComplication()) 
22778          composeCodeableConcept(null, e);
22779        closeArray();
22780      };
22781      if (element.hasFollowUp()) {
22782        openArray("followUp");
22783        for (CodeableConcept e : element.getFollowUp()) 
22784          composeCodeableConcept(null, e);
22785        closeArray();
22786      };
22787      if (element.hasRequest()) {
22788        composeReference("request", element.getRequest());
22789      }
22790      if (element.hasNotes()) {
22791        openArray("notes");
22792        for (Annotation e : element.getNotes()) 
22793          composeAnnotation(null, e);
22794        closeArray();
22795      };
22796      if (element.hasFocalDevice()) {
22797        openArray("focalDevice");
22798        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
22799          composeProcedureProcedureFocalDeviceComponent(null, e);
22800        closeArray();
22801      };
22802      if (element.hasUsed()) {
22803        openArray("used");
22804        for (Reference e : element.getUsed()) 
22805          composeReference(null, e);
22806        closeArray();
22807      };
22808  }
22809
22810  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
22811    if (element != null) {
22812      open(name);
22813      composeProcedureProcedurePerformerComponentInner(element);
22814      close();
22815    }
22816  }
22817
22818  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
22819      composeBackbone(element);
22820      if (element.hasActor()) {
22821        composeReference("actor", element.getActor());
22822      }
22823      if (element.hasRole()) {
22824        composeCodeableConcept("role", element.getRole());
22825      }
22826  }
22827
22828  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22829    if (element != null) {
22830      open(name);
22831      composeProcedureProcedureFocalDeviceComponentInner(element);
22832      close();
22833    }
22834  }
22835
22836  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
22837      composeBackbone(element);
22838      if (element.hasAction()) {
22839        composeCodeableConcept("action", element.getAction());
22840      }
22841      if (element.hasManipulated()) {
22842        composeReference("manipulated", element.getManipulated());
22843      }
22844  }
22845
22846  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
22847    if (element != null) {
22848      prop("resourceType", name);
22849      composeProcedureRequestInner(element);
22850    }
22851  }
22852
22853  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
22854      composeDomainResourceElements(element);
22855      if (element.hasIdentifier()) {
22856        openArray("identifier");
22857        for (Identifier e : element.getIdentifier()) 
22858          composeIdentifier(null, e);
22859        closeArray();
22860      };
22861      if (element.hasSubject()) {
22862        composeReference("subject", element.getSubject());
22863      }
22864      if (element.hasCode()) {
22865        composeCodeableConcept("code", element.getCode());
22866      }
22867      if (element.hasBodySite()) {
22868        openArray("bodySite");
22869        for (CodeableConcept e : element.getBodySite()) 
22870          composeCodeableConcept(null, e);
22871        closeArray();
22872      };
22873      if (element.hasReason()) {
22874        composeType("reason", element.getReason());
22875      }
22876      if (element.hasScheduled()) {
22877        composeType("scheduled", element.getScheduled());
22878      }
22879      if (element.hasEncounter()) {
22880        composeReference("encounter", element.getEncounter());
22881      }
22882      if (element.hasPerformer()) {
22883        composeReference("performer", element.getPerformer());
22884      }
22885      if (element.hasStatusElement()) {
22886        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22887        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
22888      }
22889      if (element.hasNotes()) {
22890        openArray("notes");
22891        for (Annotation e : element.getNotes()) 
22892          composeAnnotation(null, e);
22893        closeArray();
22894      };
22895      if (element.hasAsNeeded()) {
22896        composeType("asNeeded", element.getAsNeeded());
22897      }
22898      if (element.hasOrderedOnElement()) {
22899        composeDateTimeCore("orderedOn", element.getOrderedOnElement(), false);
22900        composeDateTimeExtras("orderedOn", element.getOrderedOnElement(), false);
22901      }
22902      if (element.hasOrderer()) {
22903        composeReference("orderer", element.getOrderer());
22904      }
22905      if (element.hasPriorityElement()) {
22906        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22907        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
22908      }
22909  }
22910
22911  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
22912    if (element != null) {
22913      prop("resourceType", name);
22914      composeProcessRequestInner(element);
22915    }
22916  }
22917
22918  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
22919      composeDomainResourceElements(element);
22920      if (element.hasActionElement()) {
22921        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22922        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
22923      }
22924      if (element.hasIdentifier()) {
22925        openArray("identifier");
22926        for (Identifier e : element.getIdentifier()) 
22927          composeIdentifier(null, e);
22928        closeArray();
22929      };
22930      if (element.hasRuleset()) {
22931        composeCoding("ruleset", element.getRuleset());
22932      }
22933      if (element.hasOriginalRuleset()) {
22934        composeCoding("originalRuleset", element.getOriginalRuleset());
22935      }
22936      if (element.hasCreatedElement()) {
22937        composeDateTimeCore("created", element.getCreatedElement(), false);
22938        composeDateTimeExtras("created", element.getCreatedElement(), false);
22939      }
22940      if (element.hasTarget()) {
22941        composeReference("target", element.getTarget());
22942      }
22943      if (element.hasProvider()) {
22944        composeReference("provider", element.getProvider());
22945      }
22946      if (element.hasOrganization()) {
22947        composeReference("organization", element.getOrganization());
22948      }
22949      if (element.hasRequest()) {
22950        composeReference("request", element.getRequest());
22951      }
22952      if (element.hasResponse()) {
22953        composeReference("response", element.getResponse());
22954      }
22955      if (element.hasNullifyElement()) {
22956        composeBooleanCore("nullify", element.getNullifyElement(), false);
22957        composeBooleanExtras("nullify", element.getNullifyElement(), false);
22958      }
22959      if (element.hasReferenceElement()) {
22960        composeStringCore("reference", element.getReferenceElement(), false);
22961        composeStringExtras("reference", element.getReferenceElement(), false);
22962      }
22963      if (element.hasItem()) {
22964        openArray("item");
22965        for (ProcessRequest.ItemsComponent e : element.getItem()) 
22966          composeProcessRequestItemsComponent(null, e);
22967        closeArray();
22968      };
22969      if (element.hasInclude()) {
22970        openArray("include");
22971        for (StringType e : element.getInclude()) 
22972          composeStringCore(null, e, true);
22973        closeArray();
22974        if (anyHasExtras(element.getInclude())) {
22975          openArray("_include");
22976          for (StringType e : element.getInclude()) 
22977            composeStringExtras(null, e, true);
22978          closeArray();
22979        }
22980      };
22981      if (element.hasExclude()) {
22982        openArray("exclude");
22983        for (StringType e : element.getExclude()) 
22984          composeStringCore(null, e, true);
22985        closeArray();
22986        if (anyHasExtras(element.getExclude())) {
22987          openArray("_exclude");
22988          for (StringType e : element.getExclude()) 
22989            composeStringExtras(null, e, true);
22990          closeArray();
22991        }
22992      };
22993      if (element.hasPeriod()) {
22994        composePeriod("period", element.getPeriod());
22995      }
22996  }
22997
22998  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
22999    if (element != null) {
23000      open(name);
23001      composeProcessRequestItemsComponentInner(element);
23002      close();
23003    }
23004  }
23005
23006  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
23007      composeBackbone(element);
23008      if (element.hasSequenceLinkIdElement()) {
23009        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
23010        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
23011      }
23012  }
23013
23014  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
23015    if (element != null) {
23016      prop("resourceType", name);
23017      composeProcessResponseInner(element);
23018    }
23019  }
23020
23021  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
23022      composeDomainResourceElements(element);
23023      if (element.hasIdentifier()) {
23024        openArray("identifier");
23025        for (Identifier e : element.getIdentifier()) 
23026          composeIdentifier(null, e);
23027        closeArray();
23028      };
23029      if (element.hasRequest()) {
23030        composeReference("request", element.getRequest());
23031      }
23032      if (element.hasOutcome()) {
23033        composeCoding("outcome", element.getOutcome());
23034      }
23035      if (element.hasDispositionElement()) {
23036        composeStringCore("disposition", element.getDispositionElement(), false);
23037        composeStringExtras("disposition", element.getDispositionElement(), false);
23038      }
23039      if (element.hasRuleset()) {
23040        composeCoding("ruleset", element.getRuleset());
23041      }
23042      if (element.hasOriginalRuleset()) {
23043        composeCoding("originalRuleset", element.getOriginalRuleset());
23044      }
23045      if (element.hasCreatedElement()) {
23046        composeDateTimeCore("created", element.getCreatedElement(), false);
23047        composeDateTimeExtras("created", element.getCreatedElement(), false);
23048      }
23049      if (element.hasOrganization()) {
23050        composeReference("organization", element.getOrganization());
23051      }
23052      if (element.hasRequestProvider()) {
23053        composeReference("requestProvider", element.getRequestProvider());
23054      }
23055      if (element.hasRequestOrganization()) {
23056        composeReference("requestOrganization", element.getRequestOrganization());
23057      }
23058      if (element.hasForm()) {
23059        composeCoding("form", element.getForm());
23060      }
23061      if (element.hasNotes()) {
23062        openArray("notes");
23063        for (ProcessResponse.ProcessResponseNotesComponent e : element.getNotes()) 
23064          composeProcessResponseProcessResponseNotesComponent(null, e);
23065        closeArray();
23066      };
23067      if (element.hasError()) {
23068        openArray("error");
23069        for (Coding e : element.getError()) 
23070          composeCoding(null, e);
23071        closeArray();
23072      };
23073  }
23074
23075  protected void composeProcessResponseProcessResponseNotesComponent(String name, ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23076    if (element != null) {
23077      open(name);
23078      composeProcessResponseProcessResponseNotesComponentInner(element);
23079      close();
23080    }
23081  }
23082
23083  protected void composeProcessResponseProcessResponseNotesComponentInner(ProcessResponse.ProcessResponseNotesComponent element) throws IOException {
23084      composeBackbone(element);
23085      if (element.hasType()) {
23086        composeCoding("type", element.getType());
23087      }
23088      if (element.hasTextElement()) {
23089        composeStringCore("text", element.getTextElement(), false);
23090        composeStringExtras("text", element.getTextElement(), false);
23091      }
23092  }
23093
23094  protected void composeProvenance(String name, Provenance element) throws IOException {
23095    if (element != null) {
23096      prop("resourceType", name);
23097      composeProvenanceInner(element);
23098    }
23099  }
23100
23101  protected void composeProvenanceInner(Provenance element) throws IOException {
23102      composeDomainResourceElements(element);
23103      if (element.hasTarget()) {
23104        openArray("target");
23105        for (Reference e : element.getTarget()) 
23106          composeReference(null, e);
23107        closeArray();
23108      };
23109      if (element.hasPeriod()) {
23110        composePeriod("period", element.getPeriod());
23111      }
23112      if (element.hasRecordedElement()) {
23113        composeInstantCore("recorded", element.getRecordedElement(), false);
23114        composeInstantExtras("recorded", element.getRecordedElement(), false);
23115      }
23116      if (element.hasReason()) {
23117        openArray("reason");
23118        for (CodeableConcept e : element.getReason()) 
23119          composeCodeableConcept(null, e);
23120        closeArray();
23121      };
23122      if (element.hasActivity()) {
23123        composeCodeableConcept("activity", element.getActivity());
23124      }
23125      if (element.hasLocation()) {
23126        composeReference("location", element.getLocation());
23127      }
23128      if (element.hasPolicy()) {
23129        openArray("policy");
23130        for (UriType e : element.getPolicy()) 
23131          composeUriCore(null, e, true);
23132        closeArray();
23133        if (anyHasExtras(element.getPolicy())) {
23134          openArray("_policy");
23135          for (UriType e : element.getPolicy()) 
23136            composeUriExtras(null, e, true);
23137          closeArray();
23138        }
23139      };
23140      if (element.hasAgent()) {
23141        openArray("agent");
23142        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
23143          composeProvenanceProvenanceAgentComponent(null, e);
23144        closeArray();
23145      };
23146      if (element.hasEntity()) {
23147        openArray("entity");
23148        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
23149          composeProvenanceProvenanceEntityComponent(null, e);
23150        closeArray();
23151      };
23152      if (element.hasSignature()) {
23153        openArray("signature");
23154        for (Signature e : element.getSignature()) 
23155          composeSignature(null, e);
23156        closeArray();
23157      };
23158  }
23159
23160  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
23161    if (element != null) {
23162      open(name);
23163      composeProvenanceProvenanceAgentComponentInner(element);
23164      close();
23165    }
23166  }
23167
23168  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
23169      composeBackbone(element);
23170      if (element.hasRole()) {
23171        composeCoding("role", element.getRole());
23172      }
23173      if (element.hasActor()) {
23174        composeReference("actor", element.getActor());
23175      }
23176      if (element.hasUserId()) {
23177        composeIdentifier("userId", element.getUserId());
23178      }
23179      if (element.hasRelatedAgent()) {
23180        openArray("relatedAgent");
23181        for (Provenance.ProvenanceAgentRelatedAgentComponent e : element.getRelatedAgent()) 
23182          composeProvenanceProvenanceAgentRelatedAgentComponent(null, e);
23183        closeArray();
23184      };
23185  }
23186
23187  protected void composeProvenanceProvenanceAgentRelatedAgentComponent(String name, Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23188    if (element != null) {
23189      open(name);
23190      composeProvenanceProvenanceAgentRelatedAgentComponentInner(element);
23191      close();
23192    }
23193  }
23194
23195  protected void composeProvenanceProvenanceAgentRelatedAgentComponentInner(Provenance.ProvenanceAgentRelatedAgentComponent element) throws IOException {
23196      composeBackbone(element);
23197      if (element.hasType()) {
23198        composeCodeableConcept("type", element.getType());
23199      }
23200      if (element.hasTargetElement()) {
23201        composeUriCore("target", element.getTargetElement(), false);
23202        composeUriExtras("target", element.getTargetElement(), false);
23203      }
23204  }
23205
23206  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
23207    if (element != null) {
23208      open(name);
23209      composeProvenanceProvenanceEntityComponentInner(element);
23210      close();
23211    }
23212  }
23213
23214  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
23215      composeBackbone(element);
23216      if (element.hasRoleElement()) {
23217        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23218        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
23219      }
23220      if (element.hasType()) {
23221        composeCoding("type", element.getType());
23222      }
23223      if (element.hasReferenceElement()) {
23224        composeUriCore("reference", element.getReferenceElement(), false);
23225        composeUriExtras("reference", element.getReferenceElement(), false);
23226      }
23227      if (element.hasDisplayElement()) {
23228        composeStringCore("display", element.getDisplayElement(), false);
23229        composeStringExtras("display", element.getDisplayElement(), false);
23230      }
23231      if (element.hasAgent()) {
23232        composeProvenanceProvenanceAgentComponent("agent", element.getAgent());
23233      }
23234  }
23235
23236  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
23237    if (element != null) {
23238      prop("resourceType", name);
23239      composeQuestionnaireInner(element);
23240    }
23241  }
23242
23243  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
23244      composeDomainResourceElements(element);
23245      if (element.hasIdentifier()) {
23246        openArray("identifier");
23247        for (Identifier e : element.getIdentifier()) 
23248          composeIdentifier(null, e);
23249        closeArray();
23250      };
23251      if (element.hasVersionElement()) {
23252        composeStringCore("version", element.getVersionElement(), false);
23253        composeStringExtras("version", element.getVersionElement(), false);
23254      }
23255      if (element.hasStatusElement()) {
23256        composeEnumerationCore("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23257        composeEnumerationExtras("status", element.getStatusElement(), new Questionnaire.QuestionnaireStatusEnumFactory(), false);
23258      }
23259      if (element.hasDateElement()) {
23260        composeDateTimeCore("date", element.getDateElement(), false);
23261        composeDateTimeExtras("date", element.getDateElement(), false);
23262      }
23263      if (element.hasPublisherElement()) {
23264        composeStringCore("publisher", element.getPublisherElement(), false);
23265        composeStringExtras("publisher", element.getPublisherElement(), false);
23266      }
23267      if (element.hasTelecom()) {
23268        openArray("telecom");
23269        for (ContactPoint e : element.getTelecom()) 
23270          composeContactPoint(null, e);
23271        closeArray();
23272      };
23273      if (element.hasSubjectType()) {
23274        openArray("subjectType");
23275        for (CodeType e : element.getSubjectType()) 
23276          composeCodeCore(null, e, true);
23277        closeArray();
23278        if (anyHasExtras(element.getSubjectType())) {
23279          openArray("_subjectType");
23280          for (CodeType e : element.getSubjectType()) 
23281            composeCodeExtras(null, e, true);
23282          closeArray();
23283        }
23284      };
23285      if (element.hasGroup()) {
23286        composeQuestionnaireGroupComponent("group", element.getGroup());
23287      }
23288  }
23289
23290  protected void composeQuestionnaireGroupComponent(String name, Questionnaire.GroupComponent element) throws IOException {
23291    if (element != null) {
23292      open(name);
23293      composeQuestionnaireGroupComponentInner(element);
23294      close();
23295    }
23296  }
23297
23298  protected void composeQuestionnaireGroupComponentInner(Questionnaire.GroupComponent element) throws IOException {
23299      composeBackbone(element);
23300      if (element.hasLinkIdElement()) {
23301        composeStringCore("linkId", element.getLinkIdElement(), false);
23302        composeStringExtras("linkId", element.getLinkIdElement(), false);
23303      }
23304      if (element.hasTitleElement()) {
23305        composeStringCore("title", element.getTitleElement(), false);
23306        composeStringExtras("title", element.getTitleElement(), false);
23307      }
23308      if (element.hasConcept()) {
23309        openArray("concept");
23310        for (Coding e : element.getConcept()) 
23311          composeCoding(null, e);
23312        closeArray();
23313      };
23314      if (element.hasTextElement()) {
23315        composeStringCore("text", element.getTextElement(), false);
23316        composeStringExtras("text", element.getTextElement(), false);
23317      }
23318      if (element.hasRequiredElement()) {
23319        composeBooleanCore("required", element.getRequiredElement(), false);
23320        composeBooleanExtras("required", element.getRequiredElement(), false);
23321      }
23322      if (element.hasRepeatsElement()) {
23323        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23324        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23325      }
23326      if (element.hasGroup()) {
23327        openArray("group");
23328        for (Questionnaire.GroupComponent e : element.getGroup()) 
23329          composeQuestionnaireGroupComponent(null, e);
23330        closeArray();
23331      };
23332      if (element.hasQuestion()) {
23333        openArray("question");
23334        for (Questionnaire.QuestionComponent e : element.getQuestion()) 
23335          composeQuestionnaireQuestionComponent(null, e);
23336        closeArray();
23337      };
23338  }
23339
23340  protected void composeQuestionnaireQuestionComponent(String name, Questionnaire.QuestionComponent element) throws IOException {
23341    if (element != null) {
23342      open(name);
23343      composeQuestionnaireQuestionComponentInner(element);
23344      close();
23345    }
23346  }
23347
23348  protected void composeQuestionnaireQuestionComponentInner(Questionnaire.QuestionComponent element) throws IOException {
23349      composeBackbone(element);
23350      if (element.hasLinkIdElement()) {
23351        composeStringCore("linkId", element.getLinkIdElement(), false);
23352        composeStringExtras("linkId", element.getLinkIdElement(), false);
23353      }
23354      if (element.hasConcept()) {
23355        openArray("concept");
23356        for (Coding e : element.getConcept()) 
23357          composeCoding(null, e);
23358        closeArray();
23359      };
23360      if (element.hasTextElement()) {
23361        composeStringCore("text", element.getTextElement(), false);
23362        composeStringExtras("text", element.getTextElement(), false);
23363      }
23364      if (element.hasTypeElement()) {
23365        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23366        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.AnswerFormatEnumFactory(), false);
23367      }
23368      if (element.hasRequiredElement()) {
23369        composeBooleanCore("required", element.getRequiredElement(), false);
23370        composeBooleanExtras("required", element.getRequiredElement(), false);
23371      }
23372      if (element.hasRepeatsElement()) {
23373        composeBooleanCore("repeats", element.getRepeatsElement(), false);
23374        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
23375      }
23376      if (element.hasOptions()) {
23377        composeReference("options", element.getOptions());
23378      }
23379      if (element.hasOption()) {
23380        openArray("option");
23381        for (Coding e : element.getOption()) 
23382          composeCoding(null, e);
23383        closeArray();
23384      };
23385      if (element.hasGroup()) {
23386        openArray("group");
23387        for (Questionnaire.GroupComponent e : element.getGroup()) 
23388          composeQuestionnaireGroupComponent(null, e);
23389        closeArray();
23390      };
23391  }
23392
23393  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
23394    if (element != null) {
23395      prop("resourceType", name);
23396      composeQuestionnaireResponseInner(element);
23397    }
23398  }
23399
23400  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
23401      composeDomainResourceElements(element);
23402      if (element.hasIdentifier()) {
23403        composeIdentifier("identifier", element.getIdentifier());
23404      }
23405      if (element.hasQuestionnaire()) {
23406        composeReference("questionnaire", element.getQuestionnaire());
23407      }
23408      if (element.hasStatusElement()) {
23409        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23410        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
23411      }
23412      if (element.hasSubject()) {
23413        composeReference("subject", element.getSubject());
23414      }
23415      if (element.hasAuthor()) {
23416        composeReference("author", element.getAuthor());
23417      }
23418      if (element.hasAuthoredElement()) {
23419        composeDateTimeCore("authored", element.getAuthoredElement(), false);
23420        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
23421      }
23422      if (element.hasSource()) {
23423        composeReference("source", element.getSource());
23424      }
23425      if (element.hasEncounter()) {
23426        composeReference("encounter", element.getEncounter());
23427      }
23428      if (element.hasGroup()) {
23429        composeQuestionnaireResponseGroupComponent("group", element.getGroup());
23430      }
23431  }
23432
23433  protected void composeQuestionnaireResponseGroupComponent(String name, QuestionnaireResponse.GroupComponent element) throws IOException {
23434    if (element != null) {
23435      open(name);
23436      composeQuestionnaireResponseGroupComponentInner(element);
23437      close();
23438    }
23439  }
23440
23441  protected void composeQuestionnaireResponseGroupComponentInner(QuestionnaireResponse.GroupComponent element) throws IOException {
23442      composeBackbone(element);
23443      if (element.hasLinkIdElement()) {
23444        composeStringCore("linkId", element.getLinkIdElement(), false);
23445        composeStringExtras("linkId", element.getLinkIdElement(), false);
23446      }
23447      if (element.hasTitleElement()) {
23448        composeStringCore("title", element.getTitleElement(), false);
23449        composeStringExtras("title", element.getTitleElement(), false);
23450      }
23451      if (element.hasTextElement()) {
23452        composeStringCore("text", element.getTextElement(), false);
23453        composeStringExtras("text", element.getTextElement(), false);
23454      }
23455      if (element.hasSubject()) {
23456        composeReference("subject", element.getSubject());
23457      }
23458      if (element.hasGroup()) {
23459        openArray("group");
23460        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23461          composeQuestionnaireResponseGroupComponent(null, e);
23462        closeArray();
23463      };
23464      if (element.hasQuestion()) {
23465        openArray("question");
23466        for (QuestionnaireResponse.QuestionComponent e : element.getQuestion()) 
23467          composeQuestionnaireResponseQuestionComponent(null, e);
23468        closeArray();
23469      };
23470  }
23471
23472  protected void composeQuestionnaireResponseQuestionComponent(String name, QuestionnaireResponse.QuestionComponent element) throws IOException {
23473    if (element != null) {
23474      open(name);
23475      composeQuestionnaireResponseQuestionComponentInner(element);
23476      close();
23477    }
23478  }
23479
23480  protected void composeQuestionnaireResponseQuestionComponentInner(QuestionnaireResponse.QuestionComponent element) throws IOException {
23481      composeBackbone(element);
23482      if (element.hasLinkIdElement()) {
23483        composeStringCore("linkId", element.getLinkIdElement(), false);
23484        composeStringExtras("linkId", element.getLinkIdElement(), false);
23485      }
23486      if (element.hasTextElement()) {
23487        composeStringCore("text", element.getTextElement(), false);
23488        composeStringExtras("text", element.getTextElement(), false);
23489      }
23490      if (element.hasAnswer()) {
23491        openArray("answer");
23492        for (QuestionnaireResponse.QuestionAnswerComponent e : element.getAnswer()) 
23493          composeQuestionnaireResponseQuestionAnswerComponent(null, e);
23494        closeArray();
23495      };
23496  }
23497
23498  protected void composeQuestionnaireResponseQuestionAnswerComponent(String name, QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23499    if (element != null) {
23500      open(name);
23501      composeQuestionnaireResponseQuestionAnswerComponentInner(element);
23502      close();
23503    }
23504  }
23505
23506  protected void composeQuestionnaireResponseQuestionAnswerComponentInner(QuestionnaireResponse.QuestionAnswerComponent element) throws IOException {
23507      composeBackbone(element);
23508      if (element.hasValue()) {
23509        composeType("value", element.getValue());
23510      }
23511      if (element.hasGroup()) {
23512        openArray("group");
23513        for (QuestionnaireResponse.GroupComponent e : element.getGroup()) 
23514          composeQuestionnaireResponseGroupComponent(null, e);
23515        closeArray();
23516      };
23517  }
23518
23519  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
23520    if (element != null) {
23521      prop("resourceType", name);
23522      composeReferralRequestInner(element);
23523    }
23524  }
23525
23526  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
23527      composeDomainResourceElements(element);
23528      if (element.hasStatusElement()) {
23529        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23530        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralStatusEnumFactory(), false);
23531      }
23532      if (element.hasIdentifier()) {
23533        openArray("identifier");
23534        for (Identifier e : element.getIdentifier()) 
23535          composeIdentifier(null, e);
23536        closeArray();
23537      };
23538      if (element.hasDateElement()) {
23539        composeDateTimeCore("date", element.getDateElement(), false);
23540        composeDateTimeExtras("date", element.getDateElement(), false);
23541      }
23542      if (element.hasType()) {
23543        composeCodeableConcept("type", element.getType());
23544      }
23545      if (element.hasSpecialty()) {
23546        composeCodeableConcept("specialty", element.getSpecialty());
23547      }
23548      if (element.hasPriority()) {
23549        composeCodeableConcept("priority", element.getPriority());
23550      }
23551      if (element.hasPatient()) {
23552        composeReference("patient", element.getPatient());
23553      }
23554      if (element.hasRequester()) {
23555        composeReference("requester", element.getRequester());
23556      }
23557      if (element.hasRecipient()) {
23558        openArray("recipient");
23559        for (Reference e : element.getRecipient()) 
23560          composeReference(null, e);
23561        closeArray();
23562      };
23563      if (element.hasEncounter()) {
23564        composeReference("encounter", element.getEncounter());
23565      }
23566      if (element.hasDateSentElement()) {
23567        composeDateTimeCore("dateSent", element.getDateSentElement(), false);
23568        composeDateTimeExtras("dateSent", element.getDateSentElement(), false);
23569      }
23570      if (element.hasReason()) {
23571        composeCodeableConcept("reason", element.getReason());
23572      }
23573      if (element.hasDescriptionElement()) {
23574        composeStringCore("description", element.getDescriptionElement(), false);
23575        composeStringExtras("description", element.getDescriptionElement(), false);
23576      }
23577      if (element.hasServiceRequested()) {
23578        openArray("serviceRequested");
23579        for (CodeableConcept e : element.getServiceRequested()) 
23580          composeCodeableConcept(null, e);
23581        closeArray();
23582      };
23583      if (element.hasSupportingInformation()) {
23584        openArray("supportingInformation");
23585        for (Reference e : element.getSupportingInformation()) 
23586          composeReference(null, e);
23587        closeArray();
23588      };
23589      if (element.hasFulfillmentTime()) {
23590        composePeriod("fulfillmentTime", element.getFulfillmentTime());
23591      }
23592  }
23593
23594  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
23595    if (element != null) {
23596      prop("resourceType", name);
23597      composeRelatedPersonInner(element);
23598    }
23599  }
23600
23601  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
23602      composeDomainResourceElements(element);
23603      if (element.hasIdentifier()) {
23604        openArray("identifier");
23605        for (Identifier e : element.getIdentifier()) 
23606          composeIdentifier(null, e);
23607        closeArray();
23608      };
23609      if (element.hasPatient()) {
23610        composeReference("patient", element.getPatient());
23611      }
23612      if (element.hasRelationship()) {
23613        composeCodeableConcept("relationship", element.getRelationship());
23614      }
23615      if (element.hasName()) {
23616        composeHumanName("name", element.getName());
23617      }
23618      if (element.hasTelecom()) {
23619        openArray("telecom");
23620        for (ContactPoint e : element.getTelecom()) 
23621          composeContactPoint(null, e);
23622        closeArray();
23623      };
23624      if (element.hasGenderElement()) {
23625        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23626        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
23627      }
23628      if (element.hasBirthDateElement()) {
23629        composeDateCore("birthDate", element.getBirthDateElement(), false);
23630        composeDateExtras("birthDate", element.getBirthDateElement(), false);
23631      }
23632      if (element.hasAddress()) {
23633        openArray("address");
23634        for (Address e : element.getAddress()) 
23635          composeAddress(null, e);
23636        closeArray();
23637      };
23638      if (element.hasPhoto()) {
23639        openArray("photo");
23640        for (Attachment e : element.getPhoto()) 
23641          composeAttachment(null, e);
23642        closeArray();
23643      };
23644      if (element.hasPeriod()) {
23645        composePeriod("period", element.getPeriod());
23646      }
23647  }
23648
23649  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
23650    if (element != null) {
23651      prop("resourceType", name);
23652      composeRiskAssessmentInner(element);
23653    }
23654  }
23655
23656  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
23657      composeDomainResourceElements(element);
23658      if (element.hasSubject()) {
23659        composeReference("subject", element.getSubject());
23660      }
23661      if (element.hasDateElement()) {
23662        composeDateTimeCore("date", element.getDateElement(), false);
23663        composeDateTimeExtras("date", element.getDateElement(), false);
23664      }
23665      if (element.hasCondition()) {
23666        composeReference("condition", element.getCondition());
23667      }
23668      if (element.hasEncounter()) {
23669        composeReference("encounter", element.getEncounter());
23670      }
23671      if (element.hasPerformer()) {
23672        composeReference("performer", element.getPerformer());
23673      }
23674      if (element.hasIdentifier()) {
23675        composeIdentifier("identifier", element.getIdentifier());
23676      }
23677      if (element.hasMethod()) {
23678        composeCodeableConcept("method", element.getMethod());
23679      }
23680      if (element.hasBasis()) {
23681        openArray("basis");
23682        for (Reference e : element.getBasis()) 
23683          composeReference(null, e);
23684        closeArray();
23685      };
23686      if (element.hasPrediction()) {
23687        openArray("prediction");
23688        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
23689          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
23690        closeArray();
23691      };
23692      if (element.hasMitigationElement()) {
23693        composeStringCore("mitigation", element.getMitigationElement(), false);
23694        composeStringExtras("mitigation", element.getMitigationElement(), false);
23695      }
23696  }
23697
23698  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23699    if (element != null) {
23700      open(name);
23701      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
23702      close();
23703    }
23704  }
23705
23706  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
23707      composeBackbone(element);
23708      if (element.hasOutcome()) {
23709        composeCodeableConcept("outcome", element.getOutcome());
23710      }
23711      if (element.hasProbability()) {
23712        composeType("probability", element.getProbability());
23713      }
23714      if (element.hasRelativeRiskElement()) {
23715        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
23716        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
23717      }
23718      if (element.hasWhen()) {
23719        composeType("when", element.getWhen());
23720      }
23721      if (element.hasRationaleElement()) {
23722        composeStringCore("rationale", element.getRationaleElement(), false);
23723        composeStringExtras("rationale", element.getRationaleElement(), false);
23724      }
23725  }
23726
23727  protected void composeSchedule(String name, Schedule element) throws IOException {
23728    if (element != null) {
23729      prop("resourceType", name);
23730      composeScheduleInner(element);
23731    }
23732  }
23733
23734  protected void composeScheduleInner(Schedule element) throws IOException {
23735      composeDomainResourceElements(element);
23736      if (element.hasIdentifier()) {
23737        openArray("identifier");
23738        for (Identifier e : element.getIdentifier()) 
23739          composeIdentifier(null, e);
23740        closeArray();
23741      };
23742      if (element.hasType()) {
23743        openArray("type");
23744        for (CodeableConcept e : element.getType()) 
23745          composeCodeableConcept(null, e);
23746        closeArray();
23747      };
23748      if (element.hasActor()) {
23749        composeReference("actor", element.getActor());
23750      }
23751      if (element.hasPlanningHorizon()) {
23752        composePeriod("planningHorizon", element.getPlanningHorizon());
23753      }
23754      if (element.hasCommentElement()) {
23755        composeStringCore("comment", element.getCommentElement(), false);
23756        composeStringExtras("comment", element.getCommentElement(), false);
23757      }
23758  }
23759
23760  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
23761    if (element != null) {
23762      prop("resourceType", name);
23763      composeSearchParameterInner(element);
23764    }
23765  }
23766
23767  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
23768      composeDomainResourceElements(element);
23769      if (element.hasUrlElement()) {
23770        composeUriCore("url", element.getUrlElement(), false);
23771        composeUriExtras("url", element.getUrlElement(), false);
23772      }
23773      if (element.hasNameElement()) {
23774        composeStringCore("name", element.getNameElement(), false);
23775        composeStringExtras("name", element.getNameElement(), false);
23776      }
23777      if (element.hasStatusElement()) {
23778        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23779        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
23780      }
23781      if (element.hasExperimentalElement()) {
23782        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23783        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23784      }
23785      if (element.hasPublisherElement()) {
23786        composeStringCore("publisher", element.getPublisherElement(), false);
23787        composeStringExtras("publisher", element.getPublisherElement(), false);
23788      }
23789      if (element.hasContact()) {
23790        openArray("contact");
23791        for (SearchParameter.SearchParameterContactComponent e : element.getContact()) 
23792          composeSearchParameterSearchParameterContactComponent(null, e);
23793        closeArray();
23794      };
23795      if (element.hasDateElement()) {
23796        composeDateTimeCore("date", element.getDateElement(), false);
23797        composeDateTimeExtras("date", element.getDateElement(), false);
23798      }
23799      if (element.hasRequirementsElement()) {
23800        composeStringCore("requirements", element.getRequirementsElement(), false);
23801        composeStringExtras("requirements", element.getRequirementsElement(), false);
23802      }
23803      if (element.hasCodeElement()) {
23804        composeCodeCore("code", element.getCodeElement(), false);
23805        composeCodeExtras("code", element.getCodeElement(), false);
23806      }
23807      if (element.hasBaseElement()) {
23808        composeCodeCore("base", element.getBaseElement(), false);
23809        composeCodeExtras("base", element.getBaseElement(), false);
23810      }
23811      if (element.hasTypeElement()) {
23812        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23813        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
23814      }
23815      if (element.hasDescriptionElement()) {
23816        composeStringCore("description", element.getDescriptionElement(), false);
23817        composeStringExtras("description", element.getDescriptionElement(), false);
23818      }
23819      if (element.hasXpathElement()) {
23820        composeStringCore("xpath", element.getXpathElement(), false);
23821        composeStringExtras("xpath", element.getXpathElement(), false);
23822      }
23823      if (element.hasXpathUsageElement()) {
23824        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23825        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
23826      }
23827      if (element.hasTarget()) {
23828        openArray("target");
23829        for (CodeType e : element.getTarget()) 
23830          composeCodeCore(null, e, true);
23831        closeArray();
23832        if (anyHasExtras(element.getTarget())) {
23833          openArray("_target");
23834          for (CodeType e : element.getTarget()) 
23835            composeCodeExtras(null, e, true);
23836          closeArray();
23837        }
23838      };
23839  }
23840
23841  protected void composeSearchParameterSearchParameterContactComponent(String name, SearchParameter.SearchParameterContactComponent element) throws IOException {
23842    if (element != null) {
23843      open(name);
23844      composeSearchParameterSearchParameterContactComponentInner(element);
23845      close();
23846    }
23847  }
23848
23849  protected void composeSearchParameterSearchParameterContactComponentInner(SearchParameter.SearchParameterContactComponent element) throws IOException {
23850      composeBackbone(element);
23851      if (element.hasNameElement()) {
23852        composeStringCore("name", element.getNameElement(), false);
23853        composeStringExtras("name", element.getNameElement(), false);
23854      }
23855      if (element.hasTelecom()) {
23856        openArray("telecom");
23857        for (ContactPoint e : element.getTelecom()) 
23858          composeContactPoint(null, e);
23859        closeArray();
23860      };
23861  }
23862
23863  protected void composeSlot(String name, Slot element) throws IOException {
23864    if (element != null) {
23865      prop("resourceType", name);
23866      composeSlotInner(element);
23867    }
23868  }
23869
23870  protected void composeSlotInner(Slot element) throws IOException {
23871      composeDomainResourceElements(element);
23872      if (element.hasIdentifier()) {
23873        openArray("identifier");
23874        for (Identifier e : element.getIdentifier()) 
23875          composeIdentifier(null, e);
23876        closeArray();
23877      };
23878      if (element.hasType()) {
23879        composeCodeableConcept("type", element.getType());
23880      }
23881      if (element.hasSchedule()) {
23882        composeReference("schedule", element.getSchedule());
23883      }
23884      if (element.hasFreeBusyTypeElement()) {
23885        composeEnumerationCore("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23886        composeEnumerationExtras("freeBusyType", element.getFreeBusyTypeElement(), new Slot.SlotStatusEnumFactory(), false);
23887      }
23888      if (element.hasStartElement()) {
23889        composeInstantCore("start", element.getStartElement(), false);
23890        composeInstantExtras("start", element.getStartElement(), false);
23891      }
23892      if (element.hasEndElement()) {
23893        composeInstantCore("end", element.getEndElement(), false);
23894        composeInstantExtras("end", element.getEndElement(), false);
23895      }
23896      if (element.hasOverbookedElement()) {
23897        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
23898        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
23899      }
23900      if (element.hasCommentElement()) {
23901        composeStringCore("comment", element.getCommentElement(), false);
23902        composeStringExtras("comment", element.getCommentElement(), false);
23903      }
23904  }
23905
23906  protected void composeSpecimen(String name, Specimen element) throws IOException {
23907    if (element != null) {
23908      prop("resourceType", name);
23909      composeSpecimenInner(element);
23910    }
23911  }
23912
23913  protected void composeSpecimenInner(Specimen element) throws IOException {
23914      composeDomainResourceElements(element);
23915      if (element.hasIdentifier()) {
23916        openArray("identifier");
23917        for (Identifier e : element.getIdentifier()) 
23918          composeIdentifier(null, e);
23919        closeArray();
23920      };
23921      if (element.hasStatusElement()) {
23922        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23923        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
23924      }
23925      if (element.hasType()) {
23926        composeCodeableConcept("type", element.getType());
23927      }
23928      if (element.hasParent()) {
23929        openArray("parent");
23930        for (Reference e : element.getParent()) 
23931          composeReference(null, e);
23932        closeArray();
23933      };
23934      if (element.hasSubject()) {
23935        composeReference("subject", element.getSubject());
23936      }
23937      if (element.hasAccessionIdentifier()) {
23938        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
23939      }
23940      if (element.hasReceivedTimeElement()) {
23941        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
23942        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
23943      }
23944      if (element.hasCollection()) {
23945        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
23946      }
23947      if (element.hasTreatment()) {
23948        openArray("treatment");
23949        for (Specimen.SpecimenTreatmentComponent e : element.getTreatment()) 
23950          composeSpecimenSpecimenTreatmentComponent(null, e);
23951        closeArray();
23952      };
23953      if (element.hasContainer()) {
23954        openArray("container");
23955        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
23956          composeSpecimenSpecimenContainerComponent(null, e);
23957        closeArray();
23958      };
23959  }
23960
23961  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
23962    if (element != null) {
23963      open(name);
23964      composeSpecimenSpecimenCollectionComponentInner(element);
23965      close();
23966    }
23967  }
23968
23969  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
23970      composeBackbone(element);
23971      if (element.hasCollector()) {
23972        composeReference("collector", element.getCollector());
23973      }
23974      if (element.hasComment()) {
23975        openArray("comment");
23976        for (StringType e : element.getComment()) 
23977          composeStringCore(null, e, true);
23978        closeArray();
23979        if (anyHasExtras(element.getComment())) {
23980          openArray("_comment");
23981          for (StringType e : element.getComment()) 
23982            composeStringExtras(null, e, true);
23983          closeArray();
23984        }
23985      };
23986      if (element.hasCollected()) {
23987        composeType("collected", element.getCollected());
23988      }
23989      if (element.hasQuantity()) {
23990        composeSimpleQuantity("quantity", element.getQuantity());
23991      }
23992      if (element.hasMethod()) {
23993        composeCodeableConcept("method", element.getMethod());
23994      }
23995      if (element.hasBodySite()) {
23996        composeCodeableConcept("bodySite", element.getBodySite());
23997      }
23998  }
23999
24000  protected void composeSpecimenSpecimenTreatmentComponent(String name, Specimen.SpecimenTreatmentComponent element) throws IOException {
24001    if (element != null) {
24002      open(name);
24003      composeSpecimenSpecimenTreatmentComponentInner(element);
24004      close();
24005    }
24006  }
24007
24008  protected void composeSpecimenSpecimenTreatmentComponentInner(Specimen.SpecimenTreatmentComponent element) throws IOException {
24009      composeBackbone(element);
24010      if (element.hasDescriptionElement()) {
24011        composeStringCore("description", element.getDescriptionElement(), false);
24012        composeStringExtras("description", element.getDescriptionElement(), false);
24013      }
24014      if (element.hasProcedure()) {
24015        composeCodeableConcept("procedure", element.getProcedure());
24016      }
24017      if (element.hasAdditive()) {
24018        openArray("additive");
24019        for (Reference e : element.getAdditive()) 
24020          composeReference(null, e);
24021        closeArray();
24022      };
24023  }
24024
24025  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
24026    if (element != null) {
24027      open(name);
24028      composeSpecimenSpecimenContainerComponentInner(element);
24029      close();
24030    }
24031  }
24032
24033  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
24034      composeBackbone(element);
24035      if (element.hasIdentifier()) {
24036        openArray("identifier");
24037        for (Identifier e : element.getIdentifier()) 
24038          composeIdentifier(null, e);
24039        closeArray();
24040      };
24041      if (element.hasDescriptionElement()) {
24042        composeStringCore("description", element.getDescriptionElement(), false);
24043        composeStringExtras("description", element.getDescriptionElement(), false);
24044      }
24045      if (element.hasType()) {
24046        composeCodeableConcept("type", element.getType());
24047      }
24048      if (element.hasCapacity()) {
24049        composeSimpleQuantity("capacity", element.getCapacity());
24050      }
24051      if (element.hasSpecimenQuantity()) {
24052        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
24053      }
24054      if (element.hasAdditive()) {
24055        composeType("additive", element.getAdditive());
24056      }
24057  }
24058
24059  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
24060    if (element != null) {
24061      prop("resourceType", name);
24062      composeStructureDefinitionInner(element);
24063    }
24064  }
24065
24066  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
24067      composeDomainResourceElements(element);
24068      if (element.hasUrlElement()) {
24069        composeUriCore("url", element.getUrlElement(), false);
24070        composeUriExtras("url", element.getUrlElement(), false);
24071      }
24072      if (element.hasIdentifier()) {
24073        openArray("identifier");
24074        for (Identifier e : element.getIdentifier()) 
24075          composeIdentifier(null, e);
24076        closeArray();
24077      };
24078      if (element.hasVersionElement()) {
24079        composeStringCore("version", element.getVersionElement(), false);
24080        composeStringExtras("version", element.getVersionElement(), false);
24081      }
24082      if (element.hasNameElement()) {
24083        composeStringCore("name", element.getNameElement(), false);
24084        composeStringExtras("name", element.getNameElement(), false);
24085      }
24086      if (element.hasDisplayElement()) {
24087        composeStringCore("display", element.getDisplayElement(), false);
24088        composeStringExtras("display", element.getDisplayElement(), false);
24089      }
24090      if (element.hasStatusElement()) {
24091        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24092        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24093      }
24094      if (element.hasExperimentalElement()) {
24095        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24096        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24097      }
24098      if (element.hasPublisherElement()) {
24099        composeStringCore("publisher", element.getPublisherElement(), false);
24100        composeStringExtras("publisher", element.getPublisherElement(), false);
24101      }
24102      if (element.hasContact()) {
24103        openArray("contact");
24104        for (StructureDefinition.StructureDefinitionContactComponent e : element.getContact()) 
24105          composeStructureDefinitionStructureDefinitionContactComponent(null, e);
24106        closeArray();
24107      };
24108      if (element.hasDateElement()) {
24109        composeDateTimeCore("date", element.getDateElement(), false);
24110        composeDateTimeExtras("date", element.getDateElement(), false);
24111      }
24112      if (element.hasDescriptionElement()) {
24113        composeStringCore("description", element.getDescriptionElement(), false);
24114        composeStringExtras("description", element.getDescriptionElement(), false);
24115      }
24116      if (element.hasUseContext()) {
24117        openArray("useContext");
24118        for (CodeableConcept e : element.getUseContext()) 
24119          composeCodeableConcept(null, e);
24120        closeArray();
24121      };
24122      if (element.hasRequirementsElement()) {
24123        composeStringCore("requirements", element.getRequirementsElement(), false);
24124        composeStringExtras("requirements", element.getRequirementsElement(), false);
24125      }
24126      if (element.hasCopyrightElement()) {
24127        composeStringCore("copyright", element.getCopyrightElement(), false);
24128        composeStringExtras("copyright", element.getCopyrightElement(), false);
24129      }
24130      if (element.hasCode()) {
24131        openArray("code");
24132        for (Coding e : element.getCode()) 
24133          composeCoding(null, e);
24134        closeArray();
24135      };
24136      if (element.hasFhirVersionElement()) {
24137        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
24138        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
24139      }
24140      if (element.hasMapping()) {
24141        openArray("mapping");
24142        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
24143          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
24144        closeArray();
24145      };
24146      if (element.hasKindElement()) {
24147        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24148        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
24149      }
24150      if (element.hasConstrainedTypeElement()) {
24151        composeCodeCore("constrainedType", element.getConstrainedTypeElement(), false);
24152        composeCodeExtras("constrainedType", element.getConstrainedTypeElement(), false);
24153      }
24154      if (element.hasAbstractElement()) {
24155        composeBooleanCore("abstract", element.getAbstractElement(), false);
24156        composeBooleanExtras("abstract", element.getAbstractElement(), false);
24157      }
24158      if (element.hasContextTypeElement()) {
24159        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24160        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
24161      }
24162      if (element.hasContext()) {
24163        openArray("context");
24164        for (StringType e : element.getContext()) 
24165          composeStringCore(null, e, true);
24166        closeArray();
24167        if (anyHasExtras(element.getContext())) {
24168          openArray("_context");
24169          for (StringType e : element.getContext()) 
24170            composeStringExtras(null, e, true);
24171          closeArray();
24172        }
24173      };
24174      if (element.hasBaseElement()) {
24175        composeUriCore("base", element.getBaseElement(), false);
24176        composeUriExtras("base", element.getBaseElement(), false);
24177      }
24178      if (element.hasSnapshot()) {
24179        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
24180      }
24181      if (element.hasDifferential()) {
24182        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
24183      }
24184  }
24185
24186  protected void composeStructureDefinitionStructureDefinitionContactComponent(String name, StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24187    if (element != null) {
24188      open(name);
24189      composeStructureDefinitionStructureDefinitionContactComponentInner(element);
24190      close();
24191    }
24192  }
24193
24194  protected void composeStructureDefinitionStructureDefinitionContactComponentInner(StructureDefinition.StructureDefinitionContactComponent element) throws IOException {
24195      composeBackbone(element);
24196      if (element.hasNameElement()) {
24197        composeStringCore("name", element.getNameElement(), false);
24198        composeStringExtras("name", element.getNameElement(), false);
24199      }
24200      if (element.hasTelecom()) {
24201        openArray("telecom");
24202        for (ContactPoint e : element.getTelecom()) 
24203          composeContactPoint(null, e);
24204        closeArray();
24205      };
24206  }
24207
24208  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24209    if (element != null) {
24210      open(name);
24211      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
24212      close();
24213    }
24214  }
24215
24216  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
24217      composeBackbone(element);
24218      if (element.hasIdentityElement()) {
24219        composeIdCore("identity", element.getIdentityElement(), false);
24220        composeIdExtras("identity", element.getIdentityElement(), false);
24221      }
24222      if (element.hasUriElement()) {
24223        composeUriCore("uri", element.getUriElement(), false);
24224        composeUriExtras("uri", element.getUriElement(), false);
24225      }
24226      if (element.hasNameElement()) {
24227        composeStringCore("name", element.getNameElement(), false);
24228        composeStringExtras("name", element.getNameElement(), false);
24229      }
24230      if (element.hasCommentsElement()) {
24231        composeStringCore("comments", element.getCommentsElement(), false);
24232        composeStringExtras("comments", element.getCommentsElement(), false);
24233      }
24234  }
24235
24236  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24237    if (element != null) {
24238      open(name);
24239      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
24240      close();
24241    }
24242  }
24243
24244  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
24245      composeBackbone(element);
24246      if (element.hasElement()) {
24247        openArray("element");
24248        for (ElementDefinition e : element.getElement()) 
24249          composeElementDefinition(null, e);
24250        closeArray();
24251      };
24252  }
24253
24254  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24255    if (element != null) {
24256      open(name);
24257      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
24258      close();
24259    }
24260  }
24261
24262  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
24263      composeBackbone(element);
24264      if (element.hasElement()) {
24265        openArray("element");
24266        for (ElementDefinition e : element.getElement()) 
24267          composeElementDefinition(null, e);
24268        closeArray();
24269      };
24270  }
24271
24272  protected void composeSubscription(String name, Subscription element) throws IOException {
24273    if (element != null) {
24274      prop("resourceType", name);
24275      composeSubscriptionInner(element);
24276    }
24277  }
24278
24279  protected void composeSubscriptionInner(Subscription element) throws IOException {
24280      composeDomainResourceElements(element);
24281      if (element.hasCriteriaElement()) {
24282        composeStringCore("criteria", element.getCriteriaElement(), false);
24283        composeStringExtras("criteria", element.getCriteriaElement(), false);
24284      }
24285      if (element.hasContact()) {
24286        openArray("contact");
24287        for (ContactPoint e : element.getContact()) 
24288          composeContactPoint(null, e);
24289        closeArray();
24290      };
24291      if (element.hasReasonElement()) {
24292        composeStringCore("reason", element.getReasonElement(), false);
24293        composeStringExtras("reason", element.getReasonElement(), false);
24294      }
24295      if (element.hasStatusElement()) {
24296        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24297        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
24298      }
24299      if (element.hasErrorElement()) {
24300        composeStringCore("error", element.getErrorElement(), false);
24301        composeStringExtras("error", element.getErrorElement(), false);
24302      }
24303      if (element.hasChannel()) {
24304        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
24305      }
24306      if (element.hasEndElement()) {
24307        composeInstantCore("end", element.getEndElement(), false);
24308        composeInstantExtras("end", element.getEndElement(), false);
24309      }
24310      if (element.hasTag()) {
24311        openArray("tag");
24312        for (Coding e : element.getTag()) 
24313          composeCoding(null, e);
24314        closeArray();
24315      };
24316  }
24317
24318  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
24319    if (element != null) {
24320      open(name);
24321      composeSubscriptionSubscriptionChannelComponentInner(element);
24322      close();
24323    }
24324  }
24325
24326  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
24327      composeBackbone(element);
24328      if (element.hasTypeElement()) {
24329        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24330        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
24331      }
24332      if (element.hasEndpointElement()) {
24333        composeUriCore("endpoint", element.getEndpointElement(), false);
24334        composeUriExtras("endpoint", element.getEndpointElement(), false);
24335      }
24336      if (element.hasPayloadElement()) {
24337        composeStringCore("payload", element.getPayloadElement(), false);
24338        composeStringExtras("payload", element.getPayloadElement(), false);
24339      }
24340      if (element.hasHeaderElement()) {
24341        composeStringCore("header", element.getHeaderElement(), false);
24342        composeStringExtras("header", element.getHeaderElement(), false);
24343      }
24344  }
24345
24346  protected void composeSubstance(String name, Substance element) throws IOException {
24347    if (element != null) {
24348      prop("resourceType", name);
24349      composeSubstanceInner(element);
24350    }
24351  }
24352
24353  protected void composeSubstanceInner(Substance element) throws IOException {
24354      composeDomainResourceElements(element);
24355      if (element.hasIdentifier()) {
24356        openArray("identifier");
24357        for (Identifier e : element.getIdentifier()) 
24358          composeIdentifier(null, e);
24359        closeArray();
24360      };
24361      if (element.hasCategory()) {
24362        openArray("category");
24363        for (CodeableConcept e : element.getCategory()) 
24364          composeCodeableConcept(null, e);
24365        closeArray();
24366      };
24367      if (element.hasCode()) {
24368        composeCodeableConcept("code", element.getCode());
24369      }
24370      if (element.hasDescriptionElement()) {
24371        composeStringCore("description", element.getDescriptionElement(), false);
24372        composeStringExtras("description", element.getDescriptionElement(), false);
24373      }
24374      if (element.hasInstance()) {
24375        openArray("instance");
24376        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
24377          composeSubstanceSubstanceInstanceComponent(null, e);
24378        closeArray();
24379      };
24380      if (element.hasIngredient()) {
24381        openArray("ingredient");
24382        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
24383          composeSubstanceSubstanceIngredientComponent(null, e);
24384        closeArray();
24385      };
24386  }
24387
24388  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
24389    if (element != null) {
24390      open(name);
24391      composeSubstanceSubstanceInstanceComponentInner(element);
24392      close();
24393    }
24394  }
24395
24396  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
24397      composeBackbone(element);
24398      if (element.hasIdentifier()) {
24399        composeIdentifier("identifier", element.getIdentifier());
24400      }
24401      if (element.hasExpiryElement()) {
24402        composeDateTimeCore("expiry", element.getExpiryElement(), false);
24403        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
24404      }
24405      if (element.hasQuantity()) {
24406        composeSimpleQuantity("quantity", element.getQuantity());
24407      }
24408  }
24409
24410  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
24411    if (element != null) {
24412      open(name);
24413      composeSubstanceSubstanceIngredientComponentInner(element);
24414      close();
24415    }
24416  }
24417
24418  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
24419      composeBackbone(element);
24420      if (element.hasQuantity()) {
24421        composeRatio("quantity", element.getQuantity());
24422      }
24423      if (element.hasSubstance()) {
24424        composeReference("substance", element.getSubstance());
24425      }
24426  }
24427
24428  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
24429    if (element != null) {
24430      prop("resourceType", name);
24431      composeSupplyDeliveryInner(element);
24432    }
24433  }
24434
24435  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
24436      composeDomainResourceElements(element);
24437      if (element.hasIdentifier()) {
24438        composeIdentifier("identifier", element.getIdentifier());
24439      }
24440      if (element.hasStatusElement()) {
24441        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24442        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
24443      }
24444      if (element.hasPatient()) {
24445        composeReference("patient", element.getPatient());
24446      }
24447      if (element.hasType()) {
24448        composeCodeableConcept("type", element.getType());
24449      }
24450      if (element.hasQuantity()) {
24451        composeSimpleQuantity("quantity", element.getQuantity());
24452      }
24453      if (element.hasSuppliedItem()) {
24454        composeReference("suppliedItem", element.getSuppliedItem());
24455      }
24456      if (element.hasSupplier()) {
24457        composeReference("supplier", element.getSupplier());
24458      }
24459      if (element.hasWhenPrepared()) {
24460        composePeriod("whenPrepared", element.getWhenPrepared());
24461      }
24462      if (element.hasTimeElement()) {
24463        composeDateTimeCore("time", element.getTimeElement(), false);
24464        composeDateTimeExtras("time", element.getTimeElement(), false);
24465      }
24466      if (element.hasDestination()) {
24467        composeReference("destination", element.getDestination());
24468      }
24469      if (element.hasReceiver()) {
24470        openArray("receiver");
24471        for (Reference e : element.getReceiver()) 
24472          composeReference(null, e);
24473        closeArray();
24474      };
24475  }
24476
24477  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
24478    if (element != null) {
24479      prop("resourceType", name);
24480      composeSupplyRequestInner(element);
24481    }
24482  }
24483
24484  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
24485      composeDomainResourceElements(element);
24486      if (element.hasPatient()) {
24487        composeReference("patient", element.getPatient());
24488      }
24489      if (element.hasSource()) {
24490        composeReference("source", element.getSource());
24491      }
24492      if (element.hasDateElement()) {
24493        composeDateTimeCore("date", element.getDateElement(), false);
24494        composeDateTimeExtras("date", element.getDateElement(), false);
24495      }
24496      if (element.hasIdentifier()) {
24497        composeIdentifier("identifier", element.getIdentifier());
24498      }
24499      if (element.hasStatusElement()) {
24500        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24501        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
24502      }
24503      if (element.hasKind()) {
24504        composeCodeableConcept("kind", element.getKind());
24505      }
24506      if (element.hasOrderedItem()) {
24507        composeReference("orderedItem", element.getOrderedItem());
24508      }
24509      if (element.hasSupplier()) {
24510        openArray("supplier");
24511        for (Reference e : element.getSupplier()) 
24512          composeReference(null, e);
24513        closeArray();
24514      };
24515      if (element.hasReason()) {
24516        composeType("reason", element.getReason());
24517      }
24518      if (element.hasWhen()) {
24519        composeSupplyRequestSupplyRequestWhenComponent("when", element.getWhen());
24520      }
24521  }
24522
24523  protected void composeSupplyRequestSupplyRequestWhenComponent(String name, SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24524    if (element != null) {
24525      open(name);
24526      composeSupplyRequestSupplyRequestWhenComponentInner(element);
24527      close();
24528    }
24529  }
24530
24531  protected void composeSupplyRequestSupplyRequestWhenComponentInner(SupplyRequest.SupplyRequestWhenComponent element) throws IOException {
24532      composeBackbone(element);
24533      if (element.hasCode()) {
24534        composeCodeableConcept("code", element.getCode());
24535      }
24536      if (element.hasSchedule()) {
24537        composeTiming("schedule", element.getSchedule());
24538      }
24539  }
24540
24541  protected void composeTestScript(String name, TestScript element) throws IOException {
24542    if (element != null) {
24543      prop("resourceType", name);
24544      composeTestScriptInner(element);
24545    }
24546  }
24547
24548  protected void composeTestScriptInner(TestScript element) throws IOException {
24549      composeDomainResourceElements(element);
24550      if (element.hasUrlElement()) {
24551        composeUriCore("url", element.getUrlElement(), false);
24552        composeUriExtras("url", element.getUrlElement(), false);
24553      }
24554      if (element.hasVersionElement()) {
24555        composeStringCore("version", element.getVersionElement(), false);
24556        composeStringExtras("version", element.getVersionElement(), false);
24557      }
24558      if (element.hasNameElement()) {
24559        composeStringCore("name", element.getNameElement(), false);
24560        composeStringExtras("name", element.getNameElement(), false);
24561      }
24562      if (element.hasStatusElement()) {
24563        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24564        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
24565      }
24566      if (element.hasIdentifier()) {
24567        composeIdentifier("identifier", element.getIdentifier());
24568      }
24569      if (element.hasExperimentalElement()) {
24570        composeBooleanCore("experimental", element.getExperimentalElement(), false);
24571        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
24572      }
24573      if (element.hasPublisherElement()) {
24574        composeStringCore("publisher", element.getPublisherElement(), false);
24575        composeStringExtras("publisher", element.getPublisherElement(), false);
24576      }
24577      if (element.hasContact()) {
24578        openArray("contact");
24579        for (TestScript.TestScriptContactComponent e : element.getContact()) 
24580          composeTestScriptTestScriptContactComponent(null, e);
24581        closeArray();
24582      };
24583      if (element.hasDateElement()) {
24584        composeDateTimeCore("date", element.getDateElement(), false);
24585        composeDateTimeExtras("date", element.getDateElement(), false);
24586      }
24587      if (element.hasDescriptionElement()) {
24588        composeStringCore("description", element.getDescriptionElement(), false);
24589        composeStringExtras("description", element.getDescriptionElement(), false);
24590      }
24591      if (element.hasUseContext()) {
24592        openArray("useContext");
24593        for (CodeableConcept e : element.getUseContext()) 
24594          composeCodeableConcept(null, e);
24595        closeArray();
24596      };
24597      if (element.hasRequirementsElement()) {
24598        composeStringCore("requirements", element.getRequirementsElement(), false);
24599        composeStringExtras("requirements", element.getRequirementsElement(), false);
24600      }
24601      if (element.hasCopyrightElement()) {
24602        composeStringCore("copyright", element.getCopyrightElement(), false);
24603        composeStringExtras("copyright", element.getCopyrightElement(), false);
24604      }
24605      if (element.hasMetadata()) {
24606        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24607      }
24608      if (element.hasMultiserverElement()) {
24609        composeBooleanCore("multiserver", element.getMultiserverElement(), false);
24610        composeBooleanExtras("multiserver", element.getMultiserverElement(), false);
24611      }
24612      if (element.hasFixture()) {
24613        openArray("fixture");
24614        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
24615          composeTestScriptTestScriptFixtureComponent(null, e);
24616        closeArray();
24617      };
24618      if (element.hasProfile()) {
24619        openArray("profile");
24620        for (Reference e : element.getProfile()) 
24621          composeReference(null, e);
24622        closeArray();
24623      };
24624      if (element.hasVariable()) {
24625        openArray("variable");
24626        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
24627          composeTestScriptTestScriptVariableComponent(null, e);
24628        closeArray();
24629      };
24630      if (element.hasSetup()) {
24631        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
24632      }
24633      if (element.hasTest()) {
24634        openArray("test");
24635        for (TestScript.TestScriptTestComponent e : element.getTest()) 
24636          composeTestScriptTestScriptTestComponent(null, e);
24637        closeArray();
24638      };
24639      if (element.hasTeardown()) {
24640        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
24641      }
24642  }
24643
24644  protected void composeTestScriptTestScriptContactComponent(String name, TestScript.TestScriptContactComponent element) throws IOException {
24645    if (element != null) {
24646      open(name);
24647      composeTestScriptTestScriptContactComponentInner(element);
24648      close();
24649    }
24650  }
24651
24652  protected void composeTestScriptTestScriptContactComponentInner(TestScript.TestScriptContactComponent element) throws IOException {
24653      composeBackbone(element);
24654      if (element.hasNameElement()) {
24655        composeStringCore("name", element.getNameElement(), false);
24656        composeStringExtras("name", element.getNameElement(), false);
24657      }
24658      if (element.hasTelecom()) {
24659        openArray("telecom");
24660        for (ContactPoint e : element.getTelecom()) 
24661          composeContactPoint(null, e);
24662        closeArray();
24663      };
24664  }
24665
24666  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
24667    if (element != null) {
24668      open(name);
24669      composeTestScriptTestScriptMetadataComponentInner(element);
24670      close();
24671    }
24672  }
24673
24674  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
24675      composeBackbone(element);
24676      if (element.hasLink()) {
24677        openArray("link");
24678        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
24679          composeTestScriptTestScriptMetadataLinkComponent(null, e);
24680        closeArray();
24681      };
24682      if (element.hasCapability()) {
24683        openArray("capability");
24684        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
24685          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
24686        closeArray();
24687      };
24688  }
24689
24690  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24691    if (element != null) {
24692      open(name);
24693      composeTestScriptTestScriptMetadataLinkComponentInner(element);
24694      close();
24695    }
24696  }
24697
24698  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
24699      composeBackbone(element);
24700      if (element.hasUrlElement()) {
24701        composeUriCore("url", element.getUrlElement(), false);
24702        composeUriExtras("url", element.getUrlElement(), false);
24703      }
24704      if (element.hasDescriptionElement()) {
24705        composeStringCore("description", element.getDescriptionElement(), false);
24706        composeStringExtras("description", element.getDescriptionElement(), false);
24707      }
24708  }
24709
24710  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24711    if (element != null) {
24712      open(name);
24713      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
24714      close();
24715    }
24716  }
24717
24718  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
24719      composeBackbone(element);
24720      if (element.hasRequiredElement()) {
24721        composeBooleanCore("required", element.getRequiredElement(), false);
24722        composeBooleanExtras("required", element.getRequiredElement(), false);
24723      }
24724      if (element.hasValidatedElement()) {
24725        composeBooleanCore("validated", element.getValidatedElement(), false);
24726        composeBooleanExtras("validated", element.getValidatedElement(), false);
24727      }
24728      if (element.hasDescriptionElement()) {
24729        composeStringCore("description", element.getDescriptionElement(), false);
24730        composeStringExtras("description", element.getDescriptionElement(), false);
24731      }
24732      if (element.hasDestinationElement()) {
24733        composeIntegerCore("destination", element.getDestinationElement(), false);
24734        composeIntegerExtras("destination", element.getDestinationElement(), false);
24735      }
24736      if (element.hasLink()) {
24737        openArray("link");
24738        for (UriType e : element.getLink()) 
24739          composeUriCore(null, e, true);
24740        closeArray();
24741        if (anyHasExtras(element.getLink())) {
24742          openArray("_link");
24743          for (UriType e : element.getLink()) 
24744            composeUriExtras(null, e, true);
24745          closeArray();
24746        }
24747      };
24748      if (element.hasConformance()) {
24749        composeReference("conformance", element.getConformance());
24750      }
24751  }
24752
24753  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
24754    if (element != null) {
24755      open(name);
24756      composeTestScriptTestScriptFixtureComponentInner(element);
24757      close();
24758    }
24759  }
24760
24761  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
24762      composeBackbone(element);
24763      if (element.hasAutocreateElement()) {
24764        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
24765        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
24766      }
24767      if (element.hasAutodeleteElement()) {
24768        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
24769        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
24770      }
24771      if (element.hasResource()) {
24772        composeReference("resource", element.getResource());
24773      }
24774  }
24775
24776  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
24777    if (element != null) {
24778      open(name);
24779      composeTestScriptTestScriptVariableComponentInner(element);
24780      close();
24781    }
24782  }
24783
24784  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
24785      composeBackbone(element);
24786      if (element.hasNameElement()) {
24787        composeStringCore("name", element.getNameElement(), false);
24788        composeStringExtras("name", element.getNameElement(), false);
24789      }
24790      if (element.hasHeaderFieldElement()) {
24791        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24792        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24793      }
24794      if (element.hasPathElement()) {
24795        composeStringCore("path", element.getPathElement(), false);
24796        composeStringExtras("path", element.getPathElement(), false);
24797      }
24798      if (element.hasSourceIdElement()) {
24799        composeIdCore("sourceId", element.getSourceIdElement(), false);
24800        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24801      }
24802  }
24803
24804  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
24805    if (element != null) {
24806      open(name);
24807      composeTestScriptTestScriptSetupComponentInner(element);
24808      close();
24809    }
24810  }
24811
24812  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
24813      composeBackbone(element);
24814      if (element.hasMetadata()) {
24815        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
24816      }
24817      if (element.hasAction()) {
24818        openArray("action");
24819        for (TestScript.TestScriptSetupActionComponent e : element.getAction()) 
24820          composeTestScriptTestScriptSetupActionComponent(null, e);
24821        closeArray();
24822      };
24823  }
24824
24825  protected void composeTestScriptTestScriptSetupActionComponent(String name, TestScript.TestScriptSetupActionComponent element) throws IOException {
24826    if (element != null) {
24827      open(name);
24828      composeTestScriptTestScriptSetupActionComponentInner(element);
24829      close();
24830    }
24831  }
24832
24833  protected void composeTestScriptTestScriptSetupActionComponentInner(TestScript.TestScriptSetupActionComponent element) throws IOException {
24834      composeBackbone(element);
24835      if (element.hasOperation()) {
24836        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
24837      }
24838      if (element.hasAssert()) {
24839        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
24840      }
24841  }
24842
24843  protected void composeTestScriptTestScriptSetupActionOperationComponent(String name, TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24844    if (element != null) {
24845      open(name);
24846      composeTestScriptTestScriptSetupActionOperationComponentInner(element);
24847      close();
24848    }
24849  }
24850
24851  protected void composeTestScriptTestScriptSetupActionOperationComponentInner(TestScript.TestScriptSetupActionOperationComponent element) throws IOException {
24852      composeBackbone(element);
24853      if (element.hasType()) {
24854        composeCoding("type", element.getType());
24855      }
24856      if (element.hasResourceElement()) {
24857        composeCodeCore("resource", element.getResourceElement(), false);
24858        composeCodeExtras("resource", element.getResourceElement(), false);
24859      }
24860      if (element.hasLabelElement()) {
24861        composeStringCore("label", element.getLabelElement(), false);
24862        composeStringExtras("label", element.getLabelElement(), false);
24863      }
24864      if (element.hasDescriptionElement()) {
24865        composeStringCore("description", element.getDescriptionElement(), false);
24866        composeStringExtras("description", element.getDescriptionElement(), false);
24867      }
24868      if (element.hasAcceptElement()) {
24869        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24870        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
24871      }
24872      if (element.hasContentTypeElement()) {
24873        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24874        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24875      }
24876      if (element.hasDestinationElement()) {
24877        composeIntegerCore("destination", element.getDestinationElement(), false);
24878        composeIntegerExtras("destination", element.getDestinationElement(), false);
24879      }
24880      if (element.hasEncodeRequestUrlElement()) {
24881        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24882        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
24883      }
24884      if (element.hasParamsElement()) {
24885        composeStringCore("params", element.getParamsElement(), false);
24886        composeStringExtras("params", element.getParamsElement(), false);
24887      }
24888      if (element.hasRequestHeader()) {
24889        openArray("requestHeader");
24890        for (TestScript.TestScriptSetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
24891          composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(null, e);
24892        closeArray();
24893      };
24894      if (element.hasResponseIdElement()) {
24895        composeIdCore("responseId", element.getResponseIdElement(), false);
24896        composeIdExtras("responseId", element.getResponseIdElement(), false);
24897      }
24898      if (element.hasSourceIdElement()) {
24899        composeIdCore("sourceId", element.getSourceIdElement(), false);
24900        composeIdExtras("sourceId", element.getSourceIdElement(), false);
24901      }
24902      if (element.hasTargetIdElement()) {
24903        composeIdCore("targetId", element.getTargetIdElement(), false);
24904        composeIdExtras("targetId", element.getTargetIdElement(), false);
24905      }
24906      if (element.hasUrlElement()) {
24907        composeStringCore("url", element.getUrlElement(), false);
24908        composeStringExtras("url", element.getUrlElement(), false);
24909      }
24910  }
24911
24912  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24913    if (element != null) {
24914      open(name);
24915      composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(element);
24916      close();
24917    }
24918  }
24919
24920  protected void composeTestScriptTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.TestScriptSetupActionOperationRequestHeaderComponent element) throws IOException {
24921      composeBackbone(element);
24922      if (element.hasFieldElement()) {
24923        composeStringCore("field", element.getFieldElement(), false);
24924        composeStringExtras("field", element.getFieldElement(), false);
24925      }
24926      if (element.hasValueElement()) {
24927        composeStringCore("value", element.getValueElement(), false);
24928        composeStringExtras("value", element.getValueElement(), false);
24929      }
24930  }
24931
24932  protected void composeTestScriptTestScriptSetupActionAssertComponent(String name, TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24933    if (element != null) {
24934      open(name);
24935      composeTestScriptTestScriptSetupActionAssertComponentInner(element);
24936      close();
24937    }
24938  }
24939
24940  protected void composeTestScriptTestScriptSetupActionAssertComponentInner(TestScript.TestScriptSetupActionAssertComponent element) throws IOException {
24941      composeBackbone(element);
24942      if (element.hasLabelElement()) {
24943        composeStringCore("label", element.getLabelElement(), false);
24944        composeStringExtras("label", element.getLabelElement(), false);
24945      }
24946      if (element.hasDescriptionElement()) {
24947        composeStringCore("description", element.getDescriptionElement(), false);
24948        composeStringExtras("description", element.getDescriptionElement(), false);
24949      }
24950      if (element.hasDirectionElement()) {
24951        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24952        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
24953      }
24954      if (element.hasCompareToSourceIdElement()) {
24955        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
24956        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
24957      }
24958      if (element.hasCompareToSourcePathElement()) {
24959        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24960        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
24961      }
24962      if (element.hasContentTypeElement()) {
24963        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24964        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
24965      }
24966      if (element.hasHeaderFieldElement()) {
24967        composeStringCore("headerField", element.getHeaderFieldElement(), false);
24968        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
24969      }
24970      if (element.hasMinimumIdElement()) {
24971        composeStringCore("minimumId", element.getMinimumIdElement(), false);
24972        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
24973      }
24974      if (element.hasNavigationLinksElement()) {
24975        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
24976        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
24977      }
24978      if (element.hasOperatorElement()) {
24979        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24980        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
24981      }
24982      if (element.hasPathElement()) {
24983        composeStringCore("path", element.getPathElement(), false);
24984        composeStringExtras("path", element.getPathElement(), false);
24985      }
24986      if (element.hasResourceElement()) {
24987        composeCodeCore("resource", element.getResourceElement(), false);
24988        composeCodeExtras("resource", element.getResourceElement(), false);
24989      }
24990      if (element.hasResponseElement()) {
24991        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24992        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
24993      }
24994      if (element.hasResponseCodeElement()) {
24995        composeStringCore("responseCode", element.getResponseCodeElement(), false);
24996        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
24997      }
24998      if (element.hasSourceIdElement()) {
24999        composeIdCore("sourceId", element.getSourceIdElement(), false);
25000        composeIdExtras("sourceId", element.getSourceIdElement(), false);
25001      }
25002      if (element.hasValidateProfileIdElement()) {
25003        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
25004        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
25005      }
25006      if (element.hasValueElement()) {
25007        composeStringCore("value", element.getValueElement(), false);
25008        composeStringExtras("value", element.getValueElement(), false);
25009      }
25010      if (element.hasWarningOnlyElement()) {
25011        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
25012        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
25013      }
25014  }
25015
25016  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
25017    if (element != null) {
25018      open(name);
25019      composeTestScriptTestScriptTestComponentInner(element);
25020      close();
25021    }
25022  }
25023
25024  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
25025      composeBackbone(element);
25026      if (element.hasNameElement()) {
25027        composeStringCore("name", element.getNameElement(), false);
25028        composeStringExtras("name", element.getNameElement(), false);
25029      }
25030      if (element.hasDescriptionElement()) {
25031        composeStringCore("description", element.getDescriptionElement(), false);
25032        composeStringExtras("description", element.getDescriptionElement(), false);
25033      }
25034      if (element.hasMetadata()) {
25035        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
25036      }
25037      if (element.hasAction()) {
25038        openArray("action");
25039        for (TestScript.TestScriptTestActionComponent e : element.getAction()) 
25040          composeTestScriptTestScriptTestActionComponent(null, e);
25041        closeArray();
25042      };
25043  }
25044
25045  protected void composeTestScriptTestScriptTestActionComponent(String name, TestScript.TestScriptTestActionComponent element) throws IOException {
25046    if (element != null) {
25047      open(name);
25048      composeTestScriptTestScriptTestActionComponentInner(element);
25049      close();
25050    }
25051  }
25052
25053  protected void composeTestScriptTestScriptTestActionComponentInner(TestScript.TestScriptTestActionComponent element) throws IOException {
25054      composeBackbone(element);
25055      if (element.hasOperation()) {
25056        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25057      }
25058      if (element.hasAssert()) {
25059        composeTestScriptTestScriptSetupActionAssertComponent("assert", element.getAssert());
25060      }
25061  }
25062
25063  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
25064    if (element != null) {
25065      open(name);
25066      composeTestScriptTestScriptTeardownComponentInner(element);
25067      close();
25068    }
25069  }
25070
25071  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
25072      composeBackbone(element);
25073      if (element.hasAction()) {
25074        openArray("action");
25075        for (TestScript.TestScriptTeardownActionComponent e : element.getAction()) 
25076          composeTestScriptTestScriptTeardownActionComponent(null, e);
25077        closeArray();
25078      };
25079  }
25080
25081  protected void composeTestScriptTestScriptTeardownActionComponent(String name, TestScript.TestScriptTeardownActionComponent element) throws IOException {
25082    if (element != null) {
25083      open(name);
25084      composeTestScriptTestScriptTeardownActionComponentInner(element);
25085      close();
25086    }
25087  }
25088
25089  protected void composeTestScriptTestScriptTeardownActionComponentInner(TestScript.TestScriptTeardownActionComponent element) throws IOException {
25090      composeBackbone(element);
25091      if (element.hasOperation()) {
25092        composeTestScriptTestScriptSetupActionOperationComponent("operation", element.getOperation());
25093      }
25094  }
25095
25096  protected void composeValueSet(String name, ValueSet element) throws IOException {
25097    if (element != null) {
25098      prop("resourceType", name);
25099      composeValueSetInner(element);
25100    }
25101  }
25102
25103  protected void composeValueSetInner(ValueSet element) throws IOException {
25104      composeDomainResourceElements(element);
25105      if (element.hasUrlElement()) {
25106        composeUriCore("url", element.getUrlElement(), false);
25107        composeUriExtras("url", element.getUrlElement(), false);
25108      }
25109      if (element.hasIdentifier()) {
25110        composeIdentifier("identifier", element.getIdentifier());
25111      }
25112      if (element.hasVersionElement()) {
25113        composeStringCore("version", element.getVersionElement(), false);
25114        composeStringExtras("version", element.getVersionElement(), false);
25115      }
25116      if (element.hasNameElement()) {
25117        composeStringCore("name", element.getNameElement(), false);
25118        composeStringExtras("name", element.getNameElement(), false);
25119      }
25120      if (element.hasStatusElement()) {
25121        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25122        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ConformanceResourceStatusEnumFactory(), false);
25123      }
25124      if (element.hasExperimentalElement()) {
25125        composeBooleanCore("experimental", element.getExperimentalElement(), false);
25126        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
25127      }
25128      if (element.hasPublisherElement()) {
25129        composeStringCore("publisher", element.getPublisherElement(), false);
25130        composeStringExtras("publisher", element.getPublisherElement(), false);
25131      }
25132      if (element.hasContact()) {
25133        openArray("contact");
25134        for (ValueSet.ValueSetContactComponent e : element.getContact()) 
25135          composeValueSetValueSetContactComponent(null, e);
25136        closeArray();
25137      };
25138      if (element.hasDateElement()) {
25139        composeDateTimeCore("date", element.getDateElement(), false);
25140        composeDateTimeExtras("date", element.getDateElement(), false);
25141      }
25142      if (element.hasLockedDateElement()) {
25143        composeDateCore("lockedDate", element.getLockedDateElement(), false);
25144        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
25145      }
25146      if (element.hasDescriptionElement()) {
25147        composeStringCore("description", element.getDescriptionElement(), false);
25148        composeStringExtras("description", element.getDescriptionElement(), false);
25149      }
25150      if (element.hasUseContext()) {
25151        openArray("useContext");
25152        for (CodeableConcept e : element.getUseContext()) 
25153          composeCodeableConcept(null, e);
25154        closeArray();
25155      };
25156      if (element.hasImmutableElement()) {
25157        composeBooleanCore("immutable", element.getImmutableElement(), false);
25158        composeBooleanExtras("immutable", element.getImmutableElement(), false);
25159      }
25160      if (element.hasRequirementsElement()) {
25161        composeStringCore("requirements", element.getRequirementsElement(), false);
25162        composeStringExtras("requirements", element.getRequirementsElement(), false);
25163      }
25164      if (element.hasCopyrightElement()) {
25165        composeStringCore("copyright", element.getCopyrightElement(), false);
25166        composeStringExtras("copyright", element.getCopyrightElement(), false);
25167      }
25168      if (element.hasExtensibleElement()) {
25169        composeBooleanCore("extensible", element.getExtensibleElement(), false);
25170        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
25171      }
25172      if (element.hasCodeSystem()) {
25173        composeValueSetValueSetCodeSystemComponent("codeSystem", element.getCodeSystem());
25174      }
25175      if (element.hasCompose()) {
25176        composeValueSetValueSetComposeComponent("compose", element.getCompose());
25177      }
25178      if (element.hasExpansion()) {
25179        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
25180      }
25181  }
25182
25183  protected void composeValueSetValueSetContactComponent(String name, ValueSet.ValueSetContactComponent element) throws IOException {
25184    if (element != null) {
25185      open(name);
25186      composeValueSetValueSetContactComponentInner(element);
25187      close();
25188    }
25189  }
25190
25191  protected void composeValueSetValueSetContactComponentInner(ValueSet.ValueSetContactComponent element) throws IOException {
25192      composeBackbone(element);
25193      if (element.hasNameElement()) {
25194        composeStringCore("name", element.getNameElement(), false);
25195        composeStringExtras("name", element.getNameElement(), false);
25196      }
25197      if (element.hasTelecom()) {
25198        openArray("telecom");
25199        for (ContactPoint e : element.getTelecom()) 
25200          composeContactPoint(null, e);
25201        closeArray();
25202      };
25203  }
25204
25205  protected void composeValueSetValueSetCodeSystemComponent(String name, ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25206    if (element != null) {
25207      open(name);
25208      composeValueSetValueSetCodeSystemComponentInner(element);
25209      close();
25210    }
25211  }
25212
25213  protected void composeValueSetValueSetCodeSystemComponentInner(ValueSet.ValueSetCodeSystemComponent element) throws IOException {
25214      composeBackbone(element);
25215      if (element.hasSystemElement()) {
25216        composeUriCore("system", element.getSystemElement(), false);
25217        composeUriExtras("system", element.getSystemElement(), false);
25218      }
25219      if (element.hasVersionElement()) {
25220        composeStringCore("version", element.getVersionElement(), false);
25221        composeStringExtras("version", element.getVersionElement(), false);
25222      }
25223      if (element.hasCaseSensitiveElement()) {
25224        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
25225        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
25226      }
25227      if (element.hasConcept()) {
25228        openArray("concept");
25229        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25230          composeValueSetConceptDefinitionComponent(null, e);
25231        closeArray();
25232      };
25233  }
25234
25235  protected void composeValueSetConceptDefinitionComponent(String name, ValueSet.ConceptDefinitionComponent element) throws IOException {
25236    if (element != null) {
25237      open(name);
25238      composeValueSetConceptDefinitionComponentInner(element);
25239      close();
25240    }
25241  }
25242
25243  protected void composeValueSetConceptDefinitionComponentInner(ValueSet.ConceptDefinitionComponent element) throws IOException {
25244      composeBackbone(element);
25245      if (element.hasCodeElement()) {
25246        composeCodeCore("code", element.getCodeElement(), false);
25247        composeCodeExtras("code", element.getCodeElement(), false);
25248      }
25249      if (element.hasAbstractElement()) {
25250        composeBooleanCore("abstract", element.getAbstractElement(), false);
25251        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25252      }
25253      if (element.hasDisplayElement()) {
25254        composeStringCore("display", element.getDisplayElement(), false);
25255        composeStringExtras("display", element.getDisplayElement(), false);
25256      }
25257      if (element.hasDefinitionElement()) {
25258        composeStringCore("definition", element.getDefinitionElement(), false);
25259        composeStringExtras("definition", element.getDefinitionElement(), false);
25260      }
25261      if (element.hasDesignation()) {
25262        openArray("designation");
25263        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25264          composeValueSetConceptDefinitionDesignationComponent(null, e);
25265        closeArray();
25266      };
25267      if (element.hasConcept()) {
25268        openArray("concept");
25269        for (ValueSet.ConceptDefinitionComponent e : element.getConcept()) 
25270          composeValueSetConceptDefinitionComponent(null, e);
25271        closeArray();
25272      };
25273  }
25274
25275  protected void composeValueSetConceptDefinitionDesignationComponent(String name, ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25276    if (element != null) {
25277      open(name);
25278      composeValueSetConceptDefinitionDesignationComponentInner(element);
25279      close();
25280    }
25281  }
25282
25283  protected void composeValueSetConceptDefinitionDesignationComponentInner(ValueSet.ConceptDefinitionDesignationComponent element) throws IOException {
25284      composeBackbone(element);
25285      if (element.hasLanguageElement()) {
25286        composeCodeCore("language", element.getLanguageElement(), false);
25287        composeCodeExtras("language", element.getLanguageElement(), false);
25288      }
25289      if (element.hasUse()) {
25290        composeCoding("use", element.getUse());
25291      }
25292      if (element.hasValueElement()) {
25293        composeStringCore("value", element.getValueElement(), false);
25294        composeStringExtras("value", element.getValueElement(), false);
25295      }
25296  }
25297
25298  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
25299    if (element != null) {
25300      open(name);
25301      composeValueSetValueSetComposeComponentInner(element);
25302      close();
25303    }
25304  }
25305
25306  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
25307      composeBackbone(element);
25308      if (element.hasImport()) {
25309        openArray("import");
25310        for (UriType e : element.getImport()) 
25311          composeUriCore(null, e, true);
25312        closeArray();
25313        if (anyHasExtras(element.getImport())) {
25314          openArray("_import");
25315          for (UriType e : element.getImport()) 
25316            composeUriExtras(null, e, true);
25317          closeArray();
25318        }
25319      };
25320      if (element.hasInclude()) {
25321        openArray("include");
25322        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
25323          composeValueSetConceptSetComponent(null, e);
25324        closeArray();
25325      };
25326      if (element.hasExclude()) {
25327        openArray("exclude");
25328        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
25329          composeValueSetConceptSetComponent(null, e);
25330        closeArray();
25331      };
25332  }
25333
25334  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
25335    if (element != null) {
25336      open(name);
25337      composeValueSetConceptSetComponentInner(element);
25338      close();
25339    }
25340  }
25341
25342  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
25343      composeBackbone(element);
25344      if (element.hasSystemElement()) {
25345        composeUriCore("system", element.getSystemElement(), false);
25346        composeUriExtras("system", element.getSystemElement(), false);
25347      }
25348      if (element.hasVersionElement()) {
25349        composeStringCore("version", element.getVersionElement(), false);
25350        composeStringExtras("version", element.getVersionElement(), false);
25351      }
25352      if (element.hasConcept()) {
25353        openArray("concept");
25354        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
25355          composeValueSetConceptReferenceComponent(null, e);
25356        closeArray();
25357      };
25358      if (element.hasFilter()) {
25359        openArray("filter");
25360        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
25361          composeValueSetConceptSetFilterComponent(null, e);
25362        closeArray();
25363      };
25364  }
25365
25366  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
25367    if (element != null) {
25368      open(name);
25369      composeValueSetConceptReferenceComponentInner(element);
25370      close();
25371    }
25372  }
25373
25374  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
25375      composeBackbone(element);
25376      if (element.hasCodeElement()) {
25377        composeCodeCore("code", element.getCodeElement(), false);
25378        composeCodeExtras("code", element.getCodeElement(), false);
25379      }
25380      if (element.hasDisplayElement()) {
25381        composeStringCore("display", element.getDisplayElement(), false);
25382        composeStringExtras("display", element.getDisplayElement(), false);
25383      }
25384      if (element.hasDesignation()) {
25385        openArray("designation");
25386        for (ValueSet.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
25387          composeValueSetConceptDefinitionDesignationComponent(null, e);
25388        closeArray();
25389      };
25390  }
25391
25392  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
25393    if (element != null) {
25394      open(name);
25395      composeValueSetConceptSetFilterComponentInner(element);
25396      close();
25397    }
25398  }
25399
25400  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
25401      composeBackbone(element);
25402      if (element.hasPropertyElement()) {
25403        composeCodeCore("property", element.getPropertyElement(), false);
25404        composeCodeExtras("property", element.getPropertyElement(), false);
25405      }
25406      if (element.hasOpElement()) {
25407        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25408        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
25409      }
25410      if (element.hasValueElement()) {
25411        composeCodeCore("value", element.getValueElement(), false);
25412        composeCodeExtras("value", element.getValueElement(), false);
25413      }
25414  }
25415
25416  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
25417    if (element != null) {
25418      open(name);
25419      composeValueSetValueSetExpansionComponentInner(element);
25420      close();
25421    }
25422  }
25423
25424  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
25425      composeBackbone(element);
25426      if (element.hasIdentifierElement()) {
25427        composeUriCore("identifier", element.getIdentifierElement(), false);
25428        composeUriExtras("identifier", element.getIdentifierElement(), false);
25429      }
25430      if (element.hasTimestampElement()) {
25431        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
25432        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
25433      }
25434      if (element.hasTotalElement()) {
25435        composeIntegerCore("total", element.getTotalElement(), false);
25436        composeIntegerExtras("total", element.getTotalElement(), false);
25437      }
25438      if (element.hasOffsetElement()) {
25439        composeIntegerCore("offset", element.getOffsetElement(), false);
25440        composeIntegerExtras("offset", element.getOffsetElement(), false);
25441      }
25442      if (element.hasParameter()) {
25443        openArray("parameter");
25444        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
25445          composeValueSetValueSetExpansionParameterComponent(null, e);
25446        closeArray();
25447      };
25448      if (element.hasContains()) {
25449        openArray("contains");
25450        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25451          composeValueSetValueSetExpansionContainsComponent(null, e);
25452        closeArray();
25453      };
25454  }
25455
25456  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25457    if (element != null) {
25458      open(name);
25459      composeValueSetValueSetExpansionParameterComponentInner(element);
25460      close();
25461    }
25462  }
25463
25464  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
25465      composeBackbone(element);
25466      if (element.hasNameElement()) {
25467        composeStringCore("name", element.getNameElement(), false);
25468        composeStringExtras("name", element.getNameElement(), false);
25469      }
25470      if (element.hasValue()) {
25471        composeType("value", element.getValue());
25472      }
25473  }
25474
25475  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25476    if (element != null) {
25477      open(name);
25478      composeValueSetValueSetExpansionContainsComponentInner(element);
25479      close();
25480    }
25481  }
25482
25483  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
25484      composeBackbone(element);
25485      if (element.hasSystemElement()) {
25486        composeUriCore("system", element.getSystemElement(), false);
25487        composeUriExtras("system", element.getSystemElement(), false);
25488      }
25489      if (element.hasAbstractElement()) {
25490        composeBooleanCore("abstract", element.getAbstractElement(), false);
25491        composeBooleanExtras("abstract", element.getAbstractElement(), false);
25492      }
25493      if (element.hasVersionElement()) {
25494        composeStringCore("version", element.getVersionElement(), false);
25495        composeStringExtras("version", element.getVersionElement(), false);
25496      }
25497      if (element.hasCodeElement()) {
25498        composeCodeCore("code", element.getCodeElement(), false);
25499        composeCodeExtras("code", element.getCodeElement(), false);
25500      }
25501      if (element.hasDisplayElement()) {
25502        composeStringCore("display", element.getDisplayElement(), false);
25503        composeStringExtras("display", element.getDisplayElement(), false);
25504      }
25505      if (element.hasContains()) {
25506        openArray("contains");
25507        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
25508          composeValueSetValueSetExpansionContainsComponent(null, e);
25509        closeArray();
25510      };
25511  }
25512
25513  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
25514    if (element != null) {
25515      prop("resourceType", name);
25516      composeVisionPrescriptionInner(element);
25517    }
25518  }
25519
25520  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
25521      composeDomainResourceElements(element);
25522      if (element.hasIdentifier()) {
25523        openArray("identifier");
25524        for (Identifier e : element.getIdentifier()) 
25525          composeIdentifier(null, e);
25526        closeArray();
25527      };
25528      if (element.hasDateWrittenElement()) {
25529        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
25530        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
25531      }
25532      if (element.hasPatient()) {
25533        composeReference("patient", element.getPatient());
25534      }
25535      if (element.hasPrescriber()) {
25536        composeReference("prescriber", element.getPrescriber());
25537      }
25538      if (element.hasEncounter()) {
25539        composeReference("encounter", element.getEncounter());
25540      }
25541      if (element.hasReason()) {
25542        composeType("reason", element.getReason());
25543      }
25544      if (element.hasDispense()) {
25545        openArray("dispense");
25546        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
25547          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
25548        closeArray();
25549      };
25550  }
25551
25552  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25553    if (element != null) {
25554      open(name);
25555      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
25556      close();
25557    }
25558  }
25559
25560  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
25561      composeBackbone(element);
25562      if (element.hasProduct()) {
25563        composeCoding("product", element.getProduct());
25564      }
25565      if (element.hasEyeElement()) {
25566        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25567        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
25568      }
25569      if (element.hasSphereElement()) {
25570        composeDecimalCore("sphere", element.getSphereElement(), false);
25571        composeDecimalExtras("sphere", element.getSphereElement(), false);
25572      }
25573      if (element.hasCylinderElement()) {
25574        composeDecimalCore("cylinder", element.getCylinderElement(), false);
25575        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
25576      }
25577      if (element.hasAxisElement()) {
25578        composeIntegerCore("axis", element.getAxisElement(), false);
25579        composeIntegerExtras("axis", element.getAxisElement(), false);
25580      }
25581      if (element.hasPrismElement()) {
25582        composeDecimalCore("prism", element.getPrismElement(), false);
25583        composeDecimalExtras("prism", element.getPrismElement(), false);
25584      }
25585      if (element.hasBaseElement()) {
25586        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25587        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
25588      }
25589      if (element.hasAddElement()) {
25590        composeDecimalCore("add", element.getAddElement(), false);
25591        composeDecimalExtras("add", element.getAddElement(), false);
25592      }
25593      if (element.hasPowerElement()) {
25594        composeDecimalCore("power", element.getPowerElement(), false);
25595        composeDecimalExtras("power", element.getPowerElement(), false);
25596      }
25597      if (element.hasBackCurveElement()) {
25598        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
25599        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
25600      }
25601      if (element.hasDiameterElement()) {
25602        composeDecimalCore("diameter", element.getDiameterElement(), false);
25603        composeDecimalExtras("diameter", element.getDiameterElement(), false);
25604      }
25605      if (element.hasDuration()) {
25606        composeSimpleQuantity("duration", element.getDuration());
25607      }
25608      if (element.hasColorElement()) {
25609        composeStringCore("color", element.getColorElement(), false);
25610        composeStringExtras("color", element.getColorElement(), false);
25611      }
25612      if (element.hasBrandElement()) {
25613        composeStringCore("brand", element.getBrandElement(), false);
25614        composeStringExtras("brand", element.getBrandElement(), false);
25615      }
25616      if (element.hasNotesElement()) {
25617        composeStringCore("notes", element.getNotesElement(), false);
25618        composeStringExtras("notes", element.getNotesElement(), false);
25619      }
25620  }
25621
25622  @Override
25623  protected void composeResource(Resource resource) throws IOException {
25624    if (resource instanceof Parameters)
25625      composeParameters("Parameters", (Parameters)resource);
25626    else if (resource instanceof Account)
25627      composeAccount("Account", (Account)resource);
25628    else if (resource instanceof AllergyIntolerance)
25629      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
25630    else if (resource instanceof Appointment)
25631      composeAppointment("Appointment", (Appointment)resource);
25632    else if (resource instanceof AppointmentResponse)
25633      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
25634    else if (resource instanceof AuditEvent)
25635      composeAuditEvent("AuditEvent", (AuditEvent)resource);
25636    else if (resource instanceof Basic)
25637      composeBasic("Basic", (Basic)resource);
25638    else if (resource instanceof Binary)
25639      composeBinary("Binary", (Binary)resource);
25640    else if (resource instanceof BodySite)
25641      composeBodySite("BodySite", (BodySite)resource);
25642    else if (resource instanceof Bundle)
25643      composeBundle("Bundle", (Bundle)resource);
25644    else if (resource instanceof CarePlan)
25645      composeCarePlan("CarePlan", (CarePlan)resource);
25646    else if (resource instanceof Claim)
25647      composeClaim("Claim", (Claim)resource);
25648    else if (resource instanceof ClaimResponse)
25649      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
25650    else if (resource instanceof ClinicalImpression)
25651      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
25652    else if (resource instanceof Communication)
25653      composeCommunication("Communication", (Communication)resource);
25654    else if (resource instanceof CommunicationRequest)
25655      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
25656    else if (resource instanceof Composition)
25657      composeComposition("Composition", (Composition)resource);
25658    else if (resource instanceof ConceptMap)
25659      composeConceptMap("ConceptMap", (ConceptMap)resource);
25660    else if (resource instanceof Condition)
25661      composeCondition("Condition", (Condition)resource);
25662    else if (resource instanceof Conformance)
25663      composeConformance("Conformance", (Conformance)resource);
25664    else if (resource instanceof Contract)
25665      composeContract("Contract", (Contract)resource);
25666    else if (resource instanceof Coverage)
25667      composeCoverage("Coverage", (Coverage)resource);
25668    else if (resource instanceof DataElement)
25669      composeDataElement("DataElement", (DataElement)resource);
25670    else if (resource instanceof DetectedIssue)
25671      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
25672    else if (resource instanceof Device)
25673      composeDevice("Device", (Device)resource);
25674    else if (resource instanceof DeviceComponent)
25675      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
25676    else if (resource instanceof DeviceMetric)
25677      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
25678    else if (resource instanceof DeviceUseRequest)
25679      composeDeviceUseRequest("DeviceUseRequest", (DeviceUseRequest)resource);
25680    else if (resource instanceof DeviceUseStatement)
25681      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
25682    else if (resource instanceof DiagnosticOrder)
25683      composeDiagnosticOrder("DiagnosticOrder", (DiagnosticOrder)resource);
25684    else if (resource instanceof DiagnosticReport)
25685      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
25686    else if (resource instanceof DocumentManifest)
25687      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
25688    else if (resource instanceof DocumentReference)
25689      composeDocumentReference("DocumentReference", (DocumentReference)resource);
25690    else if (resource instanceof EligibilityRequest)
25691      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
25692    else if (resource instanceof EligibilityResponse)
25693      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
25694    else if (resource instanceof Encounter)
25695      composeEncounter("Encounter", (Encounter)resource);
25696    else if (resource instanceof EnrollmentRequest)
25697      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
25698    else if (resource instanceof EnrollmentResponse)
25699      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
25700    else if (resource instanceof EpisodeOfCare)
25701      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
25702    else if (resource instanceof ExplanationOfBenefit)
25703      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
25704    else if (resource instanceof FamilyMemberHistory)
25705      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
25706    else if (resource instanceof Flag)
25707      composeFlag("Flag", (Flag)resource);
25708    else if (resource instanceof Goal)
25709      composeGoal("Goal", (Goal)resource);
25710    else if (resource instanceof Group)
25711      composeGroup("Group", (Group)resource);
25712    else if (resource instanceof HealthcareService)
25713      composeHealthcareService("HealthcareService", (HealthcareService)resource);
25714    else if (resource instanceof ImagingObjectSelection)
25715      composeImagingObjectSelection("ImagingObjectSelection", (ImagingObjectSelection)resource);
25716    else if (resource instanceof ImagingStudy)
25717      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
25718    else if (resource instanceof Immunization)
25719      composeImmunization("Immunization", (Immunization)resource);
25720    else if (resource instanceof ImmunizationRecommendation)
25721      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
25722    else if (resource instanceof ImplementationGuide)
25723      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
25724    else if (resource instanceof List_)
25725      composeList_("List", (List_)resource);
25726    else if (resource instanceof Location)
25727      composeLocation("Location", (Location)resource);
25728    else if (resource instanceof Media)
25729      composeMedia("Media", (Media)resource);
25730    else if (resource instanceof Medication)
25731      composeMedication("Medication", (Medication)resource);
25732    else if (resource instanceof MedicationAdministration)
25733      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
25734    else if (resource instanceof MedicationDispense)
25735      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
25736    else if (resource instanceof MedicationOrder)
25737      composeMedicationOrder("MedicationOrder", (MedicationOrder)resource);
25738    else if (resource instanceof MedicationStatement)
25739      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
25740    else if (resource instanceof MessageHeader)
25741      composeMessageHeader("MessageHeader", (MessageHeader)resource);
25742    else if (resource instanceof NamingSystem)
25743      composeNamingSystem("NamingSystem", (NamingSystem)resource);
25744    else if (resource instanceof NutritionOrder)
25745      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
25746    else if (resource instanceof Observation)
25747      composeObservation("Observation", (Observation)resource);
25748    else if (resource instanceof OperationDefinition)
25749      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
25750    else if (resource instanceof OperationOutcome)
25751      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
25752    else if (resource instanceof Order)
25753      composeOrder("Order", (Order)resource);
25754    else if (resource instanceof OrderResponse)
25755      composeOrderResponse("OrderResponse", (OrderResponse)resource);
25756    else if (resource instanceof Organization)
25757      composeOrganization("Organization", (Organization)resource);
25758    else if (resource instanceof Patient)
25759      composePatient("Patient", (Patient)resource);
25760    else if (resource instanceof PaymentNotice)
25761      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
25762    else if (resource instanceof PaymentReconciliation)
25763      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
25764    else if (resource instanceof Person)
25765      composePerson("Person", (Person)resource);
25766    else if (resource instanceof Practitioner)
25767      composePractitioner("Practitioner", (Practitioner)resource);
25768    else if (resource instanceof Procedure)
25769      composeProcedure("Procedure", (Procedure)resource);
25770    else if (resource instanceof ProcedureRequest)
25771      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
25772    else if (resource instanceof ProcessRequest)
25773      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
25774    else if (resource instanceof ProcessResponse)
25775      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
25776    else if (resource instanceof Provenance)
25777      composeProvenance("Provenance", (Provenance)resource);
25778    else if (resource instanceof Questionnaire)
25779      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
25780    else if (resource instanceof QuestionnaireResponse)
25781      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
25782    else if (resource instanceof ReferralRequest)
25783      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
25784    else if (resource instanceof RelatedPerson)
25785      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
25786    else if (resource instanceof RiskAssessment)
25787      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
25788    else if (resource instanceof Schedule)
25789      composeSchedule("Schedule", (Schedule)resource);
25790    else if (resource instanceof SearchParameter)
25791      composeSearchParameter("SearchParameter", (SearchParameter)resource);
25792    else if (resource instanceof Slot)
25793      composeSlot("Slot", (Slot)resource);
25794    else if (resource instanceof Specimen)
25795      composeSpecimen("Specimen", (Specimen)resource);
25796    else if (resource instanceof StructureDefinition)
25797      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
25798    else if (resource instanceof Subscription)
25799      composeSubscription("Subscription", (Subscription)resource);
25800    else if (resource instanceof Substance)
25801      composeSubstance("Substance", (Substance)resource);
25802    else if (resource instanceof SupplyDelivery)
25803      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
25804    else if (resource instanceof SupplyRequest)
25805      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
25806    else if (resource instanceof TestScript)
25807      composeTestScript("TestScript", (TestScript)resource);
25808    else if (resource instanceof ValueSet)
25809      composeValueSet("ValueSet", (ValueSet)resource);
25810    else if (resource instanceof VisionPrescription)
25811      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
25812    else if (resource instanceof Binary)
25813      composeBinary("Binary", (Binary)resource);
25814    else
25815      throw new Error("Unhandled resource type "+resource.getClass().getName());
25816  }
25817
25818  protected void composeNamedReference(String name, Resource resource) throws IOException {
25819    if (resource instanceof Parameters)
25820      composeParameters(name, (Parameters)resource);
25821    else if (resource instanceof Account)
25822      composeAccount(name, (Account)resource);
25823    else if (resource instanceof AllergyIntolerance)
25824      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
25825    else if (resource instanceof Appointment)
25826      composeAppointment(name, (Appointment)resource);
25827    else if (resource instanceof AppointmentResponse)
25828      composeAppointmentResponse(name, (AppointmentResponse)resource);
25829    else if (resource instanceof AuditEvent)
25830      composeAuditEvent(name, (AuditEvent)resource);
25831    else if (resource instanceof Basic)
25832      composeBasic(name, (Basic)resource);
25833    else if (resource instanceof Binary)
25834      composeBinary(name, (Binary)resource);
25835    else if (resource instanceof BodySite)
25836      composeBodySite(name, (BodySite)resource);
25837    else if (resource instanceof Bundle)
25838      composeBundle(name, (Bundle)resource);
25839    else if (resource instanceof CarePlan)
25840      composeCarePlan(name, (CarePlan)resource);
25841    else if (resource instanceof Claim)
25842      composeClaim(name, (Claim)resource);
25843    else if (resource instanceof ClaimResponse)
25844      composeClaimResponse(name, (ClaimResponse)resource);
25845    else if (resource instanceof ClinicalImpression)
25846      composeClinicalImpression(name, (ClinicalImpression)resource);
25847    else if (resource instanceof Communication)
25848      composeCommunication(name, (Communication)resource);
25849    else if (resource instanceof CommunicationRequest)
25850      composeCommunicationRequest(name, (CommunicationRequest)resource);
25851    else if (resource instanceof Composition)
25852      composeComposition(name, (Composition)resource);
25853    else if (resource instanceof ConceptMap)
25854      composeConceptMap(name, (ConceptMap)resource);
25855    else if (resource instanceof Condition)
25856      composeCondition(name, (Condition)resource);
25857    else if (resource instanceof Conformance)
25858      composeConformance(name, (Conformance)resource);
25859    else if (resource instanceof Contract)
25860      composeContract(name, (Contract)resource);
25861    else if (resource instanceof Coverage)
25862      composeCoverage(name, (Coverage)resource);
25863    else if (resource instanceof DataElement)
25864      composeDataElement(name, (DataElement)resource);
25865    else if (resource instanceof DetectedIssue)
25866      composeDetectedIssue(name, (DetectedIssue)resource);
25867    else if (resource instanceof Device)
25868      composeDevice(name, (Device)resource);
25869    else if (resource instanceof DeviceComponent)
25870      composeDeviceComponent(name, (DeviceComponent)resource);
25871    else if (resource instanceof DeviceMetric)
25872      composeDeviceMetric(name, (DeviceMetric)resource);
25873    else if (resource instanceof DeviceUseRequest)
25874      composeDeviceUseRequest(name, (DeviceUseRequest)resource);
25875    else if (resource instanceof DeviceUseStatement)
25876      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
25877    else if (resource instanceof DiagnosticOrder)
25878      composeDiagnosticOrder(name, (DiagnosticOrder)resource);
25879    else if (resource instanceof DiagnosticReport)
25880      composeDiagnosticReport(name, (DiagnosticReport)resource);
25881    else if (resource instanceof DocumentManifest)
25882      composeDocumentManifest(name, (DocumentManifest)resource);
25883    else if (resource instanceof DocumentReference)
25884      composeDocumentReference(name, (DocumentReference)resource);
25885    else if (resource instanceof EligibilityRequest)
25886      composeEligibilityRequest(name, (EligibilityRequest)resource);
25887    else if (resource instanceof EligibilityResponse)
25888      composeEligibilityResponse(name, (EligibilityResponse)resource);
25889    else if (resource instanceof Encounter)
25890      composeEncounter(name, (Encounter)resource);
25891    else if (resource instanceof EnrollmentRequest)
25892      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
25893    else if (resource instanceof EnrollmentResponse)
25894      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
25895    else if (resource instanceof EpisodeOfCare)
25896      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
25897    else if (resource instanceof ExplanationOfBenefit)
25898      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
25899    else if (resource instanceof FamilyMemberHistory)
25900      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
25901    else if (resource instanceof Flag)
25902      composeFlag(name, (Flag)resource);
25903    else if (resource instanceof Goal)
25904      composeGoal(name, (Goal)resource);
25905    else if (resource instanceof Group)
25906      composeGroup(name, (Group)resource);
25907    else if (resource instanceof HealthcareService)
25908      composeHealthcareService(name, (HealthcareService)resource);
25909    else if (resource instanceof ImagingObjectSelection)
25910      composeImagingObjectSelection(name, (ImagingObjectSelection)resource);
25911    else if (resource instanceof ImagingStudy)
25912      composeImagingStudy(name, (ImagingStudy)resource);
25913    else if (resource instanceof Immunization)
25914      composeImmunization(name, (Immunization)resource);
25915    else if (resource instanceof ImmunizationRecommendation)
25916      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
25917    else if (resource instanceof ImplementationGuide)
25918      composeImplementationGuide(name, (ImplementationGuide)resource);
25919    else if (resource instanceof List_)
25920      composeList_(name, (List_)resource);
25921    else if (resource instanceof Location)
25922      composeLocation(name, (Location)resource);
25923    else if (resource instanceof Media)
25924      composeMedia(name, (Media)resource);
25925    else if (resource instanceof Medication)
25926      composeMedication(name, (Medication)resource);
25927    else if (resource instanceof MedicationAdministration)
25928      composeMedicationAdministration(name, (MedicationAdministration)resource);
25929    else if (resource instanceof MedicationDispense)
25930      composeMedicationDispense(name, (MedicationDispense)resource);
25931    else if (resource instanceof MedicationOrder)
25932      composeMedicationOrder(name, (MedicationOrder)resource);
25933    else if (resource instanceof MedicationStatement)
25934      composeMedicationStatement(name, (MedicationStatement)resource);
25935    else if (resource instanceof MessageHeader)
25936      composeMessageHeader(name, (MessageHeader)resource);
25937    else if (resource instanceof NamingSystem)
25938      composeNamingSystem(name, (NamingSystem)resource);
25939    else if (resource instanceof NutritionOrder)
25940      composeNutritionOrder(name, (NutritionOrder)resource);
25941    else if (resource instanceof Observation)
25942      composeObservation(name, (Observation)resource);
25943    else if (resource instanceof OperationDefinition)
25944      composeOperationDefinition(name, (OperationDefinition)resource);
25945    else if (resource instanceof OperationOutcome)
25946      composeOperationOutcome(name, (OperationOutcome)resource);
25947    else if (resource instanceof Order)
25948      composeOrder(name, (Order)resource);
25949    else if (resource instanceof OrderResponse)
25950      composeOrderResponse(name, (OrderResponse)resource);
25951    else if (resource instanceof Organization)
25952      composeOrganization(name, (Organization)resource);
25953    else if (resource instanceof Patient)
25954      composePatient(name, (Patient)resource);
25955    else if (resource instanceof PaymentNotice)
25956      composePaymentNotice(name, (PaymentNotice)resource);
25957    else if (resource instanceof PaymentReconciliation)
25958      composePaymentReconciliation(name, (PaymentReconciliation)resource);
25959    else if (resource instanceof Person)
25960      composePerson(name, (Person)resource);
25961    else if (resource instanceof Practitioner)
25962      composePractitioner(name, (Practitioner)resource);
25963    else if (resource instanceof Procedure)
25964      composeProcedure(name, (Procedure)resource);
25965    else if (resource instanceof ProcedureRequest)
25966      composeProcedureRequest(name, (ProcedureRequest)resource);
25967    else if (resource instanceof ProcessRequest)
25968      composeProcessRequest(name, (ProcessRequest)resource);
25969    else if (resource instanceof ProcessResponse)
25970      composeProcessResponse(name, (ProcessResponse)resource);
25971    else if (resource instanceof Provenance)
25972      composeProvenance(name, (Provenance)resource);
25973    else if (resource instanceof Questionnaire)
25974      composeQuestionnaire(name, (Questionnaire)resource);
25975    else if (resource instanceof QuestionnaireResponse)
25976      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
25977    else if (resource instanceof ReferralRequest)
25978      composeReferralRequest(name, (ReferralRequest)resource);
25979    else if (resource instanceof RelatedPerson)
25980      composeRelatedPerson(name, (RelatedPerson)resource);
25981    else if (resource instanceof RiskAssessment)
25982      composeRiskAssessment(name, (RiskAssessment)resource);
25983    else if (resource instanceof Schedule)
25984      composeSchedule(name, (Schedule)resource);
25985    else if (resource instanceof SearchParameter)
25986      composeSearchParameter(name, (SearchParameter)resource);
25987    else if (resource instanceof Slot)
25988      composeSlot(name, (Slot)resource);
25989    else if (resource instanceof Specimen)
25990      composeSpecimen(name, (Specimen)resource);
25991    else if (resource instanceof StructureDefinition)
25992      composeStructureDefinition(name, (StructureDefinition)resource);
25993    else if (resource instanceof Subscription)
25994      composeSubscription(name, (Subscription)resource);
25995    else if (resource instanceof Substance)
25996      composeSubstance(name, (Substance)resource);
25997    else if (resource instanceof SupplyDelivery)
25998      composeSupplyDelivery(name, (SupplyDelivery)resource);
25999    else if (resource instanceof SupplyRequest)
26000      composeSupplyRequest(name, (SupplyRequest)resource);
26001    else if (resource instanceof TestScript)
26002      composeTestScript(name, (TestScript)resource);
26003    else if (resource instanceof ValueSet)
26004      composeValueSet(name, (ValueSet)resource);
26005    else if (resource instanceof VisionPrescription)
26006      composeVisionPrescription(name, (VisionPrescription)resource);
26007    else if (resource instanceof Binary)
26008      composeBinary(name, (Binary)resource);
26009    else
26010      throw new Error("Unhandled resource type "+resource.getClass().getName());
26011  }
26012
26013  protected void composeType(String prefix, Type type) throws IOException {
26014    if (type == null)
26015      ;
26016    else if (type instanceof Money)
26017       composeMoney(prefix+"Money", (Money) type);
26018    else if (type instanceof SimpleQuantity)
26019       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
26020    else if (type instanceof Duration)
26021       composeDuration(prefix+"Duration", (Duration) type);
26022    else if (type instanceof Count)
26023       composeCount(prefix+"Count", (Count) type);
26024    else if (type instanceof Distance)
26025       composeDistance(prefix+"Distance", (Distance) type);
26026    else if (type instanceof Age)
26027       composeAge(prefix+"Age", (Age) type);
26028    else if (type instanceof Identifier)
26029       composeIdentifier(prefix+"Identifier", (Identifier) type);
26030    else if (type instanceof Coding)
26031       composeCoding(prefix+"Coding", (Coding) type);
26032    else if (type instanceof Reference)
26033       composeReference(prefix+"Reference", (Reference) type);
26034    else if (type instanceof Signature)
26035       composeSignature(prefix+"Signature", (Signature) type);
26036    else if (type instanceof SampledData)
26037       composeSampledData(prefix+"SampledData", (SampledData) type);
26038    else if (type instanceof Quantity)
26039       composeQuantity(prefix+"Quantity", (Quantity) type);
26040    else if (type instanceof Period)
26041       composePeriod(prefix+"Period", (Period) type);
26042    else if (type instanceof Attachment)
26043       composeAttachment(prefix+"Attachment", (Attachment) type);
26044    else if (type instanceof Ratio)
26045       composeRatio(prefix+"Ratio", (Ratio) type);
26046    else if (type instanceof Range)
26047       composeRange(prefix+"Range", (Range) type);
26048    else if (type instanceof Annotation)
26049       composeAnnotation(prefix+"Annotation", (Annotation) type);
26050    else if (type instanceof CodeableConcept)
26051       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
26052    else if (type instanceof HumanName)
26053       composeHumanName(prefix+"HumanName", (HumanName) type);
26054    else if (type instanceof ContactPoint)
26055       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
26056    else if (type instanceof Meta)
26057       composeMeta(prefix+"Meta", (Meta) type);
26058    else if (type instanceof Address)
26059       composeAddress(prefix+"Address", (Address) type);
26060    else if (type instanceof Timing)
26061       composeTiming(prefix+"Timing", (Timing) type);
26062    else if (type instanceof ElementDefinition)
26063       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
26064    else if (type instanceof DateType) {
26065      composeDateCore(prefix+"Date", (DateType) type, false);
26066      composeDateExtras(prefix+"Date", (DateType) type, false);
26067    }
26068    else if (type instanceof DateTimeType) {
26069      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
26070      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
26071    }
26072    else if (type instanceof CodeType) {
26073      composeCodeCore(prefix+"Code", (CodeType) type, false);
26074      composeCodeExtras(prefix+"Code", (CodeType) type, false);
26075    }
26076    else if (type instanceof StringType) {
26077      composeStringCore(prefix+"String", (StringType) type, false);
26078      composeStringExtras(prefix+"String", (StringType) type, false);
26079    }
26080    else if (type instanceof IntegerType) {
26081      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
26082      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
26083    }
26084    else if (type instanceof OidType) {
26085      composeOidCore(prefix+"Oid", (OidType) type, false);
26086      composeOidExtras(prefix+"Oid", (OidType) type, false);
26087    }
26088    else if (type instanceof UriType) {
26089      composeUriCore(prefix+"Uri", (UriType) type, false);
26090      composeUriExtras(prefix+"Uri", (UriType) type, false);
26091    }
26092    else if (type instanceof UuidType) {
26093      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
26094      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
26095    }
26096    else if (type instanceof InstantType) {
26097      composeInstantCore(prefix+"Instant", (InstantType) type, false);
26098      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
26099    }
26100    else if (type instanceof BooleanType) {
26101      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
26102      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
26103    }
26104    else if (type instanceof Base64BinaryType) {
26105      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
26106      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
26107    }
26108    else if (type instanceof UnsignedIntType) {
26109      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26110      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
26111    }
26112    else if (type instanceof MarkdownType) {
26113      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
26114      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
26115    }
26116    else if (type instanceof TimeType) {
26117      composeTimeCore(prefix+"Time", (TimeType) type, false);
26118      composeTimeExtras(prefix+"Time", (TimeType) type, false);
26119    }
26120    else if (type instanceof IdType) {
26121      composeIdCore(prefix+"Id", (IdType) type, false);
26122      composeIdExtras(prefix+"Id", (IdType) type, false);
26123    }
26124    else if (type instanceof PositiveIntType) {
26125      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
26126      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
26127    }
26128    else if (type instanceof DecimalType) {
26129      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
26130      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
26131    }
26132    else
26133      throw new Error("Unhandled type");
26134  }
26135
26136  protected void composeTypeInner(Type type) throws IOException {
26137    if (type == null)
26138      ;
26139    else if (type instanceof Identifier)
26140       composeIdentifierInner((Identifier) type);
26141    else if (type instanceof Coding)
26142       composeCodingInner((Coding) type);
26143    else if (type instanceof Reference)
26144       composeReferenceInner((Reference) type);
26145    else if (type instanceof Signature)
26146       composeSignatureInner((Signature) type);
26147    else if (type instanceof SampledData)
26148       composeSampledDataInner((SampledData) type);
26149    else if (type instanceof Quantity)
26150       composeQuantityInner((Quantity) type);
26151    else if (type instanceof Period)
26152       composePeriodInner((Period) type);
26153    else if (type instanceof Attachment)
26154       composeAttachmentInner((Attachment) type);
26155    else if (type instanceof Ratio)
26156       composeRatioInner((Ratio) type);
26157    else if (type instanceof Range)
26158       composeRangeInner((Range) type);
26159    else if (type instanceof Annotation)
26160       composeAnnotationInner((Annotation) type);
26161    else if (type instanceof CodeableConcept)
26162       composeCodeableConceptInner((CodeableConcept) type);
26163    else if (type instanceof Money)
26164       composeMoneyInner((Money) type);
26165    else if (type instanceof SimpleQuantity)
26166       composeSimpleQuantityInner((SimpleQuantity) type);
26167    else if (type instanceof Duration)
26168       composeDurationInner((Duration) type);
26169    else if (type instanceof Count)
26170       composeCountInner((Count) type);
26171    else if (type instanceof Distance)
26172       composeDistanceInner((Distance) type);
26173    else if (type instanceof Age)
26174       composeAgeInner((Age) type);
26175    else if (type instanceof HumanName)
26176       composeHumanNameInner((HumanName) type);
26177    else if (type instanceof ContactPoint)
26178       composeContactPointInner((ContactPoint) type);
26179    else if (type instanceof Meta)
26180       composeMetaInner((Meta) type);
26181    else if (type instanceof Address)
26182       composeAddressInner((Address) type);
26183    else if (type instanceof Timing)
26184       composeTimingInner((Timing) type);
26185    else if (type instanceof ElementDefinition)
26186       composeElementDefinitionInner((ElementDefinition) type);
26187    else
26188      throw new Error("Unhandled type");
26189  }
26190
26191}
26192