Don't write Booleans and Numbers as strings in Cell serialisation

This commit is contained in:
Owen Stephens 2019-04-04 11:42:01 +01:00
parent 62bcc80dcc
commit a881dc80aa

View File

@ -102,7 +102,7 @@ public class Cell implements HasFields {
@JsonProperty("v") @JsonProperty("v")
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
public String getValueAsString() { public Object getValue() {
if (value != null && !ExpressionUtils.isError(value)) { if (value != null && !ExpressionUtils.isError(value)) {
Instant instant = null; Instant instant = null;
if (value instanceof OffsetDateTime) { if (value instanceof OffsetDateTime) {
@ -119,8 +119,9 @@ public class Cell implements HasFields {
return ((Double)value).toString(); return ((Double)value).toString();
} else if (value instanceof Float } else if (value instanceof Float
&& (((Float)value).isNaN() || ((Float)value).isInfinite())) { && (((Float)value).isNaN() || ((Float)value).isInfinite())) {
// TODO: Skip? Write as string?
return ((Float)value).toString(); return ((Float)value).toString();
} else if (value instanceof Boolean || value instanceof Number){
return value;
} else { } else {
return value.toString(); return value.toString();
} }