001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.BackboneElement40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class Population40_50 {
009  public static org.hl7.fhir.r5.model.Population convertPopulation(org.hl7.fhir.r4.model.Population src) throws FHIRException {
010    if (src == null) return null;
011    org.hl7.fhir.r5.model.Population tgt = new org.hl7.fhir.r5.model.Population();
012    BackboneElement40_50.copyBackboneElement(src, tgt);
013    if (src.hasAge()) tgt.setAge(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getAge()));
014    if (src.hasGender()) tgt.setGender(CodeableConcept40_50.convertCodeableConcept(src.getGender()));
015    if (src.hasRace()) tgt.setRace(CodeableConcept40_50.convertCodeableConcept(src.getRace()));
016    if (src.hasPhysiologicalCondition())
017      tgt.setPhysiologicalCondition(CodeableConcept40_50.convertCodeableConcept(src.getPhysiologicalCondition()));
018    return tgt;
019  }
020
021  public static org.hl7.fhir.r4.model.Population convertPopulation(org.hl7.fhir.r5.model.Population src) throws FHIRException {
022    if (src == null) return null;
023    org.hl7.fhir.r4.model.Population tgt = new org.hl7.fhir.r4.model.Population();
024    BackboneElement40_50.copyBackboneElement(src, tgt);
025    if (src.hasAge()) tgt.setAge(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getAge()));
026    if (src.hasGender()) tgt.setGender(CodeableConcept40_50.convertCodeableConcept(src.getGender()));
027    if (src.hasRace()) tgt.setRace(CodeableConcept40_50.convertCodeableConcept(src.getRace()));
028    if (src.hasPhysiologicalCondition())
029      tgt.setPhysiologicalCondition(CodeableConcept40_50.convertCodeableConcept(src.getPhysiologicalCondition()));
030    return tgt;
031  }
032}