Adding blank case for ExpressionNode.toString() in r4 and r5. (#609)

This commit is contained in:
Mark Iantorno 2021-09-27 14:52:55 -04:00 committed by GitHub
parent ad18e131d8
commit 72b7300700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 102 additions and 95 deletions

View File

@ -1 +1,2 @@
* https://github.com/hapifhir/org.hl7.fhir.core/issues/499
* https://github.com/hapifhir/org.hl7.fhir.core/issues/602

View File

@ -349,25 +349,28 @@ public class ExpressionNode {
b.append(", ");
b.append(n.toString());
}
if (function == Function.Item)
if (function == Function.Item) {
b.append("]");
else {
} else {
b.append(")");
}
break;
case Constant:
if (constant instanceof StringType)
b.append("'"+Utilities.escapeJson(constant.primitiveValue())+"'");
else if (constant instanceof Quantity) {
if (constant == null) {
b.append("{}");
} else if (constant instanceof StringType) {
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
} else if (constant instanceof Quantity) {
Quantity q = (Quantity) constant;
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
b.append(" '");
b.append(Utilities.escapeJson(q.getUnit()));
b.append("'");
} else if (constant.primitiveValue() != null)
} else if (constant.primitiveValue() != null) {
b.append(Utilities.escapeJson(constant.primitiveValue()));
else
} else {
b.append(Utilities.escapeJson(constant.toString()));
}
break;
case Group:
b.append("(");

View File

@ -395,25 +395,28 @@ public class ExpressionNode {
b.append(", ");
b.append(n.toString());
}
if (function == Function.Item)
if (function == Function.Item) {
b.append("]");
else {
} else {
b.append(")");
}
break;
case Constant:
if (constant instanceof StringType)
b.append("'"+Utilities.escapeJson(constant.primitiveValue())+"'");
else if (constant instanceof Quantity) {
if (constant == null) {
b.append("{}");
} else if (constant instanceof StringType) {
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
} else if (constant instanceof Quantity) {
Quantity q = (Quantity) constant;
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
b.append(" '");
b.append(Utilities.escapeJson(q.getUnit()));
b.append("'");
} else if (constant.primitiveValue() != null)
} else if (constant.primitiveValue() != null) {
b.append(Utilities.escapeJson(constant.primitiveValue()));
else
} else {
b.append(Utilities.escapeJson(constant.toString()));
}
break;
case Group:
b.append("(");