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 1, remove field name
This commit is contained in:
1 parent
5b10d06348
commit
fc96685ed0
43 files changed
+105
-111
No files matched your search
@@ -22,17 +22,17 @@ public class DefaultJsonScalar implements JsonScalar {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(String name, Object value) throws IOException {
|
||||
public void write(Object value) throws IOException {
|
||||
|
||||
if (value instanceof String) {
|
||||
writeJson.writeStringField(name, (String)value);
|
||||
writeJson.writeString((String)value);
|
||||
|
||||
} else {
|
||||
ScalarType scalarType = (ScalarType)typeManager.getScalarType(value.getClass());
|
||||
if (scalarType == null) {
|
||||
throw new IllegalArgumentException("unhandled type " + value.getClass());
|
||||
}
|
||||
scalarType.jsonWrite(writeJson, name, value);
|
||||
scalarType.jsonWrite(writeJson, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,6 +313,15 @@ public class WriteJson implements JsonWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNumber(double value) {
|
||||
try {
|
||||
generator.writeNumber(value);
|
||||
} catch (IOException e) {
|
||||
throw new JsonIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNumber(BigDecimal value) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user