001package org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Code30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Decimal30_40; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class SimpleQuantity30_40 { 011 public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { 012 if (src == null) return null; 013 org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); 014 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 015 if (src.hasValue()) tgt.setValueElement(Decimal30_40.convertDecimal(src.getValueElement())); 016 if (src.hasComparator()) 017 tgt.setComparatorElement(Quantity30_40.convertQuantityComparator(src.getComparatorElement())); 018 if (src.hasUnit()) tgt.setUnitElement(String30_40.convertString(src.getUnitElement())); 019 if (src.hasSystem()) tgt.setSystemElement(Uri30_40.convertUri(src.getSystemElement())); 020 if (src.hasCode()) tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { 025 if (src == null) return null; 026 org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); 027 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 028 if (src.hasValue()) tgt.setValueElement(Decimal30_40.convertDecimal(src.getValueElement())); 029 if (src.hasComparator()) 030 tgt.setComparatorElement(Quantity30_40.convertQuantityComparator(src.getComparatorElement())); 031 if (src.hasUnit()) tgt.setUnitElement(String30_40.convertString(src.getUnitElement())); 032 if (src.hasSystem()) tgt.setSystemElement(Uri30_40.convertUri(src.getSystemElement())); 033 if (src.hasCode()) tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement())); 034 return tgt; 035 } 036}