This commit is contained in:
@@ -68,7 +68,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return readerPool.get();
|
return readerPool.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void offerBsonReader(BsonReader in) {
|
public void offerBsonReader(final BsonReader in) {
|
||||||
if (in != null) readerPool.offer(in);
|
if (in != null) readerPool.offer(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return writerPool.get().tiny(tiny);
|
return writerPool.get().tiny(tiny);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void offerBsonWriter(BsonWriter out) {
|
public void offerBsonWriter(final BsonWriter out) {
|
||||||
if (out != null) writerPool.offer(out);
|
if (out != null) writerPool.offer(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return convertFrom(type, bytes, 0, bytes.length);
|
return convertFrom(type, bytes, 0, bytes.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T convertFrom(final Type type, final byte[] bytes, int start, int len) {
|
public <T> T convertFrom(final Type type, final byte[] bytes, final int start, final int len) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
final BsonReader in = readerPool.get();
|
final BsonReader in = readerPool.get();
|
||||||
in.setBytes(bytes, start, len);
|
in.setBytes(bytes, start, len);
|
||||||
@@ -123,7 +123,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------ convertTo -----------------------------------------------------------
|
//------------------------------ convertTo -----------------------------------------------------------
|
||||||
public byte[] convertTo(Object value) {
|
public byte[] convertTo(final Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
final BsonWriter out = writerPool.get().tiny(tiny);
|
final BsonWriter out = writerPool.get().tiny(tiny);
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -134,7 +134,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return convertTo(value.getClass(), value);
|
return convertTo(value.getClass(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] convertTo(final Type type, Object value) {
|
public byte[] convertTo(final Type type, final Object value) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
final BsonWriter out = writerPool.get().tiny(tiny);
|
final BsonWriter out = writerPool.get().tiny(tiny);
|
||||||
factory.loadEncoder(type).convertTo(out, value);
|
factory.loadEncoder(type).convertTo(out, value);
|
||||||
@@ -143,7 +143,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final OutputStream out, Object value) {
|
public void convertTo(final OutputStream out, final Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
new BsonStreamWriter(tiny, out).writeNull();
|
new BsonStreamWriter(tiny, out).writeNull();
|
||||||
} else {
|
} else {
|
||||||
@@ -151,7 +151,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final OutputStream out, final Type type, Object value) {
|
public void convertTo(final OutputStream out, final Type type, final Object value) {
|
||||||
if (type == null) return;
|
if (type == null) return;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
new BsonStreamWriter(tiny, out).writeNull();
|
new BsonStreamWriter(tiny, out).writeNull();
|
||||||
@@ -160,7 +160,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Type type, Object value) {
|
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Type type, final Object value) {
|
||||||
if (supplier == null || type == null) return null;
|
if (supplier == null || type == null) return null;
|
||||||
BsonByteBufferWriter out = new BsonByteBufferWriter(tiny, supplier);
|
BsonByteBufferWriter out = new BsonByteBufferWriter(tiny, supplier);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -171,7 +171,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return out.toBuffers();
|
return out.toBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, Object value) {
|
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Object value) {
|
||||||
if (supplier == null) return null;
|
if (supplier == null) return null;
|
||||||
BsonByteBufferWriter out = new BsonByteBufferWriter(tiny, supplier);
|
BsonByteBufferWriter out = new BsonByteBufferWriter(tiny, supplier);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -182,7 +182,7 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
return out.toBuffers();
|
return out.toBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final BsonWriter writer, Object value) {
|
public void convertTo(final BsonWriter writer, final Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
writer.writeNull();
|
writer.writeNull();
|
||||||
} else {
|
} else {
|
||||||
@@ -190,17 +190,17 @@ public final class BsonConvert extends Convert<BsonReader, BsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final BsonWriter writer, final Type type, Object value) {
|
public void convertTo(final BsonWriter writer, final Type type, final Object value) {
|
||||||
if (type == null) return;
|
if (type == null) return;
|
||||||
factory.loadEncoder(type).convertTo(writer, value);
|
factory.loadEncoder(type).convertTo(writer, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BsonWriter convertToWriter(Object value) {
|
public BsonWriter convertToWriter(final Object value) {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
return convertToWriter(value.getClass(), value);
|
return convertToWriter(value.getClass(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BsonWriter convertToWriter(final Type type, Object value) {
|
public BsonWriter convertToWriter(final Type type, final Object value) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
final BsonWriter out = writerPool.get().tiny(tiny);
|
final BsonWriter out = writerPool.get().tiny(tiny);
|
||||||
factory.loadEncoder(type).convertTo(out, value);
|
factory.loadEncoder(type).convertTo(out, value);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return readerPool.get();
|
return readerPool.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void offerJsonReader(JsonReader in) {
|
public void offerJsonReader(final JsonReader in) {
|
||||||
if (in != null) readerPool.offer(in);
|
if (in != null) readerPool.offer(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return writerPool.get().tiny(tiny);
|
return writerPool.get().tiny(tiny);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void offerJsonWriter(JsonWriter out) {
|
public void offerJsonWriter(final JsonWriter out) {
|
||||||
if (out != null) writerPool.offer(out);
|
if (out != null) writerPool.offer(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return convertFrom(type, text, 0, text.length);
|
return convertFrom(type, text, 0, text.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T convertFrom(final Type type, final char[] text, int start, int len) {
|
public <T> T convertFrom(final Type type, final char[] text, final int start, final int len) {
|
||||||
if (text == null || type == null) return null;
|
if (text == null || type == null) return null;
|
||||||
final JsonReader in = readerPool.get();
|
final JsonReader in = readerPool.get();
|
||||||
in.setText(text, start, len);
|
in.setText(text, start, len);
|
||||||
@@ -118,12 +118,12 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------ convertTo -----------------------------------------------------------
|
//------------------------------ convertTo -----------------------------------------------------------
|
||||||
public String convertTo(Object value) {
|
public String convertTo(final Object value) {
|
||||||
if (value == null) return "null";
|
if (value == null) return "null";
|
||||||
return convertTo(value.getClass(), value);
|
return convertTo(value.getClass(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertTo(final Type type, Object value) {
|
public String convertTo(final Type type, final Object value) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
if (value == null) return "null";
|
if (value == null) return "null";
|
||||||
final JsonWriter out = writerPool.get().tiny(tiny);
|
final JsonWriter out = writerPool.get().tiny(tiny);
|
||||||
@@ -133,7 +133,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final OutputStream out, Object value) {
|
public void convertTo(final OutputStream out, final Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
new JsonStreamWriter(tiny, out).writeNull();
|
new JsonStreamWriter(tiny, out).writeNull();
|
||||||
} else {
|
} else {
|
||||||
@@ -141,7 +141,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final OutputStream out, final Type type, Object value) {
|
public void convertTo(final OutputStream out, final Type type, final Object value) {
|
||||||
if (type == null) return;
|
if (type == null) return;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
new JsonStreamWriter(tiny, out).writeNull();
|
new JsonStreamWriter(tiny, out).writeNull();
|
||||||
@@ -150,7 +150,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, Object value) {
|
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Object value) {
|
||||||
if (supplier == null) return null;
|
if (supplier == null) return null;
|
||||||
JsonByteBufferWriter out = new JsonByteBufferWriter(tiny, null, supplier);
|
JsonByteBufferWriter out = new JsonByteBufferWriter(tiny, null, supplier);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -161,7 +161,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return out.toBuffers();
|
return out.toBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Type type, Object value) {
|
public ByteBuffer[] convertTo(final Supplier<ByteBuffer> supplier, final Type type, final Object value) {
|
||||||
if (supplier == null || type == null) return null;
|
if (supplier == null || type == null) return null;
|
||||||
JsonByteBufferWriter out = new JsonByteBufferWriter(tiny, null, supplier);
|
JsonByteBufferWriter out = new JsonByteBufferWriter(tiny, null, supplier);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -172,7 +172,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
return out.toBuffers();
|
return out.toBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final JsonWriter writer, Object value) {
|
public void convertTo(final JsonWriter writer, final Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
writer.writeNull();
|
writer.writeNull();
|
||||||
} else {
|
} else {
|
||||||
@@ -180,7 +180,7 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTo(final JsonWriter writer, final Type type, Object value) {
|
public void convertTo(final JsonWriter writer, final Type type, final Object value) {
|
||||||
if (type == null) return;
|
if (type == null) return;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
writer.writeNull();
|
writer.writeNull();
|
||||||
@@ -189,12 +189,12 @@ public final class JsonConvert extends Convert<JsonReader, JsonWriter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonWriter convertToWriter(Object value) {
|
public JsonWriter convertToWriter(final Object value) {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
return convertToWriter(value.getClass(), value);
|
return convertToWriter(value.getClass(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonWriter convertToWriter(final Type type, Object value) {
|
public JsonWriter convertToWriter(final Type type, final Object value) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
final JsonWriter out = writerPool.get().tiny(tiny);
|
final JsonWriter out = writerPool.get().tiny(tiny);
|
||||||
factory.loadEncoder(type).convertTo(out, value);
|
factory.loadEncoder(type).convertTo(out, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user