![](/hapi-fhir/images/logos/raccoon-forwards.png)
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.Boolean10_40; 005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Code10_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 Coding10_40 { 011 public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { 012 if (src == null || src.isEmpty()) return null; 013 org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); 014 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 015 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_40.convertUri(src.getSystemElement())); 016 if (src.hasVersionElement()) tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 017 if (src.hasCodeElement()) tgt.setCodeElement(Code10_40.convertCode(src.getCodeElement())); 018 if (src.hasDisplayElement()) tgt.setDisplayElement(String10_40.convertString(src.getDisplayElement())); 019 if (src.hasUserSelectedElement()) 020 tgt.setUserSelectedElement(Boolean10_40.convertBoolean(src.getUserSelectedElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { 025 if (src == null || src.isEmpty()) return null; 026 org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); 027 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 028 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_40.convertUri(src.getSystemElement())); 029 if (src.hasVersionElement()) tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 030 if (src.hasCodeElement()) tgt.setCodeElement(Code10_40.convertCode(src.getCodeElement())); 031 if (src.hasDisplayElement()) tgt.setDisplayElement(String10_40.convertString(src.getDisplayElement())); 032 if (src.hasUserSelectedElement()) 033 tgt.setUserSelectedElement(Boolean10_40.convertBoolean(src.getUserSelectedElement())); 034 return tgt; 035 } 036}