001package org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_40; 004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Code10_40; 005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Decimal10_40; 006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.String10_40; 007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Uri10_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Count10_40 { 011 public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { 012 if (src == null || src.isEmpty()) return null; 013 org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); 014 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 015 if (src.hasValueElement()) tgt.setValueElement(Decimal10_40.convertDecimal(src.getValueElement())); 016 if (src.hasComparator()) 017 tgt.setComparatorElement(Quantity10_40.convertQuantityComparator(src.getComparatorElement())); 018 if (src.hasUnitElement()) tgt.setUnitElement(String10_40.convertString(src.getUnitElement())); 019 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_40.convertUri(src.getSystemElement())); 020 if (src.hasCodeElement()) tgt.setCodeElement(Code10_40.convertCode(src.getCodeElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { 025 if (src == null || src.isEmpty()) return null; 026 org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); 027 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 028 if (src.hasValueElement()) tgt.setValueElement(Decimal10_40.convertDecimal(src.getValueElement())); 029 if (src.hasComparator()) 030 tgt.setComparatorElement(Quantity10_40.convertQuantityComparator(src.getComparatorElement())); 031 if (src.hasUnitElement()) tgt.setUnitElement(String10_40.convertString(src.getUnitElement())); 032 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_40.convertUri(src.getSystemElement())); 033 if (src.hasCodeElement()) tgt.setCodeElement(Code10_40.convertCode(src.getCodeElement())); 034 return tgt; 035 } 036}