mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#585 - Refactor of ScalarType jsonWrite() method such that it only takes JsonGenerator - part 2, use JsonGenerator
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user