001package org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Code30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Decimal30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class SimpleQuantity30_50 { 011 public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { 012 if (src == null) return null; 013 org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); 014 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 015 if (src.hasValue()) tgt.setValueElement(Decimal30_50.convertDecimal(src.getValueElement())); 016 if (src.hasComparator()) 017 tgt.setComparatorElement(Quantity30_50.convertQuantityComparator(src.getComparatorElement())); 018 if (src.hasUnit()) tgt.setUnitElement(String30_50.convertString(src.getUnitElement())); 019 if (src.hasSystem()) tgt.setSystemElement(Uri30_50.convertUri(src.getSystemElement())); 020 if (src.hasCode()) tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 028 if (src.hasValue()) tgt.setValueElement(Decimal30_50.convertDecimal(src.getValueElement())); 029 if (src.hasComparator()) 030 tgt.setComparatorElement(Quantity30_50.convertQuantityComparator(src.getComparatorElement())); 031 if (src.hasUnit()) tgt.setUnitElement(String30_50.convertString(src.getUnitElement())); 032 if (src.hasSystem()) tgt.setSystemElement(Uri30_50.convertUri(src.getSystemElement())); 033 if (src.hasCode()) tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement())); 034 return tgt; 035 } 036}