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.*;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.PositiveInt40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010/*
011  Copyright (c) 2011+, HL7, Inc.
012  All rights reserved.
013  
014  Redistribution and use in source and binary forms, with or without modification, 
015  are permitted provided that the following conditions are met:
016  
017   * Redistributions of source code must retain the above copyright notice, this 
018     list of conditions and the following disclaimer.
019   * Redistributions in binary form must reproduce the above copyright notice, 
020     this list of conditions and the following disclaimer in the documentation 
021     and/or other materials provided with the distribution.
022   * Neither the name of HL7 nor the names of its contributors may be used to 
023     endorse or promote products derived from this software without specific 
024     prior written permission.
025  
026  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
027  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
028  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
029  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
030  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
031  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
032  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
033  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
034  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
035  POSSIBILITY OF SUCH DAMAGE.
036  
037*/
038// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
039public class InsurancePlan40_50 {
040
041  public static org.hl7.fhir.r5.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r4.model.InsurancePlan src) throws FHIRException {
042    if (src == null)
043      return null;
044    org.hl7.fhir.r5.model.InsurancePlan tgt = new org.hl7.fhir.r5.model.InsurancePlan();
045    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
046    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
047      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
048    if (src.hasStatus())
049      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
050    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
051      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
052    if (src.hasName())
053      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
054    for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t));
055    if (src.hasPeriod())
056      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
057    if (src.hasOwnedBy())
058      tgt.setOwnedBy(Reference40_50.convertReference(src.getOwnedBy()));
059    if (src.hasAdministeredBy())
060      tgt.setAdministeredBy(Reference40_50.convertReference(src.getAdministeredBy()));
061    for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea())
062      tgt.addCoverageArea(Reference40_50.convertReference(t));
063    for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact())
064      tgt.addContact(convertInsurancePlanContactComponent(t));
065    for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference40_50.convertReference(t));
066    for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
067    for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage())
068      tgt.addCoverage(convertInsurancePlanCoverageComponent(t));
069    for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan())
070      tgt.addPlan(convertInsurancePlanPlanComponent(t));
071    return tgt;
072  }
073
074  public static org.hl7.fhir.r4.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r5.model.InsurancePlan src) throws FHIRException {
075    if (src == null)
076      return null;
077    org.hl7.fhir.r4.model.InsurancePlan tgt = new org.hl7.fhir.r4.model.InsurancePlan();
078    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
079    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
080      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
081    if (src.hasStatus())
082      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
083    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType())
084      tgt.addType(CodeableConcept40_50.convertCodeableConcept(t));
085    if (src.hasName())
086      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
087    for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) tgt.getAlias().add(String40_50.convertString(t));
088    if (src.hasPeriod())
089      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
090    if (src.hasOwnedBy())
091      tgt.setOwnedBy(Reference40_50.convertReference(src.getOwnedBy()));
092    if (src.hasAdministeredBy())
093      tgt.setAdministeredBy(Reference40_50.convertReference(src.getAdministeredBy()));
094    for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea())
095      tgt.addCoverageArea(Reference40_50.convertReference(t));
096    for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact())
097      tgt.addContact(convertInsurancePlanContactComponent(t));
098    for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) tgt.addEndpoint(Reference40_50.convertReference(t));
099    for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
100    for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage())
101      tgt.addCoverage(convertInsurancePlanCoverageComponent(t));
102    for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan())
103      tgt.addPlan(convertInsurancePlanPlanComponent(t));
104    return tgt;
105  }
106
107  public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException {
108    if (src == null)
109      return null;
110    org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent();
111    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
112    if (src.hasPurpose())
113      tgt.setPurpose(CodeableConcept40_50.convertCodeableConcept(src.getPurpose()));
114    if (src.hasName())
115      tgt.setName(HumanName40_50.convertHumanName(src.getName()));
116    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
117      tgt.addTelecom(ContactPoint40_50.convertContactPoint(t));
118    if (src.hasAddress())
119      tgt.setAddress(Address40_50.convertAddress(src.getAddress()));
120    return tgt;
121  }
122
123  public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException {
124    if (src == null)
125      return null;
126    org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent();
127    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
128    if (src.hasPurpose())
129      tgt.setPurpose(CodeableConcept40_50.convertCodeableConcept(src.getPurpose()));
130    if (src.hasName())
131      tgt.setName(HumanName40_50.convertHumanName(src.getName()));
132    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
133      tgt.addTelecom(ContactPoint40_50.convertContactPoint(t));
134    if (src.hasAddress())
135      tgt.setAddress(Address40_50.convertAddress(src.getAddress()));
136    return tgt;
137  }
138
139  public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException {
140    if (src == null)
141      return null;
142    org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent();
143    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
144    if (src.hasType())
145      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
146    for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
147    for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit())
148      tgt.addBenefit(convertCoverageBenefitComponent(t));
149    return tgt;
150  }
151
152  public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException {
153    if (src == null)
154      return null;
155    org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent();
156    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
157    if (src.hasType())
158      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
159    for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
160    for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit())
161      tgt.addBenefit(convertCoverageBenefitComponent(t));
162    return tgt;
163  }
164
165  public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException {
166    if (src == null)
167      return null;
168    org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent();
169    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
170    if (src.hasType())
171      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
172    if (src.hasRequirement())
173      tgt.setRequirementElement(String40_50.convertString(src.getRequirementElement()));
174    for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit())
175      tgt.addLimit(convertCoverageBenefitLimitComponent(t));
176    return tgt;
177  }
178
179  public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException {
180    if (src == null)
181      return null;
182    org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent();
183    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
184    if (src.hasType())
185      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
186    if (src.hasRequirement())
187      tgt.setRequirementElement(String40_50.convertString(src.getRequirementElement()));
188    for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit())
189      tgt.addLimit(convertCoverageBenefitLimitComponent(t));
190    return tgt;
191  }
192
193  public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException {
194    if (src == null)
195      return null;
196    org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent();
197    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
198    if (src.hasValue())
199      tgt.setValue(Quantity40_50.convertQuantity(src.getValue()));
200    if (src.hasCode())
201      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
202    return tgt;
203  }
204
205  public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException {
206    if (src == null)
207      return null;
208    org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent();
209    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
210    if (src.hasValue())
211      tgt.setValue(Quantity40_50.convertQuantity(src.getValue()));
212    if (src.hasCode())
213      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
214    return tgt;
215  }
216
217  public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException {
218    if (src == null)
219      return null;
220    org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent();
221    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
222    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
223      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
224    if (src.hasType())
225      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
226    for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea())
227      tgt.addCoverageArea(Reference40_50.convertReference(t));
228    for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
229    for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost())
230      tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t));
231    for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost())
232      tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t));
233    return tgt;
234  }
235
236  public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException {
237    if (src == null)
238      return null;
239    org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent();
240    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
241    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
242      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
243    if (src.hasType())
244      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
245    for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea())
246      tgt.addCoverageArea(Reference40_50.convertReference(t));
247    for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) tgt.addNetwork(Reference40_50.convertReference(t));
248    for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost())
249      tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t));
250    for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost())
251      tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t));
252    return tgt;
253  }
254
255  public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException {
256    if (src == null)
257      return null;
258    org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent();
259    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
260    if (src.hasType())
261      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
262    if (src.hasGroupSize())
263      tgt.setGroupSizeElement(PositiveInt40_50.convertPositiveInt(src.getGroupSizeElement()));
264    if (src.hasCost())
265      tgt.setCost(Money40_50.convertMoney(src.getCost()));
266    if (src.hasComment())
267      tgt.setCommentElement(String40_50.convertString(src.getCommentElement()));
268    return tgt;
269  }
270
271  public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException {
272    if (src == null)
273      return null;
274    org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent();
275    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
276    if (src.hasType())
277      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
278    if (src.hasGroupSize())
279      tgt.setGroupSizeElement(PositiveInt40_50.convertPositiveInt(src.getGroupSizeElement()));
280    if (src.hasCost())
281      tgt.setCost(Money40_50.convertMoney(src.getCost()));
282    if (src.hasComment())
283      tgt.setCommentElement(String40_50.convertString(src.getCommentElement()));
284    return tgt;
285  }
286
287  public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException {
288    if (src == null)
289      return null;
290    org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent();
291    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
292    if (src.hasCategory())
293      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
294    for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit())
295      tgt.addBenefit(convertPlanBenefitComponent(t));
296    return tgt;
297  }
298
299  public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException {
300    if (src == null)
301      return null;
302    org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent();
303    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
304    if (src.hasCategory())
305      tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategory()));
306    for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit())
307      tgt.addBenefit(convertPlanBenefitComponent(t));
308    return tgt;
309  }
310
311  public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException {
312    if (src == null)
313      return null;
314    org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent();
315    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
316    if (src.hasType())
317      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
318    for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost())
319      tgt.addCost(convertPlanBenefitCostComponent(t));
320    return tgt;
321  }
322
323  public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException {
324    if (src == null)
325      return null;
326    org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent();
327    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
328    if (src.hasType())
329      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
330    for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost())
331      tgt.addCost(convertPlanBenefitCostComponent(t));
332    return tgt;
333  }
334
335  public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException {
336    if (src == null)
337      return null;
338    org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent();
339    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
340    if (src.hasType())
341      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
342    if (src.hasApplicability())
343      tgt.setApplicability(CodeableConcept40_50.convertCodeableConcept(src.getApplicability()));
344    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getQualifiers())
345      tgt.addQualifiers(CodeableConcept40_50.convertCodeableConcept(t));
346    if (src.hasValue())
347      tgt.setValue(Quantity40_50.convertQuantity(src.getValue()));
348    return tgt;
349  }
350
351  public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException {
352    if (src == null)
353      return null;
354    org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent();
355    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
356    if (src.hasType())
357      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
358    if (src.hasApplicability())
359      tgt.setApplicability(CodeableConcept40_50.convertCodeableConcept(src.getApplicability()));
360    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getQualifiers())
361      tgt.addQualifiers(CodeableConcept40_50.convertCodeableConcept(t));
362    if (src.hasValue())
363      tgt.setValue(Quantity40_50.convertQuantity(src.getValue()));
364    return tgt;
365  }
366}