001package org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext14_40; 004import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Boolean14_40; 005import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Code14_40; 006import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.String14_40; 007import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Uri14_40; 008import org.hl7.fhir.exceptions.FHIRException; 009 010public class Coding14_40 { 011 public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2016may.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 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 015 if (src.hasSystem()) tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement())); 016 if (src.hasVersion()) tgt.setVersionElement(String14_40.convertString(src.getVersionElement())); 017 if (src.hasCode()) tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement())); 018 if (src.hasDisplay()) tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement())); 019 if (src.hasUserSelected()) tgt.setUserSelectedElement(Boolean14_40.convertBoolean(src.getUserSelectedElement())); 020 return tgt; 021 } 022 023 public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { 024 if (src == null || src.isEmpty()) return null; 025 org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); 026 ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt); 027 if (src.hasSystem()) tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement())); 028 if (src.hasVersion()) tgt.setVersionElement(String14_40.convertString(src.getVersionElement())); 029 if (src.hasCode()) tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement())); 030 if (src.hasDisplay()) tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement())); 031 if (src.hasUserSelected()) tgt.setUserSelectedElement(Boolean14_40.convertBoolean(src.getUserSelectedElement())); 032 return tgt; 033 } 034}