001package org.hl7.fhir.convertors.conv10_40.resources10_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.exceptions.FHIRException; 006 007public class Binary10_40 { 008 009 public static org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { 010 if (src == null || src.isEmpty()) 011 return null; 012 org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); 013 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyResource(src, tgt); 014 if (src.hasContentTypeElement()) 015 tgt.setContentTypeElement(Code10_40.convertCode(src.getContentTypeElement())); 016 tgt.setContent(src.getContent()); 017 return tgt; 018 } 019 020 public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { 021 if (src == null || src.isEmpty()) 022 return null; 023 org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); 024 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyResource(src, tgt); 025 if (src.hasContentTypeElement()) 026 tgt.setContentTypeElement(Code10_40.convertCode(src.getContentTypeElement())); 027 if (src.hasContent()) 028 tgt.setContent(src.getContent()); 029 return tgt; 030 } 031}