Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Customized id conversion to use getIdPart instead of getValue.
Browse files Browse the repository at this point in the history
  • Loading branch information
bashir2 committed Feb 23, 2021
1 parent ee65d1b commit f1a4d83
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;

public abstract class PrimitiveConverter<T> extends HapiConverter<T> {
Expand Down Expand Up @@ -54,13 +55,19 @@ public void toHapi(Object input, IPrimitiveType primitive) {
primitive.setValue(input);
}

protected Object fromHapi(IIdType id) {
return id.getIdPart();
}

protected Object fromHapi(IPrimitiveType primitive) {
return primitive.getValue();
}

@Override
public Object fromHapi(Object input) {

if (input instanceof IIdType) {
return fromHapi((IIdType) input);
}
return fromHapi((IPrimitiveType) input);
}

Expand Down

0 comments on commit f1a4d83

Please sign in to comment.