001package org.hl7.fhir.convertors.conv14_40.resources14_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_40;
004import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.Code14_40;
005import org.hl7.fhir.exceptions.FHIRException;
006
007public class Binary14_40 {
008  public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException {
009    if (src == null || src.isEmpty()) return null;
010    org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary();
011    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyResource(src, tgt);
012    if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code14_40.convertCode(src.getContentTypeElement()));
013    tgt.setContent(src.getContent());
014    return tgt;
015  }
016
017  public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException {
018    if (src == null || src.isEmpty()) return null;
019    org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary();
020    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyResource(src, tgt);
021    if (src.hasContentTypeElement()) tgt.setContentTypeElement(Code14_40.convertCode(src.getContentTypeElement()));
022    tgt.setContent(src.getContent());
023    return tgt;
024  }
025}