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