mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +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
@@ -1244,7 +1244,7 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
} else {
|
||||
if (scalarType != null) {
|
||||
writeJson.writeFieldName(name);
|
||||
scalarType.jsonWrite(writeJson, value);
|
||||
scalarType.jsonWrite(writeJson.gen(), value);
|
||||
} else {
|
||||
writeJson.writeValueUsingObjectMapper(name, value);
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
if (value == null) {
|
||||
ctx.writeNullField(name);
|
||||
} else {
|
||||
ctx.writeFieldName(name);
|
||||
compoundType.jsonWrite(ctx, value, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public final class CtCompoundType<V> implements ScalarDataReader<V> {
|
||||
|
||||
} else {
|
||||
ctx.writeFieldName(propName);
|
||||
((ScalarType) propReaders[i]).jsonWrite(ctx, value);
|
||||
((ScalarType) propReaders[i]).jsonWrite(ctx.gen(), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.text.StringFormatter;
|
||||
import com.avaje.ebean.text.StringParser;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -208,6 +208,6 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
/**
|
||||
* Write the value to the JsonGenerator.
|
||||
*/
|
||||
void jsonWrite(JsonWriter writer, T value) throws IOException;
|
||||
void jsonWrite(JsonGenerator writer, T value) throws IOException;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, T value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, T value) throws IOException {
|
||||
writer.writeNumber(convertToMillis(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.JsonConfig;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -104,19 +104,19 @@ public abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, T value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, T value) throws IOException {
|
||||
|
||||
switch (mode) {
|
||||
case ISO8601: {
|
||||
writer.gen().writeString(toJsonISO8601(value));
|
||||
writer.writeString(toJsonISO8601(value));
|
||||
break;
|
||||
}
|
||||
case NANOS: {
|
||||
writer.gen().writeNumber(toJsonNanos(value));
|
||||
writer.writeNumber(toJsonNanos(value));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
writer.gen().writeNumber(convertToMillis(value));
|
||||
writer.writeNumber(convertToMillis(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -129,7 +129,7 @@ public abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, T value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, T value) throws IOException {
|
||||
writer.writeString(format(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ScalarTypeBigDecimal extends ScalarTypeBase<BigDecimal> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, BigDecimal value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, BigDecimal value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -336,7 +336,7 @@ public class ScalarTypeBoolean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Boolean value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Boolean value) throws IOException {
|
||||
writer.writeBoolean(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
@@ -43,13 +44,20 @@ public class ScalarTypeByte extends ScalarTypeBase<Byte> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Byte value) throws IOException {
|
||||
throw new IOException("Not supported");
|
||||
public void jsonWrite(JsonGenerator writer, Byte value) throws IOException {
|
||||
writer.writeBinary(new byte[]{value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte jsonRead(JsonParser parser, JsonToken event) throws IOException {
|
||||
throw new IOException("Not supported");
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
parser.readBinaryValue(os);
|
||||
byte[] bytes = os.toByteArray();
|
||||
if (bytes.length == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return bytes[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -43,9 +42,8 @@ public abstract class ScalarTypeBytesBase extends ScalarTypeBase<byte[]> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, byte[] value) throws IOException {
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(value);
|
||||
writer.writeBinary(is, value.length);
|
||||
public void jsonWrite(JsonGenerator writer, byte[] value) throws IOException {
|
||||
writer.writeBinary(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -66,9 +65,8 @@ public class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, byte[] value) throws IOException {
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(value);
|
||||
writer.writeBinary(is, value.length);
|
||||
public void jsonWrite(JsonGenerator writer, byte[] value) throws IOException {
|
||||
writer.writeBinary(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScalarTypeDouble extends ScalarTypeBase<Double> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Double value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Double value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ScalarTypeDuration extends ScalarTypeBase<Duration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Duration value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Duration value) throws IOException {
|
||||
writer.writeString(value.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ScalarTypeEncryptedWrapper<T> implements ScalarType<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, T value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, T value) throws IOException {
|
||||
wrapped.jsonWrite(writer, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class ScalarTypeEnumStandard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Object value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Object value) throws IOException {
|
||||
writer.writeString(formatValue(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import org.slf4j.Logger;
|
||||
@@ -112,7 +112,7 @@ public class ScalarTypeFile extends ScalarTypeBase<File> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, File value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, File value) throws IOException {
|
||||
InputStream is = getInputStream(value);
|
||||
writer.writeBinary(is, (int) value.length());
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScalarTypeFloat extends ScalarTypeBase<Float> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Float value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Float value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScalarTypeInteger extends ScalarTypeBase<Integer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Integer value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Integer value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import org.joda.time.DateTimeZone;
|
||||
@@ -72,7 +72,7 @@ public class ScalarTypeJodaLocalTime extends ScalarTypeBase<LocalTime> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, LocalTime value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, LocalTime value) throws IOException {
|
||||
writer.writeString(value.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -194,8 +194,8 @@ public abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Map value) throws IOException {
|
||||
EJson.write(value, writer.gen());
|
||||
public void jsonWrite(JsonGenerator writer, Map value) throws IOException {
|
||||
EJson.write(value, writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -206,8 +206,8 @@ public abstract class ScalarTypeJsonNode extends ScalarTypeBase<JsonNode> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, JsonNode value) throws IOException {
|
||||
objectMapper.writeTree(writer.gen(), value);
|
||||
public void jsonWrite(JsonGenerator writer, JsonNode value) throws IOException {
|
||||
objectMapper.writeTree(writer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ScalarTypeLocalTime extends ScalarTypeBase<LocalTime> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, LocalTime value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, LocalTime value) throws IOException {
|
||||
writer.writeString(value.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScalarTypeLong extends ScalarTypeBase<Long> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Long value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Long value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ScalarTypeMathBigInteger extends ScalarTypeBase<BigInteger> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, BigInteger value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, BigInteger value) throws IOException {
|
||||
writer.writeNumber(value.longValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ScalarTypeMonthDay extends ScalarTypeBase<MonthDay> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, MonthDay value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, MonthDay value) throws IOException {
|
||||
writer.writeString(format(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.EJson;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -113,8 +113,8 @@ public class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Map value) throws IOException {
|
||||
EJson.write(value, writer.gen());
|
||||
public void jsonWrite(JsonGenerator writer, Map value) throws IOException {
|
||||
EJson.write(value, writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ScalarTypeShort extends ScalarTypeBase<Short> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Short value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Short value) throws IOException {
|
||||
writer.writeNumber(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScalarTypeString extends ScalarTypeBase<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, String value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, String value) throws IOException {
|
||||
writer.writeString(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ScalarTypeTime extends ScalarTypeBase<Time> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Time value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Time value) throws IOException {
|
||||
writer.writeString(format(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class ScalarTypeUUIDBinary extends ScalarTypeBase<UUID> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, UUID value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, UUID value) throws IOException {
|
||||
writer.writeString(value.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbType;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ScalarTypeUUIDNative extends ScalarTypeBase<UUID> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, UUID value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, UUID value) throws IOException {
|
||||
writer.writeString(formatValue(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, B beanValue) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, B beanValue) throws IOException {
|
||||
S unwrapValue = converter.unwrapValue(beanValue);
|
||||
scalarType.jsonWrite(writer, unwrapValue);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.avaje.ebean.text.TextException;
|
||||
import com.avaje.ebean.text.json.JsonWriter;
|
||||
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
|
||||
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyType;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ScalarTypeYear extends ScalarTypeBase<Year> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jsonWrite(JsonWriter writer, Year value) throws IOException {
|
||||
public void jsonWrite(JsonGenerator writer, Year value) throws IOException {
|
||||
writer.writeNumber(value.getValue());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user