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.convertors.conv14_40.datatypes14_40.primitivetypes14_40.String14_40; 007import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Uri14_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Distance14_40 { 011 public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { 012 if (src == null || src.isEmpty()) return null; 013 org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); 014 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 015 if (src.hasValue()) tgt.setValueElement(Decimal14_40.convertDecimal(src.getValueElement())); 016 if (src.hasComparator()) 017 tgt.setComparatorElement(Quantity14_40.convertQuantityComparator(src.getComparatorElement())); 018 if (src.hasUnit()) tgt.setUnitElement(String14_40.convertString(src.getUnitElement())); 019 if (src.hasSystem()) tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement())); 020 if (src.hasCode()) tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { 025 if (src == null || src.isEmpty()) return null; 026 org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); 027 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 028 if (src.hasValue()) tgt.setValueElement(Decimal14_40.convertDecimal(src.getValueElement())); 029 if (src.hasComparator()) 030 tgt.setComparatorElement(Quantity14_40.convertQuantityComparator(src.getComparatorElement())); 031 if (src.hasUnit()) tgt.setUnitElement(String14_40.convertString(src.getUnitElement())); 032 if (src.hasSystem()) tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement())); 033 if (src.hasCode()) tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement())); 034 return tgt; 035 } 036}