Skip to content

Commit

Permalink
Fixes for Tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival committed Oct 30, 2024
1 parent c2cfd64 commit fc64604
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ protected IParametersParameterComponentAdapter addPart(IParametersAdapter pa, St

@SuppressWarnings("unchecked")
protected void addPart(IParametersAdapter pa, String name, Object value) {
IParametersParameterComponentAdapter ppca = this.addPart(pa, name);

if (value == null) {
return;
}

if (value instanceof Iterable) {
var ppca = this.addPart(pa, name);
Iterable<Object> values = (Iterable<Object>) value;
for (Object o : values) {
this.addSubPart(ppca, "element", o);
Expand All @@ -113,9 +112,16 @@ protected void addPart(IParametersAdapter pa, String name, Object value) {
value = this.fhirTypeConverter.toFhirType(value);
}

if (value instanceof IBaseDatatype) {
// Likely already a parameter part
if (value instanceof IBaseBackboneElement) {
var ppca = this.adapterFactory.createParametersParameters((IBaseBackboneElement) value);
ppca.setName(name);
pa.addParameter(ppca.get());
} else if (value instanceof IBaseDatatype) {
var ppca = this.addPart(pa, name);
ppca.setValue((IBaseDatatype) value);
} else if (value instanceof IBaseResource) {
var ppca = this.addPart(pa, name);
ppca.setResource((IBaseResource) value);
} else {
throw new IllegalArgumentException(String.format(
Expand Down

0 comments on commit fc64604

Please sign in to comment.