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.DateTime14_40;
005import org.hl7.fhir.exceptions.FHIRException;
006
007public class Period14_40 {
008  public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException {
009    if (src == null || src.isEmpty()) return null;
010    org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period();
011    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
012    if (src.hasStart()) tgt.setStartElement(DateTime14_40.convertDateTime(src.getStartElement()));
013    if (src.hasEnd()) tgt.setEndElement(DateTime14_40.convertDateTime(src.getEndElement()));
014    return tgt;
015  }
016
017  public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException {
018    if (src == null || src.isEmpty()) return null;
019    org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period();
020    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
021    if (src.hasStart()) tgt.setStartElement(DateTime14_40.convertDateTime(src.getStartElement()));
022    if (src.hasEnd()) tgt.setEndElement(DateTime14_40.convertDateTime(src.getEndElement()));
023    return tgt;
024  }
025}