001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Id40_50;
013import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
014import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
015import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
016import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.ElementDefinition40_50;
017import org.hl7.fhir.exceptions.FHIRException;
018import org.hl7.fhir.r5.model.Enumeration;
019import org.hl7.fhir.r5.model.StructureDefinition;
020
021/*
022  Copyright (c) 2011+, HL7, Inc.
023  All rights reserved.
024  
025  Redistribution and use in source and binary forms, with or without modification, 
026  are permitted provided that the following conditions are met:
027  
028   * Redistributions of source code must retain the above copyright notice, this 
029     list of conditions and the following disclaimer.
030   * Redistributions in binary form must reproduce the above copyright notice, 
031     this list of conditions and the following disclaimer in the documentation 
032     and/or other materials provided with the distribution.
033   * Neither the name of HL7 nor the names of its contributors may be used to 
034     endorse or promote products derived from this software without specific 
035     prior written permission.
036  
037  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
038  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
039  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
040  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
041  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
042  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
043  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
044  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
045  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
046  POSSIBILITY OF SUCH DAMAGE.
047  
048*/
049// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
050public class StructureDefinition40_50 {
051
052  public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException {
053    if (src == null)
054      return null;
055    org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition();
056    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
057    if (src.hasUrl())
058      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
059    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
060      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
061    if (src.hasVersion())
062      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
063    if (src.hasName())
064      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
065    if (src.hasTitle())
066      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
067    if (src.hasStatus())
068      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
069    if (src.hasExperimental())
070      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
071    if (src.hasDate())
072      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
073    if (src.hasPublisher())
074      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
075    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
076      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
077    if (src.hasDescription())
078      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
079    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
080      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
081    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
082      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
083    if (src.hasPurpose())
084      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
085    if (src.hasCopyright())
086      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
087    for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding40_50.convertCoding(t));
088    if (src.hasFhirVersion())
089      tgt.setFhirVersionElement(Enumerations40_50.convertFHIRVersion(src.getFhirVersionElement()));
090    for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
091      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
092    if (src.hasKind())
093      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
094    if (src.hasAbstract())
095      tgt.setAbstractElement(Boolean40_50.convertBoolean(src.getAbstractElement()));
096    for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext())
097      tgt.addContext(convertStructureDefinitionContextComponent(t));
098    for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant())
099      tgt.getContextInvariant().add(String40_50.convertString(t));
100    if (src.hasType())
101      tgt.setTypeElement(Uri40_50.convertUri(src.getTypeElement()));
102    if (src.hasBaseDefinition())
103      tgt.setBaseDefinitionElement(Canonical40_50.convertCanonical(src.getBaseDefinitionElement()));
104    if (src.hasDerivation())
105      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
106    if (src.hasSnapshot())
107      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
108    if (src.hasDifferential())
109      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
110    return tgt;
111  }
112
113  public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException {
114    if (src == null)
115      return null;
116    org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition();
117    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
118    if (src.hasUrl())
119      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
120    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
121      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
122    if (src.hasVersion())
123      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
124    if (src.hasName())
125      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
126    if (src.hasTitle())
127      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
128    if (src.hasStatus())
129      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
130    if (src.hasExperimental())
131      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
132    if (src.hasDate())
133      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
134    if (src.hasPublisher())
135      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
136    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
137      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
138    if (src.hasDescription())
139      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
140    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
141      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
142    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
143      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
144    if (src.hasPurpose())
145      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
146    if (src.hasCopyright())
147      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
148    for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding40_50.convertCoding(t));
149    if (src.hasFhirVersion())
150      tgt.setFhirVersionElement(Enumerations40_50.convertFHIRVersion(src.getFhirVersionElement()));
151    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
152      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
153    if (src.hasKind())
154      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
155    if (src.hasAbstract())
156      tgt.setAbstractElement(Boolean40_50.convertBoolean(src.getAbstractElement()));
157    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext())
158      tgt.addContext(convertStructureDefinitionContextComponent(t));
159    for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant())
160      tgt.getContextInvariant().add(String40_50.convertString(t));
161    if (src.hasType())
162      tgt.setTypeElement(Uri40_50.convertUri(src.getTypeElement()));
163    if (src.hasBaseDefinition())
164      tgt.setBaseDefinitionElement(Canonical40_50.convertCanonical(src.getBaseDefinitionElement()));
165    if (src.hasDerivation())
166      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
167    if (src.hasSnapshot())
168      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
169    if (src.hasDifferential())
170      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
171    return tgt;
172  }
173
174  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
175      if (src == null || src.isEmpty())
176          return null;
177      Enumeration<StructureDefinition.StructureDefinitionKind> tgt = new Enumeration<>(new StructureDefinition.StructureDefinitionKindEnumFactory());
178      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
179      if (src.getValue() == null) {
180          tgt.setValue(null);
181      } else {
182          switch (src.getValue()) {
183              case PRIMITIVETYPE:
184                  tgt.setValue(StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
185                  break;
186              case COMPLEXTYPE:
187                  tgt.setValue(StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
188                  break;
189              case RESOURCE:
190                  tgt.setValue(StructureDefinition.StructureDefinitionKind.RESOURCE);
191                  break;
192              case LOGICAL:
193                  tgt.setValue(StructureDefinition.StructureDefinitionKind.LOGICAL);
194                  break;
195              default:
196                  tgt.setValue(StructureDefinition.StructureDefinitionKind.NULL);
197                  break;
198          }
199      }
200      return tgt;
201  }
202
203  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
204      if (src == null || src.isEmpty())
205          return null;
206      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKindEnumFactory());
207      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
208      if (src.getValue() == null) {
209          tgt.setValue(null);
210      } else {
211          switch (src.getValue()) {
212              case PRIMITIVETYPE:
213                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
214                  break;
215              case COMPLEXTYPE:
216                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
217                  break;
218              case RESOURCE:
219                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
220                  break;
221              case LOGICAL:
222                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
223                  break;
224              default:
225                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL);
226                  break;
227          }
228      }
229      return tgt;
230  }
231
232  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
233      if (src == null || src.isEmpty())
234          return null;
235      Enumeration<StructureDefinition.TypeDerivationRule> tgt = new Enumeration<>(new StructureDefinition.TypeDerivationRuleEnumFactory());
236      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
237      if (src.getValue() == null) {
238          tgt.setValue(null);
239      } else {
240          switch (src.getValue()) {
241              case SPECIALIZATION:
242                  tgt.setValue(StructureDefinition.TypeDerivationRule.SPECIALIZATION);
243                  break;
244              case CONSTRAINT:
245                  tgt.setValue(StructureDefinition.TypeDerivationRule.CONSTRAINT);
246                  break;
247              default:
248                  tgt.setValue(StructureDefinition.TypeDerivationRule.NULL);
249                  break;
250          }
251      }
252      return tgt;
253  }
254
255  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
256      if (src == null || src.isEmpty())
257          return null;
258      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRuleEnumFactory());
259      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
260      if (src.getValue() == null) {
261          tgt.setValue(null);
262      } else {
263          switch (src.getValue()) {
264              case SPECIALIZATION:
265                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
266                  break;
267              case CONSTRAINT:
268                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
269                  break;
270              default:
271                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL);
272                  break;
273          }
274      }
275      return tgt;
276  }
277
278  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
279    if (src == null)
280      return null;
281    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent();
282    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
283    if (src.hasIdentity())
284      tgt.setIdentityElement(Id40_50.convertId(src.getIdentityElement()));
285    if (src.hasUri())
286      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
287    if (src.hasName())
288      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
289    if (src.hasComment())
290      tgt.setCommentElement(String40_50.convertString(src.getCommentElement()));
291    return tgt;
292  }
293
294  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
295    if (src == null)
296      return null;
297    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent();
298    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
299    if (src.hasIdentity())
300      tgt.setIdentityElement(Id40_50.convertId(src.getIdentityElement()));
301    if (src.hasUri())
302      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
303    if (src.hasName())
304      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
305    if (src.hasComment())
306      tgt.setCommentElement(String40_50.convertString(src.getCommentElement()));
307    return tgt;
308  }
309
310  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent convertStructureDefinitionContextComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent src) throws FHIRException {
311    if (src == null)
312      return null;
313    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent();
314    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
315    if (src.hasType())
316      tgt.setTypeElement(convertExtensionContextType(src.getTypeElement()));
317    if (src.hasExpression())
318      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
319    return tgt;
320  }
321
322  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent convertStructureDefinitionContextComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent src) throws FHIRException {
323    if (src == null)
324      return null;
325    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent();
326    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
327    if (src.hasType())
328      tgt.setTypeElement(convertExtensionContextType(src.getTypeElement()));
329    if (src.hasExpression())
330      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
331    return tgt;
332  }
333
334  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType> convertExtensionContextType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> src) throws FHIRException {
335      if (src == null || src.isEmpty())
336          return null;
337      Enumeration<StructureDefinition.ExtensionContextType> tgt = new Enumeration<>(new StructureDefinition.ExtensionContextTypeEnumFactory());
338      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
339      if (src.getValue() == null) {
340          tgt.setValue(null);
341      } else {
342          switch (src.getValue()) {
343              case FHIRPATH:
344                  tgt.setValue(StructureDefinition.ExtensionContextType.FHIRPATH);
345                  break;
346              case ELEMENT:
347                  tgt.setValue(StructureDefinition.ExtensionContextType.ELEMENT);
348                  break;
349              case EXTENSION:
350                  tgt.setValue(StructureDefinition.ExtensionContextType.EXTENSION);
351                  break;
352              default:
353                  tgt.setValue(StructureDefinition.ExtensionContextType.NULL);
354                  break;
355          }
356      }
357      return tgt;
358  }
359
360  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> convertExtensionContextType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType> src) throws FHIRException {
361      if (src == null || src.isEmpty())
362          return null;
363      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextTypeEnumFactory());
364      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
365      if (src.getValue() == null) {
366          tgt.setValue(null);
367      } else {
368          switch (src.getValue()) {
369              case FHIRPATH:
370                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.FHIRPATH);
371                  break;
372              case ELEMENT:
373                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT);
374                  break;
375              case EXTENSION:
376                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION);
377                  break;
378              default:
379                  tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL);
380                  break;
381          }
382      }
383      return tgt;
384  }
385
386  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
387    if (src == null)
388      return null;
389    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent();
390    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
391    for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
392      tgt.addElement(ElementDefinition40_50.convertElementDefinition(t));
393    return tgt;
394  }
395
396  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
397    if (src == null)
398      return null;
399    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent();
400    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
401    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
402      tgt.addElement(ElementDefinition40_50.convertElementDefinition(t));
403    return tgt;
404  }
405
406  public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
407    if (src == null)
408      return null;
409    org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent();
410    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
411    for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
412      tgt.addElement(ElementDefinition40_50.convertElementDefinition(t));
413    return tgt;
414  }
415
416  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
417    if (src == null)
418      return null;
419    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent();
420    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
421    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
422      tgt.addElement(ElementDefinition40_50.convertElementDefinition(t));
423    return tgt;
424  }
425}