001package org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Code10_30;
005import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Decimal10_30;
006import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.String10_30;
007import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Uri10_30;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Age10_30 {
011  public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException {
012    if (src == null || src.isEmpty()) return null;
013    org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age();
014    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
015    if (src.hasValueElement()) tgt.setValueElement(Decimal10_30.convertDecimal(src.getValueElement()));
016    if (src.hasComparator())
017      tgt.setComparatorElement(Quantity10_30.convertQuantityComparator(src.getComparatorElement()));
018    if (src.hasUnitElement()) tgt.setUnitElement(String10_30.convertString(src.getUnitElement()));
019    if (src.hasSystemElement()) tgt.setSystemElement(Uri10_30.convertUri(src.getSystemElement()));
020    if (src.hasCodeElement()) tgt.setCodeElement(Code10_30.convertCode(src.getCodeElement()));
021    return tgt;
022  }
023
024  public static org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException {
025    if (src == null || src.isEmpty()) return null;
026    org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age();
027    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
028    if (src.hasValueElement()) tgt.setValueElement(Decimal10_30.convertDecimal(src.getValueElement()));
029    if (src.hasComparator())
030      tgt.setComparatorElement(Quantity10_30.convertQuantityComparator(src.getComparatorElement()));
031    if (src.hasUnitElement()) tgt.setUnitElement(String10_30.convertString(src.getUnitElement()));
032    if (src.hasSystemElement()) tgt.setSystemElement(Uri10_30.convertUri(src.getSystemElement()));
033    if (src.hasCodeElement()) tgt.setCodeElement(Code10_30.convertCode(src.getCodeElement()));
034    return tgt;
035  }
036}