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.String14_40;
005import org.hl7.fhir.exceptions.FHIRException;
006
007public class CodeableConcept14_40 {
008  public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException {
009    if (src == null || src.isEmpty()) return null;
010    org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept();
011    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
012    for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) tgt.addCoding(Coding14_40.convertCoding(t));
013    if (src.hasText()) tgt.setTextElement(String14_40.convertString(src.getTextElement()));
014    return tgt;
015  }
016
017  public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException {
018    if (src == null || src.isEmpty()) return null;
019    org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept();
020    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
021    for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) tgt.addCoding(Coding14_40.convertCoding(t));
022    if (src.hasText()) tgt.setTextElement(String14_40.convertString(src.getTextElement()));
023    return tgt;
024  }
025
026  public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException {
027    org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext();
028    result.setValue(convertCodeableConcept(t));
029    return result;
030  }
031}