001package org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_40;
004import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Code14_40;
005import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Decimal14_40;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class Money14_40 {
009  public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException {
010    if (src == null || src.isEmpty()) return null;
011    org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money();
012    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
013    if (src.hasValue()) tgt.setValueElement(Decimal14_40.convertDecimal(src.getValueElement()));
014    if (src.hasCode()) tgt.setCurrencyElement(Code14_40.convertCode(src.getCodeElement()));
015    return tgt;
016  }
017
018  public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException {
019    if (src == null || src.isEmpty()) return null;
020    org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money();
021    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
022    if (src.hasValue()) tgt.setValueElement(Decimal14_40.convertDecimal(src.getValueElement()));
023    if (src.hasCurrency()) tgt.setCodeElement(Code14_40.convertCode(src.getCurrencyElement()));
024    return tgt;
025  }
026}