Adding blank case for ExpressionNode.toString() in r4 and r5. (#609)
This commit is contained in:
parent
ad18e131d8
commit
72b7300700
|
@ -1 +1,2 @@
|
||||||
|
* https://github.com/hapifhir/org.hl7.fhir.core/issues/499
|
||||||
* https://github.com/hapifhir/org.hl7.fhir.core/issues/602
|
* https://github.com/hapifhir/org.hl7.fhir.core/issues/602
|
||||||
|
|
|
@ -331,43 +331,46 @@ public class ExpressionNode {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Name:
|
case Name:
|
||||||
b.append(name);
|
b.append(name);
|
||||||
break;
|
break;
|
||||||
case Function:
|
case Function:
|
||||||
if (function == Function.Item)
|
if (function == Function.Item)
|
||||||
b.append("[");
|
b.append("[");
|
||||||
else {
|
else {
|
||||||
b.append(name);
|
b.append(name);
|
||||||
b.append("(");
|
b.append("(");
|
||||||
}
|
}
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (ExpressionNode n : parameters) {
|
for (ExpressionNode n : parameters) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
b.append(", ");
|
b.append(", ");
|
||||||
b.append(n.toString());
|
b.append(n.toString());
|
||||||
}
|
}
|
||||||
if (function == Function.Item)
|
if (function == Function.Item) {
|
||||||
b.append("]");
|
b.append("]");
|
||||||
else {
|
} else {
|
||||||
b.append(")");
|
b.append(")");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Constant:
|
case Constant:
|
||||||
if (constant instanceof StringType)
|
if (constant == null) {
|
||||||
b.append("'"+Utilities.escapeJson(constant.primitiveValue())+"'");
|
b.append("{}");
|
||||||
else if (constant instanceof Quantity) {
|
} else if (constant instanceof StringType) {
|
||||||
|
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
|
||||||
|
} else if (constant instanceof Quantity) {
|
||||||
Quantity q = (Quantity) constant;
|
Quantity q = (Quantity) constant;
|
||||||
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
||||||
b.append(" '");
|
b.append(" '");
|
||||||
b.append(Utilities.escapeJson(q.getUnit()));
|
b.append(Utilities.escapeJson(q.getUnit()));
|
||||||
b.append("'");
|
b.append("'");
|
||||||
} else if (constant.primitiveValue() != null)
|
} else if (constant.primitiveValue() != null) {
|
||||||
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
||||||
else
|
} else {
|
||||||
b.append(Utilities.escapeJson(constant.toString()));
|
b.append(Utilities.escapeJson(constant.toString()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Group:
|
case Group:
|
||||||
b.append("(");
|
b.append("(");
|
||||||
|
|
|
@ -395,25 +395,28 @@ public class ExpressionNode {
|
||||||
b.append(", ");
|
b.append(", ");
|
||||||
b.append(n.toString());
|
b.append(n.toString());
|
||||||
}
|
}
|
||||||
if (function == Function.Item)
|
if (function == Function.Item) {
|
||||||
b.append("]");
|
b.append("]");
|
||||||
else {
|
} else {
|
||||||
b.append(")");
|
b.append(")");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Constant:
|
case Constant:
|
||||||
if (constant instanceof StringType)
|
if (constant == null) {
|
||||||
b.append("'"+Utilities.escapeJson(constant.primitiveValue())+"'");
|
b.append("{}");
|
||||||
else if (constant instanceof Quantity) {
|
} else if (constant instanceof StringType) {
|
||||||
|
b.append("'" + Utilities.escapeJson(constant.primitiveValue()) + "'");
|
||||||
|
} else if (constant instanceof Quantity) {
|
||||||
Quantity q = (Quantity) constant;
|
Quantity q = (Quantity) constant;
|
||||||
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
b.append(Utilities.escapeJson(q.getValue().toPlainString()));
|
||||||
b.append(" '");
|
b.append(" '");
|
||||||
b.append(Utilities.escapeJson(q.getUnit()));
|
b.append(Utilities.escapeJson(q.getUnit()));
|
||||||
b.append("'");
|
b.append("'");
|
||||||
} else if (constant.primitiveValue() != null)
|
} else if (constant.primitiveValue() != null) {
|
||||||
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
b.append(Utilities.escapeJson(constant.primitiveValue()));
|
||||||
else
|
} else {
|
||||||
b.append(Utilities.escapeJson(constant.toString()));
|
b.append(Utilities.escapeJson(constant.toString()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Group:
|
case Group:
|
||||||
b.append("(");
|
b.append("(");
|
||||||
|
|
Loading…
Reference in New Issue