pb
This commit is contained in:
@@ -86,14 +86,4 @@ public class ProtobufArrayEncoder<T> extends ArrayEncoder<ProtobufWriter, T>
|
|||||||
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requireSize() {
|
|
||||||
return !componentPrimitived;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,11 +77,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Boolean.class;
|
return Boolean.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
@@ -108,11 +103,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Byte.class;
|
return Byte.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return byte.class;
|
return byte.class;
|
||||||
@@ -139,11 +129,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Character.class;
|
return Character.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return char.class;
|
return char.class;
|
||||||
@@ -170,11 +155,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Short.class;
|
return Short.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return short.class;
|
return short.class;
|
||||||
@@ -201,11 +181,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Integer.class;
|
return Integer.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return int.class;
|
return int.class;
|
||||||
@@ -232,11 +207,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Float.class;
|
return Float.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.FLOAT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return float.class;
|
return float.class;
|
||||||
@@ -263,11 +233,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Long.class;
|
return Long.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -294,11 +259,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Double.class;
|
return Double.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.DOUBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return double.class;
|
return double.class;
|
||||||
@@ -323,11 +283,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------- simple object -------------------------------------
|
// ------------------------------------- simple object -------------------------------------
|
||||||
@@ -351,11 +306,6 @@ public abstract class ProtobufCoders {
|
|||||||
return Number.class;
|
return Number.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -378,11 +328,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return StringWrapper.class;
|
return StringWrapper.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufCharSequenceSimpledCoder
|
public static class ProtobufCharSequenceSimpledCoder
|
||||||
@@ -401,11 +346,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return CharSequence.class;
|
return CharSequence.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufStringBuilderSimpledCoder
|
public static class ProtobufStringBuilderSimpledCoder
|
||||||
@@ -424,11 +364,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return StringBuilder.class;
|
return StringBuilder.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDateSimpledCoder extends DateSimpledCoder<ProtobufReader, ProtobufWriter>
|
public static class ProtobufDateSimpledCoder extends DateSimpledCoder<ProtobufReader, ProtobufWriter>
|
||||||
@@ -451,11 +386,6 @@ public abstract class ProtobufCoders {
|
|||||||
return java.util.Date.class;
|
return java.util.Date.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -482,11 +412,6 @@ public abstract class ProtobufCoders {
|
|||||||
return java.time.Instant.class;
|
return java.time.Instant.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -517,11 +442,6 @@ public abstract class ProtobufCoders {
|
|||||||
return java.time.LocalDate.class;
|
return java.time.LocalDate.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return int.class;
|
return int.class;
|
||||||
@@ -549,11 +469,6 @@ public abstract class ProtobufCoders {
|
|||||||
return java.time.LocalTime.class;
|
return java.time.LocalTime.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -579,11 +494,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return java.time.LocalDateTime.class;
|
return java.time.LocalDateTime.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDurationSimpledCoder extends DurationSimpledCoder<ProtobufReader, ProtobufWriter>
|
public static class ProtobufDurationSimpledCoder extends DurationSimpledCoder<ProtobufReader, ProtobufWriter>
|
||||||
@@ -607,11 +517,6 @@ public abstract class ProtobufCoders {
|
|||||||
return java.time.Duration.class;
|
return java.time.Duration.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -639,11 +544,6 @@ public abstract class ProtobufCoders {
|
|||||||
return AtomicBoolean.class;
|
return AtomicBoolean.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
@@ -671,11 +571,6 @@ public abstract class ProtobufCoders {
|
|||||||
return AtomicInteger.class;
|
return AtomicInteger.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return int.class;
|
return int.class;
|
||||||
@@ -702,11 +597,6 @@ public abstract class ProtobufCoders {
|
|||||||
return AtomicLong.class;
|
return AtomicLong.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -731,11 +621,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return BigInteger.class;
|
return BigInteger.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufBigDecimalSimpledCoder extends BigDecimalSimpledCoder<ProtobufReader, ProtobufWriter>
|
public static class ProtobufBigDecimalSimpledCoder extends BigDecimalSimpledCoder<ProtobufReader, ProtobufWriter>
|
||||||
@@ -755,11 +640,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return BigDecimal.class;
|
return BigDecimal.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufInetAddressSimpledCoder extends InetAddressSimpledCoder<ProtobufReader, ProtobufWriter>
|
public static class ProtobufInetAddressSimpledCoder extends InetAddressSimpledCoder<ProtobufReader, ProtobufWriter>
|
||||||
@@ -784,11 +664,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return InetAddress.class;
|
return InetAddress.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufInetSocketAddressSimpledCoder
|
public static class ProtobufInetSocketAddressSimpledCoder
|
||||||
@@ -815,11 +690,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return InetSocketAddress.class;
|
return InetSocketAddress.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufLongAdderSimpledCoder extends LongAdderSimpledCoder<ProtobufReader, ProtobufWriter>
|
public static class ProtobufLongAdderSimpledCoder extends LongAdderSimpledCoder<ProtobufReader, ProtobufWriter>
|
||||||
@@ -842,11 +712,6 @@ public abstract class ProtobufCoders {
|
|||||||
return LongAdder.class;
|
return LongAdder.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.INT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Class primitiveType() {
|
public final Class primitiveType() {
|
||||||
return long.class;
|
return long.class;
|
||||||
@@ -871,11 +736,6 @@ public abstract class ProtobufCoders {
|
|||||||
public Type getType() {
|
public Type getType() {
|
||||||
return Uint128.class;
|
return Uint128.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------- boolean[] -------------------------------------
|
// ------------------------------------- boolean[] -------------------------------------
|
||||||
@@ -898,11 +758,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, boolean[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, boolean[] value) {
|
||||||
return value == null ? 0 : value.length;
|
return value == null ? 0 : value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufByteArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, byte[]>
|
public static class ProtobufByteArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, byte[]>
|
||||||
@@ -924,11 +779,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, byte[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, byte[] value) {
|
||||||
return value == null ? 0 : value.length;
|
return value == null ? 0 : value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufCharArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, char[]>
|
public static class ProtobufCharArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, char[]>
|
||||||
@@ -957,11 +807,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufShortArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, short[]>
|
public static class ProtobufShortArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, short[]>
|
||||||
@@ -990,11 +835,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufIntArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, int[]>
|
public static class ProtobufIntArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, int[]>
|
||||||
@@ -1023,11 +863,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufFloatArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, float[]>
|
public static class ProtobufFloatArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, float[]>
|
||||||
@@ -1049,11 +884,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, float[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, float[] value) {
|
||||||
return value == null ? 0 : value.length * 4;
|
return value == null ? 0 : value.length * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufLongArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, long[]>
|
public static class ProtobufLongArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, long[]>
|
||||||
@@ -1082,11 +912,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDoubleArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, double[]>
|
public static class ProtobufDoubleArraySimpledCoder extends SimpledCoder<ProtobufReader, ProtobufWriter, double[]>
|
||||||
@@ -1108,11 +933,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, double[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, double[] value) {
|
||||||
return value == null ? 0 : value.length * 8;
|
return value == null ? 0 : value.length * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------- Boolean[] -------------------------------------
|
// ------------------------------------- Boolean[] -------------------------------------
|
||||||
@@ -1135,11 +955,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Boolean[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Boolean[] value) {
|
||||||
return value == null ? 0 : value.length;
|
return value == null ? 0 : value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufByteArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Byte[]>
|
public static class ProtobufByteArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Byte[]>
|
||||||
@@ -1161,11 +976,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Byte[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Byte[] value) {
|
||||||
return value == null ? 0 : value.length;
|
return value == null ? 0 : value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufCharArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Character[]>
|
public static class ProtobufCharArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Character[]>
|
||||||
@@ -1194,11 +1004,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufShortArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Short[]>
|
public static class ProtobufShortArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Short[]>
|
||||||
@@ -1227,11 +1032,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufIntArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Integer[]>
|
public static class ProtobufIntArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Integer[]>
|
||||||
@@ -1260,11 +1060,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufFloatArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Float[]>
|
public static class ProtobufFloatArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Float[]>
|
||||||
@@ -1286,11 +1081,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Float[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Float[] value) {
|
||||||
return value == null ? 0 : value.length * 4;
|
return value == null ? 0 : value.length * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufLongArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Long[]>
|
public static class ProtobufLongArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Long[]>
|
||||||
@@ -1319,11 +1109,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDoubleArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Double[]>
|
public static class ProtobufDoubleArraySimpledCoder2 extends SimpledCoder<ProtobufReader, ProtobufWriter, Double[]>
|
||||||
@@ -1345,11 +1130,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Double[] value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Double[] value) {
|
||||||
return value == null ? 0 : value.length * 8;
|
return value == null ? 0 : value.length * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------- Collection<Boolean> -------------------------------------
|
// ------------------------------------- Collection<Boolean> -------------------------------------
|
||||||
@@ -1377,11 +1157,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Collection<Boolean> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Collection<Boolean> value) {
|
||||||
return value == null ? 0 : value.size();
|
return value == null ? 0 : value.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufByteCollectionSimpledCoder
|
public static class ProtobufByteCollectionSimpledCoder
|
||||||
@@ -1408,11 +1183,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Collection<Byte> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Collection<Byte> value) {
|
||||||
return value == null ? 0 : value.size();
|
return value == null ? 0 : value.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufCharCollectionSimpledCoder
|
public static class ProtobufCharCollectionSimpledCoder
|
||||||
@@ -1446,11 +1216,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufShortCollectionSimpledCoder
|
public static class ProtobufShortCollectionSimpledCoder
|
||||||
@@ -1484,11 +1249,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufIntCollectionSimpledCoder
|
public static class ProtobufIntCollectionSimpledCoder
|
||||||
@@ -1522,11 +1282,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufFloatCollectionSimpledCoder
|
public static class ProtobufFloatCollectionSimpledCoder
|
||||||
@@ -1553,11 +1308,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Collection<Float> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Collection<Float> value) {
|
||||||
return value == null ? 0 : value.size() * 4;
|
return value == null ? 0 : value.size() * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufLongCollectionSimpledCoder
|
public static class ProtobufLongCollectionSimpledCoder
|
||||||
@@ -1591,11 +1341,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDoubleCollectionSimpledCoder
|
public static class ProtobufDoubleCollectionSimpledCoder
|
||||||
@@ -1622,11 +1367,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Collection<Double> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Collection<Double> value) {
|
||||||
return value == null ? 0 : value.size() * 8;
|
return value == null ? 0 : value.size() * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------- Stream<Boolean> -------------------------------------
|
// ------------------------------------- Stream<Boolean> -------------------------------------
|
||||||
@@ -1650,11 +1390,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Stream<Boolean> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Stream<Boolean> value) {
|
||||||
return value == null ? 0 : (int) value.count();
|
return value == null ? 0 : (int) value.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufByteStreamSimpledCoder
|
public static class ProtobufByteStreamSimpledCoder
|
||||||
@@ -1677,11 +1412,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Stream<Byte> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Stream<Byte> value) {
|
||||||
return value == null ? 0 : (int) value.count();
|
return value == null ? 0 : (int) value.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufCharStreamSimpledCoder
|
public static class ProtobufCharStreamSimpledCoder
|
||||||
@@ -1711,11 +1441,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufShortStreamSimpledCoder
|
public static class ProtobufShortStreamSimpledCoder
|
||||||
@@ -1745,11 +1470,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufIntStreamSimpledCoder
|
public static class ProtobufIntStreamSimpledCoder
|
||||||
@@ -1779,11 +1499,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufFloatStreamSimpledCoder
|
public static class ProtobufFloatStreamSimpledCoder
|
||||||
@@ -1806,11 +1521,6 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Stream<Float> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Stream<Float> value) {
|
||||||
return value == null ? 0 : (int) value.count() * 4;
|
return value == null ? 0 : (int) value.count() * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufLongStreamSimpledCoder
|
public static class ProtobufLongStreamSimpledCoder
|
||||||
@@ -1840,11 +1550,6 @@ public abstract class ProtobufCoders {
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProtobufDoubleStreamSimpledCoder
|
public static class ProtobufDoubleStreamSimpledCoder
|
||||||
@@ -1867,10 +1572,5 @@ public abstract class ProtobufCoders {
|
|||||||
public int computeSize(ProtobufWriter out, int tagSize, Stream<Double> value) {
|
public int computeSize(ProtobufWriter out, int tagSize, Stream<Double> value) {
|
||||||
return value == null ? 0 : (int) value.count() * 8;
|
return value == null ? 0 : (int) value.count() * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,14 +86,4 @@ public class ProtobufCollectionEncoder<T> extends CollectionEncoder<ProtobufWrit
|
|||||||
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requireSize() {
|
|
||||||
return !componentPrimitived;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public abstract class ProtobufDynEncoder<T> extends ProtobufObjectEncoder<T> {
|
|||||||
this.typeClass = (Class) type;
|
this.typeClass = (Class) type;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.objectEncoderSelf = objectEncoderSelf;
|
this.objectEncoderSelf = objectEncoderSelf;
|
||||||
this.memberSizeRequired = objectEncoderSelf.memberSizeRequired;
|
|
||||||
this.members = objectEncoderSelf.getMembers();
|
this.members = objectEncoderSelf.getMembers();
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
factory.register(type, this);
|
factory.register(type, this);
|
||||||
|
|||||||
@@ -27,12 +27,5 @@ public interface ProtobufEncodeable<W extends Writer, T> extends Encodeable<W, T
|
|||||||
// 计算内容长度
|
// 计算内容长度
|
||||||
public int computeSize(ProtobufWriter out, int tagSize, T value);
|
public int computeSize(ProtobufWriter out, int tagSize, T value);
|
||||||
|
|
||||||
// 是否需要计算内容长度
|
|
||||||
default boolean requireSize() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取数据类型枚举
|
|
||||||
public ProtobufTypeEnum typeEnum();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,16 +71,12 @@ public class ProtobufEnumSimpledCoder<R extends ProtobufReader, W extends Protob
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeSize(ProtobufWriter out, int tagSize, E value) {
|
public int computeSize(ProtobufWriter out, int tagSize, E value) {
|
||||||
|
if (value == null) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (enumtostring) {
|
||||||
|
return ProtobufCoders.ProtobufStringSimpledCoder.instance.computeSize(out, tagSize, value.name());
|
||||||
|
} else {
|
||||||
|
return ProtobufCoders.ProtobufIntSimpledCoder.instance.computeSize(value.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requireSize() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return enumtostring ? ProtobufTypeEnum.BYTES : ProtobufTypeEnum.INT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,15 @@ import static org.redkale.convert.pb.ProtobufMapEncoder.createAttribute;
|
|||||||
public class ProtobufMapDecoder<K, V> extends MapDecoder<ProtobufReader, K, V>
|
public class ProtobufMapDecoder<K, V> extends MapDecoder<ProtobufReader, K, V>
|
||||||
implements ProtobufTagDecodeable<ProtobufReader, Map<K, V>> {
|
implements ProtobufTagDecodeable<ProtobufReader, Map<K, V>> {
|
||||||
|
|
||||||
protected final boolean enumtostring;
|
|
||||||
|
|
||||||
protected final DeMember keyMember;
|
protected final DeMember keyMember;
|
||||||
|
|
||||||
protected final DeMember valueMember;
|
protected final DeMember valueMember;
|
||||||
|
|
||||||
public ProtobufMapDecoder(ConvertFactory factory, Type type) {
|
public ProtobufMapDecoder(ConvertFactory factory, Type type) {
|
||||||
super(factory, type);
|
super(factory, type);
|
||||||
this.enumtostring = ((ProtobufFactory) factory).enumtostring;
|
boolean enumtostring = ((ProtobufFactory) factory).enumtostring;
|
||||||
int keyTag = ProtobufFactory.getTag(1, ((ProtobufEncodeable) keyDecoder).typeEnum());
|
int keyTag = ProtobufFactory.getTag("key", keyDecoder.getType(), 1, enumtostring);
|
||||||
int valTag = ProtobufFactory.getTag(2, ((ProtobufEncodeable) valueDecoder).typeEnum());
|
int valTag = ProtobufFactory.getTag("value", valueDecoder.getType(), 2, enumtostring);
|
||||||
this.keyMember = new DeMember(createAttribute("key", keyDecoder.getType()), keyTag, keyDecoder);
|
this.keyMember = new DeMember(createAttribute("key", keyDecoder.getType()), keyTag, keyDecoder);
|
||||||
this.valueMember = new DeMember(createAttribute("value", valueDecoder.getType()), valTag, valueDecoder);
|
this.valueMember = new DeMember(createAttribute("value", valueDecoder.getType()), valTag, valueDecoder);
|
||||||
setTagSize(keyMember, ProtobufFactory.computeSInt32SizeNoTag(keyMember.getTag()));
|
setTagSize(keyMember, ProtobufFactory.computeSInt32SizeNoTag(keyMember.getTag()));
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ public class ProtobufMapEncoder<K, V> extends MapEncoder<ProtobufWriter, K, V>
|
|||||||
super(factory, type);
|
super(factory, type);
|
||||||
this.keyMember = new EnMember(createAttribute("key", keyEncoder.getType()), keyEncoder);
|
this.keyMember = new EnMember(createAttribute("key", keyEncoder.getType()), keyEncoder);
|
||||||
this.valueMember = new EnMember(createAttribute("value", valueEncoder.getType()), valueEncoder);
|
this.valueMember = new EnMember(createAttribute("value", valueEncoder.getType()), valueEncoder);
|
||||||
setTag(keyMember, ProtobufFactory.getTag(1, ((ProtobufEncodeable) keyEncoder).typeEnum()));
|
boolean enumtostring = ((ProtobufFactory) factory).enumtostring;
|
||||||
setTag(valueMember, ProtobufFactory.getTag(2, ((ProtobufEncodeable) valueEncoder).typeEnum()));
|
setTag(keyMember, ProtobufFactory.getTag("key", keyEncoder.getType(), 1, enumtostring));
|
||||||
|
setTag(valueMember, ProtobufFactory.getTag("value", valueEncoder.getType(), 2, enumtostring));
|
||||||
setTagSize(keyMember, ProtobufFactory.computeSInt32SizeNoTag(keyMember.getTag()));
|
setTagSize(keyMember, ProtobufFactory.computeSInt32SizeNoTag(keyMember.getTag()));
|
||||||
setTagSize(valueMember, ProtobufFactory.computeSInt32SizeNoTag(valueMember.getTag()));
|
setTagSize(valueMember, ProtobufFactory.computeSInt32SizeNoTag(valueMember.getTag()));
|
||||||
this.keySimpled = keyEncoder instanceof SimpledCoder;
|
this.keySimpled = keyEncoder instanceof SimpledCoder;
|
||||||
@@ -111,16 +112,6 @@ public class ProtobufMapEncoder<K, V> extends MapEncoder<ProtobufWriter, K, V>
|
|||||||
return size.get();
|
return size.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean requireSize() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Attribute createAttribute(String field, Type type) {
|
static Attribute createAttribute(String field, Type type) {
|
||||||
return Attribute.create(Map.class, field, TypeToken.typeToClass(type), type, null, null, null);
|
return Attribute.create(Map.class, field, TypeToken.typeToClass(type), type, null, null, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import org.redkale.util.Utility;
|
|||||||
public class ProtobufObjectEncoder<T> extends ObjectEncoder<ProtobufWriter, T>
|
public class ProtobufObjectEncoder<T> extends ObjectEncoder<ProtobufWriter, T>
|
||||||
implements ProtobufEncodeable<ProtobufWriter, T> {
|
implements ProtobufEncodeable<ProtobufWriter, T> {
|
||||||
|
|
||||||
protected boolean memberSizeRequired;
|
|
||||||
|
|
||||||
protected ProtobufObjectEncoder(Type type) {
|
protected ProtobufObjectEncoder(Type type) {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
@@ -86,8 +84,6 @@ public class ProtobufObjectEncoder<T> extends ObjectEncoder<ProtobufWriter, T>
|
|||||||
}
|
}
|
||||||
Attribute attr = member.getAttribute();
|
Attribute attr = member.getAttribute();
|
||||||
boolean enumtostring = ((ProtobufFactory) factory).enumtostring;
|
boolean enumtostring = ((ProtobufFactory) factory).enumtostring;
|
||||||
this.memberSizeRequired |= !(member.getEncoder() instanceof SimpledCoder)
|
|
||||||
&& ((ProtobufEncodeable) member.getEncoder()).requireSize();
|
|
||||||
setTag(member, ProtobufFactory.getTag(attr.field(), attr.genericType(), member.getPosition(), enumtostring));
|
setTag(member, ProtobufFactory.getTag(attr.field(), attr.genericType(), member.getPosition(), enumtostring));
|
||||||
setTagSize(member, ProtobufFactory.computeSInt32SizeNoTag(member.getTag()));
|
setTagSize(member, ProtobufFactory.computeSInt32SizeNoTag(member.getTag()));
|
||||||
}
|
}
|
||||||
@@ -105,18 +101,4 @@ public class ProtobufObjectEncoder<T> extends ObjectEncoder<ProtobufWriter, T>
|
|||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean requiredMemberSize() {
|
|
||||||
return true||memberSizeRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean requireSize() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,14 +92,4 @@ public class ProtobufStreamEncoder<T> extends StreamEncoder<ProtobufWriter, T>
|
|||||||
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
return ProtobufFactory.computeSInt32SizeNoTag(dataSize) + dataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requireSize() {
|
|
||||||
return !componentPrimitived;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ProtobufTypeEnum typeEnum() {
|
|
||||||
return ProtobufTypeEnum.BYTES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user