#585 - Refactor of ScalarType jsonWrite() method such that it only takes JsonGenerator - part 2, use JsonGenerator

This commit is contained in:
Robin Bygrave committed 2016-03-03 20:27:13 +13:00
1 parent fc96685ed0
commit a4f0e3936a
38 files changed
+115 -110

No files matched your search

@@ -22,17 +22,18 @@ public class DefaultJsonScalar implements JsonScalar {
}
@Override
@SuppressWarnings("unchecked")
public void write(Object value) throws IOException {
if (value instanceof String) {
writeJson.writeString((String)value);
} else {
ScalarType scalarType = (ScalarType)typeManager.getScalarType(value.getClass());
ScalarType scalarType = typeManager.getScalarType(value.getClass());
if (scalarType == null) {
throw new IllegalArgumentException("unhandled type " + value.getClass());
}
scalarType.jsonWrite(writeJson, value);
scalarType.jsonWrite(writeJson.gen(), value);
}
}
}