001package org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_30;
004import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30;
005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Decimal14_30;
006import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.String14_30;
007import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Uri14_30;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Money14_30 {
011  public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException {
012    if (src == null || src.isEmpty()) return null;
013    org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money();
014    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
015    if (src.hasValue()) tgt.setValueElement(Decimal14_30.convertDecimal(src.getValueElement()));
016    if (src.hasComparator())
017      tgt.setComparatorElement(Quantity14_30.convertQuantityComparator(src.getComparatorElement()));
018    if (src.hasUnit()) tgt.setUnitElement(String14_30.convertString(src.getUnitElement()));
019    if (src.hasSystem()) tgt.setSystemElement(Uri14_30.convertUri(src.getSystemElement()));
020    if (src.hasCode()) tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
021    return tgt;
022  }
023
024  public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException {
025    if (src == null || src.isEmpty()) return null;
026    org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money();
027    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
028    if (src.hasValue()) tgt.setValueElement(Decimal14_30.convertDecimal(src.getValueElement()));
029    if (src.hasComparator())
030      tgt.setComparatorElement(Quantity14_30.convertQuantityComparator(src.getComparatorElement()));
031    if (src.hasUnit()) tgt.setUnitElement(String14_30.convertString(src.getUnitElement()));
032    if (src.hasSystem()) tgt.setSystemElement(Uri14_30.convertUri(src.getSystemElement()));
033    if (src.hasCode()) tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
034    return tgt;
035  }
036}