001package org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_40;
004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.DateTime10_40;
005import org.hl7.fhir.exceptions.FHIRException;
006
007public class Annotation10_40 {
008  public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException {
009    if (src == null || src.isEmpty()) return null;
010    org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation();
011    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
012    if (src.hasAuthor())
013      tgt.setAuthor(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getAuthor()));
014    if (src.hasTimeElement()) tgt.setTimeElement(DateTime10_40.convertDateTime(src.getTimeElement()));
015    tgt.setText(src.getText());
016    return tgt;
017  }
018
019  public static org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException {
020    if (src == null || src.isEmpty()) return null;
021    org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation();
022    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
023    if (src.hasAuthor())
024      tgt.setAuthor(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getAuthor()));
025    if (src.hasTimeElement()) tgt.setTimeElement(DateTime10_40.convertDateTime(src.getTimeElement()));
026    tgt.setText(src.getText());
027    return tgt;
028  }
029}