001package org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_50; 004import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Boolean10_50; 005import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Code10_50; 006import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50; 007import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Coding10_50 { 011 public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { 012 if (src == null || src.isEmpty()) return null; 013 org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); 014 ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); 015 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_50.convertUri(src.getSystemElement())); 016 if (src.hasVersionElement()) tgt.setVersionElement(String10_50.convertString(src.getVersionElement())); 017 if (src.hasCodeElement()) tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement())); 018 if (src.hasDisplayElement()) tgt.setDisplayElement(String10_50.convertString(src.getDisplayElement())); 019 if (src.hasUserSelectedElement()) 020 tgt.setUserSelectedElement(Boolean10_50.convertBoolean(src.getUserSelectedElement())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); 028 if (src.hasSystemElement()) tgt.setSystemElement(Uri10_50.convertUri(src.getSystemElement())); 029 if (src.hasVersionElement()) tgt.setVersionElement(String10_50.convertString(src.getVersionElement())); 030 if (src.hasCodeElement()) tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement())); 031 if (src.hasDisplayElement()) tgt.setDisplayElement(String10_50.convertString(src.getDisplayElement())); 032 if (src.hasUserSelectedElement()) 033 tgt.setUserSelectedElement(Boolean10_50.convertBoolean(src.getUserSelectedElement())); 034 return tgt; 035 } 036}