001package org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext40_50; 004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50; 007import org.hl7.fhir.exceptions.FHIRException; 008import org.hl7.fhir.r5.model.CodeableReference; 009 010public class Reference40_50 { 011 public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { 012 if (src == null) return null; 013 org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); 014 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 015 if (src.hasReference()) tgt.setReferenceElement(String40_50.convertString(src.getReferenceElement_())); 016 if (src.hasType()) tgt.setTypeElement(Uri40_50.convertUri(src.getTypeElement())); 017 if (src.hasIdentifier()) tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier())); 018 if (src.hasDisplay()) tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement())); 019 return tgt; 020 } 021 022 public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { 023 if (src == null) return null; 024 org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); 025 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 026 if (src.hasReference()) tgt.setReferenceElement(String40_50.convertString(src.getReferenceElement_())); 027 if (src.hasType()) tgt.setTypeElement(Uri40_50.convertUri(src.getTypeElement())); 028 if (src.hasIdentifier()) tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier())); 029 if (src.hasDisplay()) tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement())); 030 return tgt; 031 } 032 033 public static CodeableReference convertReferenceToCodeableReference(org.hl7.fhir.r4.model.Reference src) { 034 CodeableReference tgt = new CodeableReference(); 035 tgt.setReference(convertReference(src)); 036 return tgt; 037 } 038}